Class FieldTuple<T extends CalculusFieldElement<T>>

java.lang.Object
org.hipparchus.util.FieldTuple<T>
Type Parameters:
T - the type of the field elements
All Implemented Interfaces:
CalculusFieldElement<FieldTuple<T>>, FieldElement<FieldTuple<T>>

public class FieldTuple<T extends CalculusFieldElement<T>> extends Object implements CalculusFieldElement<FieldTuple<T>>
This class allows to perform the same computation of all components of a Tuple at once.
Since:
1.2
• Constructor Summary

Constructors
Constructor
Description
FieldTuple(T... x)
Creates a new instance from its components.
• Method Summary

Modifier and Type
Method
Description
FieldTuple<T>
abs()
absolute value.
FieldTuple<T>
acos()
Arc cosine operation.
FieldTuple<T>
acosh()
Inverse hyperbolic cosine operation.
FieldTuple<T>
add(double a)
'+' operator.
FieldTuple<T>
add(FieldTuple<T> a)
Compute this + a.
FieldTuple<T>
asin()
Arc sine operation.
FieldTuple<T>
asinh()
Inverse hyperbolic sine operation.
FieldTuple<T>
atan()
Arc tangent operation.
FieldTuple<T>
atan2(FieldTuple<T> x)
Two arguments arc tangent operation.
FieldTuple<T>
atanh()
Inverse hyperbolic tangent operation.
FieldTuple<T>
cbrt()
Cubic root.
FieldTuple<T>
ceil()
Get the smallest whole number larger than instance.
FieldTuple<T>
copySign(double sign)
Returns the instance with the sign of the argument.
FieldTuple<T>
copySign(FieldTuple<T> sign)
Returns the instance with the sign of the argument.
FieldTuple<T>
cos()
Cosine operation.
FieldTuple<T>
cosh()
Hyperbolic cosine operation.
FieldTuple<T>
divide(double a)
'÷' operator.
FieldTuple<T>
divide(FieldTuple<T> a)
Compute this ÷ a.
boolean
equals(Object obj)
FieldTuple<T>
exp()
Exponential.
FieldTuple<T>
expm1()
Exponential minus 1.
FieldTuple<T>
floor()
Get the largest whole number smaller than instance.
T
getComponent(int index)
Get one component of the tuple.
T[]
getComponents()
Get all components of the tuple.
int
getDimension()
Get the dimension of the tuple.
Field<FieldTuple<T>>
getField()
Get the Field to which the instance belongs.
FieldTuple<T>
getPi()
Get the Archimedes constant π.
double
getReal()
Get the real value of the number.
int
hashCode()
FieldTuple<T>
hypot(FieldTuple<T> y)
Returns the hypotenuse of a triangle with sides this and y - sqrt(this2 +y2) avoiding intermediate overflow or underflow.
FieldTuple<T>
linearCombination(double[] a, FieldTuple<T>[] b)
Compute a linear combination.
FieldTuple<T>
linearCombination(double a1, FieldTuple<T> b1, double a2, FieldTuple<T> b2)
Compute a linear combination.
FieldTuple<T>
linearCombination(double a1, FieldTuple<T> b1, double a2, FieldTuple<T> b2, double a3, FieldTuple<T> b3)
Compute a linear combination.
FieldTuple<T>
linearCombination(double a1, FieldTuple<T> b1, double a2, FieldTuple<T> b2, double a3, FieldTuple<T> b3, double a4, FieldTuple<T> b4)
Compute a linear combination.
FieldTuple<T>
linearCombination(FieldTuple<T>[] a, FieldTuple<T>[] b)
Compute a linear combination.
FieldTuple<T>
linearCombination(FieldTuple<T> a1, FieldTuple<T> b1, FieldTuple<T> a2, FieldTuple<T> b2)
Compute a linear combination.
FieldTuple<T>
linearCombination(FieldTuple<T> a1, FieldTuple<T> b1, FieldTuple<T> a2, FieldTuple<T> b2, FieldTuple<T> a3, FieldTuple<T> b3)
Compute a linear combination.
FieldTuple<T>
linearCombination(FieldTuple<T> a1, FieldTuple<T> b1, FieldTuple<T> a2, FieldTuple<T> b2, FieldTuple<T> a3, FieldTuple<T> b3, FieldTuple<T> a4, FieldTuple<T> b4)
Compute a linear combination.
FieldTuple<T>
log()
Natural logarithm.
FieldTuple<T>
log10()
Base 10 logarithm.
FieldTuple<T>
log1p()
Shifted natural logarithm.
FieldTuple<T>
multiply(double a)
'×' operator.
FieldTuple<T>
multiply(int n)
Compute n × this.
FieldTuple<T>
multiply(FieldTuple<T> a)
Compute this × a.
FieldTuple<T>
negate()
Returns the additive inverse of this element.
FieldTuple<T>
newInstance(double value)
Create an instance corresponding to a constant real value.
FieldTuple<T>
pow(double p)
Power operation.
FieldTuple<T>
pow(int n)
Integer power operation.
FieldTuple<T>
pow(FieldTuple<T> e)
Power operation.
FieldTuple<T>
reciprocal()
Returns the multiplicative inverse of this element.
FieldTuple<T>
remainder(double a)
IEEE remainder operator.
FieldTuple<T>
remainder(FieldTuple<T> a)
IEEE remainder operator.
FieldTuple<T>
rint()
Get the whole number that is the nearest to the instance, or the even one if x is exactly half way between two integers.
FieldTuple<T>
rootN(int n)
Nth root.
FieldTuple<T>
scalb(int n)
Multiply the instance by a power of 2.
FieldTuple<T>
sign()
Compute the sign of the instance.
FieldTuple<T>
sin()
Sine operation.
FieldSinCos<FieldTuple<T>>
sinCos()
Combined Sine and Cosine operation.
FieldTuple<T>
sinh()
Hyperbolic sine operation.
FieldSinhCosh<FieldTuple<T>>
sinhCosh()
Combined hyperbolic sine and cosine operation.
FieldTuple<T>
sqrt()
Square root.
FieldTuple<T>
square()
Compute this × this.
FieldTuple<T>
subtract(double a)
'-' operator.
FieldTuple<T>
subtract(FieldTuple<T> a)
Compute this - a.
FieldTuple<T>
tan()
Tangent operation.
FieldTuple<T>
tanh()
Hyperbolic tangent operation.
FieldTuple<T>
toDegrees()
Convert radians to degrees, with error of less than 0.5 ULP
FieldTuple<T>
toRadians()
Convert degrees to radians, with error of less than 0.5 ULP
FieldTuple<T>
ulp()
Compute least significant bit (Unit in Last Position) for a number.

