onion (version 1.5-0)

onionmat: Onionic matrices

Description

Simple functionality for quaternionic and octonionic matrices, intended for use in the jordan package. Use idiom like matrix(Him,4,5) or matrix(roct(6),2,3) to create an onionmat object, a matrix of onions.

The package is intended to match base R's matrix functionality in the sense that standard R idiom just goes through for onionic matrices. Determinants are not well-defined for quaternionic or octonionic matrices, and matrix inverses are not implemented.

Usage

newonionmat(d, M)
onionmat(data = NA, nrow = 1, ncol = 1, byrow = FALSE, dimnames = NULL)
as.onionmat(x)
is.onionmat(x)
onionmat_negative(e1)
onionmat_inverse(e1)
onionmat_prod_onionmat(e1,e2)
onionmat_power_onionmat(...)
onionmat_prod_single(x,y)
onionmat_power_single(e1,e2)
onionmat_plus_onionmat(e1,e2)
matrix_arith_onion(e1,e2)
onion_arith_matrix(e1,e2)
matrix_plus_onion(e1,e2)
matrix_prod_onion(e1,e2)
drop(x)
# S4 method for onionmat,onionmat
cprod(x,y)
# S4 method for onionmat,missing
cprod(x,y)
# S4 method for onionmat,ANY
cprod(x,y)
# S4 method for ANY,ANY
cprod(x,y)
# S4 method for onion,missing
cprod(x,y)
# S4 method for onion,onion
cprod(x,y)
# S4 method for onion,onionmat
cprod(x,y)
# S4 method for onionmat,onion
cprod(x,y)
# S4 method for onionmat,onionmat
tcprod(x,y)
# S4 method for onionmat,missing
tcprod(x,y)
# S4 method for onionmat,ANY
tcprod(x,y)
# S4 method for ANY,ANY
tcprod(x,y)
# S4 method for onion,missing
cprod(x,y)
# S4 method for onion,onion
cprod(x,y)
# S4 method for onion,onionmat
cprod(x,y)
# S4 method for onionmat,onion
cprod(x,y)
# S4 method for onionmat
t(x)
# S4 method for onion
t(x)
# S4 method for onionmat
ht(x)
# S4 method for onion
ht(x)
nrow(x)
ncol(x)
herm_onion_mat(real_diagonal, onions)
onionmat_complex(z)
onionmat_conjugate(z)
onionmat_imag(z)
onionmat_re(z)
onionmat_mod(z)
onionmat_matrixprod_onionmat(x,y)
onion_matrixprod_onionmat(x,y)
onionmat_matrixprod_numeric(x,y)
onionmat_matrixprod_onion(x,y)

Arguments

d,M

data and matrix index

x,y,z,e1,e2

Objects of class onionmat

data,nrow,ncol,byrow,dimnames

In function onionmat(), as for matrix()

...

Further arguments (currently ignored)

real_diagonal, onions

In function herm_onion_mat(), on- and off- diagonal elements of an Hermitian matrix

Author

Robin K. S. Hankin

Details

An object of class onionmat is a two-element list, the first of which is an onion, and the second an integer matrix used for tracking attributes such as dimensions and dimnames. This device makes the extraction and replacement methods easy.

The S4 method for matrix() simply dispatches to onionmat(), which is a drop-in replacement for matrix().

Function newonionmat() is lower-level: it also creates onionmat objects, but takes two arguments: an onion and a matrix; the matrix argument can be used to specify additional attributes via attr(), but this ability is not currently used in the package.

Functions such as onionmat_plus_onionmat() are low-level helper functions, not really designed for the end-user.

Vignette onionmat shows some use-cases.

Examples

Run this code

matrix(rquat(28),4,7)

M <- onionmat(rquat(10),2,5)
cprod(M) 

Re(M)
Re(M) <- 0.3

romat() %*% rquat(6)

Run the code above in your browser using DataCamp Workspace