Skip to Content

Math {spam}

Mathematical functions
Package: 
spam
Version: 
0.40-0

Description

Applies the Math group functions to 'spam' objects

Usage

# ceiling(x)
# floor(x)

# exp(x, base = exp(1))
# log(x, base = exp(1))
# sqrt(x)

# abs(x)
# cumprod(x)
# cumsum(x)

# cos(x)
# sin(x)
# tan(x)
# acosh(x)
...

Arguments

x
spam object.
base
positive number. The base with respect to which logarithms are computed. Defaults to e=exp(1).

Details

It is important to note that the zero entries do not enter the evaluation. The operations are performed on the stored non-zero elements. This may lead to differences if compared with the same operation on a full matrix. For example, the cosine of sparse matrix is a (full) matrix with many ones.

Evaluating function resulting in NA/NaN/Inf is possible but the result cannot be used further as NA/NaN/Inf are not meaningful (yet).

Values

All functions operate on the vector x@entries and return the result thereof.

See Also

Math2

Examples

getGroupMembers("Math")
 
mat <- matrix(c( 1,2,0,3,0,0,0,4,5),3)
smat <- as.spam( mat)
cos( mat)
cos( smat)
 
 
sqrt( smat)

Author(s)

Reinhard Furrer

Documentation reproduced from package spam, version 0.40-0. License: GPL | file LICENSE