Methods inherited from class java.lang.Object

clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait

Methods inherited from interface org.hipparchus.CalculusFieldElement

getExponent, isFinite, isInfinite, isNaN, norm, round

Methods inherited from interface org.hipparchus.FieldElement

isZero
• Constructor Details

• FieldTuple

public FieldTuple(T... x)
Creates a new instance from its components.
Parameters:
x - components of the tuple
• Method Details

• newInstance

public  newInstance(double value)
Create an instance corresponding to a constant real value.
Specified by:
newInstance in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Parameters:
value - constant real value
Returns:
instance corresponding to a constant real value
• getDimension

public int getDimension()
Get the dimension of the tuple.
Returns:
dimension of the tuple
• getComponent

public T getComponent(int index)
Get one component of the tuple.
Parameters:
index - index of the component, between 0 and getDimension() - 1
Returns:
value of the component
• getComponents

public T[] getComponents()
Get all components of the tuple.
Returns:
all components
• getField

public Field<FieldTuple<T>> getField()
Get the Field to which the instance belongs.
Specified by:
getField in interface FieldElement<T extends CalculusFieldElement<T>>
Returns:
Field to which the instance belongs

Compute this + a.
Specified by:
add in interface FieldElement<T extends CalculusFieldElement<T>>
Parameters:
a - element to add
Returns:
a new element representing this + a
• subtract

public  subtract(FieldTuple<T> a)
Compute this - a.
Specified by:
subtract in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Specified by:
subtract in interface FieldElement<T extends CalculusFieldElement<T>>
Parameters:
a - element to subtract
Returns:
a new element representing this - a
• negate

