onion (version 1.5-0)

Complex: Complex functionality for onions

Description

Functionality in the Complex group.

The norm Norm(O) of onion \(O\) is the product of \(O\) with its conjugate: \(|O|=OO^*\) but a more efficient numerical method is used (see dotprod()).

The Mod Mod(O) of onion \(O\) is the square root of its norm.

The sign of onion \(O\) is the onion with the same direction as \(O\) but with unit Norm: sign(O)=O/Mod(O).

Function Im() sets the real component of its argument to zero, and Conj() flips the sign of its argument's non-real components.

Usage

# S4 method for onion
Re(z)
# S4 method for onion
Im(z)
Re(z) <- value
Im(x) <- value
# S4 method for onion
Conj(z)
# S4 method for onion
Mod(z)
onion_abs(x)
onion_conjugate(z)
# S4 method for onion
sign(x)

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.

Arguments

x,z

Object of class onion or glub

value

replacement value

Author

Robin K. S. Hankin

See Also

Examples

Run this code

a <- rquat()
Re(a)
Re(a) <- j(a)

Im(a)

b <- romat()

A <- romat()
Im(A) <- Im(A)*10

Run the code above in your browser using DataLab