public abstract class DifferentiableOperation
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
ADDITION_PRECEDENCE
precedence at addition level
|
static int |
POWER_PRECEDENCE
precedence at power level
|
static int |
PRODUCT_PRECEDENCE
precedence at product level
|
static int |
QUOTIENT_PRECEDENCE
precedence at quotient level
|
static int |
SUBTRACTION_PRECEDENCE
precedence at subtraction level
|
static int |
SYMBOL_PRECEDENCE
precedence at symbol level
|
Constructor and Description |
---|
DifferentiableOperation() |
Modifier and Type | Method and Description |
---|---|
DifferentiableOperation |
abs()
get the absolute value of this operation
|
DifferentiableOperation |
acos()
get the arc cosine value of this operation
|
DifferentiableOperation |
asin()
get the arc sine value of this operation
|
DifferentiableOperation |
atan()
get the arc tangent value of this operation
|
protected abstract DifferentiableOperation |
copySubstituting(java.util.Map<DifferentiableOperation,DifferentiableOperation> substitutions)
Construct a copy this operation substituting the operations given in the map.
|
protected DifferentiableOperation |
copySubstitutingWithCache(java.util.Map<DifferentiableOperation,DifferentiableOperation> substitutions)
Construct a copy of this operation substituting the operations given in the map.
|
DifferentiableOperation |
copyWithSubstitutions(java.util.Map<DifferentiableVariable,DifferentiableOperation> userSubstitutions)
Construct a copy this operation substituting the operations given in the map.
|
DifferentiableOperation |
cos()
get the cosine value of this operation
|
DifferentiableOperation |
cosh()
get the hyperbolic cosine value of this operation
|
double |
evaluate()
Evaluate the operation with the default variable values
|
double |
evaluate(DifferentiableVariableValues valueMap)
Evaluate the operation for the specified variable values using the default value if this variable is not specified in the map
|
protected abstract double |
evaluate(DifferentiableVariableValues valueMap,
java.util.Map<DifferentiableOperation,java.lang.Double> cache)
Evaluate the operation for the specified variable values using the default value if this variable is not specified in the map
|
protected double |
evaluateWithCache(DifferentiableVariableValues valueMap,
java.util.Map<DifferentiableOperation,java.lang.Double> cache)
Evaluate the operation for the specified variable values using the default value if this variable is not specified in the map
|
DifferentiableOperation |
exp()
get the exponential of this operation
|
static DifferentiableOperation |
getConstant(double value)
get a constant operation representing the specified constant value
|
abstract DifferentiableOperation |
getDerivative(DifferentiableVariable variable)
Get the derivative with respect to the specified variable
|
protected abstract int |
getPrecedence()
get the operation precedence
|
static DifferentiableVariable |
getVariable(java.lang.String name,
double defaultValue)
get an operation representing the variable
|
boolean |
isEqualTo(DifferentiableOperation operation)
Test whether this operation is equal to or equivalent to the specified operation.
|
protected abstract boolean |
isEquivalentTo(DifferentiableOperation operation)
Test whether this operation is equivalent to the specified operation when the two operations are different instances.
|
DifferentiableOperation |
log()
get the natural logarithm of this operation
|
DifferentiableOperation |
minus(xal.tools.math.differential.DifferentiableNegation subtrahend)
subtract the subtrahend from this operation returning the new operation
|
DifferentiableOperation |
minus(DifferentiableOperation subtrahend)
subtract the subtrahend from this operation returning the new operation
|
DifferentiableOperation |
minus(xal.tools.math.differential.DifferentiableZero subtrahend)
subtract the subtrahend from this operation returning the new operation
|
DifferentiableOperation |
minus(double subtrahend)
subtract the subtrahend from this operation returning the new operation
|
static DifferentiableOperation |
multiply(DifferentiableOperation... multiplicands)
multiply the arguments
|
DifferentiableOperation |
negate()
multiply the operation by negative one
|
DifferentiableOperation |
over(xal.tools.math.differential.DifferentiableDivision divisor)
Divide the operation from this
|
DifferentiableOperation |
over(xal.tools.math.differential.DifferentiableOne divisor)
Divide the operation from this
|
DifferentiableOperation |
over(DifferentiableOperation divisor)
Divide the operation from this
|
DifferentiableOperation |
over(double value)
Divide the operation from this
|
DifferentiableOperation |
plus(xal.tools.math.differential.DifferentiableNegation addend)
add the addend to this operation returning the new operation
|
DifferentiableOperation |
plus(DifferentiableOperation... addends)
add the specified arguments to this
|
DifferentiableOperation |
plus(DifferentiableOperation addend)
add the addend to this operation returning the new operation
|
DifferentiableOperation |
plus(xal.tools.math.differential.DifferentiableZero addend)
add the addend to this operation returning the new operation
|
DifferentiableOperation |
plus(double addend)
add the addend to this operation returning the new operation
|
DifferentiableOperation |
pow(DifferentiableOperation power)
get this operation raised to the specified power
|
DifferentiableOperation |
pow(double power)
get this operation raised to the specified power
|
DifferentiableOperation |
reciprocal()
get the reciprocal of this operation
|
DifferentiableOperation |
sin()
get the sine value of this operation
|
DifferentiableOperation |
sinh()
get the hyperbolic sine value of this operation
|
DifferentiableOperation |
sqrt()
get the square root of this operation
|
static DifferentiableOperation |
sum(DifferentiableOperation... addends)
add the arguments
|
DifferentiableOperation |
tan()
get the tangent value of this operation
|
DifferentiableOperation |
tanh()
get the hyperbolic tangent value of this operation
|
DifferentiableOperation |
times(xal.tools.math.differential.DifferentiableOne multiplicand)
multiply the multiplicand to this operation returning the new operation
|
DifferentiableOperation |
times(DifferentiableOperation... multiplicands)
multiply the arguments
|
DifferentiableOperation |
times(DifferentiableOperation multiplicand)
multiply the multiplicand to this operation returning the new operation
|
DifferentiableOperation |
times(xal.tools.math.differential.DifferentiableZero multiplicand)
multiply the multiplicand to this operation returning the new operation
|
DifferentiableOperation |
times(double value)
multiply the multiplicand to this operation returning the new operation
|
protected java.lang.String |
toString(int parentPrecedence)
Generate the string representation based on the precedence of the parent operation
|
protected java.lang.String |
toString(int parentPrecedence,
boolean closeIfEqualPrecedence)
Generate the string representation based on the precedence of the parent operation
|
public static final int ADDITION_PRECEDENCE
public static final int SUBTRACTION_PRECEDENCE
public static final int PRODUCT_PRECEDENCE
public static final int QUOTIENT_PRECEDENCE
public static final int POWER_PRECEDENCE
public static final int SYMBOL_PRECEDENCE
public static DifferentiableOperation getConstant(double value)
public static DifferentiableVariable getVariable(java.lang.String name, double defaultValue)
public final DifferentiableOperation copyWithSubstitutions(java.util.Map<DifferentiableVariable,DifferentiableOperation> userSubstitutions)
userSubstitutions
- a user supplied map of the new operations keyed by the current operations to be substitutedprotected abstract DifferentiableOperation copySubstituting(java.util.Map<DifferentiableOperation,DifferentiableOperation> substitutions)
substitutions
- map of the new operations keyed by the current operations to be substitutedprotected final DifferentiableOperation copySubstitutingWithCache(java.util.Map<DifferentiableOperation,DifferentiableOperation> substitutions)
substitutions
- map of the new operations keyed by the current operations to be substitutedpublic final double evaluate()
public double evaluate(DifferentiableVariableValues valueMap)
protected abstract int getPrecedence()
protected abstract double evaluate(DifferentiableVariableValues valueMap, java.util.Map<DifferentiableOperation,java.lang.Double> cache)
protected final double evaluateWithCache(DifferentiableVariableValues valueMap, java.util.Map<DifferentiableOperation,java.lang.Double> cache)
public abstract DifferentiableOperation getDerivative(DifferentiableVariable variable)
public static DifferentiableOperation sum(DifferentiableOperation... addends)
public DifferentiableOperation plus(DifferentiableOperation... addends)
public DifferentiableOperation plus(DifferentiableOperation addend)
public DifferentiableOperation plus(double addend)
public DifferentiableOperation plus(xal.tools.math.differential.DifferentiableZero addend)
public DifferentiableOperation plus(xal.tools.math.differential.DifferentiableNegation addend)
public DifferentiableOperation minus(DifferentiableOperation subtrahend)
public DifferentiableOperation minus(double subtrahend)
public DifferentiableOperation minus(xal.tools.math.differential.DifferentiableZero subtrahend)
public DifferentiableOperation minus(xal.tools.math.differential.DifferentiableNegation subtrahend)
public static DifferentiableOperation multiply(DifferentiableOperation... multiplicands)
public DifferentiableOperation times(DifferentiableOperation... multiplicands)
public DifferentiableOperation times(DifferentiableOperation multiplicand)
public DifferentiableOperation times(double value)
public DifferentiableOperation times(xal.tools.math.differential.DifferentiableZero multiplicand)
public DifferentiableOperation times(xal.tools.math.differential.DifferentiableOne multiplicand)
public DifferentiableOperation over(DifferentiableOperation divisor)
public DifferentiableOperation over(double value)
public DifferentiableOperation over(xal.tools.math.differential.DifferentiableOne divisor)
public DifferentiableOperation over(xal.tools.math.differential.DifferentiableDivision divisor)
public DifferentiableOperation negate()
public DifferentiableOperation reciprocal()
public DifferentiableOperation abs()
public DifferentiableOperation pow(double power)
public DifferentiableOperation pow(DifferentiableOperation power)
public DifferentiableOperation sqrt()
public DifferentiableOperation sin()
public DifferentiableOperation cos()
public DifferentiableOperation tan()
public DifferentiableOperation asin()
public DifferentiableOperation acos()
public DifferentiableOperation atan()
public DifferentiableOperation sinh()
public DifferentiableOperation cosh()
public DifferentiableOperation tanh()
public DifferentiableOperation exp()
public DifferentiableOperation log()
protected java.lang.String toString(int parentPrecedence)
protected abstract boolean isEquivalentTo(DifferentiableOperation operation)
public final boolean isEqualTo(DifferentiableOperation operation)
protected java.lang.String toString(int parentPrecedence, boolean closeIfEqualPrecedence)