Equivalent to zapsmall()

zap(X)
# S3 method for class 'kform'
zap(X)
# S3 method for class 'ktensor'
zap(X)

Arguments

X

Tensor or \(k\)-form to be zapped

Details

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.

Value

Returns an object of the same class

Author

Robin K. S. Hankin

Examples


S <- rform(7)
S == zap(S)  # should be TRUE because the coeffs are integers
#> [1] TRUE

(a <- rform())
#> An alternating linear map from V^3 to R with V=R^7:
#>            val
#>  2 4 6  =    6
#>  3 4 7  =   -7
#>  1 3 6  =   -5
#>  1 4 5  =   -4
#>  2 3 5  =    3
#>  1 5 6  =   -9
#>  1 5 7  =   -2
#>  1 4 7  =    9
(b <- rform()*1e-11)
#> An alternating linear map from V^3 to R with V=R^7:
#>               val
#>  1 2 4  =   1e-11
#>  1 5 7  =  -2e-11
#>  2 4 7  =   3e-11
#>  1 5 6  =   9e-11
#>  3 4 5  =   4e-11
#>  1 6 7  =   7e-11
#>  1 3 6  =  -5e-11
#>  1 3 5  =   6e-11
#>  1 2 3  =  -8e-11
a+b
#> An alternating linear map from V^3 to R with V=R^7:
#>               val
#>  2 4 6  =   6e+00
#>  1 6 7  =   7e-11
#>  3 4 5  =   4e-11
#>  1 4 7  =   9e+00
#>  1 5 6  =  -9e+00
#>  2 4 7  =   3e-11
#>  2 3 5  =   3e+00
#>  1 4 5  =  -4e+00
#>  1 3 5  =   6e-11
#>  1 2 3  =  -8e-11
#>  1 3 6  =  -5e+00
#>  3 4 7  =  -7e+00
#>  1 2 4  =   1e-11
#>  1 5 7  =  -2e+00
zap(a+b)
#> An alternating linear map from V^3 to R with V=R^7:
#>            val
#>  1 5 7  =   -2
#>  3 4 7  =   -7
#>  1 3 6  =   -5
#>  1 4 5  =   -4
#>  2 3 5  =    3
#>  1 5 6  =   -9
#>  1 4 7  =    9
#>  2 4 6  =    6