public  negate()
Returns the additive inverse of this element.
Specified by:
negate in interface FieldElement<T extends CalculusFieldElement<T>>
Returns:
the opposite of this.
• multiply

public  multiply(FieldTuple<T> a)
Compute this × a.
Specified by:
multiply in interface FieldElement<T extends CalculusFieldElement<T>>
Parameters:
a - element to multiply
Returns:
a new element representing this × a
• multiply

public  multiply(int n)
Compute n × this. Multiplication by an integer number is defined as the following sum $n \times \mathrm{this} = \sum_{i=1}^n \mathrm{this}$
Specified by:
multiply in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Specified by:
multiply in interface FieldElement<T extends CalculusFieldElement<T>>
Parameters:
n - Number of times this must be added to itself.
Returns:
A new element representing n × this.
• divide

public  divide(FieldTuple<T> a)
Compute this ÷ a.
Specified by:
divide in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Specified by:
divide in interface FieldElement<T extends CalculusFieldElement<T>>
Parameters:
a - element to divide by
Returns:
a new element representing this ÷ a
• reciprocal

public  reciprocal()
Returns the multiplicative inverse of this element.
Specified by:
reciprocal in interface FieldElement<T extends CalculusFieldElement<T>>
Returns:
the inverse of this.
• equals

public boolean equals(Object obj)
Overrides:
equals in class Object
• hashCode

public int hashCode()
Overrides:
hashCode in class Object
• getReal

public double getReal()
Get the real value of the number.
Specified by:
getReal in interface FieldElement<T extends CalculusFieldElement<T>>
Returns:
real value

'+' operator.
Specified by:
add in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Parameters:
a - right hand side parameter of the operator
Returns:
this+a
• subtract

public  subtract(double a)
'-' operator.
Specified by:
subtract in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Parameters:
a - right hand side parameter of the operator
Returns:
this-a
• multiply

public  multiply(double a)
'×' operator.
Specified by:
multiply in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Parameters:
a - right hand side parameter of the operator
Returns:
this×a
• square

public  square()
Compute this × this.
Specified by:
square in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Returns:
a new element representing this × this
• divide

public  divide(double a)
'÷' operator.
Specified by:
divide in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Parameters:
a - right hand side parameter of the operator
Returns:
this÷a
• remainder

public  remainder(double a)
IEEE remainder operator.
Specified by:
remainder in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Parameters:
a - right hand side parameter of the operator
Returns:
this - n × a where n is the closest integer to this/a
• remainder

public  remainder(FieldTuple<T> a)
IEEE remainder operator.
Specified by:
remainder in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Parameters:
a - right hand side parameter of the operator
Returns:
this - n × a where n is the closest integer to this/a
• abs

public  abs()
absolute value.
Specified by:
abs in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Returns:
abs(this)
• ceil

public  ceil()
Get the smallest whole number larger than instance.
Specified by:
ceil in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Returns:
ceil(this)
• floor

public  floor()
Get the largest whole number smaller than instance.
Specified by:
floor in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Returns:
floor(this)
• rint

public  rint()
Get the whole number that is the nearest to the instance, or the even one if x is exactly half way between two integers.
Specified by:
rint in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Returns:
a double number r such that r is an integer r - 0.5 ≤ this ≤ r + 0.5
• sign

public  sign()
Compute the sign of the instance. The sign is -1 for negative numbers, +1 for positive numbers and 0 otherwise, for Complex number, it is extended on the unit circle (equivalent to z/|z|, with special handling for 0 and NaN)
Specified by:
sign in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Returns:
-1.0, -0.0, +0.0, +1.0 or NaN depending on sign of a
• copySign

public  copySign(FieldTuple<T> sign)
Returns the instance with the sign of the argument. A NaN sign argument is treated as positive.
Specified by:
copySign in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Parameters:
sign - the sign for the returned value
Returns:
the instance with the same sign as the sign argument
• copySign

public  copySign(double sign)
Returns the instance with the sign of the argument. A NaN sign argument is treated as positive.
Specified by:
copySign in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Parameters:
sign - the sign for the returned value
Returns:
the instance with the same sign as the sign argument
• scalb

public  scalb(int n)
Multiply the instance by a power of 2.
Specified by:
scalb in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Parameters:
n - power of 2
Returns:
this × 2n
• ulp

