dot-class {onion} | R Documentation |
Class “dot”
Description
The dot object is defined so that idiom like .[x,y]
returns the
commutator, that is, xy-yx
or the Lie bracket \([x,y]\). It
would have been nice to use [x,y]
(that is, without the dot) but
although this is syntactically consistent, it cannot be done in R.
The “meat” of the package is:
setClass("dot", slots = c(ignore='numeric')) `.` <- new("dot") setMethod("[",signature(x="dot",i="ANY",j="ANY"),function(x,i,j,drop){i*j-j*i})
The package code includes other bits and pieces such as informative
error messages for idiom such as .[]
. The package defines a
matrix method for the dot object. This is because “*
”
returns (incorrectly, in my view) the elementwise product, not the
matrix product.
The Jacobi identity, satisfied by any associative algebra, is
\[ \left[x,\left[y,z\right]\right]+ \left[y,\left[z,x\right]\right]+ \left[z,\left[x,y\right]\right]=0 \]Function ad()
returns the adjoint operator. The adjoint
vignette provides details and examples of the adjoint operator.
The dot object is generated by running script inst/dot.Rmd
, which
includes some further discussion and technical documentation, and
creates file dot.rda
which resides in the data/
directory.
Value
Always returns an object of the same class as xy
Slots
ignore
:Object of class
"numeric"
, just a formal placeholder
Methods
- [
signature(x = "dot", i = "ANY", j = "ANY")
: ...- [
signature(x = "dot", i = "ANY", j = "missing")
: ...- [
signature(x = "dot", i = "function", j = "function")
: ...- [
signature(x = "dot", i = "matrix", j = "matrix")
: ...- [
signature(x = "dot", i = "missing", j = "ANY")
: ...- [
signature(x = "dot", i = "missing", j = "missing")
: ...
Author(s)
Robin K. S. Hankin
See Also
Examples
x <- rquat()
y <- rquat()
z <- rquat()
.[x,y]
.[x,.[y,z]] + .[y,.[z,x]] + .[z,.[x,y]] # Jacobi, expanded