Package org.ojalgo.function.polynomial
Class AbstractPolynomial<N extends java.lang.Comparable<N>,P extends AbstractPolynomial<N,P>>
- java.lang.Object
-
- org.ojalgo.function.polynomial.AbstractPolynomial<N,P>
-
- All Implemented Interfaces:
java.util.function.DoubleUnaryOperator
,java.util.function.Function<N,N>
,java.util.function.UnaryOperator<N>
,Group
,Group.Additive<PolynomialFunction<N>>
,Operation
,Operation.Addition<PolynomialFunction<N>>
,Operation.Multiplication<PolynomialFunction<N>>
,Ring<PolynomialFunction<N>>
,BasicFunction
,BasicFunction.Differentiable<N,PolynomialFunction<N>>
,BasicFunction.Integratable<N,PolynomialFunction<N>>
,PolynomialFunction<N>
,UnaryFunction<N>
,Access1D<N>
,Mutate1D
,Structure1D
- Direct Known Subclasses:
PolynomialR032
,PolynomialR064
,PolynomialR256
,ScalarPolynomial
abstract class AbstractPolynomial<N extends java.lang.Comparable<N>,P extends AbstractPolynomial<N,P>> extends java.lang.Object implements PolynomialFunction<N>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.ojalgo.structure.Access1D
Access1D.Aggregatable<N extends java.lang.Comparable<N>>, Access1D.Collectable<N extends java.lang.Comparable<N>,R extends Mutate1D>, Access1D.ElementView<N extends java.lang.Comparable<N>>, Access1D.SelectionView<N extends java.lang.Comparable<N>>, Access1D.Sliceable<N extends java.lang.Comparable<N>>, Access1D.Visitable<N extends java.lang.Comparable<N>>
-
Nested classes/interfaces inherited from interface org.ojalgo.function.BasicFunction
BasicFunction.Differentiable<N extends java.lang.Comparable<N>,F extends BasicFunction>, BasicFunction.Integratable<N extends java.lang.Comparable<N>,F extends BasicFunction>, BasicFunction.PlainUnary<T,R>
-
Nested classes/interfaces inherited from interface org.ojalgo.algebra.Group
Group.Additive<T>, Group.Multiplicative<T>
-
Nested classes/interfaces inherited from interface org.ojalgo.structure.Mutate1D
Mutate1D.Fillable<N extends java.lang.Comparable<N>>, Mutate1D.Mixable<N extends java.lang.Comparable<N>>, Mutate1D.Modifiable<N extends java.lang.Comparable<N>>, Mutate1D.ModifiableReceiver<N extends java.lang.Comparable<N>>, Mutate1D.Receiver<N extends java.lang.Comparable<N>>, Mutate1D.Sortable
-
Nested classes/interfaces inherited from interface org.ojalgo.algebra.Operation
Operation.Addition<T>, Operation.Division<T>, Operation.Multiplication<T>, Operation.Subtraction<T>
-
Nested classes/interfaces inherited from interface org.ojalgo.structure.Structure1D
Structure1D.BasicMapper<T>, Structure1D.IndexMapper<T>, Structure1D.IntIndex, Structure1D.Logical<S extends Structure1D,B extends Structure1D.Logical<S,B>>, Structure1D.LongIndex, Structure1D.LoopCallback
-
-
Field Summary
Fields Modifier and Type Field Description static NumberContext
DEGREE_ACCURACY
private BasicArray<N>
myCoefficients
private P
myDerivative
private P
myPrimitive
-
Constructor Summary
Constructors Constructor Description AbstractPolynomial(BasicArray<N> coefficients)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description P
add(PolynomialFunction<N> addend)
P
buildDerivative()
P
buildPrimitive()
(package private) BasicArray<N>
coefficients()
long
count()
The total number of elements in this structure.int
degree(NumberContext accuracy)
The largest exponent/power of the non-zero (to the given accuracy) coefficients.double
doubleValue(int power)
boolean
equals(java.lang.Object obj)
void
estimate(java.util.List<? extends N> x, java.util.List<? extends N> y)
void
estimate(NumberSeries<?> samples)
(package private) void
estimate(Access1D<?> x, Access1D<?> y, PhysicalStore.Factory<N,?> store, QR.Factory<N> qr)
N
get(long power)
protected abstract N
getDerivativeFactor(int power)
protected abstract N
getPrimitiveFactor(int power)
int
hashCode()
double
invoke(double arg)
float
invoke(float arg)
abstract P
multiply(PolynomialFunction<N> multiplicand)
protected abstract P
newInstance(int size)
(package private) double
norm(int power)
(package private) abstract P
one()
P
power(int power)
Multiply by itselfpower
times.void
set(int power, double coefficient)
void
set(int power, N coefficient)
void
set(long power, java.lang.Comparable<?> value)
void
set(Access1D<?> coefficients)
int
size()
The total number of elements in this structure.java.lang.String
toString()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.ojalgo.structure.Access1D
asCollectable1D, asKeyed1D, axpy, byteValue, byteValue, dot, doubleValue, elements, floatValue, floatValue, intValue, intValue, longValue, longValue, nonzeros, select, shortValue, shortValue, supplyTo, toRawCopy1D
-
Methods inherited from interface org.ojalgo.function.BasicFunction.Integratable
integrate
-
Methods inherited from interface org.ojalgo.algebra.Group.Additive
negate
-
Methods inherited from interface org.ojalgo.structure.Mutate1D
reset, set, set, set, set, set, set, set, set, set, set, set
-
Methods inherited from interface org.ojalgo.function.polynomial.PolynomialFunction
degree, estimate
-
Methods inherited from interface org.ojalgo.function.UnaryFunction
andThen, apply, applyAsDouble, compose, invoke, invoke, invoke, invoke, invoke
-
-
-
-
Field Detail
-
DEGREE_ACCURACY
public static final NumberContext DEGREE_ACCURACY
-
myCoefficients
private final BasicArray<N extends java.lang.Comparable<N>> myCoefficients
-
myDerivative
private transient P extends AbstractPolynomial<N,P> myDerivative
-
myPrimitive
private transient P extends AbstractPolynomial<N,P> myPrimitive
-
-
Constructor Detail
-
AbstractPolynomial
AbstractPolynomial(BasicArray<N> coefficients)
-
-
Method Detail
-
add
public P add(PolynomialFunction<N> addend)
- Specified by:
add
in interfaceOperation.Addition<N extends java.lang.Comparable<N>>
- Parameters:
addend
- What to add- Returns:
this + addend
-
buildDerivative
public P buildDerivative()
- Specified by:
buildDerivative
in interfaceBasicFunction.Differentiable<N extends java.lang.Comparable<N>,P extends AbstractPolynomial<N,P>>
-
buildPrimitive
public P buildPrimitive()
- Specified by:
buildPrimitive
in interfaceBasicFunction.Integratable<N extends java.lang.Comparable<N>,P extends AbstractPolynomial<N,P>>
-
count
public long count()
Description copied from interface:Structure1D
The total number of elements in this structure.You only need to implement this method if the structure can contain more than Integer.MAX_VALUE elements.
- Specified by:
count
in interfaceStructure1D
-
degree
public int degree(NumberContext accuracy)
Description copied from interface:PolynomialFunction
The largest exponent/power of the non-zero (to the given accuracy) coefficients.- Specified by:
degree
in interfacePolynomialFunction<N extends java.lang.Comparable<N>>
-
doubleValue
public double doubleValue(int power)
- Specified by:
doubleValue
in interfaceAccess1D<N extends java.lang.Comparable<N>>
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
estimate
public void estimate(java.util.List<? extends N> x, java.util.List<? extends N> y)
- Specified by:
estimate
in interfacePolynomialFunction<N extends java.lang.Comparable<N>>
-
estimate
public void estimate(NumberSeries<?> samples)
- Specified by:
estimate
in interfacePolynomialFunction<N extends java.lang.Comparable<N>>
-
get
public N get(long power)
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
invoke
public double invoke(double arg)
- Specified by:
invoke
in interfaceUnaryFunction<N extends java.lang.Comparable<N>>
-
invoke
public float invoke(float arg)
- Specified by:
invoke
in interfaceUnaryFunction<N extends java.lang.Comparable<N>>
-
multiply
public abstract P multiply(PolynomialFunction<N> multiplicand)
- Specified by:
multiply
in interfaceOperation.Multiplication<N extends java.lang.Comparable<N>>
- Parameters:
multiplicand
- The multiplicand- Returns:
this * multiplicand
.
-
power
public final P power(int power)
Description copied from interface:Operation.Multiplication
Multiply by itselfpower
times.- Specified by:
power
in interfaceOperation.Multiplication<N extends java.lang.Comparable<N>>
-
set
public final void set(Access1D<?> coefficients)
- Specified by:
set
in interfacePolynomialFunction<N extends java.lang.Comparable<N>>
-
set
public void set(int power, N coefficient)
- Specified by:
set
in interfacePolynomialFunction<N extends java.lang.Comparable<N>>
-
set
public final void set(long power, java.lang.Comparable<?> value)
-
size
public int size()
Description copied from interface:Structure1D
The total number of elements in this structure.- Specified by:
size
in interfaceStructure1D
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getDerivativeFactor
protected abstract N getDerivativeFactor(int power)
-
getPrimitiveFactor
protected abstract N getPrimitiveFactor(int power)
-
newInstance
protected abstract P newInstance(int size)
-
coefficients
BasicArray<N> coefficients()
-
estimate
void estimate(Access1D<?> x, Access1D<?> y, PhysicalStore.Factory<N,?> store, QR.Factory<N> qr)
-
norm
double norm(int power)
-
one
abstract P one()
-
-