public  ulp()
Compute least significant bit (Unit in Last Position) for a number.
Specified by:
ulp in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Returns:
ulp(this)
• hypot

public  hypot(FieldTuple<T> y)
Returns the hypotenuse of a triangle with sides this and y - sqrt(this2 +y2) avoiding intermediate overflow or underflow.
• If either argument is infinite, then the result is positive infinity.
• else, if either argument is NaN then the result is NaN.
Specified by:
hypot in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Parameters:
y - a value
Returns:
sqrt(this2 +y2)
• sqrt

public  sqrt()
Square root.
Specified by:
sqrt in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Returns:
square root of the instance
• cbrt

public  cbrt()
Cubic root.
Specified by:
cbrt in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Returns:
cubic root of the instance
• rootN

public  rootN(int n)
Nth root.
Specified by:
rootN in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Parameters:
n - order of the root
Returns:
nth root of the instance
• pow

public  pow(double p)
Power operation.
Specified by:
pow in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Parameters:
p - power to apply
Returns:
thisp
• pow

public  pow(int n)
Integer power operation.
Specified by:
pow in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Parameters:
n - power to apply
Returns:
thisn
• pow

public  pow(FieldTuple<T> e)
Power operation.
Specified by:
pow in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Parameters:
e - exponent
Returns:
thise
• exp

public  exp()
Exponential.
Specified by:
exp in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Returns:
exponential of the instance
• expm1

public  expm1()
Exponential minus 1.
Specified by:
expm1 in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Returns:
exponential minus one of the instance
• log

public  log()
Natural logarithm.
Specified by:
log in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Returns:
logarithm of the instance
• log1p

public  log1p()
Shifted natural logarithm.
Specified by:
log1p in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Returns:
logarithm of one plus the instance
• log10

public  log10()
Base 10 logarithm.
Specified by:
log10 in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Returns:
base 10 logarithm of the instance
• cos

public  cos()
Cosine operation.
Specified by:
cos in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Returns:
cos(this)
• sin

public  sin()
Sine operation.
Specified by:
sin in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Returns:
sin(this)
• sinCos

public  sinCos()
Combined Sine and Cosine operation.
Specified by:
sinCos in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Returns:
[sin(this), cos(this)]
• tan

public  tan()
Tangent operation.
Specified by:
tan in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Returns:
tan(this)
• acos

public  acos()
Arc cosine operation.
Specified by:
acos in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Returns:
acos(this)
• asin

public  asin()
Arc sine operation.
Specified by:
asin in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Returns:
asin(this)
• atan

public  atan()
Arc tangent operation.
Specified by:
atan in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Returns:
atan(this)
• atan2

public  atan2(FieldTuple<T> x)
Two arguments arc tangent operation.

Beware of the order or arguments! As this is based on a two-arguments functions, in order to be consistent with arguments order, the instance is the first argument and the single provided argument is the second argument. In order to be consistent with programming languages atan2, this method computes atan2(this, x), i.e. the instance represents the y argument and the x argument is the one passed as a single argument. This may seem confusing especially for users of Wolfram alpha, as this site is not consistent with programming languages atan2 two-arguments arc tangent and puts x as its first argument.

Specified by:
atan2 in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Parameters:
x - second argument of the arc tangent
Returns:
atan2(this, x)
• cosh

public  cosh()
Hyperbolic cosine operation.
Specified by:
cosh in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Returns:
cosh(this)
• sinh

public  sinh()
Hyperbolic sine operation.
Specified by:
sinh in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Returns:
sinh(this)
• sinhCosh

public  sinhCosh()
Combined hyperbolic sine and cosine operation.
Specified by:
sinhCosh in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Returns:
[sinh(this), cosh(this)]
• tanh

public  tanh()
Hyperbolic tangent operation.
Specified by:
tanh in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Returns:
tanh(this)
• acosh

public  acosh()
Inverse hyperbolic cosine operation.
Specified by:
acosh in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Returns:
acosh(this)
• asinh

public  asinh()
Inverse hyperbolic sine operation.
Specified by:
asinh in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Returns:
asin(this)
• atanh

public  atanh()
Inverse hyperbolic tangent operation.
Specified by:
atanh in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Returns:
atanh(this)
• toDegrees

