Package org.robwork.sdurw_math
Class PolynomialNDEigenVector3dDouble
- java.lang.Object
-
- org.robwork.sdurw_math.PolynomialNDEigenVector3dDouble
-
public class PolynomialNDEigenVector3dDouble extends java.lang.ObjectRepresentation of a polynomial that can have non-scalar coefficients (polynomial
matrix).
Representation of a polynomial of the following form:
f(x) = C_n x^n + C_(n-1) x^(n-1) + C_2 x^2 + C_1 x + C_0
The polynomial is represented as a list of coefficients ordered from lowest-order term to
highest-order term, {c_0,c_1,...,c_n}.
-
-
Constructor Summary
Constructors Constructor Description PolynomialNDEigenVector3dDouble(long order)Create polynomial with uninitialized coefficients.PolynomialNDEigenVector3dDouble(long cPtr, boolean cMemoryOwn)PolynomialNDEigenVector3dDouble(PolynomialNDEigenVector3dDouble p)Create polynomial from other polynomial.PolynomialNDEigenVector3dDouble(VectorEigenVector3d coefficients)Create polynomial from vector.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description PolynomialNDEigenVector3dDoubleadd(PolynomialNDEigenVector3dDouble b)Polynomial addition.PolynomialNDEigenVector3dDoubleaddAssign(PolynomialNDEigenVector3dDouble b)Polynomial addition.voidassign(PolynomialNDEigenVector3dDouble b)Assignment.PolynomialNDEigenVector3dDoubledeflate(double x)Perform deflation of polynomial.voiddelete()PolynomialNDEigenVector3dDoublederivative()Get the derivative polynomial.
PolynomialNDEigenVector3dDoublederivative(long n)Get the derivative polynomial.PolynomialNDEigenVector3dDoubledevideAssign(double s)Scalar divisionPolynomialNDEigenVector3dDoubledivide(double s)Scalar divisionbooleanequals(PolynomialNDEigenVector3dDouble b)Check if polynomials are equal.EigenVector3devaluate(double x)Evaluate the polynomial using Horner's Method.VectorEigenVector3devaluateDerivatives(double x)Evaluate the first n derivatives of the polynomial using Horner's Method.VectorEigenVector3devaluateDerivatives(double x, long n)Evaluate the first n derivatives of the polynomial using Horner's Method.EigenVector3dget(long i)static longgetCPtr(PolynomialNDEigenVector3dDouble obj)voidincreaseOrder()voidincreaseOrder(long increase)voidincreaseOrder(long increase, EigenVector3d value)Increase the order of this polynomial.PolynomialNDEigenVector3dDoublemultiply(double s)Scalar multiplicationPolynomialNDEigenVector3dDoublemultiplyAssign(double s)Scalar multiplicationPolynomialNDEigenVector3dDoublenegate()Negate coefficients.longorder()Get the order of the polynomial (the highest power).voidset(long i, EigenVector3d d)PolynomialNDEigenVector3dDoublesubtract(PolynomialNDEigenVector3dDouble b)Polynomial subtraction.PolynomialNDEigenVector3dDoublesubtractAssign(PolynomialNDEigenVector3dDouble b)Polynomial subtraction.java.lang.StringtoString()
-
-
-
Constructor Detail
-
PolynomialNDEigenVector3dDouble
public PolynomialNDEigenVector3dDouble(long cPtr, boolean cMemoryOwn)
-
PolynomialNDEigenVector3dDouble
public PolynomialNDEigenVector3dDouble(long order)
Create polynomial with uninitialized coefficients.- Parameters:
order- [in] the order of the polynomial.
-
PolynomialNDEigenVector3dDouble
public PolynomialNDEigenVector3dDouble(VectorEigenVector3d coefficients)
Create polynomial from vector.- Parameters:
coefficients- [in] the coefficients ordered from lowest-order term to highest-order
term.
-
PolynomialNDEigenVector3dDouble
public PolynomialNDEigenVector3dDouble(PolynomialNDEigenVector3dDouble p)
Create polynomial from other polynomial.- Parameters:
p- [in] the polynomial to copy.
-
-
Method Detail
-
getCPtr
public static long getCPtr(PolynomialNDEigenVector3dDouble obj)
-
delete
public void delete()
-
order
public long order()
Get the order of the polynomial (the highest power).- Returns:
- the order.
-
increaseOrder
public void increaseOrder(long increase, EigenVector3d value)Increase the order of this polynomial.- Parameters:
increase- [in] how much to increase the order (default is 1).value- [in] initialize new coefficients to this value.
-
increaseOrder
public void increaseOrder(long increase)
-
increaseOrder
public void increaseOrder()
-
evaluate
public EigenVector3d evaluate(double x)
Evaluate the polynomial using Horner's Method.- Parameters:
x- [in] the input parameter.- Returns:
- the value f(x).
-
evaluateDerivatives
public VectorEigenVector3d evaluateDerivatives(double x, long n)
Evaluate the first n derivatives of the polynomial using Horner's Method.- Parameters:
x- [in] the input parameter.n- [in] the number of derivatives to find (default is the first derivative only)- Returns:
- a vector of values {f(x),\dot{f}(x),\ddot{f}(x),\cdots}.
-
evaluateDerivatives
public VectorEigenVector3d evaluateDerivatives(double x)
Evaluate the first n derivatives of the polynomial using Horner's Method.- Parameters:
x- [in] the input parameter.
- Returns:
- a vector of values {f(x),\dot{f}(x),\ddot{f}(x),\cdots}.
-
deflate
public PolynomialNDEigenVector3dDouble deflate(double x)
Perform deflation of polynomial.- Parameters:
x- [in] a root of the polynomial.- Returns:
- a new polynomial of same order minus one.
Note: There is no check that the given root is in fact a root of the polynomial.
-
derivative
public PolynomialNDEigenVector3dDouble derivative(long n)
Get the derivative polynomial.- Parameters:
n- [in] gives the n'th derivative (default is n=1).- Returns:
- a new polynomial of same order minus one.
Note: To evaluate derivatives use the evaluate derivative method which is more precise.
-
derivative
public PolynomialNDEigenVector3dDouble derivative()
Get the derivative polynomial.
- Returns:
- a new polynomial of same order minus one.
Note: To evaluate derivatives use the evaluate derivative method which is more precise.
-
get
public EigenVector3d get(long i)
-
set
public void set(long i, EigenVector3d d)
-
multiply
public PolynomialNDEigenVector3dDouble multiply(double s)
Scalar multiplication- Parameters:
s- [in] scalar to multiply with.- Returns:
- new polynomial after multiplication.
-
divide
public PolynomialNDEigenVector3dDouble divide(double s)
Scalar division- Parameters:
s- [in] scalar to divide with.- Returns:
- new polynomial after division.
-
multiplyAssign
public PolynomialNDEigenVector3dDouble multiplyAssign(double s)
Scalar multiplication- Parameters:
s- [in] the scalar to multiply with.- Returns:
- reference to same polynomial with changed coefficients.
-
devideAssign
public PolynomialNDEigenVector3dDouble devideAssign(double s)
Scalar division- Parameters:
s- [in] the scalar to divide with.- Returns:
- reference to same polynomial with changed coefficients.
-
subtract
public PolynomialNDEigenVector3dDouble subtract(PolynomialNDEigenVector3dDouble b)
Polynomial subtraction.- Parameters:
b- [in] polynomial of to subtract.- Returns:
- new polynomial after subtraction.
-
subtractAssign
public PolynomialNDEigenVector3dDouble subtractAssign(PolynomialNDEigenVector3dDouble b)
Polynomial subtraction.- Parameters:
b- [in] polynomial to subtract.- Returns:
- same polynomial with different coefficients after subtraction.
-
add
public PolynomialNDEigenVector3dDouble add(PolynomialNDEigenVector3dDouble b)
Polynomial addition.- Parameters:
b- [in] polynomial to add.- Returns:
- new polynomial after addition.
-
addAssign
public PolynomialNDEigenVector3dDouble addAssign(PolynomialNDEigenVector3dDouble b)
Polynomial addition.- Parameters:
b- [in] polynomial to add.- Returns:
- same polynomial with different coefficients after addition.
-
assign
public void assign(PolynomialNDEigenVector3dDouble b)
Assignment.- Parameters:
b- [in] the polynomial to take coefficients from.
-
negate
public PolynomialNDEigenVector3dDouble negate()
Negate coefficients.- Returns:
- new polynomial with coefficients negated.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(PolynomialNDEigenVector3dDouble b)
Check if polynomials are equal.- Parameters:
b- [in] the polynomial to compare with.- Returns:
- true if equal, false if not.
-
-