Math.sparse3Darray {spatstat.sparse} | R Documentation |
S3 Group Generic Methods for Sparse Three-Dimensional Arrays
Description
Group generic methods which make it possible to
apply the familiar mathematical operators and functions
to sparse three-dimensional arrays (objects of class
"sparse3Darray"
).
See Details for a list of implemented functions.
Usage
## S3 methods for group generics have prototypes:
Math(x, ...)
Ops(e1, e2)
Complex(z)
Summary(..., na.rm=FALSE)
Arguments
x , z , e1 , e2 |
Sparse three-dimensional arrays (objects of class
|
... |
further arguments passed to methods. |
na.rm |
Logical value specifying whether missing values should be removed. |
Details
These group generics make it possible to perform element-wise arithmetic and logical operations with sparse three-dimensional arrays, or apply mathematical functions element-wise, or compute standard summaries such as the mean and maximum.
Below is a list of mathematical functions and operators which are defined for sparse 3D arrays.
Group
"Math"
:-
abs
,sign
,sqrt
,
floor
,ceiling
,trunc
,
round
,signif
-
exp
,log
,expm1
,log1p
,
cos
,sin
,tan
,
cospi
,sinpi
,tanpi
,
acos
,asin
,atan
cosh
,sinh
,tanh
,
acosh
,asinh
,atanh
-
lgamma
,gamma
,digamma
,trigamma
-
cumsum
,cumprod
,cummax
,cummin
-
Group
"Ops"
:-
"+"
,"-"
,"*"
,"/"
,"^"
,"%%"
,"%/%"
-
"&"
,"|"
,"!"
-
"=="
,"!="
,"<"
,"<="
,">="
,">"
-
Group
"Summary"
:-
all
,any
-
sum
,prod
-
min
,max
-
range
-
Group
"Complex"
:-
Arg
,Conj
,Im
,Mod
,Re
-
Value
The result of group "Math"
functions is another
three-dimensional array of the same dimensions as x
,
which is sparse if the function maps 0 to 0, and otherwise is a
full three-dimensional array.
The result of group "Ops"
operators is
another three-dimensional array of the same dimensions as
e1
and e2
, which is sparse if both e1
and
e2
are sparse.
The result of group "Complex"
functions is
another sparse three-dimensional array of the same dimensions as
z
.
The result of group "Summary"
functions is
a logical value or a numeric value or a numeric vector of length 2.
Author(s)
Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner rolfturner@posteo.net and Ege Rubak rubak@math.aau.dk.
See Also
Examples
M <- sparse3Darray(i=1:4, j=sample(1:4, replace=TRUE),
k=c(1,2,1,2), x=1:4, dims=c(5,5,2))
negM <- -M
twoM <- M + M
Mplus <- M + 1 ## not sparse!
posM <- (M > 0)
range(M)
sinM <- sin(M)
cosM <- cos(M) ## not sparse!
expM1 <- expm1(M)