R Documentation |
Print methods for Clifford algebra
## S3 method for class 'clifford'
print(x,...)
## S3 method for class 'clifford'
as.character(x,...)
catterm(a)
x |
Object of class |
... |
Further arguments, currently ignored |
a |
Integer vector representing a term |
The print method does not change the internal representation of a
clifford
object, which is a two-element list, the first of which
is a list of integer vectors representing terms, and the second is a
numeric vector of coefficients. The print method has special
dispensation for the zero clifford object.
The print method is sensitive to the value of options separate
and basissep
. If option separate
is FALSE
(the
default), the method prints the basis blades in a compact form, as in
“e_134
”. The indices of the basis vectors are separated
with the value of option basissep
which is usually NULL
;
but if n>9
, then setting option basissep
to a comma
(“,
”) might look good as it will print e_10,11,12
instead of e_101112
:
options("basissep" = ",")
If option separate
is TRUE
, the method prints the basis
vectors separately, as in e10 e11 e12
:
options("separate" = TRUE)
Function catterm()
is a low-level helper function, used in the
print method, coercion to character, and also in function
getcoeffs()
to set the names of its output. It takes an integer
vector like c(1,5,6)
and returns a representation of the
corresponding basis blade, in this case “e_156
”. Function
catterm()
is where options basissep
and separate
are processed. Special dispensation is needed for length-zero vectors,
for which the empty string is returned. This is needed to ensure that
the constant term (which has a basis blade of numeric(0)
) is
treated appropriately. See also list_modifier()
which deals with
this issue.
Experimental bespoke print method print_clifford_quaternion()
and
print_clifford_pauli()
is included. This are executed if option
clifford_print_special
is quaternion
; if NULL
, then
print_clifford_default()
is used. It is straightforward to add
further bespoke print methods if needed (modify
print.clifford()
).
Robin K. S. Hankin
clifford
a <- rclifff(9)
a # default print method incomprehensible
options("separate" = TRUE)
a # marginally better
options("separate" = FALSE)
options(basissep=",")
a # clearer; YMMV
options(basissep = NULL, maxdim=NULL) # restore default
options("maxdim" = 3)
signature(3)
a <- clifford(list(0,c(1,2),c(1,3),c(2,3)),6:9)
a
options("clifford_print_special" = "quaternion")
a
options("maxdim" = NULL)
options("clifford_print_special" = NULL)
signature(Inf)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.