Complex {onion} | R Documentation |
Complex functionality for onions
Description
Functionality in the Complex group.
The norm Norm(O)
of onion is the product of
with its conjugate:
but a more efficient
numerical method is used (see
dotprod()
).
The Mod Mod(O)
of onion is the square root of its
norm.
The sign of onion is the onion with the same direction
as
but with unit Norm:
sign(O)=O/Mod(O)
.
Function Im()
sets the real component of its argument to zero
and returns that; Conj()
flips the sign of its argument's
non-real components. Function Re()
returns the real component
(first row) of its argument as a numeric vector. If x
is an
onion, then x == Re(x) + Im(x)
.
Usage
## S4 method for signature 'onion'
Re(z)
## S4 method for signature 'onion'
Im(z)
Re(z) <- value
Im(x) <- value
## S4 method for signature 'onion'
Conj(z)
## S4 method for signature 'onion'
Mod(z)
onion_abs(x)
onion_conjugate(z)
## S4 method for signature 'onion'
sign(x)
Arguments
x , z |
Object of class onion or glub |
value |
replacement value |
Value
All functions documented here return a numeric vector or matrix of the
same dimensions as their argument, apart from functions Im()
and Conj()
, which return an object of the same class as its
argument.
Note
If x
is a numeric vector and y
an onion, one might
expect typing x[1] <- y
to result in x
being a onion.
This is impossible, according to John Chambers.
Extract and set methods for components such as i,j,k
are
documented at Extract.Rd
Compare clifford::Conj()
, which is more complicated.
Author(s)
Robin K. S. Hankin
See Also
Examples
a <- rquat()
Re(a)
Re(a) <- j(a)
Im(a)
b <- romat()
A <- romat()
Im(A) <- Im(A)*10