Class BigQuaternion
java.lang.Object
edu.jas.arith.BigQuaternion
- All Implemented Interfaces:
AbelianGroupElem<BigQuaternion>, Element<BigQuaternion>, GcdRingElem<BigQuaternion>, MonoidElem<BigQuaternion>, RingElem<BigQuaternion>, StarRingElem<BigQuaternion>, Serializable, Comparable<BigQuaternion>
- Direct Known Subclasses:
BigQuaternionInteger
public class BigQuaternion
extends Object
implements StarRingElem<BigQuaternion>, GcdRingElem<BigQuaternion>
BigQuaternion class based on BigRational implementing the RingElem interface
and with the familiar MAS static method names. Objects of this class are
immutable. The integer quaternion methods are implemented after
https://de.wikipedia.org/wiki/Hurwitzquaternion see also
https://en.wikipedia.org/wiki/Hurwitz_quaternion
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final booleanfinal BigRationalImaginary part i of the data structure.final BigRationalImaginary part j of the data structure.final BigRationalImaginary part k of the data structure.private static final org.apache.logging.log4j.Loggerprotected static final Randomfinal BigRationalReal part of the data structure.final BigQuaternionRingCorresponding BigQuaternion ring. -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for a BigQuaternion with no arguments.BigQuaternion(BigQuaternionRing fac, long r) Constructor for a BigQuaternion from long.BigQuaternion(BigQuaternionRing fac, BigComplex r) Constructor for a BigQuaternion from BigComplex.Constructor for a BigQuaternion from BigRationals.BigQuaternion(BigQuaternionRing fac, BigRational r, BigRational i) Constructor for a BigQuaternion from BigRationals.BigQuaternion(BigQuaternionRing fac, BigRational r, BigRational i, BigRational j) Constructor for a BigQuaternion from BigRationals.BigQuaternion(BigQuaternionRing fac, BigRational r, BigRational i, BigRational j, BigRational k) Constructor for a BigQuaternion from BigRationals.BigQuaternion(BigQuaternionRing fac, String s) The BigQuaternion string constructor accepts the following formats: empty string, "rational", or "rat i rat j rat k rat" with no blanks around i, j or k if used as polynoial coefficient. -
Method Summary
Modifier and TypeMethodDescriptionabs()Quaternion number absolute value.longReturns the number of bits in the representation of this BigQuaternion, including a sign bit.ceil()BigQuaternion ceiling, component wise.intSince quaternion numbers are unordered, we use lexicographical order of re, im, jm and km.BigQuaternion conjugate.copy()Clone this.BigQuaternion right divide.BigQuaternion divide.BigQuaternion extended greatest common divisor.booleanComparison with any other object.factory()Get the corresponding element factory.floor()BigQuaternion floor, component wise.gcd(BigQuaternion S) Quaternion number greatest common divisor.getIm()Get the imaginary part im.getJm()Get the imaginary part jm.getKm()Get the imaginary part km.getRe()Get the real part.inthashCode()Hash code for this BigQuaternion.inverse()BigQuaternion inverse.booleanisEntier()Is BigQuaternion entier element.booleanisIMAG()Is BigQuaternion imaginary one.booleanisONE()Is BigQuaternion number one.static booleanIs BigQuaternion number one.static booleanIs Quaternion number zero.booleanisUnit()Is BigQuaternion unit element.booleanisZERO()Is BigQuaternion number zero.BigQuaternion left divide.Quaternion number greatest common divisor.BigQuaternion left remainder.BigQuaternion multiply.BigQuaternion multiply with BigRational.BigQuaternion multiply left.negate()BigQuaternion number negative.norm()Quaternion number norm.static BigRationalQuaternion number absolute value.static BigQuaternionQuaternion number conjugate.static BigQuaternionQDIF(BigQuaternion A, BigQuaternion B) Quaternion number difference.static BigQuaternionQuaternion number inverse.static BigQuaternionQuaternion number negative.static BigQuaternionQPROD(BigQuaternion A, BigQuaternion B) Quaternion number product.static BigQuaternionQQ(BigQuaternion A, BigQuaternion B) Quaternion number quotient.static BigQuaternionQSUM(BigQuaternion A, BigQuaternion B) Quaternion number sum.Quotient and remainder by division of this by S.BigQuaternion (right) remainder.BigQuaternion right divide.Quaternion number greatest common divisor.BigQuaternion right remainder.BigQuaternion round to next Hurwitz integer.BigQuaternion round to next Lipschitz integer.intsignum()Since quaternion numbers are unordered, we use lexicographical order of re, im, jm and km.BigQuaternion subtraction.sum(BigQuaternion B) BigQuaternion summation.toScript()Get a scripting compatible string representation.Get a scripting compatible string representation of the factory.toString()Get the string representation.Methods inherited from interface MonoidElem
power, twosidedDivide, twosidedRemainder
-
Field Details
-
re
Real part of the data structure. -
im
Imaginary part i of the data structure. -
jm
Imaginary part j of the data structure. -
km
Imaginary part k of the data structure. -
ring
Corresponding BigQuaternion ring. -
random
-
logger
private static final org.apache.logging.log4j.Logger logger -
debug
private static final boolean debug
-
-
Constructor Details
-
BigQuaternion
public BigQuaternion(BigQuaternionRing fac, BigRational r, BigRational i, BigRational j, BigRational k) Constructor for a BigQuaternion from BigRationals.- Parameters:
fac- BigQuaternionRing.r- BigRational.i- BigRational.j- BigRational.k- BigRational.
-
BigQuaternion
Constructor for a BigQuaternion from BigRationals.- Parameters:
fac- BigQuaternionRing.r- BigRational.i- BigRational.j- BigRational.
-
BigQuaternion
Constructor for a BigQuaternion from BigRationals.- Parameters:
fac- BigQuaternionRing.r- BigRational.i- BigRational.
-
BigQuaternion
Constructor for a BigQuaternion from BigRationals.- Parameters:
fac- BigQuaternionRing.r- BigRational.
-
BigQuaternion
Constructor for a BigQuaternion from BigComplex.- Parameters:
fac- BigQuaternionRing.r- BigComplex.
-
BigQuaternion
Constructor for a BigQuaternion from long.- Parameters:
fac- BigQuaternionRing.r- long.
-
BigQuaternion
Constructor for a BigQuaternion with no arguments.- Parameters:
fac- BigQuaternionRing.
-
BigQuaternion
The BigQuaternion string constructor accepts the following formats: empty string, "rational", or "rat i rat j rat k rat" with no blanks around i, j or k if used as polynoial coefficient.- Parameters:
fac- BigQuaternionRing.s- String.- Throws:
NumberFormatException
-
-
Method Details
-
factory
Get the corresponding element factory.- Specified by:
factoryin interfaceElement<BigQuaternion>- Returns:
- factory for this Element.
- See Also:
-
copy
Clone this.- Specified by:
copyin interfaceElement<BigQuaternion>- Returns:
- Creates and returns a copy of this Element.
- See Also:
-
getRe
-
getIm
-
getJm
-
getKm
-
toString
-
toScript
Get a scripting compatible string representation.- Specified by:
toScriptin interfaceElement<BigQuaternion>- Returns:
- script compatible representation for this Element.
- See Also:
-
toScriptFactory
Get a scripting compatible string representation of the factory.- Specified by:
toScriptFactoryin interfaceElement<BigQuaternion>- Returns:
- script compatible representation for this ElemFactory.
- See Also:
-
isQZERO
Is Quaternion number zero.- Parameters:
A- BigQuaternion.- Returns:
- true if A is 0, else false.
-
isZERO
public boolean isZERO()Is BigQuaternion number zero.- Specified by:
isZEROin interfaceAbelianGroupElem<BigQuaternion>- Returns:
- true if this is 0, else false.
- See Also:
-
isQONE
Is BigQuaternion number one.- Parameters:
A- is a quaternion number.- Returns:
- true if A is 1, else false.
-
isONE
public boolean isONE()Is BigQuaternion number one.- Specified by:
isONEin interfaceMonoidElem<BigQuaternion>- Returns:
- true if this is 1, else false.
- See Also:
-
isIMAG
public boolean isIMAG()Is BigQuaternion imaginary one.- Returns:
- true if this is i, else false.
-
isUnit
public boolean isUnit()Is BigQuaternion unit element.- Specified by:
isUnitin interfaceMonoidElem<BigQuaternion>- Returns:
- If this is a unit then true is returned, else false.
- See Also:
-
isEntier
public boolean isEntier()Is BigQuaternion entier element.- Returns:
- If this is an integer Hurwitz element then true is returned, else false.
-
equals
-
hashCode
public int hashCode()Hash code for this BigQuaternion.- Specified by:
hashCodein interfaceElement<BigQuaternion>- Overrides:
hashCodein classObject- Returns:
- the hashCode.
- See Also:
-
compareTo
Since quaternion numbers are unordered, we use lexicographical order of re, im, jm and km.- Specified by:
compareToin interfaceComparable<BigQuaternion>- Specified by:
compareToin interfaceElement<BigQuaternion>- Parameters:
b- BigQuaternion.- Returns:
- 0 if b is equal to this, 1 if this is greater b and -1 else.
-
signum
public int signum()Since quaternion numbers are unordered, we use lexicographical order of re, im, jm and km.- Specified by:
signumin interfaceAbelianGroupElem<BigQuaternion>- Returns:
- 0 if this is equal to 0; 1 if re > 0, or re == 0 and im > 0, or ...; -1 if re < 0, or re == 0 and im < 0, or ...
- See Also:
-
sum
BigQuaternion summation.- Specified by:
sumin interfaceAbelianGroupElem<BigQuaternion>- Parameters:
B- BigQuaternion.- Returns:
- this+B.
-
QSUM
Quaternion number sum.- Parameters:
A- BigQuaternion.B- BigQuaternion.- Returns:
- A+B.
-
QDIF
Quaternion number difference.- Parameters:
A- BigQuaternion.B- BigQuaternion.- Returns:
- A-B.
-
subtract
BigQuaternion subtraction.- Specified by:
subtractin interfaceAbelianGroupElem<BigQuaternion>- Parameters:
B- BigQuaternion.- Returns:
- this-B.
-
QNEG
Quaternion number negative.- Parameters:
A- is a quaternion number- Returns:
- -A.
-
negate
BigQuaternion number negative.- Specified by:
negatein interfaceAbelianGroupElem<BigQuaternion>- Returns:
- -this.
- See Also:
-
QCON
Quaternion number conjugate.- Parameters:
A- is a quaternion number.- Returns:
- the quaternion conjugate of A.
-
conjugate
BigQuaternion conjugate.- Specified by:
conjugatein interfaceStarRingElem<BigQuaternion>- Returns:
- conjugate(this).
-
norm
Quaternion number norm.- Specified by:
normin interfaceStarRingElem<BigQuaternion>- Returns:
- ||this||.
- See Also:
-
abs
Quaternion number absolute value.- Specified by:
absin interfaceAbelianGroupElem<BigQuaternion>- Returns:
- |this|.
- See Also:
-
QABS
Quaternion number absolute value.- Parameters:
A- is a quaternion number.- Returns:
- the absolute value of A, a rational number. Note: The square root is not jet implemented.
-
QPROD
Quaternion number product.- Parameters:
A- BigQuaternion.B- BigQuaternion.- Returns:
- A*B.
-
multiply
BigQuaternion multiply with BigRational.- Parameters:
b- BigRational.- Returns:
- this*b.
-
multiply
BigQuaternion multiply.- Specified by:
multiplyin interfaceMonoidElem<BigQuaternion>- Parameters:
B- BigQuaternion.- Returns:
- this*B.
-
multiplyLeft
BigQuaternion multiply left.- Parameters:
B- BigQuaternion.- Returns:
- B*this.
-
QINV
Quaternion number inverse.- Parameters:
A- is a non-zero quaternion number.- Returns:
- S with S * A = A * S = 1.
-
inverse
BigQuaternion inverse.- Specified by:
inversein interfaceMonoidElem<BigQuaternion>- Returns:
- S with S * this = this * S = 1.
- See Also:
-
rightRemainder
BigQuaternion right remainder.- Specified by:
rightRemainderin interfaceMonoidElem<BigQuaternion>- Parameters:
S- BigQuaternion.- Returns:
- 0.
-
remainder
BigQuaternion (right) remainder.- Specified by:
remainderin interfaceMonoidElem<BigQuaternion>- Parameters:
S- BigQuaternion.- Returns:
- 0.
-
leftRemainder
BigQuaternion left remainder.- Specified by:
leftRemainderin interfaceMonoidElem<BigQuaternion>- Parameters:
S- BigQuaternion.- Returns:
- 0.
-
QQ
Quaternion number quotient.- Parameters:
A- BigQuaternion.B- BigQuaternion.- Returns:
- R/S.
-
divide
BigQuaternion right divide.- Specified by:
dividein interfaceMonoidElem<BigQuaternion>- Parameters:
b- BigQuaternion.- Returns:
- this * b**(-1).
-
rightDivide
BigQuaternion right divide.- Specified by:
rightDividein interfaceMonoidElem<BigQuaternion>- Parameters:
b- BigQuaternion.- Returns:
- q = this * b**(-1), such that q * b = this.
-
leftDivide
BigQuaternion left divide.- Specified by:
leftDividein interfaceMonoidElem<BigQuaternion>- Parameters:
b- BigQuaternion.- Returns:
- q = b**(-1) * this, such that b * q = this.
-
divide
BigQuaternion divide.- Parameters:
b- BigRational.- Returns:
- this/b.
-
quotientRemainder
Quotient and remainder by division of this by S.- Specified by:
quotientRemainderin interfaceMonoidElem<BigQuaternion>- Parameters:
S- a quaternion number- Returns:
- [this*S**(-1), this - (this*S**(-1))*S].
-
gcd
Quaternion number greatest common divisor.- Specified by:
gcdin interfaceRingElem<BigQuaternion>- Parameters:
S- BigQuaternion.- Returns:
- gcd(this,S).
-
leftGcd
Quaternion number greatest common divisor.- Specified by:
leftGcdin interfaceRingElem<BigQuaternion>- Parameters:
S- BigQuaternion.- Returns:
- leftCcd(this,S).
-
rightGcd
Quaternion number greatest common divisor.- Specified by:
rightGcdin interfaceRingElem<BigQuaternion>- Parameters:
S- BigQuaternion.- Returns:
- rightCcd(this,S).
-
egcd
BigQuaternion extended greatest common divisor.- Specified by:
egcdin interfaceRingElem<BigQuaternion>- Parameters:
S- BigQuaternion.- Returns:
- [ gcd(this,S), a, b ] with a*this + b*S = gcd(this,S).
-
bitLength
public long bitLength()Returns the number of bits in the representation of this BigQuaternion, including a sign bit. It is equivalent tore.bitLength()+im.bitLength()+jm.bitLength()+km.bitLength().)- Returns:
- number of bits in the representation of this BigQuaternion, including a sign bit.
-
ceil
-
floor
-
roundToLipschitzian
BigQuaternion round to next Lipschitz integer. BigQuaternion with all integer components.- Returns:
- Lipschitz integer of this.
-
roundToHurwitzian
BigQuaternion round to next Hurwitz integer. BigQuaternion with all integer or all 1/2 times integer components.- Returns:
- Hurwitz integer near this.
-