Allows arithmetic operators to be used for octonion calculations, such as addition, multiplication, division, integer powers, etc.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Objects of class “
Ops.onion() passes unary and binary arithmetic
/”) to the appropriate specialist function.
The most interesting operator is “
*”, which is passed to
AprodA(). This function is sensitive to the value of option
use.R. If this is
TRUE, then arguments are passed, via
Amassage(), to either
R_HprodH() (for quaternions), or
R_OprodO() (for octonions). If option
anything other than
TRUE (including being unset, which is the
default), the massaged arguments are passed to
OprodO(). This is what the user usually
wants: it is much faster than using the
The relative performance of, say,
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
An object of the appropriate (ie biggest) class as went in,
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
None of these functions are really intended for the end user: use the ops as shown in the examples section.
A” at the beginning of a function name means
Any onion. Thus
Ainv() takes quaternionic or
octonionic arguments, but
OprodO() takes only octonions.
1 2 3 4 5 6 7
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.