Ops.onion {onion} | R Documentation |
Allows arithmetic operators to be used for octonion calculations, such as addition, multiplication, division, integer powers, etc.
Ops.onion(e1, e2) OprodO(oct1,oct2) HprodH(quat1,quat2) R_OprodO(oct1,oct2) R_HprodH(quat1,quat2) AprodA(A,B, ur=getOption("use.R")) AsumA(A, B) Apower(A,B) AequalsA(A,B) AprodS(A,scalar) Ainv(A) Aneg(A) Amassage(A,B) harmonize(A,B)
e1 |
an object of class "onion" . |
e2 |
an object of class "onion" . |
A |
object of class "onion" |
B |
object of class "onion" |
oct1 |
Octonionic vector |
oct2 |
Octonionic vector |
quat1 |
Quaternionic vector |
quat2 |
Quaternionic vector |
scalar |
Scalar vector |
ur |
In function AprodA() , Boolean with default
FALSE meaning to use the c implementation; and
TRUE meaning to use the interpreted R function. See
details section. |
The function Ops.onion()
passes “*
” to function
AprodA()
. This function is sensitive to the value of option
use.R
. If this is FALSE
, then
arguments are passed, via Amassage()
, to either
R_HprodH()
(for quaternions), or
R_OprodO()
(for octonions). If option use.R
is
anything other than FALSE
(including being unset, which is the
default), the massaged arguments are passed to
R_HprodH()
or R_OprodO()
.
The relative performance of, say, OprodO()
vs
R_OprodO()
, will be system dependent but on my little Linux
system (Fedora; 256MB) OprodO()
runs more than three hundred
times faster than R_OprodO()
. Your mileage may vary; see
examples section for using options()
to set argument ur
.
Return an object of the appropriate (ie biggest) class as went in,
qua harmonize()
.
The only non obvious ones are Amassage()
, which is used by the
other functions to massage the two arguments into being the same
length, thus emulating recycling.
The other one is harmonize()
that coerces scalars into
quaternions and quaternions into octonions if necessary, returning a
list of two octonions or two quaternions of the same length, for
passing to functions like AprodA()
.
None of these functions are really intended for the end
user: use the ops as shown in the examples section.
The “A
” at the function means Any onion. Thus
Ainv()
takes quaternionic or octonionic arguments, but
OprodO()
takes only octonions.
x <- octonion(Re=1 , il=1:3, k=3:1) y <- octonion(Re=1:3, i=1 ,il=3:1) z <- octonion(Re=3:1, j=1 ,jl=1:3) x*9 x+y x*y x/y