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 headerSinand one node for the argumentx. Internally an AST is represented as ajava.util.Listwhich contains- the operator of a function (i.e. the "header"-symbol: Sin, Cos, Inverse, Plus,
Times,...) at index
0and - the
narguments 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 IExprarg1()Get the first argument (i.e.IExprarg2()Get the second argument (i.e.IExprarg3()Get the third argument (i.e.IExprarg4()Get the fourth argument (i.e.IExprarg5()Get the fifth argument (i.e.intargSize()Returns the number of arguments in thisIAST.Set<IExpr>asSet()Collect all arguments of this AST in a new set.ASTRealVectorclone()Returns a newHMArrayListwith the same elements, the same size and the same capacity as thisHMArrayList.booleancontains(Object object)Tests whether thisListcontains the specified object.ASTRealVectorcopy()Returns a shallow copy of thisIASTinstance (the elements themselves are not copied).IASTAppendablecopyAppendable()Returns a shallow copy of thisIASTinstance (the elements themselves are not copied).IASTAppendablecopyAppendable(int additionalCapacity)Returns a shallow copy of thisIASTinstance (the elements themselves are not copied).booleanequals(Object obj)IExprevalEvaluate(EvalEngine engine)Evaluate arguments with the headF.Evaluate, i.e.IExprevaluate(EvalEngine engine)Evaluate an expressionIASTfilter(IASTAppendable filterAST, Predicate<? super IExpr> predicate)Select all elements by applying thepredicateto each argument in thisASTand append the arguments which satisfy the predicate to thefilterAST.IASTfilter(IASTAppendable filterAST, IASTAppendable restAST, Predicate<? super IExpr> predicate)Select all elements by applying thepredicateto each argument in thisASTand append the elements which satisfy thepredicateto thefilterAST, or otherwise append it to therestAST.IASTfilterFunction(IASTAppendable filterAST, IASTAppendable restAST, Function<IExpr,IExpr> function)Select all elements by applying thefunctionto each argument in thisASTand append the result elements for which thefunctionreturns nonF.NILelements to thefilterAST, or otherwise append the argument to therestAST.StringfullFormString()Return theFullForm()of this expressionIExprget(int location)Returns the element at the specified location in thisIAST.doublegetEntry(int location)IASTgetItems(int[] items, int length)Returnslengthnumber of elements specified in theitemsposition array in thisIAST.org.hipparchus.linear.RealVectorgetRealVector()inthashCode()FNV-1 hash code of thisIAST.IExprhead()If this object is an instance ofIASTget the first element (offset 0) of theIASTlist (i.e.booleanisAST0()Test if this expression is anIASTfunction, which contains a header element (i.e.booleanisAST1()Test if this expression is anIASTfunction, which contains a header element (i.e.booleanisAST2()Test if this expression is anIASTfunction, which contains a header element (i.e.booleanisAST3()Test if this expression is anIASTfunction, which contains a header element (i.e.intisInexactVector()booleanisList()Test if this expression is a list (i.e.booleanisNaN()booleanisNumericAST()Test if this expression is an IAST and contains at least one numeric argument.booleanisNumericFunction(boolean allowList)Test if this expression is a numeric function (i.e.booleanisNumericMode()Test if this expression contains a numeric number (i.e.booleanisRealVector()Test if this expression is a real vector (i.e.booleanisSameHead(ISymbol head)Check if the object at index 0 (i.e.booleanisSameHead(ISymbol head, int length)Check if the object at index 0 (i.e.booleanisSameHead(ISymbol head, int minLength, int maxLength)Check if the object at index 0 (i.e.booleanisSameHeadSizeGE(ISymbol head, int length)Check if the object at index 0 (i.e.intisVector()Test if this expression is a vector and return the length of the vector.voidjoinToString(StringBuilder builder, CharSequence delimiter)Append a String composed of the elements of this vector joined together with the specifieddelimiter.static ASTRealVectormap(IAST astVector, DoubleUnaryOperator function)Returns a new ASTRealVector where each element is mapped by the given function.voidreadExternal(ObjectInput objectInput)IExprset(int location, IExpr object)Replaces the element at the specified location in thisArrayListwith the specified object.IASTMutablesetAtCopy(int i, IExpr expr)Create a shallow copy of thisIASTinstance (the elements themselves are not copied) and set theexprat the givenposition.voidsetEntry(int location, double value)intsize()Returns the number of elements in thisArrayList.ASTRealVectorsubtract(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.RealVectortoRealVector()Convert this object into a RealVector.StringtoString()voidtoString(Appendable buf)voidwriteExternal(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- iftrueallocate 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- iftrueallocate 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 theASTfunction (i.e. get(1) ).
Example: for the AST representing the expressionSin(x),arg1()returnsx.- Specified by:
arg1in 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 theASTfunction (i.e. get(2) ).
Example: for the AST representing the expressionx^y(i.e.Power(x, y)),arg2()returnsy.- Specified by:
arg2in 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 theASTfunction (i.e. get(3) ).
Example: for the AST representing the expressionf(a, b, c),arg3()returnsc.- Specified by:
arg3in 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 theASTfunction (i.e. get(4) ).
Example: for the AST representing the expressionf(a, b ,c, d),arg4()returnsd.- Specified by:
arg4in 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 theASTfunction (i.e. get(5) ).
Example: for the AST representing the expressionf(a, b ,c, d, e),arg5()returnse.- Specified by:
arg5in 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:
argSizein interfaceIAST- Specified by:
argSizein interfaceIExpr- Returns:
- the number of arguments in this
IAST. - See Also:
IExpr.size()
-
asSet
public Set<IExpr> asSet()
Description copied from interface:IASTCollect all arguments of this AST in a new set.- Specified by:
asSetin interfaceIAST- Overrides:
asSetin classAbstractAST- Returns:
nullif a set couldn't be created
-
clone
public ASTRealVector clone()
Returns a newHMArrayListwith the same elements, the same size and the same capacity as thisHMArrayList.
-
contains
public boolean contains(Object object)
Tests whether thisListcontains the specified object.- Specified by:
containsin interfaceIAST- Overrides:
containsin classAbstractAST- Parameters:
object- the object to search for.- Returns:
trueif object is an element of thisList,falseotherwise
-
copy
public ASTRealVector copy()
Returns a shallow copy of this
IASTinstance (the elements themselves are not copied). In contrast to theIAST.copyAppendable()method, this method returns exactly the same type forAST0, AST1, AST2, AST3and tries to transformASTobjects toAST0, AST1, AST2, AST3if 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:IASTReturns a shallow copy of this
IASTinstance (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 newASTobject, so that additional arguments could be appended at the end.This also allows to set the header object to an arbitrary expression.
- Specified by:
copyAppendablein interfaceIAST- Returns:
- a copy of this
IASTinstance.
-
copyAppendable
public IASTAppendable copyAppendable(int additionalCapacity)
Description copied from interface:IASTReturns a shallow copy of this
IASTinstance (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 newASTobject, so that additional arguments could be appended at the end.This also allows to set the header object to an arbitrary expression.
- Specified by:
copyAppendablein interfaceIAST- Returns:
- a copy of this
IASTinstance.
-
equals
public boolean equals(Object obj)
- Specified by:
equalsin interfaceedu.jas.structure.Element<IExpr>- Overrides:
equalsin classAbstractAST
-
evaluate
public IExpr evaluate(EvalEngine engine)
Evaluate an expression- Specified by:
evaluatein interfaceIExpr- Overrides:
evaluatein classAbstractAST- Parameters:
engine- the evaluation engine- Returns:
- the evaluated Object or
F.NILif the evaluation is not possible (i.e. the evaluation doesn't change the object).
-
evalEvaluate
public IExpr evalEvaluate(EvalEngine engine)
Description copied from class:AbstractASTEvaluate arguments with the headF.Evaluate, i.e.f(a, ... , Evaluate(x), ...)- Overrides:
evalEvaluatein 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 thefunctionto each argument in thisASTand append the result elements for which thefunctionreturns nonF.NILelements to thefilterAST, or otherwise append the argument to therestAST.- Overrides:
filterFunctionin classAbstractAST- Parameters:
filterAST- the nonF.NILelements which were returned by thefunction#apply()methodrestAST- the arguments in thisASTfor which thefunction#apply()method returnedF.NILfunction- 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:
fullFormStringin interfaceIExpr- Overrides:
fullFormStringin classAbstractAST- Returns:
-
filter
public IAST filter(IASTAppendable filterAST, IASTAppendable restAST, Predicate<? super IExpr> predicate)
Select all elements by applying thepredicateto each argument in thisASTand append the elements which satisfy thepredicateto thefilterAST, or otherwise append it to therestAST.- Specified by:
filterin interfaceIAST- Overrides:
filterin classAbstractAST- Parameters:
filterAST- the elements where thepredicate#apply()method returnstruerestAST- 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 thepredicateto each argument in thisASTand append the arguments which satisfy the predicate to thefilterAST.- Specified by:
filterin interfaceIAST- Overrides:
filterin classAbstractAST- Parameters:
filterAST- the elements where thepredicate#apply()method returnstruepredicate- the predicate which filters each argument in thisAST- Returns:
- the
filterAST
-
get
public IExpr get(int location)
Description copied from interface:IASTReturns the element at the specified location in thisIAST. If this is anIAssociationreturn the value of the rule at the specified location.- Specified by:
getin interfaceIAST- Specified by:
getin interfaceITensorAccess- Specified by:
getin 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:IASTReturnslengthnumber of elements specified in theitemsposition array in thisIAST.
-
getEntry
public double getEntry(int location)
-
getRealVector
public org.hipparchus.linear.RealVector getRealVector()
-
hashCode
public int hashCode()
Description copied from class:AbstractASTFNV-1 hash code of thisIAST.- Specified by:
hashCodein interfaceedu.jas.structure.Element<IExpr>- Overrides:
hashCodein classAbstractAST
-
head
public final IExpr head()
Description copied from interface:IExprIf this object is an instance ofIASTget the first element (offset 0) of theIASTlist (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 anIASTfunction, which contains a header element (i.e. the function name) at index position0and no argument elements.
Therefore this expression is no atomic expression.- Specified by:
isAST0in interfaceIExpr- Overrides:
isAST0in classAbstractAST- Returns:
- See Also:
IExpr.isAtom()
-
isAST1
public boolean isAST1()
Test if this expression is anIASTfunction, which contains a header element (i.e. the function name) at index position0and one argument element at the index position1.
Therefore this expression is no atomic expression.- Specified by:
isAST1in interfaceIExpr- Overrides:
isAST1in classAbstractAST- Returns:
- See Also:
IExpr.isAtom()
-
isAST2
public boolean isAST2()
Test if this expression is anIASTfunction, which contains a header element (i.e. the function name) at index position0and two argument elements at the index positions1, 2.
Therefore this expression is no atomic expression.- Specified by:
isAST2in interfaceIExpr- Overrides:
isAST2in classAbstractAST- Returns:
- See Also:
IExpr.isAtom()
-
isAST3
public boolean isAST3()
Test if this expression is anIASTfunction, which contains a header element (i.e. the function name) at index position0and three argument elements at the index positions1, 2, 3.
Therefore this expression is no atomic expression.- Specified by:
isAST3in interfaceIExpr- Overrides:
isAST3in 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:
isListin interfaceIExpr- Overrides:
isListin classAbstractAST- Returns:
-
isNaN
public boolean isNaN()
- Specified by:
isNaNin interfaceorg.hipparchus.CalculusFieldElement<IExpr>
-
isRealVector
public boolean isRealVector()
Test if this expression is a real vector (i.e. an instance ofASTRealVectoror aList[...]with elements of typeorg.matheclipse.core.expression.Num.- Specified by:
isRealVectorin interfaceIExpr- Overrides:
isRealVectorin 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:
isSameHeadin 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 asheadand if the size of the list equalslength.- Overrides:
isSameHeadin 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 asheadand if the size of the list is betweenminLengthandmaxLength.- Overrides:
isSameHeadin classAbstractAST- Parameters:
head- object to compare with element at location0minLength- 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 asheadand if the size of the list is greater or equallength.- Specified by:
isSameHeadSizeGEin interfaceIAST- Specified by:
isSameHeadSizeGEin 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 aASTRealVectoror aList(...)and no element is itself aList(...)or aSparseArray(...)of dimension1;- Specified by:
isVectorin interfaceIExpr- Overrides:
isVectorin classAbstractAST- Returns:
-1if the expression is no vector orsize()-1of this vector AST.
-
isInexactVector
public final int isInexactVector()
- Specified by:
isInexactVectorin interfaceIExpr- Overrides:
isInexactVectorin classAbstractAST
-
isNumericAST
public boolean isNumericAST()
Test if this expression is an IAST and contains at least one numeric argument.- Specified by:
isNumericASTin interfaceIExpr- Overrides:
isNumericASTin 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:
isNumericFunctionin interfaceIExpr- Overrides:
isNumericFunctionin classAbstractAST- Parameters:
allowList- iftrueaList(...)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 typeINumorIComplexNum.- Specified by:
isNumericModein interfaceIExpr- Overrides:
isNumericModein classAbstractAST- Returns:
true, if the given expression contains numeric number (i.e. of typeINumorIComplexNum.- 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:
joinToStringin 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:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
set
public IExpr set(int location, IExpr object)
Replaces the element at the specified location in thisArrayListwith the specified object. Internally thehashValuewill be reset to0.- Specified by:
setin 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:IASTCreate a shallow copy of thisIASTinstance (the elements themselves are not copied) and set theexprat 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:
sizein interfaceIAST- Specified by:
sizein 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:
toDoubleVectorin interfaceIExpr- Overrides:
toDoubleVectorin classAbstractAST- Returns:
nullif this object can not be converted into adouble[]vector
-
toComplexVector
public org.hipparchus.complex.Complex[] toComplexVector()
Description copied from class:AbstractASTConvert this object into aComplex[]vector.- Specified by:
toComplexVectorin interfaceIExpr- Overrides:
toComplexVectorin classAbstractAST- Returns:
nullif this object can not be converted into aComplex[]vector
-
toRealVector
public org.hipparchus.linear.RealVector toRealVector()
Convert this object into a RealVector.- Specified by:
toRealVectorin interfaceIExpr- Returns:
nullif this object can not be converted into a RealVector
-
toString
public String toString()
- Overrides:
toStringin classAbstractAST
-
toString
public void toString(Appendable buf)
-
writeExternal
public void writeExternal(ObjectOutput objectOutput) throws IOException
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
-