zap: Zap small values in a clifford object

Description Usage Arguments Details Author(s) Examples

Description

Generic version of zapsmall()

Usage

1
zap(x, drop=TRUE, digits = getOption("digits"))

Arguments

x

Clifford object

drop

Boolean with default TRUE meaning to coerce the output to numeric with drop()

digits

number of digits to retain

Details

Given a clifford object, coefficients close to zero are ‘zapped’, i.e., replaced by ‘0’ in much the same way as base::zapsmall().

The function should be called zapsmall(), and dispatch to the appropriate base function, but I could not figure out how to do this with S3 (the docs were singularly unhelpful) and gave up.

Note, this function actually changes the numeric value, it is not just a print method.

Author(s)

Robin K. S. Hankin

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
a <- clifford(sapply(1:10,seq_len),90^-(1:10))
zap(a)
options(digits=3)
zap(a)


a-zap(a)   # nonzero

B <- rblade(g=3)
mB <- B*rev(B)
zap(mB)
drop(mB)

clifford documentation built on Nov. 19, 2021, 1:06 a.m.