public  toDegrees()
Convert radians to degrees, with error of less than 0.5 ULP
Specified by:
toDegrees in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Returns:
instance converted into degrees

Convert degrees to radians, with error of less than 0.5 ULP
Specified by:
toRadians in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Returns:
instance converted into radians
• linearCombination

public  linearCombination(FieldTuple<T>[] a, FieldTuple<T>[] b) throws MathIllegalArgumentException
Compute a linear combination.
Specified by:
linearCombination in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Parameters:
a - Factors.
b - Factors.
Returns:
Σi ai bi.
Throws:
MathIllegalArgumentException - if arrays dimensions don't match
• linearCombination

public  linearCombination(double[] a, FieldTuple<T>[] b) throws MathIllegalArgumentException
Compute a linear combination.
Specified by:
linearCombination in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Parameters:
a - Factors.
b - Factors.
Returns:
Σi ai bi.
Throws:
MathIllegalArgumentException - if arrays dimensions don't match
• linearCombination

public  linearCombination(FieldTuple<T> a1, FieldTuple<T> b1, FieldTuple<T> a2, FieldTuple<T> b2)
Compute a linear combination.
Specified by:
linearCombination in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Parameters:
a1 - first factor of the first term
b1 - second factor of the first term
a2 - first factor of the second term
b2 - second factor of the second term
Returns:
a1×b1 + a2×b2
• linearCombination

public  linearCombination(double a1, FieldTuple<T> b1, double a2, FieldTuple<T> b2)
Compute a linear combination.
Specified by:
linearCombination in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Parameters:
a1 - first factor of the first term
b1 - second factor of the first term
a2 - first factor of the second term
b2 - second factor of the second term
Returns:
a1×b1 + a2×b2
• linearCombination

public  linearCombination(FieldTuple<T> a1, FieldTuple<T> b1, FieldTuple<T> a2, FieldTuple<T> b2, FieldTuple<T> a3, FieldTuple<T> b3)
Compute a linear combination.
Specified by:
linearCombination in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Parameters:
a1 - first factor of the first term
b1 - second factor of the first term
a2 - first factor of the second term
b2 - second factor of the second term
a3 - first factor of the third term
b3 - second factor of the third term
Returns:
a1×b1 + a2×b2 + a3×b3
• linearCombination

public  linearCombination(double a1, FieldTuple<T> b1, double a2, FieldTuple<T> b2, double a3, FieldTuple<T> b3)
Compute a linear combination.
Specified by:
linearCombination in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Parameters:
a1 - first factor of the first term
b1 - second factor of the first term
a2 - first factor of the second term
b2 - second factor of the second term
a3 - first factor of the third term
b3 - second factor of the third term
Returns:
a1×b1 + a2×b2 + a3×b3
• linearCombination

public  linearCombination(FieldTuple<T> a1, FieldTuple<T> b1, FieldTuple<T> a2, FieldTuple<T> b2, FieldTuple<T> a3, FieldTuple<T> b3, FieldTuple<T> a4, FieldTuple<T> b4)
Compute a linear combination.
Specified by:
linearCombination in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Parameters:
a1 - first factor of the first term
b1 - second factor of the first term
a2 - first factor of the second term
b2 - second factor of the second term
a3 - first factor of the third term
b3 - second factor of the third term
a4 - first factor of the fourth term
b4 - second factor of the fourth term
Returns:
a1×b1 + a2×b2 + a3×b3 + a4×b4
• linearCombination

public  linearCombination(double a1, FieldTuple<T> b1, double a2, FieldTuple<T> b2, double a3, FieldTuple<T> b3, double a4, FieldTuple<T> b4)
Compute a linear combination.
Specified by:
linearCombination in interface CalculusFieldElement<T extends CalculusFieldElement<T>>
Parameters:
a1 - first factor of the first term
b1 - second factor of the first term
a2 - first factor of the second term
b2 - second factor of the second term
a3 - first factor of the third term
b3 - second factor of the third term
a4 - first factor of the fourth term
b4 - second factor of the fourth term
Returns:
a1×b1 + a2×b2 + a3×b3 + a4×b4
getPi in interface CalculusFieldElement<T extends CalculusFieldElement<T>>