Package org.hipparchus.util
Class Tuple
- java.lang.Object
-
- org.hipparchus.util.Tuple
-
- All Implemented Interfaces:
FieldElement<Tuple>
,RealFieldElement<Tuple>
public class Tuple extends Object implements RealFieldElement<Tuple>
This class allows to perform the same computation of all components of a Tuple at once.- Since:
- 1.2
-
-
Constructor Summary
Constructors Constructor Description Tuple(double... x)
Creates a new instance from its components.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tuple
abs()
absolute value.Tuple
acos()
Arc cosine operation.Tuple
acosh()
Inverse hyperbolic cosine operation.Tuple
add(double a)
'+' operator.Tuple
add(Tuple a)
Compute this + a.Tuple
asin()
Arc sine operation.Tuple
asinh()
Inverse hyperbolic sine operation.Tuple
atan()
Arc tangent operation.Tuple
atan2(Tuple x)
Two arguments arc tangent operation.Tuple
atanh()
Inverse hyperbolic tangent operation.Tuple
cbrt()
Cubic root.Tuple
ceil()
Get the smallest whole number larger than instance.Tuple
copySign(double sign)
Returns the instance with the sign of the argument.Tuple
copySign(Tuple sign)
Returns the instance with the sign of the argument.Tuple
cos()
Cosine operation.Tuple
cosh()
Hyperbolic cosine operation.Tuple
divide(double a)
'÷' operator.Tuple
divide(Tuple a)
Compute this ÷ a.boolean
equals(Object obj)
Tuple
exp()
Exponential.Tuple
expm1()
Exponential minus 1.Tuple
floor()
Get the largest whole number smaller than instance.double
getComponent(int index)
Get one component of the tuple.double[]
getComponents()
Get all components of the tuple.int
getDimension()
Get the dimension of the tuple.Field<Tuple>
getField()
Get theField
to which the instance belongs.double
getReal()
Get the real value of the number.int
hashCode()
Tuple
hypot(Tuple y)
Returns the hypotenuse of a triangle with sidesthis
andy
- sqrt(this2 +y2) avoiding intermediate overflow or underflow.Tuple
linearCombination(double[] a, Tuple[] b)
Compute a linear combination.Tuple
linearCombination(double a1, Tuple b1, double a2, Tuple b2)
Compute a linear combination.Tuple
linearCombination(double a1, Tuple b1, double a2, Tuple b2, double a3, Tuple b3)
Compute a linear combination.Tuple
linearCombination(double a1, Tuple b1, double a2, Tuple b2, double a3, Tuple b3, double a4, Tuple b4)
Compute a linear combination.Tuple
linearCombination(Tuple[] a, Tuple[] b)
Compute a linear combination.Tuple
linearCombination(Tuple a1, Tuple b1, Tuple a2, Tuple b2)
Compute a linear combination.Tuple
linearCombination(Tuple a1, Tuple b1, Tuple a2, Tuple b2, Tuple a3, Tuple b3)
Compute a linear combination.Tuple
linearCombination(Tuple a1, Tuple b1, Tuple a2, Tuple b2, Tuple a3, Tuple b3, Tuple a4, Tuple b4)
Compute a linear combination.Tuple
log()
Natural logarithm.Tuple
log10()
Base 10 logarithm.Tuple
log1p()
Shifted natural logarithm.Tuple
multiply(double a)
'×' operator.Tuple
multiply(int n)
Compute n × this.Tuple
multiply(Tuple a)
Compute this × a.Tuple
negate()
Returns the additive inverse ofthis
element.Tuple
pow(double p)
Power operation.Tuple
pow(int n)
Integer power operation.Tuple
pow(Tuple e)
Power operation.Tuple
reciprocal()
Returns the multiplicative inverse ofthis
element.Tuple
remainder(double a)
IEEE remainder operator.Tuple
remainder(Tuple a)
IEEE remainder operator.Tuple
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.Tuple
rootN(int n)
Nth root.long
round()
Get the closest long to instance value.Tuple
scalb(int n)
Multiply the instance by a power of 2.Tuple
signum()
Compute the signum of the instance.Tuple
sin()
Sine operation.FieldSinCos<Tuple>
sinCos()
Combined Sine and Cosine operation.Tuple
sinh()
Hyperbolic sine operation.Tuple
sqrt()
Square root.Tuple
subtract(double a)
'-' operator.Tuple
subtract(Tuple a)
Compute this - a.Tuple
tan()
Tangent operation.Tuple
tanh()
Hyperbolic tangent operation.
-
-
-
Method Detail
-
getDimension
public int getDimension()
Get the dimension of the tuple.- Returns:
- dimension of the tuple
-
getComponent
public double getComponent(int index)
Get one component of the tuple.- Parameters:
index
- index of the component, between 0 andgetDimension()
- 1- Returns:
- value of the component
-
getComponents
public double[] getComponents()
Get all components of the tuple.- Returns:
- all components
-
getField
public Field<Tuple> getField()
Get theField
to which the instance belongs.- Specified by:
getField
in interfaceFieldElement<Tuple>
- Returns:
Field
to which the instance belongs
-
add
public Tuple add(Tuple a)
Compute this + a.- Specified by:
add
in interfaceFieldElement<Tuple>
- Parameters:
a
- element to add- Returns:
- a new element representing this + a
-
subtract
public Tuple subtract(Tuple a)
Compute this - a.- Specified by:
subtract
in interfaceFieldElement<Tuple>
- Parameters:
a
- element to subtract- Returns:
- a new element representing this - a
-
negate
public Tuple negate()
Returns the additive inverse ofthis
element.- Specified by:
negate
in interfaceFieldElement<Tuple>
- Returns:
- the opposite of
this
.
-
multiply
public Tuple multiply(Tuple a)
Compute this × a.- Specified by:
multiply
in interfaceFieldElement<Tuple>
- Parameters:
a
- element to multiply- Returns:
- a new element representing this × a
-
multiply
public Tuple multiply(int n)
Compute n × this. Multiplication by an integer number is defined as the following sumn × this = ∑i=1n this. - Specified by:
multiply
in interfaceFieldElement<Tuple>
- Parameters:
n
- Number of timesthis
must be added to itself.- Returns:
- A new element representing n × this.
-
divide
public Tuple divide(Tuple a)
Compute this ÷ a.- Specified by:
divide
in interfaceFieldElement<Tuple>
- Parameters:
a
- element to divide by- Returns:
- a new element representing this ÷ a
-
reciprocal
public Tuple reciprocal()
Returns the multiplicative inverse ofthis
element.- Specified by:
reciprocal
in interfaceFieldElement<Tuple>
- Specified by:
reciprocal
in interfaceRealFieldElement<Tuple>
- Returns:
- the inverse of
this
.
-
getReal
public double getReal()
Get the real value of the number.- Specified by:
getReal
in interfaceRealFieldElement<Tuple>
- Returns:
- real value
-
add
public Tuple add(double a)
'+' operator.- Specified by:
add
in interfaceRealFieldElement<Tuple>
- Parameters:
a
- right hand side parameter of the operator- Returns:
- this+a
-
subtract
public Tuple subtract(double a)
'-' operator.- Specified by:
subtract
in interfaceRealFieldElement<Tuple>
- Parameters:
a
- right hand side parameter of the operator- Returns:
- this-a
-
multiply
public Tuple multiply(double a)
'×' operator.- Specified by:
multiply
in interfaceRealFieldElement<Tuple>
- Parameters:
a
- right hand side parameter of the operator- Returns:
- this×a
-
divide
public Tuple divide(double a)
'÷' operator.- Specified by:
divide
in interfaceRealFieldElement<Tuple>
- Parameters:
a
- right hand side parameter of the operator- Returns:
- this÷a
-
remainder
public Tuple remainder(double a)
IEEE remainder operator.- Specified by:
remainder
in interfaceRealFieldElement<Tuple>
- Parameters:
a
- right hand side parameter of the operator- Returns:
- this - n × a where n is the closest integer to this/a (the even integer is chosen for n if this/a is halfway between two integers)
-
remainder
public Tuple remainder(Tuple a)
IEEE remainder operator.- Specified by:
remainder
in interfaceRealFieldElement<Tuple>
- Parameters:
a
- right hand side parameter of the operator- Returns:
- this - n × a where n is the closest integer to this/a (the even integer is chosen for n if this/a is halfway between two integers)
-
abs
public Tuple abs()
absolute value.- Specified by:
abs
in interfaceRealFieldElement<Tuple>
- Returns:
- abs(this)
-
ceil
public Tuple ceil()
Get the smallest whole number larger than instance.- Specified by:
ceil
in interfaceRealFieldElement<Tuple>
- Returns:
- ceil(this)
-
floor
public Tuple floor()
Get the largest whole number smaller than instance.- Specified by:
floor
in interfaceRealFieldElement<Tuple>
- Returns:
- floor(this)
-
rint
public Tuple 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 interfaceRealFieldElement<Tuple>
- Returns:
- a double number r such that r is an integer r - 0.5 ≤ this ≤ r + 0.5
-
round
public long round()
Get the closest long to instance value.- Specified by:
round
in interfaceRealFieldElement<Tuple>
- Returns:
- closest long to
RealFieldElement.getReal()
-
signum
public Tuple signum()
Compute the signum of the instance. The signum is -1 for negative numbers, +1 for positive numbers and 0 otherwise- Specified by:
signum
in interfaceRealFieldElement<Tuple>
- Returns:
- -1.0, -0.0, +0.0, +1.0 or NaN depending on sign of a
-
copySign
public Tuple copySign(Tuple sign)
Returns the instance with the sign of the argument. A NaNsign
argument is treated as positive.- Specified by:
copySign
in interfaceRealFieldElement<Tuple>
- Parameters:
sign
- the sign for the returned value- Returns:
- the instance with the same sign as the
sign
argument
-
copySign
public Tuple copySign(double sign)
Returns the instance with the sign of the argument. A NaNsign
argument is treated as positive.- Specified by:
copySign
in interfaceRealFieldElement<Tuple>
- Parameters:
sign
- the sign for the returned value- Returns:
- the instance with the same sign as the
sign
argument
-
scalb
public Tuple scalb(int n)
Multiply the instance by a power of 2.- Specified by:
scalb
in interfaceRealFieldElement<Tuple>
- Parameters:
n
- power of 2- Returns:
- this × 2n
-
hypot
public Tuple hypot(Tuple y)
Returns the hypotenuse of a triangle with sidesthis
andy
- 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 interfaceRealFieldElement<Tuple>
- Parameters:
y
- a value- Returns:
- sqrt(this2 +y2)
-
sqrt
public Tuple sqrt()
Square root.- Specified by:
sqrt
in interfaceRealFieldElement<Tuple>
- Returns:
- square root of the instance
-
cbrt
public Tuple cbrt()
Cubic root.- Specified by:
cbrt
in interfaceRealFieldElement<Tuple>
- Returns:
- cubic root of the instance
-
rootN
public Tuple rootN(int n)
Nth root.- Specified by:
rootN
in interfaceRealFieldElement<Tuple>
- Parameters:
n
- order of the root- Returns:
- nth root of the instance
-
pow
public Tuple pow(double p)
Power operation.- Specified by:
pow
in interfaceRealFieldElement<Tuple>
- Parameters:
p
- power to apply- Returns:
- thisp
-
pow
public Tuple pow(int n)
Integer power operation.- Specified by:
pow
in interfaceRealFieldElement<Tuple>
- Parameters:
n
- power to apply- Returns:
- thisn
-
pow
public Tuple pow(Tuple e)
Power operation.- Specified by:
pow
in interfaceRealFieldElement<Tuple>
- Parameters:
e
- exponent- Returns:
- thise
-
exp
public Tuple exp()
Exponential.- Specified by:
exp
in interfaceRealFieldElement<Tuple>
- Returns:
- exponential of the instance
-
expm1
public Tuple expm1()
Exponential minus 1.- Specified by:
expm1
in interfaceRealFieldElement<Tuple>
- Returns:
- exponential minus one of the instance
-
log
public Tuple log()
Natural logarithm.- Specified by:
log
in interfaceRealFieldElement<Tuple>
- Returns:
- logarithm of the instance
-
log1p
public Tuple log1p()
Shifted natural logarithm.- Specified by:
log1p
in interfaceRealFieldElement<Tuple>
- Returns:
- logarithm of one plus the instance
-
log10
public Tuple log10()
Base 10 logarithm.- Specified by:
log10
in interfaceRealFieldElement<Tuple>
- Returns:
- base 10 logarithm of the instance
-
cos
public Tuple cos()
Cosine operation.- Specified by:
cos
in interfaceRealFieldElement<Tuple>
- Returns:
- cos(this)
-
sin
public Tuple sin()
Sine operation.- Specified by:
sin
in interfaceRealFieldElement<Tuple>
- Returns:
- sin(this)
-
sinCos
public FieldSinCos<Tuple> sinCos()
Combined Sine and Cosine operation.- Specified by:
sinCos
in interfaceRealFieldElement<Tuple>
- Returns:
- [sin(this), cos(this)]
-
tan
public Tuple tan()
Tangent operation.- Specified by:
tan
in interfaceRealFieldElement<Tuple>
- Returns:
- tan(this)
-
acos
public Tuple acos()
Arc cosine operation.- Specified by:
acos
in interfaceRealFieldElement<Tuple>
- Returns:
- acos(this)
-
asin
public Tuple asin()
Arc sine operation.- Specified by:
asin
in interfaceRealFieldElement<Tuple>
- Returns:
- asin(this)
-
atan
public Tuple atan()
Arc tangent operation.- Specified by:
atan
in interfaceRealFieldElement<Tuple>
- Returns:
- atan(this)
-
atan2
public Tuple atan2(Tuple x)
Two arguments arc tangent operation.- Specified by:
atan2
in interfaceRealFieldElement<Tuple>
- Parameters:
x
- second argument of the arc tangent- Returns:
- atan2(this, x)
-
cosh
public Tuple cosh()
Hyperbolic cosine operation.- Specified by:
cosh
in interfaceRealFieldElement<Tuple>
- Returns:
- cosh(this)
-
sinh
public Tuple sinh()
Hyperbolic sine operation.- Specified by:
sinh
in interfaceRealFieldElement<Tuple>
- Returns:
- sinh(this)
-
tanh
public Tuple tanh()
Hyperbolic tangent operation.- Specified by:
tanh
in interfaceRealFieldElement<Tuple>
- Returns:
- tanh(this)
-
acosh
public Tuple acosh()
Inverse hyperbolic cosine operation.- Specified by:
acosh
in interfaceRealFieldElement<Tuple>
- Returns:
- acosh(this)
-
asinh
public Tuple asinh()
Inverse hyperbolic sine operation.- Specified by:
asinh
in interfaceRealFieldElement<Tuple>
- Returns:
- asin(this)
-
atanh
public Tuple atanh()
Inverse hyperbolic tangent operation.- Specified by:
atanh
in interfaceRealFieldElement<Tuple>
- Returns:
- atanh(this)
-
linearCombination
public Tuple linearCombination(Tuple[] a, Tuple[] b) throws MathIllegalArgumentException
Compute a linear combination.- Specified by:
linearCombination
in interfaceRealFieldElement<Tuple>
- Parameters:
a
- Factors.b
- Factors.- Returns:
Σi ai bi
.- Throws:
MathIllegalArgumentException
- if arrays dimensions don't match
-
linearCombination
public Tuple linearCombination(double[] a, Tuple[] b) throws MathIllegalArgumentException
Compute a linear combination.- Specified by:
linearCombination
in interfaceRealFieldElement<Tuple>
- Parameters:
a
- Factors.b
- Factors.- Returns:
Σi ai bi
.- Throws:
MathIllegalArgumentException
- if arrays dimensions don't match
-
linearCombination
public Tuple linearCombination(Tuple a1, Tuple b1, Tuple a2, Tuple b2)
Compute a linear combination.- Specified by:
linearCombination
in interfaceRealFieldElement<Tuple>
- Parameters:
a1
- first factor of the first termb1
- second factor of the first terma2
- first factor of the second termb2
- second factor of the second term- Returns:
- a1×b1 + a2×b2
- See Also:
RealFieldElement.linearCombination(Object, Object, Object, Object, Object, Object)
,RealFieldElement.linearCombination(Object, Object, Object, Object, Object, Object, Object, Object)
-
linearCombination
public Tuple linearCombination(double a1, Tuple b1, double a2, Tuple b2)
Compute a linear combination.- Specified by:
linearCombination
in interfaceRealFieldElement<Tuple>
- Parameters:
a1
- first factor of the first termb1
- second factor of the first terma2
- first factor of the second termb2
- second factor of the second term- Returns:
- a1×b1 + a2×b2
- See Also:
RealFieldElement.linearCombination(double, Object, double, Object, double, Object)
,RealFieldElement.linearCombination(double, Object, double, Object, double, Object, double, Object)
-
linearCombination
public Tuple linearCombination(Tuple a1, Tuple b1, Tuple a2, Tuple b2, Tuple a3, Tuple b3)
Compute a linear combination.- Specified by:
linearCombination
in interfaceRealFieldElement<Tuple>
- Parameters:
a1
- first factor of the first termb1
- second factor of the first terma2
- first factor of the second termb2
- second factor of the second terma3
- first factor of the third termb3
- second factor of the third term- Returns:
- a1×b1 + a2×b2 + a3×b3
- See Also:
RealFieldElement.linearCombination(Object, Object, Object, Object)
,RealFieldElement.linearCombination(Object, Object, Object, Object, Object, Object, Object, Object)
-
linearCombination
public Tuple linearCombination(double a1, Tuple b1, double a2, Tuple b2, double a3, Tuple b3)
Compute a linear combination.- Specified by:
linearCombination
in interfaceRealFieldElement<Tuple>
- Parameters:
a1
- first factor of the first termb1
- second factor of the first terma2
- first factor of the second termb2
- second factor of the second terma3
- first factor of the third termb3
- second factor of the third term- Returns:
- a1×b1 + a2×b2 + a3×b3
- See Also:
RealFieldElement.linearCombination(double, Object, double, Object)
,RealFieldElement.linearCombination(double, Object, double, Object, double, Object, double, Object)
-
linearCombination
public Tuple linearCombination(Tuple a1, Tuple b1, Tuple a2, Tuple b2, Tuple a3, Tuple b3, Tuple a4, Tuple b4)
Compute a linear combination.- Specified by:
linearCombination
in interfaceRealFieldElement<Tuple>
- Parameters:
a1
- first factor of the first termb1
- second factor of the first terma2
- first factor of the second termb2
- second factor of the second terma3
- first factor of the third termb3
- second factor of the third terma4
- first factor of the fourth termb4
- second factor of the fourth term- Returns:
- a1×b1 + a2×b2 + a3×b3 + a4×b4
- See Also:
RealFieldElement.linearCombination(Object, Object, Object, Object)
,RealFieldElement.linearCombination(Object, Object, Object, Object, Object, Object)
-
linearCombination
public Tuple linearCombination(double a1, Tuple b1, double a2, Tuple b2, double a3, Tuple b3, double a4, Tuple b4)
Compute a linear combination.- Specified by:
linearCombination
in interfaceRealFieldElement<Tuple>
- Parameters:
a1
- first factor of the first termb1
- second factor of the first terma2
- first factor of the second termb2
- second factor of the second terma3
- first factor of the third termb3
- second factor of the third terma4
- first factor of the fourth termb4
- second factor of the fourth term- Returns:
- a1×b1 + a2×b2 + a3×b3 + a4×b4
- See Also:
RealFieldElement.linearCombination(double, Object, double, Object)
,RealFieldElement.linearCombination(double, Object, double, Object, double, Object)
-
-