onion (version 1.5-0)

onion-class: Class “onion”

Description

The formal S4 class for onion and onionmat objects

Arguments

Objects from the Class

Class onion is a virtual S4 class extending classes quaternion and octonion. In package documentation, “onion” means an R object that behaves as a vector of quaternions or octonions, stored as a four- or eight- row numeric matrix.

Class onionmat is the S4 class for matrices whose elements are quaternions or octonions. An onionmat is stored as a two-element list, the first being an onion and the second an integer matrix which holds structural matrix attributes such as dimensions and dimnames. Most standard arithmetic R idiom for matrices should work for onionmats.

Class index is taken from the excellent Matrix package and is a setClassUnion() of classes numeric, logical, and character, which mean that it is an arity-one matrix index.

Author

Robin K. S. Hankin

Examples

Run this code

as.octonion(1:8,single=TRUE)
as.quaternion(matrix(runif(20),nrow=4))

H <- matrix(rquat(21),3,7)
dimnames(H) <- list(foo=letters[1:3],bar=state.abb[1:7])

i(H) <- 0.1

I <- matrix(rquat(14),7,2)
dimnames(I) <- list(foo=state.abb[1:7],baz=LETTERS[1:2])
H %*% I

Run the code above in your browser using DataLab