Equivalent to zapsmall()
zap(X)
# S3 method for kform
zap(X)
# S3 method for ktensor
zap(X)
Returns an object of the same class
Tensor or
Robin K. S. Hankin
Given an object of class ktensor
or kform
, coefficients
close to zero are ‘zapped’, i.e., replaced by ‘0’, using
base::zapsmall()
.
Note, zap()
actually changes the numeric value, it is not just
a print method.
S <- rform(7)
S == zap(S) # should be TRUE because the coeffs are integers
(a <- rform())
(b <- rform()*1e-11)
a+b
zap(a+b)
Run the code above in your browser using DataLab