accessor.RdAccessor methods for free algebra objects
words(x)
coeffs(x, drop=TRUE)
coeffs(x) <- valueObject of class freealg
Numeric vector of length 1
Boolean, with default TRUE meaning to drop the
disord attribute, as per disordR::drop() and
FALSE meaning to consistently return a disord object
irregardless
Access or set the different parts of a freealg object. The
constant term is technically a coefficient but is documented under
constant.Rd.
“Pure” extraction and replacement (as in a[i] and
a[i] <- value is implemented experimentally. The code for
extraction is cute but not particularly efficient.
There is an extended discussion of disordR discipline in the
context of algebras in the mvp package at accessor.Rd.
a <- rfalg()
a
#> free algebra element algebraically equal to
#> + aacc + 4ac + 7c + 3cac + 6cb + 7cccb
coeffs(a)
#> A disord object with hash ff1655e0016671a6baf88564d9774c741da169c0 and elements
#> [1] 1 4 7 3 6 7
#> (in some order)
words(a) # NB: hash is identical to that of coeffs(a)
#> A disord object with hash ff1655e0016671a6baf88564d9774c741da169c0 and elements
#> [[1]]
#> [1] 1 1 3 3
#>
#> [[2]]
#> [1] 1 3
#>
#> [[3]]
#> [1] 3
#>
#> [[4]]
#> [1] 3 1 3
#>
#> [[5]]
#> [1] 3 2
#>
#> [[6]]
#> [1] 3 3 3 2
#>
#> (in some order)
coeffs(a) <- 7 # replacement methods work
a
#> free algebra element algebraically equal to
#> + 7aacc + 7ac + 7c + 7cac + 7cb + 7cccb
coeffs(a)
#> [1] 7 7 7 7 7 7