Class ASTRealVector
- java.lang.Object
-
- org.matheclipse.core.expression.AbstractAST
-
- org.matheclipse.core.expression.ASTRealVector
-
- All Implemented Interfaces:
edu.jas.structure.AbelianGroupElem<IExpr>
,edu.jas.structure.Element<IExpr>
,edu.jas.structure.GcdRingElem<IExpr>
,edu.jas.structure.MonoidElem<IExpr>
,edu.jas.structure.RingElem<IExpr>
,Externalizable
,Serializable
,Cloneable
,Comparable<IExpr>
,Iterable<IExpr>
,RandomAccess
,org.hipparchus.CalculusFieldElement<IExpr>
,org.hipparchus.FieldElement<IExpr>
,IAST
,IASTMutable
,IExpr
,ITensorAccess
public class ASTRealVector extends AbstractAST implements Externalizable, RandomAccess
Immutable (A)bstract (S)yntax (T)ree of a given function with no argument.In Symja, an abstract syntax tree (AST), is a tree representation of the abstract syntactic structure of the Symja source code. Each node of the tree denotes a construct occurring in the source code. The syntax is 'abstract' in the sense that it does not represent every detail that appears in the real syntax. For instance, grouping parentheses are implicit in the tree structure, and a syntactic construct such as a
Sin[x]
expression will be denoted by an AST with 2 nodes. One node for the headerSin
and one node for the argumentx
. Internally an AST is represented as ajava.util.List
which contains- the operator of a function (i.e. the "header"-symbol: Sin, Cos, Inverse, Plus,
Times,...) at index
0
and - the
n
arguments of a function in the index1 to n
- See Also:
AST
, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.matheclipse.core.expression.AbstractAST
AbstractAST.ASTIterator, AbstractAST.NILPointer
-
Nested classes/interfaces inherited from interface org.matheclipse.core.interfaces.IAST
IAST.PROPERTY
-
Nested classes/interfaces inherited from interface org.matheclipse.core.interfaces.IExpr
IExpr.COMPARE_TERNARY
-
-
Field Summary
-
Fields inherited from class org.matheclipse.core.expression.AbstractAST
fEvalFlags, hashValue
-
Fields inherited from interface org.matheclipse.core.interfaces.IAST
BUILT_IN_EVALED, CONTAINS_DEFAULT_PATTERN, CONTAINS_NO_DEFAULT_PATTERN_MASK, CONTAINS_NO_PATTERN, CONTAINS_NUMERIC_ARG, CONTAINS_PATTERN, CONTAINS_PATTERN_EXPR, CONTAINS_PATTERN_SEQUENCE, IS_ALL_EXPANDED, IS_DECOMPOSED_PARTIAL_FRACTION, IS_DERIVATIVE_EVALED, IS_EXPANDED, IS_FLAT_ORDERLESS_EVALED, IS_FLATTENED, IS_FLATTENED_OR_SORTED_MASK, IS_HASH_EVALED, IS_LISTABLE_THREADED, IS_MATRIX, IS_MATRIX_OR_VECTOR, IS_NOT_NUMERIC_FUNCTION, IS_NOT_NUMERIC_FUNCTION_OR_LIST, IS_NUMERIC_FUNCTION, IS_NUMERIC_FUNCTION_OR_LIST, IS_NUMERIC_MASK, IS_SORTED, IS_VECTOR, NO_FLAG, NUMERIC_ARBITRARY_EVALED, NUMERIC_DOUBLE_EVALED, OUTPUT_MULTILINE, SEQUENCE_FLATTENED, TIMES_PARSED_IMPLICIT
-
Fields inherited from interface org.matheclipse.core.interfaces.IExpr
ASTID, BDDEXPRID, BIOSEQUENCEID, BLANKID, BYTEARRAYID, COMPILEFUNCTONID, COMPLEXID, DATAID, DATASETID, DATEOBJECTEXPRID, DISPATCHID, DOUBLECOMPLEXID, DOUBLEID, FILEEXPRID, FITTEDMODELID, FRACTIONID, GEOPOSITIONID, GRAPHEXPRID, IMAGEID, INPUTSTREAMEXPRID, INTEGERID, INTERPOLATEDFUNCTONID, JAVACLASSEXPRID, JAVAOBJECTEXPRID, LINEARSOLVEUNCTONID, METHODSYMBOLID, NUMERICARRAYID, OUTPUTSTREAMEXPRID, PATTERNID, QUANTITYID, SERIESID, SPARSEARRAYID, STRINGID, SYMBOLID, TESTREPORTOBJECT, TESTRESULTOBJECT, TIMEOBJECTEXPRID
-
-
Constructor Summary
Constructors Constructor Description ASTRealVector()
ASTRealVector(double[] vector, boolean deepCopy)
ASTRealVector(org.hipparchus.linear.RealVector vector, boolean deepCopy)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description IExpr
arg1()
Get the first argument (i.e.IExpr
arg2()
Get the second argument (i.e.IExpr
arg3()
Get the third argument (i.e.IExpr
arg4()
Get the fourth argument (i.e.IExpr
arg5()
Get the fifth argument (i.e.int
argSize()
Returns the number of arguments in thisIAST
.Set<IExpr>
asSet()
Collect all arguments of this AST in a new set.ASTRealVector
clone()
Returns a newHMArrayList
with the same elements, the same size and the same capacity as thisHMArrayList
.boolean
contains(Object object)
Tests whether thisList
contains the specified object.ASTRealVector
copy()
Returns a shallow copy of thisIAST
instance (the elements themselves are not copied).IASTAppendable
copyAppendable()
Returns a shallow copy of thisIAST
instance (the elements themselves are not copied).IASTAppendable
copyAppendable(int additionalCapacity)
Returns a shallow copy of thisIAST
instance (the elements themselves are not copied).boolean
equals(Object obj)
IExpr
evalEvaluate(EvalEngine engine)
Evaluate arguments with the headF.Evaluate
, i.e.IExpr
evaluate(EvalEngine engine)
Evaluate an expressionIAST
filter(IASTAppendable filterAST, Predicate<? super IExpr> predicate)
Select all elements by applying thepredicate
to each argument in thisAST
and append the arguments which satisfy the predicate to thefilterAST
.IAST
filter(IASTAppendable filterAST, IASTAppendable restAST, Predicate<? super IExpr> predicate)
Select all elements by applying thepredicate
to each argument in thisAST
and append the elements which satisfy thepredicate
to thefilterAST
, or otherwise append it to therestAST
.IAST
filterFunction(IASTAppendable filterAST, IASTAppendable restAST, Function<IExpr,IExpr> function)
Select all elements by applying thefunction
to each argument in thisAST
and append the result elements for which thefunction
returns nonF.NIL
elements to thefilterAST
, or otherwise append the argument to therestAST
.String
fullFormString()
Return theFullForm()
of this expressionIExpr
get(int location)
Returns the element at the specified location in thisIAST
.double
getEntry(int location)
IAST
getItems(int[] items, int length)
Returnslength
number of elements specified in theitems
position array in thisIAST
.org.hipparchus.linear.RealVector
getRealVector()
int
hashCode()
FNV-1 hash code of thisIAST
.IExpr
head()
If this object is an instance ofIAST
get the first element (offset 0) of theIAST
list (i.e.boolean
isAST0()
Test if this expression is anIAST
function, which contains a header element (i.e.boolean
isAST1()
Test if this expression is anIAST
function, which contains a header element (i.e.boolean
isAST2()
Test if this expression is anIAST
function, which contains a header element (i.e.boolean
isAST3()
Test if this expression is anIAST
function, which contains a header element (i.e.int
isInexactVector()
boolean
isList()
Test if this expression is a list (i.e.boolean
isNaN()
boolean
isNumericAST()
Test if this expression is an IAST and contains at least one numeric argument.boolean
isNumericFunction(boolean allowList)
Test if this expression is a numeric function (i.e.boolean
isNumericMode()
Test if this expression contains a numeric number (i.e.boolean
isRealVector()
Test if this expression is a real vector (i.e.boolean
isSameHead(ISymbol head)
Check if the object at index 0 (i.e.boolean
isSameHead(ISymbol head, int length)
Check if the object at index 0 (i.e.boolean
isSameHead(ISymbol head, int minLength, int maxLength)
Check if the object at index 0 (i.e.boolean
isSameHeadSizeGE(ISymbol head, int length)
Check if the object at index 0 (i.e.int
isVector()
Test if this expression is a vector and return the length of the vector.void
joinToString(StringBuilder builder, CharSequence delimiter)
Append a String composed of the elements of this vector joined together with the specifieddelimiter
.static ASTRealVector
map(IAST astVector, DoubleUnaryOperator function)
Returns a new ASTRealVector where each element is mapped by the given function.void
readExternal(ObjectInput objectInput)
IExpr
set(int location, IExpr object)
Replaces the element at the specified location in thisArrayList
with the specified object.IASTMutable
setAtCopy(int i, IExpr expr)
Create a shallow copy of thisIAST
instance (the elements themselves are not copied) and set theexpr
at the givenposition
.void
setEntry(int location, double value)
int
size()
Returns the number of elements in thisArrayList
.ASTRealVector
subtract(ASTRealVector that)
IExpr[]
toArray()
Returns a new array containing all elements contained in thisArrayList
.org.hipparchus.complex.Complex[]
toComplexVector()
Convert this object into aComplex[]
vector.double[]
toDoubleVector()
Convert this object into adouble[]
vector.org.hipparchus.linear.RealVector
toRealVector()
Convert this object into a RealVector.String
toString()
void
toString(Appendable buf)
void
writeExternal(ObjectOutput objectOutput)
-
Methods inherited from class org.matheclipse.core.expression.AbstractAST
accept, accept, accept, accept, addEvalFlags, appendAtClone, appendClone, apply, apply, apply, asNumerDenom, asPowersDict, asType, clearHashCache, compareAdjacent, compareTo, copyAlloc, copyFrom, copyFrom, copyHead, copyHead, copyUntil, copyUntil, count, depth, determinePrecision, equalsArgs, equalsAt, equalsFromPosition, equalTernary, evalNumber, evalReal, exists, exists, extractConditionalExpression, filter, filter, filter, filterNIL, findFirst, foldLeft, foldRight, forAll, forAll, forAllLeaves, forAllLeaves, forEach, forEach, forEachRule, forEachRule, fullFormString, gcd, get, getArg, getAST, getAt, getEvalFlags, getHashCache, getIndex, getInt, getList, getNumber, getOptionalValue, getPart, getPart, getProperty, getUnevaluated, has, hasTrigonometricFunction, hierarchy, indexOf, indexOf, internalFormString, internalJavaString, internalScalaString, intSlot, isAbs, isAllExpanded, isAlternatives, isAnd, isArcCos, isArcCosh, isArcSin, isArcSinh, isArcTan, isArcTanh, isAST, isAST, isAST, isAST, isAST, isAST, isAST, isASTSizeGE, isAtom, isBooleanFormula, isBooleanFunction, isBooleanResult, isComparatorFunction, isComplexInfinity, isCondition, isConditionalExpression, isConjugate, isContinuousDistribution, isCos, isCosh, isDefer, isDerivative, isDerivativeAST1, isDirectedInfinity, isDirectedInfinity, isDiscreteDistribution, isDistribution, isEdge, isEmpty, isEmptyIntervalData, isEmptyList, isEqual, isEvalFlagOff, isEvalFlagOn, isExcept, isExpanded, isFlatAST, isFree, isFree, isFreeAST, isFreeAST, isFreeAt, isFreeOfPatterns, isFunction, isFunctionID, isGEOrdered, isGTOrdered, isHoldAllCompleteAST, isHoldPatternOrLiteral, isHyperbolicFunction, isInfinity, isIntegerResult, isInterval, isInterval1, isIntervalData, isList, isList, isListableAST, isListOfEdges, isListOfLists, isListOfMatrices, isListOfPoints, isListOfRules, isListOfRulesOrAssociation, isListOfStrings, isLog, isMatrix, isMatrixIgnore, isMember, isModule, isModuleOrWithCondition, isNegative, isNegativeInfinity, isNegativeResult, isNonEmptyList, isNonNegativeResult, isNot, isNotEmpty, isNumericArgument, isNumericFunction, isNumericFunction, isNumericFunction, isOneIdentityAST1, isOptional, isOr, isOrderlessAST, isPatternDefault, isPatternExpr, isPatternMatchingFunction, isPatternTest, isPiecewise, isPlus, isPlus2, isPlus3, isPlusTimesPower, isPolynomial, isPolynomial, isPolynomialOfMaxDegree, isPolynomialOfMaxDegree, isPolynomialStruct, isPositive, isPositiveResult, isPossibleZero, isPower, isPureFunction, isRationalResult, isRealMatrix, isRealResult, isRule, isRuleAST, isRuleDelayed, isSame, isSame, isSequence, isSin, isSinh, isSlot, isSlotSequence, isSpan, isSubscript, isTan, isTanh, isTimes, isTimes2, isTimes3, isTrigFunction, isUnevaluated, isUnit, isValue, isVariable, isWith, iterator, last, lastIndexOf, leafCount, leafCountSimplify, linear, linearPower, lower, makeAST, makeList, map, map, map, map, map, map, mapLeaf, mapLeft, mapMatrixColumns, mapReverse, mapRight, mapThread, mapThread, mapThread, mapThreadEvaled, mapThreadEvaled, negative, normal, oneIdentity, opposite, optional, orElse, partition, partitionPlus, partitionTimes, patternHashCode, prependClone, putProperty, remove, removeAtClone, removeAtCopy, removeIf, removePositionsAtCopy, removePositionsAtCopy, reverse, rewrite, rotateLeft, rotateRight, select, select, setAtClone, setEvalFlags, setPart, signum, sortInplace, splice, stream, stream, timesDistributed, toBooleanMatrix, toBooleanVector, toBooleValueVector, toByteMatrix, toComplexMatrix, toDoubleMatrix, toDoubleMatrixIgnore, toDoubleVectorIgnore, toIntMatrix, toIntVector, topHead, toRealMatrixIgnore, upper, variables2Slots
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.hipparchus.CalculusFieldElement
getExponent, isFinite, isInfinite, norm, round
-
Methods inherited from interface org.matheclipse.core.interfaces.IAST
acceptChecked, containsAll, copyAST, copyTo, copyTo, count, exists, exists, existsLeft, extract, findFirstEquals, first, forAll, forAll, forEach, forEach, forEach, forEach, forEach, forEach, functionEvaled, getRule, getRule, getRule, getValue, hasNumericArgument, hasOptionalArgument, isASTOrAssociation, isNotDefined, isNumberOrInfinity, isRealsIntervalData, joinToString, mapAt, mapLeaf, most, oneIdentity0, oneIdentity1, removeFromEnd, removeFromStart, rest, second, slice, splice, stream0, toArray
-
Methods inherited from interface org.matheclipse.core.interfaces.IASTMutable
setApply, setArgs, setArgs, setIf, setIfPresent, setValue, sortInplace
-
Methods inherited from interface org.matheclipse.core.interfaces.IExpr
$div, $minus, $plus, $times, $up, abs, acos, acosh, add, add, and, apply, apply, asBaseExp, asCoeffAdd, asCoeffAdd, asCoeffAdd, asCoeffExponent, asCoeffmul, asCoeffmul, asCoeffmul, asCoeffmul, asCoeffMul, asCoeffMul, asin, asinh, asLeadingTerm, asLeadingTerm, asLeadingTerm, asLeadingTerm, atan, atan2, atanh, base, cancel, cbrt, ceil, compareToNumerical, complexArg, conjugate, constantArray, copySign, copySign, copySign, cos, cosh, dec, divide, divide, egcd, equalsArgs, equalTo, erf, erfc, eval, eval, evalAsLeadingTerm, evalBinary64, evalComplex, evalDouble, evalf, evalf, evalfc, evalfc, evalNIL, evaluateHead, evaluateOrElse, exp, expm1, exponent, factory, floor, fresnelC, fresnelS, gaussianIntegers, getField, getPi, getReal, greater, greaterEqual, greaterEqualThan, greaterEqualThan, greaterThan, greaterThan, has, has, has, hasComplexNumber, hasFree, headID, hypergeometric0F1, hypergeometric1F1, hypergeometric2F1, hypot, ifPresent, im, inc, indexOf, inverse, isAssociation, isBlank, isBooleanFormulaSymbol, isBuiltInSymbol, isBuiltInSymbolID, isComparatorFunctionSymbol, isComplex, isComplexNumeric, isConstantAttribute, isCoreFunctionSymbol, isDataset, isE, isEvenResult, isExactNumber, isExp, isFactorSqrtExpr, isFalse, isFraction, isFree, isFree, isHoldOrHoldFormOrDefer, isImaginaryUnit, isIndeterminate, isInexactNumber, isInteger, isInvalid, isLEOrdered, isList1, isList2, isList3, isList4, isListOfRules, isListOrAssociation, isLTOrdered, isMachineNumber, isMathematicalIntegerNegative, isMathematicalIntegerNonNegative, isMatrix, isMember, isMinusOne, isNegativeImaginaryUnit, isNegativeSigned, isNIL, isNonZeroComplexResult, isNonZeroRealResult, isNumber, isNumEqualInteger, isNumEqualRational, isNumeric, isNumericArgument, isNumericArray, isNumericFunction, isNumIntValue, isOne, isONE, isOptionsPattern, isPattern, isPatternOptional, isPatternSequence, isPi, isPowerReciprocal, isPredicateFunctionSymbol, isPresent, isQuantity, isRational, isRationalValue, isReal, isRealConstant, isRealNumber, isReNegativeResult, isRepeated, isRePositiveResult, isRGBColor, isSparseArray, isSqrt, isSqrtExpr, isString, isString, isStringIgnoreCase, isSymbol, isSymbolOrPattern, isTrue, isUndefined, isUnequalResult, isVariable, isZero, isZERO, isZeroResult, leadTerm, leadTerm, less, lessEqual, lessEqualThan, lessEqualThan, lessThan, lessThan, linearCombination, linearCombination, linearCombination, linearCombination, linearCombination, linearCombination, linearCombination, linearCombination, log, log10, log1p, mapExpr, minus, mod, multiply, multiply, multiply, multiplyDistributed, negate, newInstance, one, or, orElse, orElseGet, orElseThrow, plus, pow, pow, pow, power, power, re, reciprocal, remainder, remainder, replaceAll, replaceAll, replaceAll, replacePart, replaceRepeated, replaceRepeated, replaceRepeated, rint, rootN, roundExpr, scalb, sign, sin, sinCos, sinh, sinhCosh, sqr, sqrt, subs, subtract, subtract, sum, tan, tanh, times, toDegrees, toDoubleDefault, toDoubleDefault, together, toIntDefault, toIntDefault, toLongDefault, toLongDefault, toMMA, toNumber, toNumber, toRadians, toRealMatrix, toScript, toScriptFactory, toWolframString, trigsimp, ulp, unequalTo, unitStep, zero
-
Methods inherited from interface java.lang.Iterable
spliterator
-
-
-
-
Constructor Detail
-
ASTRealVector
public ASTRealVector()
-
ASTRealVector
public ASTRealVector(double[] vector, boolean deepCopy)
- Parameters:
vector
-deepCopy
- iftrue
allocate new memory and copy all elements from the vector
-
ASTRealVector
public ASTRealVector(org.hipparchus.linear.RealVector vector, boolean deepCopy)
- Parameters:
vector
- the vector which should be wrapped in this object.deepCopy
- iftrue
allocate new memory and copy all elements from the vector
-
-
Method Detail
-
map
public static ASTRealVector map(IAST astVector, DoubleUnaryOperator function)
Returns a new ASTRealVector where each element is mapped by the given function.- Parameters:
astVector
- an AST which could be converted intodouble[]
function
- Function to apply to each entry.- Returns:
- a new vector.
-
arg1
public IExpr arg1()
Get the first argument (i.e. the second element of the underlying list structure) of theAST
function (i.e. get(1) ).
Example: for the AST representing the expressionSin(x)
,arg1()
returnsx
.- Specified by:
arg1
in interfaceIAST
- Returns:
- the first argument of the function represented by this
AST
. - See Also:
IExpr.head()
-
arg2
public IExpr arg2()
Get the second argument (i.e. the third element of the underlying list structure) of theAST
function (i.e. get(2) ).
Example: for the AST representing the expressionx^y
(i.e.Power(x, y)
),arg2()
returnsy
.- Specified by:
arg2
in interfaceIAST
- Returns:
- the second argument of the function represented by this
AST
. - See Also:
IExpr.head()
-
arg3
public IExpr arg3()
Get the third argument (i.e. the fourth element of the underlying list structure) of theAST
function (i.e. get(3) ).
Example: for the AST representing the expressionf(a, b, c)
,arg3()
returnsc
.- Specified by:
arg3
in interfaceIAST
- Returns:
- the third argument of the function represented by this
AST
. - See Also:
IExpr.head()
-
arg4
public IExpr arg4()
Get the fourth argument (i.e. the fifth element of the underlying list structure) of theAST
function (i.e. get(4) ).
Example: for the AST representing the expressionf(a, b ,c, d)
,arg4()
returnsd
.- Specified by:
arg4
in interfaceIAST
- Returns:
- the fourth argument of the function represented by this
AST
. - See Also:
IExpr.head()
-
arg5
public IExpr arg5()
Get the fifth argument (i.e. the sixth element of the underlying list structure) of theAST
function (i.e. get(5) ).
Example: for the AST representing the expressionf(a, b ,c, d, e)
,arg5()
returnse
.- Specified by:
arg5
in interfaceIAST
- Returns:
- the fifth argument of the function represented by this
AST
. - See Also:
IExpr.head()
-
argSize
public int argSize()
Returns the number of arguments in thisIAST
. The number of arguments equalssize() - 1
(i.e. the number of elements minus 1). If this is an atom return size-1
.- Specified by:
argSize
in interfaceIAST
- Specified by:
argSize
in interfaceIExpr
- Returns:
- the number of arguments in this
IAST
. - See Also:
IExpr.size()
-
asSet
public Set<IExpr> asSet()
Description copied from interface:IAST
Collect all arguments of this AST in a new set.- Specified by:
asSet
in interfaceIAST
- Overrides:
asSet
in classAbstractAST
- Returns:
null
if a set couldn't be created
-
clone
public ASTRealVector clone()
Returns a newHMArrayList
with the same elements, the same size and the same capacity as thisHMArrayList
.
-
contains
public boolean contains(Object object)
Tests whether thisList
contains the specified object.- Specified by:
contains
in interfaceIAST
- Overrides:
contains
in classAbstractAST
- Parameters:
object
- the object to search for.- Returns:
true
if object is an element of thisList
,false
otherwise
-
copy
public ASTRealVector copy()
Returns a shallow copy of this
IAST
instance (the elements themselves are not copied). In contrast to theIAST.copyAppendable()
method, this method returns exactly the same type forAST0, AST1, AST2, AST3
and tries to transformAST
objects toAST0, AST1, AST2, AST3
if possible.Because it's not allowed to set the header object (offset 0) to an arbitrary expression after a
copy()
, this method should only be used if the arguments (offset 1..argSize) should be set to new expressions.
-
copyAppendable
public IASTAppendable copyAppendable()
Description copied from interface:IAST
Returns a shallow copy of this
IAST
instance (the elements themselves are not copied). In contrast to theIAST.copy()
method, this method doesn't return exactly the same type for a givenAST0, AST1, AST2, AST3...
object but transforms it into a newAST
object, so that additional arguments could be appended at the end.This also allows to set the header object to an arbitrary expression.
- Specified by:
copyAppendable
in interfaceIAST
- Returns:
- a copy of this
IAST
instance.
-
copyAppendable
public IASTAppendable copyAppendable(int additionalCapacity)
Description copied from interface:IAST
Returns a shallow copy of this
IAST
instance (the elements themselves are not copied). In contrast to theIAST.copy()
method, this method doesn't return exactly the same type for a givenAST0, AST1, AST2, AST3...
object but transforms it into a newAST
object, so that additional arguments could be appended at the end.This also allows to set the header object to an arbitrary expression.
- Specified by:
copyAppendable
in interfaceIAST
- Returns:
- a copy of this
IAST
instance.
-
equals
public boolean equals(Object obj)
- Specified by:
equals
in interfaceedu.jas.structure.Element<IExpr>
- Overrides:
equals
in classAbstractAST
-
evaluate
public IExpr evaluate(EvalEngine engine)
Evaluate an expression- Specified by:
evaluate
in interfaceIExpr
- Overrides:
evaluate
in classAbstractAST
- Parameters:
engine
- the evaluation engine- Returns:
- the evaluated Object or
F.NIL
if the evaluation is not possible (i.e. the evaluation doesn't change the object).
-
evalEvaluate
public IExpr evalEvaluate(EvalEngine engine)
Description copied from class:AbstractAST
Evaluate arguments with the headF.Evaluate
, i.e.f(a, ... , Evaluate(x), ...)
- Overrides:
evalEvaluate
in classAbstractAST
- Parameters:
engine
- the evaluation engine- Returns:
-
filterFunction
public final IAST filterFunction(IASTAppendable filterAST, IASTAppendable restAST, Function<IExpr,IExpr> function)
Select all elements by applying thefunction
to each argument in thisAST
and append the result elements for which thefunction
returns nonF.NIL
elements to thefilterAST
, or otherwise append the argument to therestAST
.- Overrides:
filterFunction
in classAbstractAST
- Parameters:
filterAST
- the nonF.NIL
elements which were returned by thefunction#apply()
methodrestAST
- the arguments in thisAST
for which thefunction#apply()
method returnedF.NIL
function
- the function which filters each argument by returning a value which unequalsF.NIL
- Returns:
- the given
filterAST
-
fullFormString
public final String fullFormString()
Return theFullForm()
of this expression- Specified by:
fullFormString
in interfaceIExpr
- Overrides:
fullFormString
in classAbstractAST
- Returns:
-
filter
public IAST filter(IASTAppendable filterAST, IASTAppendable restAST, Predicate<? super IExpr> predicate)
Select all elements by applying thepredicate
to each argument in thisAST
and append the elements which satisfy thepredicate
to thefilterAST
, or otherwise append it to therestAST
.- Specified by:
filter
in interfaceIAST
- Overrides:
filter
in classAbstractAST
- Parameters:
filterAST
- the elements where thepredicate#apply()
method returnstrue
restAST
- the elements which don't match the predicatepredicate
- the predicate which filters each argument in thisAST
- Returns:
- the
filterAST
-
filter
public IAST filter(IASTAppendable filterAST, Predicate<? super IExpr> predicate)
Select all elements by applying thepredicate
to each argument in thisAST
and append the arguments which satisfy the predicate to thefilterAST
.- Specified by:
filter
in interfaceIAST
- Overrides:
filter
in classAbstractAST
- Parameters:
filterAST
- the elements where thepredicate#apply()
method returnstrue
predicate
- the predicate which filters each argument in thisAST
- Returns:
- the
filterAST
-
get
public IExpr get(int location)
Description copied from interface:IAST
Returns the element at the specified location in thisIAST
. If this is anIAssociation
return the value of the rule at the specified location.- Specified by:
get
in interfaceIAST
- Specified by:
get
in interfaceITensorAccess
- Specified by:
get
in classAbstractAST
- Parameters:
location
- the index of the element to return.- Returns:
- the element at the specified location.
-
getItems
public IAST getItems(int[] items, int length)
Description copied from interface:IAST
Returnslength
number of elements specified in theitems
position array in thisIAST
.
-
getEntry
public double getEntry(int location)
-
getRealVector
public org.hipparchus.linear.RealVector getRealVector()
-
hashCode
public int hashCode()
Description copied from class:AbstractAST
FNV-1 hash code of thisIAST
.- Specified by:
hashCode
in interfaceedu.jas.structure.Element<IExpr>
- Overrides:
hashCode
in classAbstractAST
-
head
public final IExpr head()
Description copied from interface:IExpr
If this object is an instance ofIAST
get the first element (offset 0) of theIAST
list (i.e.#get(0)
). Otherwise return the specific header, i.e. forinteger number type => S.Integer, fraction number type => S.Rational, complex number type => S.Complex, ...
-
isAST0
public boolean isAST0()
Test if this expression is anIAST
function, which contains a header element (i.e. the function name) at index position0
and no argument elements.
Therefore this expression is no atomic expression.- Specified by:
isAST0
in interfaceIExpr
- Overrides:
isAST0
in classAbstractAST
- Returns:
- See Also:
IExpr.isAtom()
-
isAST1
public boolean isAST1()
Test if this expression is anIAST
function, which contains a header element (i.e. the function name) at index position0
and one argument element at the index position1
.
Therefore this expression is no atomic expression.- Specified by:
isAST1
in interfaceIExpr
- Overrides:
isAST1
in classAbstractAST
- Returns:
- See Also:
IExpr.isAtom()
-
isAST2
public boolean isAST2()
Test if this expression is anIAST
function, which contains a header element (i.e. the function name) at index position0
and two argument elements at the index positions1, 2
.
Therefore this expression is no atomic expression.- Specified by:
isAST2
in interfaceIExpr
- Overrides:
isAST2
in classAbstractAST
- Returns:
- See Also:
IExpr.isAtom()
-
isAST3
public boolean isAST3()
Test if this expression is anIAST
function, which contains a header element (i.e. the function name) at index position0
and three argument elements at the index positions1, 2, 3
.
Therefore this expression is no atomic expression.- Specified by:
isAST3
in interfaceIExpr
- Overrides:
isAST3
in classAbstractAST
- Returns:
- See Also:
IExpr.isAtom()
-
isList
public boolean isList()
Test if this expression is a list (i.e. an AST with head List)- Specified by:
isList
in interfaceIExpr
- Overrides:
isList
in classAbstractAST
- Returns:
-
isNaN
public boolean isNaN()
- Specified by:
isNaN
in interfaceorg.hipparchus.CalculusFieldElement<IExpr>
-
isRealVector
public boolean isRealVector()
Test if this expression is a real vector (i.e. an instance ofASTRealVector
or aList[...]
with elements of typeorg.matheclipse.core.expression.Num
.- Specified by:
isRealVector
in interfaceIExpr
- Overrides:
isRealVector
in classAbstractAST
- Returns:
-
isSameHead
public boolean isSameHead(ISymbol head)
Check if the object at index 0 (i.e. the head of the list) is the same object ashead
- Overrides:
isSameHead
in classAbstractAST
- Parameters:
head
- object to compare with element at location0
- Returns:
-
isSameHead
public boolean isSameHead(ISymbol head, int length)
Check if the object at index 0 (i.e. the head of the list) is the same object ashead
and if the size of the list equalslength
.- Overrides:
isSameHead
in classAbstractAST
- Parameters:
head
- object to compare with element at location0
- Returns:
-
isSameHead
public boolean isSameHead(ISymbol head, int minLength, int maxLength)
Check if the object at index 0 (i.e. the head of the list) is the same object ashead
and if the size of the list is betweenminLength
andmaxLength
.- Overrides:
isSameHead
in classAbstractAST
- Parameters:
head
- object to compare with element at location0
minLength
- minimum length of list elements.maxLength
- maximum length of list elements.- Returns:
-
isSameHeadSizeGE
public boolean isSameHeadSizeGE(ISymbol head, int length)
Check if the object at index 0 (i.e. the head of the list) is the same object ashead
and if the size of the list is greater or equallength
.- Specified by:
isSameHeadSizeGE
in interfaceIAST
- Specified by:
isSameHeadSizeGE
in interfaceIExpr
- Parameters:
head
- object to compare with element at location0
- Returns:
-
isVector
public final int isVector()
Test if this expression is a vector and return the length of the vector. This expression is only a vector, if the expression is aASTRealVector
or aList(...)
and no element is itself aList(...)
or aSparseArray(...)
of dimension1
;- Specified by:
isVector
in interfaceIExpr
- Overrides:
isVector
in classAbstractAST
- Returns:
-1
if the expression is no vector orsize()-1
of this vector AST.
-
isInexactVector
public final int isInexactVector()
- Specified by:
isInexactVector
in interfaceIExpr
- Overrides:
isInexactVector
in classAbstractAST
-
isNumericAST
public boolean isNumericAST()
Test if this expression is an IAST and contains at least one numeric argument.- Specified by:
isNumericAST
in interfaceIExpr
- Overrides:
isNumericAST
in classAbstractAST
- Returns:
-
isNumericFunction
public boolean isNumericFunction(boolean allowList)
Test if this expression is a numeric function (i.e. a number, a symbolic constant or a function (with attribute NumericFunction) where all arguments are also "numeric functions")- Specified by:
isNumericFunction
in interfaceIExpr
- Overrides:
isNumericFunction
in classAbstractAST
- Parameters:
allowList
- iftrue
aList(...)
AST is seen, as if it has attributeISymbol.NUMERICFUNCTION
- Returns:
true
, if the given expression is a numeric function or value.- See Also:
IExpr.isRealResult()
-
isNumericMode
public boolean isNumericMode()
Test if this expression contains a numeric number (i.e. of typeINum
orIComplexNum
.- Specified by:
isNumericMode
in interfaceIExpr
- Overrides:
isNumericMode
in classAbstractAST
- Returns:
true
, if the given expression contains numeric number (i.e. of typeINum
orIComplexNum
.- See Also:
IExpr.isRealResult()
-
joinToString
public void joinToString(StringBuilder builder, CharSequence delimiter)
Append a String composed of the elements of this vector joined together with the specifieddelimiter
.- Specified by:
joinToString
in interfaceIAST
- Parameters:
builder
- join the elements as stringsdelimiter
- the delimiter that separates each element
-
readExternal
public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
-
set
public IExpr set(int location, IExpr object)
Replaces the element at the specified location in thisArrayList
with the specified object. Internally thehashValue
will be reset to0
.- Specified by:
set
in interfaceIASTMutable
- Parameters:
location
- the index at which to put the specified object.object
- the object to add.- Returns:
- the previous element at the index.
- Throws:
IndexOutOfBoundsException
- whenlocation < 0 || >= size()
-
setAtCopy
public IASTMutable setAtCopy(int i, IExpr expr)
Description copied from interface:IAST
Create a shallow copy of thisIAST
instance (the elements themselves are not copied) and set theexpr
at the givenposition
. In contrast to thesetAtClone()
method, this method returns exactly the same type forAST0, AST1, AST2, AST3
.
-
setEntry
public void setEntry(int location, double value)
-
size
public int size()
Returns the number of elements in thisArrayList
.- Specified by:
size
in interfaceIAST
- Specified by:
size
in interfaceIExpr
- Returns:
- the number of elements in this
ArrayList
. - See Also:
IAST.argSize()
-
subtract
public ASTRealVector subtract(ASTRealVector that)
-
toArray
public IExpr[] toArray()
Returns a new array containing all elements contained in thisArrayList
.
-
toDoubleVector
public double[] toDoubleVector()
Convert this object into adouble[]
vector.- Specified by:
toDoubleVector
in interfaceIExpr
- Overrides:
toDoubleVector
in classAbstractAST
- Returns:
null
if this object can not be converted into adouble[]
vector
-
toComplexVector
public org.hipparchus.complex.Complex[] toComplexVector()
Description copied from class:AbstractAST
Convert this object into aComplex[]
vector.- Specified by:
toComplexVector
in interfaceIExpr
- Overrides:
toComplexVector
in classAbstractAST
- Returns:
null
if this object can not be converted into aComplex[]
vector
-
toRealVector
public org.hipparchus.linear.RealVector toRealVector()
Convert this object into a RealVector.- Specified by:
toRealVector
in interfaceIExpr
- Returns:
null
if this object can not be converted into a RealVector
-
toString
public String toString()
- Overrides:
toString
in classAbstractAST
-
toString
public void toString(Appendable buf)
-
writeExternal
public void writeExternal(ObjectOutput objectOutput) throws IOException
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
-