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