| Arith {onion} | R Documentation |
Methods for Function Arith in package Onion
Description
Methods for Arithmetic functions for onions: +,
-, *, /, ^
Usage
onion_negative(z)
onion_inverse(z)
onion_arith_onion(e1,e2)
onion_arith_numeric(e1,e2)
numeric_arith_onion(e1,e2)
harmonize_oo(a,b)
harmonize_on(a,b)
onion_plus_onion(a,b)
onion_plus_numeric(a,b)
onion_prod_onion(e1,e2)
octonion_prod_octonion(o1,o2)
quaternion_prod_quaternion(q1,q2)
onion_prod_numeric(a,b)
onion_power_singleinteger(o,n)
onion_power_numeric(o,p)
Arguments
z, e1, e2, a, b, o, o1, o2, n, q1, q2, p |
onions or numeric vectors |
Details
The package implements the Arith group of S4 generics so
that idiom like A + B*C works as expected with onions.
Functions like onion_inverse() and onion_plus_onion()
are low-level helper functions. The only really interesting operation
is multiplication; functions octonion_prod_octonion() and
quaternion_prod_quaternion() dispatch to C.
Names are implemented and the rules are inherited (via
harmonize_oo() and harmonize_on()) from rbind().
Value
generally return an onion
Note
Previous versions of the package included the option to use native R rather than the faster compiled C code used here. But this was very slow and is now discontinued.
Author(s)
Robin K. S. Hankin
Examples
a <- rquat()
b <- rquat()
a
Re(a)
j(a) <- 0.2
a*b
b*a # quaternions are noncommutative
x <- as.octonion(matrix(rnorm(40),nrow=8))
y <- roct()
z <- roct()
x*(y*z) - (x*y)*z # octonions are nonassociative [use associator()]
[Package onion version 1.5-3 Index]