mathjs 9.3.2 → 9.4.0
Sign up to get free protection for your applications and to get access to all the features.
- package/HISTORY.md +22 -0
- package/README.md +1 -0
- package/bin/cli.js +11 -11
- package/docs/expressions/parsing.md +21 -4
- package/docs/reference/functions/complex.md +5 -49
- package/docs/reference/functions/eigs.md +12 -12
- package/docs/reference/functions/flatten.md +1 -0
- package/docs/reference/functions/matrixFromColumns.md +1 -1
- package/docs/reference/functions/matrixFromFunction.md +12 -0
- package/docs/reference/functions/matrixFromRows.md +1 -1
- package/docs/reference/functions.md +4 -1
- package/examples/advanced/custom_scope_objects.js +115 -0
- package/lib/browser/math.js +10 -10
- package/lib/browser/math.js.map +1 -1
- package/lib/cjs/core/create.js +8 -7
- package/lib/cjs/core/function/import.js +9 -7
- package/lib/cjs/core/function/typed.js +6 -1
- package/lib/cjs/defaultInstance.js +3 -3
- package/lib/cjs/entry/allFactoriesAny.js +3 -3
- package/lib/cjs/entry/allFactoriesNumber.js +3 -3
- package/lib/cjs/entry/configReadonly.js +5 -4
- package/lib/cjs/entry/dependenciesAny/dependenciesEigs.generated.js +51 -0
- package/lib/cjs/entry/dependenciesAny/dependenciesMatrixFromColumns.generated.js +29 -0
- package/lib/cjs/entry/dependenciesAny/dependenciesMatrixFromFunction.generated.js +26 -0
- package/lib/cjs/entry/dependenciesAny/dependenciesMatrixFromRows.generated.js +29 -0
- package/lib/cjs/entry/dependenciesAny.generated.js +24 -0
- package/lib/cjs/entry/impureFunctionsAny.generated.js +22 -17
- package/lib/cjs/entry/impureFunctionsNumber.generated.js +11 -9
- package/lib/cjs/entry/pureFunctionsAny.generated.js +78 -41
- package/lib/cjs/expression/Parser.js +22 -15
- package/lib/cjs/expression/embeddedDocs/embeddedDocs.js +9 -0
- package/lib/cjs/expression/embeddedDocs/function/matrix/column.js +1 -1
- package/lib/cjs/expression/embeddedDocs/function/matrix/matrixFromColumns.js +15 -0
- package/lib/cjs/expression/embeddedDocs/function/matrix/matrixFromFunction.js +15 -0
- package/lib/cjs/expression/embeddedDocs/function/matrix/matrixFromRows.js +15 -0
- package/lib/cjs/expression/embeddedDocs/function/matrix/row.js +1 -1
- package/lib/cjs/expression/function/evaluate.js +6 -4
- package/lib/cjs/expression/keywords.js +1 -3
- package/lib/cjs/expression/node/AccessorNode.js +1 -0
- package/lib/cjs/expression/node/AssignmentNode.js +6 -3
- package/lib/cjs/expression/node/FunctionAssignmentNode.js +2 -4
- package/lib/cjs/expression/node/FunctionNode.js +76 -46
- package/lib/cjs/expression/node/IndexNode.js +5 -13
- package/lib/cjs/expression/node/Node.js +15 -9
- package/lib/cjs/expression/node/ObjectNode.js +5 -3
- package/lib/cjs/expression/node/SymbolNode.js +2 -2
- package/lib/cjs/expression/node/utils/access.js +5 -3
- package/lib/cjs/expression/node/utils/assign.js +5 -3
- package/lib/cjs/expression/parse.js +10 -14
- package/lib/cjs/expression/transform/utils/compileInlineExpression.js +5 -3
- package/lib/cjs/factoriesAny.js +24 -0
- package/lib/cjs/function/algebra/decomposition/qr.js +5 -3
- package/lib/cjs/function/algebra/simplify/resolve.js +7 -1
- package/lib/cjs/function/algebra/simplify.js +20 -14
- package/lib/cjs/function/algebra/solver/lsolveAll.js +6 -16
- package/lib/cjs/function/algebra/solver/usolveAll.js +6 -16
- package/lib/cjs/function/arithmetic/ceil.js +6 -16
- package/lib/cjs/function/arithmetic/floor.js +6 -16
- package/lib/cjs/function/arithmetic/norm.js +2 -2
- package/lib/cjs/function/arithmetic/pow.js +9 -7
- package/lib/cjs/function/arithmetic/round.js +7 -5
- package/lib/cjs/function/complex/im.js +3 -0
- package/lib/cjs/function/complex/re.js +3 -0
- package/lib/cjs/function/matrix/eigs/complexEigs.js +631 -0
- package/lib/cjs/function/matrix/eigs/realSymetric.js +341 -0
- package/lib/cjs/function/matrix/eigs.js +188 -334
- package/lib/cjs/function/matrix/flatten.js +1 -0
- package/lib/cjs/function/matrix/matrixFromColumns.js +118 -0
- package/lib/cjs/function/matrix/matrixFromFunction.js +85 -0
- package/lib/cjs/function/matrix/matrixFromRows.js +108 -0
- package/lib/cjs/function/probability/pickRandom.js +1 -1
- package/lib/cjs/function/probability/util/seededRNG.js +2 -2
- package/lib/cjs/function/relational/compareNatural.js +2 -2
- package/lib/cjs/header.js +2 -2
- package/lib/cjs/plain/bignumber/index.js +2 -2
- package/lib/cjs/type/bignumber/BigNumber.js +2 -2
- package/lib/cjs/type/complex/Complex.js +5 -5
- package/lib/cjs/type/fraction/Fraction.js +2 -2
- package/lib/cjs/type/matrix/DenseMatrix.js +138 -0
- package/lib/cjs/type/matrix/Matrix.js +10 -0
- package/lib/cjs/type/matrix/SparseMatrix.js +77 -3
- package/lib/cjs/type/matrix/function/matrix.js +2 -1
- package/lib/cjs/type/unit/Unit.js +15 -13
- package/lib/cjs/utils/array.js +1 -1
- package/lib/cjs/utils/customs.js +18 -4
- package/lib/cjs/utils/emitter.js +2 -2
- package/lib/cjs/utils/function.js +6 -2
- package/lib/cjs/utils/is.js +7 -5
- package/lib/cjs/utils/latex.js +2 -2
- package/lib/cjs/utils/map.js +197 -0
- package/lib/cjs/utils/object.js +6 -5
- package/lib/cjs/utils/scope.js +33 -0
- package/lib/cjs/utils/snapshot.js +17 -16
- package/lib/cjs/utils/string.js +6 -4
- package/lib/cjs/version.js +1 -1
- package/lib/esm/constants.js +15 -15
- package/lib/esm/core/create.js +1 -2
- package/lib/esm/core/function/typed.js +5 -1
- package/lib/esm/entry/configReadonly.js +1 -2
- package/lib/esm/entry/dependenciesAny/dependenciesEigs.generated.js +34 -0
- package/lib/esm/entry/dependenciesAny/dependenciesMatrixFromColumns.generated.js +16 -0
- package/lib/esm/entry/dependenciesAny/dependenciesMatrixFromFunction.generated.js +14 -0
- package/lib/esm/entry/dependenciesAny/dependenciesMatrixFromRows.generated.js +16 -0
- package/lib/esm/entry/dependenciesAny.generated.js +3 -0
- package/lib/esm/entry/impureFunctionsAny.generated.js +13 -10
- package/lib/esm/entry/impureFunctionsNumber.generated.js +1 -1
- package/lib/esm/entry/pureFunctionsAny.generated.js +66 -32
- package/lib/esm/expression/Help.js +1 -1
- package/lib/esm/expression/Parser.js +23 -15
- package/lib/esm/expression/embeddedDocs/embeddedDocs.js +6 -0
- package/lib/esm/expression/embeddedDocs/function/matrix/column.js +1 -1
- package/lib/esm/expression/embeddedDocs/function/matrix/matrixFromColumns.js +8 -0
- package/lib/esm/expression/embeddedDocs/function/matrix/matrixFromFunction.js +8 -0
- package/lib/esm/expression/embeddedDocs/function/matrix/matrixFromRows.js +8 -0
- package/lib/esm/expression/embeddedDocs/function/matrix/row.js +1 -1
- package/lib/esm/expression/function/compile.js +1 -1
- package/lib/esm/expression/function/evaluate.js +6 -5
- package/lib/esm/expression/function/help.js +1 -1
- package/lib/esm/expression/function/parser.js +1 -1
- package/lib/esm/expression/keywords.js +1 -3
- package/lib/esm/expression/node/AccessorNode.js +2 -1
- package/lib/esm/expression/node/ArrayNode.js +1 -1
- package/lib/esm/expression/node/AssignmentNode.js +7 -4
- package/lib/esm/expression/node/BlockNode.js +1 -1
- package/lib/esm/expression/node/ConditionalNode.js +1 -1
- package/lib/esm/expression/node/ConstantNode.js +1 -1
- package/lib/esm/expression/node/FunctionAssignmentNode.js +3 -4
- package/lib/esm/expression/node/FunctionNode.js +57 -39
- package/lib/esm/expression/node/IndexNode.js +1 -1
- package/lib/esm/expression/node/Node.js +7 -8
- package/lib/esm/expression/node/ObjectNode.js +1 -1
- package/lib/esm/expression/node/OperatorNode.js +1 -1
- package/lib/esm/expression/node/ParenthesisNode.js +1 -1
- package/lib/esm/expression/node/RangeNode.js +1 -1
- package/lib/esm/expression/node/RelationalNode.js +1 -1
- package/lib/esm/expression/node/SymbolNode.js +3 -3
- package/lib/esm/expression/parse.js +2 -3
- package/lib/esm/expression/transform/apply.transform.js +1 -1
- package/lib/esm/expression/transform/column.transform.js +1 -1
- package/lib/esm/expression/transform/concat.transform.js +1 -1
- package/lib/esm/expression/transform/diff.transform.js +1 -1
- package/lib/esm/expression/transform/filter.transform.js +1 -1
- package/lib/esm/expression/transform/forEach.transform.js +1 -1
- package/lib/esm/expression/transform/index.transform.js +1 -1
- package/lib/esm/expression/transform/map.transform.js +1 -1
- package/lib/esm/expression/transform/max.transform.js +1 -1
- package/lib/esm/expression/transform/mean.transform.js +1 -1
- package/lib/esm/expression/transform/min.transform.js +1 -1
- package/lib/esm/expression/transform/range.transform.js +1 -1
- package/lib/esm/expression/transform/row.transform.js +1 -1
- package/lib/esm/expression/transform/std.transform.js +1 -1
- package/lib/esm/expression/transform/subset.transform.js +1 -1
- package/lib/esm/expression/transform/sum.transform.js +1 -1
- package/lib/esm/expression/transform/utils/compileInlineExpression.js +4 -3
- package/lib/esm/expression/transform/variance.transform.js +1 -1
- package/lib/esm/factoriesAny.js +3 -0
- package/lib/esm/factoriesNumber.js +1 -1
- package/lib/esm/function/algebra/decomposition/lup.js +1 -1
- package/lib/esm/function/algebra/decomposition/qr.js +2 -3
- package/lib/esm/function/algebra/decomposition/slu.js +1 -1
- package/lib/esm/function/algebra/derivative.js +1 -1
- package/lib/esm/function/algebra/rationalize.js +1 -1
- package/lib/esm/function/algebra/simplify/resolve.js +7 -2
- package/lib/esm/function/algebra/simplify/simplifyConstant.js +1 -1
- package/lib/esm/function/algebra/simplify/simplifyCore.js +1 -1
- package/lib/esm/function/algebra/simplify/util.js +1 -1
- package/lib/esm/function/algebra/simplify.js +16 -12
- package/lib/esm/function/algebra/solver/lsolve.js +1 -1
- package/lib/esm/function/algebra/solver/lsolveAll.js +1 -1
- package/lib/esm/function/algebra/solver/lusolve.js +1 -1
- package/lib/esm/function/algebra/solver/usolve.js +1 -1
- package/lib/esm/function/algebra/solver/usolveAll.js +1 -1
- package/lib/esm/function/algebra/sparse/csAmd.js +1 -1
- package/lib/esm/function/algebra/sparse/csChol.js +1 -1
- package/lib/esm/function/algebra/sparse/csCounts.js +1 -1
- package/lib/esm/function/algebra/sparse/csLu.js +1 -1
- package/lib/esm/function/algebra/sparse/csSpsolve.js +1 -1
- package/lib/esm/function/algebra/sparse/csSqr.js +1 -1
- package/lib/esm/function/algebra/sparse/csSymperm.js +1 -1
- package/lib/esm/function/arithmetic/abs.js +1 -1
- package/lib/esm/function/arithmetic/add.js +1 -1
- package/lib/esm/function/arithmetic/addScalar.js +1 -1
- package/lib/esm/function/arithmetic/cbrt.js +1 -1
- package/lib/esm/function/arithmetic/ceil.js +1 -1
- package/lib/esm/function/arithmetic/cube.js +1 -1
- package/lib/esm/function/arithmetic/divide.js +1 -1
- package/lib/esm/function/arithmetic/divideScalar.js +1 -1
- package/lib/esm/function/arithmetic/dotDivide.js +1 -1
- package/lib/esm/function/arithmetic/dotMultiply.js +1 -1
- package/lib/esm/function/arithmetic/dotPow.js +1 -1
- package/lib/esm/function/arithmetic/exp.js +1 -1
- package/lib/esm/function/arithmetic/expm1.js +1 -1
- package/lib/esm/function/arithmetic/fix.js +1 -1
- package/lib/esm/function/arithmetic/floor.js +1 -1
- package/lib/esm/function/arithmetic/gcd.js +1 -1
- package/lib/esm/function/arithmetic/hypot.js +1 -1
- package/lib/esm/function/arithmetic/lcm.js +1 -1
- package/lib/esm/function/arithmetic/log.js +1 -1
- package/lib/esm/function/arithmetic/log10.js +1 -1
- package/lib/esm/function/arithmetic/log1p.js +1 -1
- package/lib/esm/function/arithmetic/log2.js +1 -1
- package/lib/esm/function/arithmetic/mod.js +1 -1
- package/lib/esm/function/arithmetic/multiply.js +1 -1
- package/lib/esm/function/arithmetic/multiplyScalar.js +1 -1
- package/lib/esm/function/arithmetic/norm.js +3 -3
- package/lib/esm/function/arithmetic/nthRoot.js +2 -2
- package/lib/esm/function/arithmetic/nthRoots.js +1 -1
- package/lib/esm/function/arithmetic/pow.js +10 -8
- package/lib/esm/function/arithmetic/round.js +6 -6
- package/lib/esm/function/arithmetic/sign.js +1 -1
- package/lib/esm/function/arithmetic/sqrt.js +1 -1
- package/lib/esm/function/arithmetic/square.js +1 -1
- package/lib/esm/function/arithmetic/subtract.js +1 -1
- package/lib/esm/function/arithmetic/unaryMinus.js +1 -1
- package/lib/esm/function/arithmetic/unaryPlus.js +1 -1
- package/lib/esm/function/arithmetic/xgcd.js +1 -1
- package/lib/esm/function/bitwise/bitAnd.js +1 -1
- package/lib/esm/function/bitwise/bitNot.js +1 -1
- package/lib/esm/function/bitwise/bitOr.js +1 -1
- package/lib/esm/function/bitwise/bitXor.js +1 -1
- package/lib/esm/function/bitwise/leftShift.js +1 -1
- package/lib/esm/function/bitwise/rightArithShift.js +1 -1
- package/lib/esm/function/bitwise/rightLogShift.js +1 -1
- package/lib/esm/function/combinatorics/bellNumbers.js +1 -1
- package/lib/esm/function/combinatorics/catalan.js +1 -1
- package/lib/esm/function/combinatorics/composition.js +1 -1
- package/lib/esm/function/combinatorics/stirlingS2.js +1 -1
- package/lib/esm/function/complex/arg.js +1 -1
- package/lib/esm/function/complex/conj.js +1 -1
- package/lib/esm/function/complex/im.js +4 -1
- package/lib/esm/function/complex/re.js +4 -1
- package/lib/esm/function/geometry/distance.js +1 -1
- package/lib/esm/function/geometry/intersect.js +1 -1
- package/lib/esm/function/logical/and.js +1 -1
- package/lib/esm/function/logical/not.js +1 -1
- package/lib/esm/function/logical/or.js +1 -1
- package/lib/esm/function/logical/xor.js +1 -1
- package/lib/esm/function/matrix/apply.js +1 -1
- package/lib/esm/function/matrix/column.js +1 -1
- package/lib/esm/function/matrix/concat.js +1 -1
- package/lib/esm/function/matrix/count.js +1 -1
- package/lib/esm/function/matrix/cross.js +1 -1
- package/lib/esm/function/matrix/ctranspose.js +1 -1
- package/lib/esm/function/matrix/det.js +1 -1
- package/lib/esm/function/matrix/diag.js +1 -1
- package/lib/esm/function/matrix/diff.js +1 -1
- package/lib/esm/function/matrix/dot.js +1 -1
- package/lib/esm/function/matrix/eigs/complexEigs.js +586 -0
- package/lib/esm/function/matrix/eigs/realSymetric.js +335 -0
- package/lib/esm/function/matrix/eigs.js +187 -335
- package/lib/esm/function/matrix/expm.js +1 -1
- package/lib/esm/function/matrix/filter.js +1 -1
- package/lib/esm/function/matrix/flatten.js +2 -1
- package/lib/esm/function/matrix/forEach.js +1 -1
- package/lib/esm/function/matrix/getMatrixDataType.js +1 -1
- package/lib/esm/function/matrix/identity.js +1 -1
- package/lib/esm/function/matrix/inv.js +1 -1
- package/lib/esm/function/matrix/kron.js +1 -1
- package/lib/esm/function/matrix/map.js +1 -1
- package/lib/esm/function/matrix/matrixFromColumns.js +93 -0
- package/lib/esm/function/matrix/matrixFromFunction.js +78 -0
- package/lib/esm/function/matrix/matrixFromRows.js +83 -0
- package/lib/esm/function/matrix/ones.js +1 -1
- package/lib/esm/function/matrix/partitionSelect.js +1 -1
- package/lib/esm/function/matrix/range.js +1 -1
- package/lib/esm/function/matrix/reshape.js +1 -1
- package/lib/esm/function/matrix/resize.js +1 -1
- package/lib/esm/function/matrix/rotate.js +1 -1
- package/lib/esm/function/matrix/rotationMatrix.js +1 -1
- package/lib/esm/function/matrix/row.js +1 -1
- package/lib/esm/function/matrix/size.js +1 -1
- package/lib/esm/function/matrix/sort.js +1 -1
- package/lib/esm/function/matrix/sqrtm.js +1 -1
- package/lib/esm/function/matrix/squeeze.js +1 -1
- package/lib/esm/function/matrix/subset.js +1 -1
- package/lib/esm/function/matrix/trace.js +1 -1
- package/lib/esm/function/matrix/transpose.js +1 -1
- package/lib/esm/function/matrix/zeros.js +1 -1
- package/lib/esm/function/probability/combinations.js +1 -1
- package/lib/esm/function/probability/combinationsWithRep.js +1 -1
- package/lib/esm/function/probability/factorial.js +1 -1
- package/lib/esm/function/probability/gamma.js +1 -1
- package/lib/esm/function/probability/kldivergence.js +1 -1
- package/lib/esm/function/probability/multinomial.js +1 -1
- package/lib/esm/function/probability/permutations.js +1 -1
- package/lib/esm/function/probability/pickRandom.js +2 -2
- package/lib/esm/function/probability/random.js +2 -2
- package/lib/esm/function/probability/randomInt.js +1 -1
- package/lib/esm/function/relational/compare.js +2 -2
- package/lib/esm/function/relational/compareNatural.js +1 -1
- package/lib/esm/function/relational/compareText.js +2 -2
- package/lib/esm/function/relational/deepEqual.js +1 -1
- package/lib/esm/function/relational/equal.js +2 -2
- package/lib/esm/function/relational/equalScalar.js +2 -2
- package/lib/esm/function/relational/equalText.js +1 -1
- package/lib/esm/function/relational/larger.js +2 -2
- package/lib/esm/function/relational/largerEq.js +2 -2
- package/lib/esm/function/relational/smaller.js +2 -2
- package/lib/esm/function/relational/smallerEq.js +2 -2
- package/lib/esm/function/relational/unequal.js +2 -2
- package/lib/esm/function/set/setCartesian.js +1 -1
- package/lib/esm/function/set/setDifference.js +1 -1
- package/lib/esm/function/set/setDistinct.js +1 -1
- package/lib/esm/function/set/setIntersect.js +1 -1
- package/lib/esm/function/set/setIsSubset.js +1 -1
- package/lib/esm/function/set/setMultiplicity.js +1 -1
- package/lib/esm/function/set/setPowerset.js +1 -1
- package/lib/esm/function/set/setSize.js +1 -1
- package/lib/esm/function/set/setSymDifference.js +1 -1
- package/lib/esm/function/set/setUnion.js +1 -1
- package/lib/esm/function/special/erf.js +1 -1
- package/lib/esm/function/statistics/mad.js +1 -1
- package/lib/esm/function/statistics/max.js +1 -1
- package/lib/esm/function/statistics/mean.js +1 -1
- package/lib/esm/function/statistics/median.js +1 -1
- package/lib/esm/function/statistics/min.js +1 -1
- package/lib/esm/function/statistics/mode.js +1 -1
- package/lib/esm/function/statistics/prod.js +1 -1
- package/lib/esm/function/statistics/quantileSeq.js +1 -1
- package/lib/esm/function/statistics/std.js +1 -1
- package/lib/esm/function/statistics/sum.js +1 -1
- package/lib/esm/function/statistics/variance.js +1 -1
- package/lib/esm/function/string/bin.js +1 -1
- package/lib/esm/function/string/format.js +1 -1
- package/lib/esm/function/string/hex.js +1 -1
- package/lib/esm/function/string/oct.js +1 -1
- package/lib/esm/function/string/print.js +1 -1
- package/lib/esm/function/trigonometry/acos.js +1 -1
- package/lib/esm/function/trigonometry/acosh.js +1 -1
- package/lib/esm/function/trigonometry/acot.js +1 -1
- package/lib/esm/function/trigonometry/acoth.js +1 -1
- package/lib/esm/function/trigonometry/acsc.js +1 -1
- package/lib/esm/function/trigonometry/acsch.js +1 -1
- package/lib/esm/function/trigonometry/asec.js +1 -1
- package/lib/esm/function/trigonometry/asech.js +1 -1
- package/lib/esm/function/trigonometry/asin.js +1 -1
- package/lib/esm/function/trigonometry/asinh.js +1 -1
- package/lib/esm/function/trigonometry/atan.js +1 -1
- package/lib/esm/function/trigonometry/atan2.js +1 -1
- package/lib/esm/function/trigonometry/atanh.js +1 -1
- package/lib/esm/function/trigonometry/cos.js +1 -1
- package/lib/esm/function/trigonometry/cosh.js +1 -1
- package/lib/esm/function/trigonometry/cot.js +1 -1
- package/lib/esm/function/trigonometry/coth.js +1 -1
- package/lib/esm/function/trigonometry/csc.js +1 -1
- package/lib/esm/function/trigonometry/csch.js +1 -1
- package/lib/esm/function/trigonometry/sec.js +1 -1
- package/lib/esm/function/trigonometry/sech.js +1 -1
- package/lib/esm/function/trigonometry/sin.js +1 -1
- package/lib/esm/function/trigonometry/sinh.js +1 -1
- package/lib/esm/function/trigonometry/tan.js +1 -1
- package/lib/esm/function/trigonometry/tanh.js +1 -1
- package/lib/esm/function/unit/to.js +1 -1
- package/lib/esm/function/utils/clone.js +1 -1
- package/lib/esm/function/utils/hasNumericValue.js +1 -1
- package/lib/esm/function/utils/isInteger.js +1 -1
- package/lib/esm/function/utils/isNaN.js +1 -1
- package/lib/esm/function/utils/isNegative.js +1 -1
- package/lib/esm/function/utils/isNumeric.js +1 -1
- package/lib/esm/function/utils/isPositive.js +1 -1
- package/lib/esm/function/utils/isPrime.js +1 -1
- package/lib/esm/function/utils/isZero.js +1 -1
- package/lib/esm/function/utils/numeric.js +1 -1
- package/lib/esm/function/utils/typeOf.js +1 -1
- package/lib/esm/json/reviver.js +1 -1
- package/lib/esm/type/bignumber/BigNumber.js +1 -1
- package/lib/esm/type/bignumber/function/bignumber.js +1 -1
- package/lib/esm/type/boolean.js +1 -1
- package/lib/esm/type/chain/Chain.js +1 -1
- package/lib/esm/type/chain/function/chain.js +1 -1
- package/lib/esm/type/complex/function/complex.js +1 -1
- package/lib/esm/type/fraction/function/fraction.js +1 -1
- package/lib/esm/type/matrix/DenseMatrix.js +75 -1
- package/lib/esm/type/matrix/FibonacciHeap.js +1 -1
- package/lib/esm/type/matrix/ImmutableDenseMatrix.js +1 -1
- package/lib/esm/type/matrix/Matrix.js +10 -0
- package/lib/esm/type/matrix/MatrixIndex.js +1 -1
- package/lib/esm/type/matrix/Spa.js +1 -1
- package/lib/esm/type/matrix/SparseMatrix.js +37 -3
- package/lib/esm/type/matrix/function/index.js +1 -1
- package/lib/esm/type/matrix/function/matrix.js +3 -2
- package/lib/esm/type/matrix/function/sparse.js +1 -1
- package/lib/esm/type/matrix/utils/algorithm01.js +1 -1
- package/lib/esm/type/matrix/utils/algorithm02.js +1 -1
- package/lib/esm/type/matrix/utils/algorithm03.js +1 -1
- package/lib/esm/type/matrix/utils/algorithm04.js +1 -1
- package/lib/esm/type/matrix/utils/algorithm05.js +1 -1
- package/lib/esm/type/matrix/utils/algorithm06.js +1 -1
- package/lib/esm/type/matrix/utils/algorithm07.js +1 -1
- package/lib/esm/type/matrix/utils/algorithm08.js +1 -1
- package/lib/esm/type/matrix/utils/algorithm09.js +1 -1
- package/lib/esm/type/matrix/utils/algorithm10.js +1 -1
- package/lib/esm/type/matrix/utils/algorithm11.js +1 -1
- package/lib/esm/type/matrix/utils/algorithm12.js +1 -1
- package/lib/esm/type/matrix/utils/algorithm13.js +1 -1
- package/lib/esm/type/matrix/utils/algorithm14.js +1 -1
- package/lib/esm/type/number.js +1 -1
- package/lib/esm/type/string.js +1 -1
- package/lib/esm/type/unit/Unit.js +4 -5
- package/lib/esm/type/unit/function/createUnit.js +1 -1
- package/lib/esm/type/unit/function/splitUnit.js +1 -1
- package/lib/esm/type/unit/function/unit.js +1 -1
- package/lib/esm/type/unit/physicalConstants.js +2 -2
- package/lib/esm/utils/array.js +1 -1
- package/lib/esm/utils/customs.js +10 -0
- package/lib/esm/utils/map.js +135 -0
- package/lib/esm/utils/scope.js +26 -0
- package/lib/esm/utils/snapshot.js +3 -4
- package/lib/esm/version.js +1 -1
- package/package.json +18 -9
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.matrix = exports.SparseMatrix = exports.isNegative = exports.SQRT2 = exports.random = exports.combinationsWithRep = exports.sin = exports.csc = exports.cos = exports.asinh = exports.acsch = exports.acosh = exports.bin = exports.mode = exports.getMatrixDataType = exports.conj = exports.sqrt = exports.log2 = exports.exp = exports.addScalar = exports.unaryMinus = exports.fraction = exports.string = exports.typeOf = exports.hasNumericValue = exports.clone = exports.LN2 = exports.randomInt = exports.pickRandom = exports.combinations = exports.tanh = exports.sinh = exports.sech = exports.csch = exports.coth = exports.cosh = exports.atanh = exports.atan = exports.asin = exports.asec = exports.acsc = exports.acot = exports.acos = exports.isPrime = exports.print = exports.oct = exports.format = exports.erf = exports.map = exports.forEach = exports.filter = exports.not = exports.im = exports.arg = exports.bitNot = exports.square = exports.sign = exports.multiplyScalar = exports.log10 = exports.expm1 = exports.cube = exports.apply = exports.unaryPlus = exports.splitUnit = exports.complex = exports["boolean"] = exports.number = exports.equalScalar = exports.isNaN = exports.isPositive = exports.isNumeric = exports.isInteger = exports.typed = exports.phi = exports.DenseMatrix = exports.version = exports.LOG2E = exports._Infinity = exports.e = exports.Fraction = exports.weakMixingAngle = exports.sackurTetrode = exports.fineStructure = exports.efimovFactor = exports.tau = exports.SQRT1_2 = exports.pi = exports._NaN = exports.LOG10E = exports.LN10 = exports.i = exports.replacer = exports.Matrix = exports.BigNumber = exports._true = exports._null = exports._false = exports.Range = exports.Complex = exports.ResultSet = void 0;
|
7
|
-
exports.
|
8
|
-
exports.planckConstant = exports.gasConstant = exports.unit = exports.rydberg = exports.magneticFluxQuantum = exports.coulomb = exports.mad = exports.rotate = exports.thomsonCrossSection = exports.planckTime = exports.molarVolume = exports.inverseConductanceQuantum = exports.elementaryCharge = exports.bohrRadius = exports.median = exports.rotationMatrix = exports.wienDisplacement = exports.speedOfLight = exports.quantumOfCirculation = exports.planckMass = exports.nuclearMagneton = exports.molarMassC12 = exports.loschmidt = exports.gravity = exports.fermiCoupling = exports.electricConstant = exports.classicalElectronRadius = exports.avogadro = exports.multinomial = exports.sqrtm = exports.lusolve = exports.norm = exports.usolve = exports.vacuumImpedance = exports.stefanBoltzmann = exports.secondRadiation = exports.reducedPlanckConstant = exports.protonMass = exports.planckTemperature = exports.planckLength = exports.planckCharge = exports.neutronMass = exports.molarPlanckConstant = exports.molarMass = exports.magneticConstant = exports.klitzing = exports.hartreeEnergy = exports.gravitationConstant = exports.firstRadiation = exports.faraday = exports.electronMass = exports.deuteronMass = exports.conductanceQuantum = exports.boltzmann = exports.bohrMagneton = exports.atomicMass = exports.std = exports.intersect = exports.eigs = exports.createUnit = exports.Unit = exports.log1p = exports.bellNumbers = exports.kldivergence = exports.variance = exports.mean = exports.divide = exports.expm = exports.inv = exports.qr = exports.hypot = exports.usolveAll = exports.dotDivide = exports.log = exports.
|
7
|
+
exports.nthRoots = exports.divideScalar = exports.diff = exports.fix = exports.setIsSubset = exports.deepEqual = exports.ctranspose = exports.count = exports.xor = exports.ceil = exports.setSymDifference = exports.setCartesian = exports.max = exports.equal = exports.prod = exports.row = exports.range = exports.cross = exports.subtract = exports.matrixFromRows = exports.permutations = exports.factorial = exports.sum = exports.index = exports.setPowerset = exports.setDistinct = exports.cot = exports.min = exports.sort = exports.smallerEq = exports.and = exports.numeric = exports.transpose = exports.kron = exports.bitOr = exports.lcm = exports.matrixFromColumns = exports.bignumber = exports.gamma = exports.quantileSeq = exports.trace = exports.setSize = exports.setMultiplicity = exports.setIntersect = exports.setDifference = exports.tan = exports.asech = exports.Index = exports.partitionSelect = exports.largerEq = exports.equalText = exports.compareNatural = exports.rightArithShift = exports.dotPow = exports.pow = exports.to = exports.squeeze = exports.resize = exports.flatten = exports.re = exports.dotMultiply = exports.multiply = exports.floor = exports.cbrt = exports.matrixFromFunction = exports.isZero = exports.composition = exports.dot = exports.add = exports.sec = exports.atan2 = exports.acoth = exports.sparse = exports.FibonacciHeap = exports.ImmutableDenseMatrix = exports.unequal = exports.larger = exports.smaller = exports.compareText = exports.compare = exports.rightLogShift = exports.leftShift = exports.round = exports.hex = exports.zeros = exports.subset = exports.size = exports.reshape = exports.ones = exports.identity = exports.diag = exports.concat = exports.or = exports.bitXor = exports.bitAnd = exports.xgcd = exports.nthRoot = exports.mod = exports.gcd = exports.abs = void 0;
|
8
|
+
exports.planckConstant = exports.gasConstant = exports.unit = exports.rydberg = exports.magneticFluxQuantum = exports.coulomb = exports.mad = exports.rotate = exports.thomsonCrossSection = exports.planckTime = exports.molarVolume = exports.inverseConductanceQuantum = exports.elementaryCharge = exports.bohrRadius = exports.median = exports.rotationMatrix = exports.wienDisplacement = exports.speedOfLight = exports.quantumOfCirculation = exports.planckMass = exports.nuclearMagneton = exports.molarMassC12 = exports.loschmidt = exports.gravity = exports.fermiCoupling = exports.electricConstant = exports.classicalElectronRadius = exports.avogadro = exports.multinomial = exports.sqrtm = exports.lusolve = exports.norm = exports.usolve = exports.vacuumImpedance = exports.stefanBoltzmann = exports.secondRadiation = exports.reducedPlanckConstant = exports.protonMass = exports.planckTemperature = exports.planckLength = exports.planckCharge = exports.neutronMass = exports.molarPlanckConstant = exports.molarMass = exports.magneticConstant = exports.klitzing = exports.hartreeEnergy = exports.gravitationConstant = exports.firstRadiation = exports.faraday = exports.electronMass = exports.deuteronMass = exports.conductanceQuantum = exports.boltzmann = exports.bohrMagneton = exports.atomicMass = exports.std = exports.intersect = exports.eigs = exports.createUnit = exports.Unit = exports.log1p = exports.bellNumbers = exports.kldivergence = exports.variance = exports.mean = exports.divide = exports.expm = exports.inv = exports.qr = exports.hypot = exports.usolveAll = exports.dotDivide = exports.log = exports.column = exports.catalan = exports.stirlingS2 = exports.distance = exports.det = exports.slu = exports.lup = exports.setUnion = exports.Spa = exports.lsolveAll = exports.lsolve = void 0;
|
9
9
|
|
10
10
|
var _configReadonly = require("./configReadonly.js");
|
11
11
|
|
@@ -475,17 +475,10 @@ var matrix = /* #__PURE__ */(0, _factoriesAny.createMatrix)({
|
|
475
475
|
typed: typed
|
476
476
|
});
|
477
477
|
exports.matrix = matrix;
|
478
|
-
var
|
479
|
-
|
480
|
-
Complex: Complex,
|
481
|
-
Fraction: Fraction,
|
482
|
-
config: _configReadonly.config,
|
483
|
-
isNegative: isNegative,
|
484
|
-
matrix: matrix,
|
485
|
-
typed: typed,
|
486
|
-
unaryMinus: unaryMinus
|
478
|
+
var abs = /* #__PURE__ */(0, _factoriesAny.createAbs)({
|
479
|
+
typed: typed
|
487
480
|
});
|
488
|
-
exports.
|
481
|
+
exports.abs = abs;
|
489
482
|
var gcd = /* #__PURE__ */(0, _factoriesAny.createGcd)({
|
490
483
|
BigNumber: BigNumber,
|
491
484
|
DenseMatrix: DenseMatrix,
|
@@ -720,10 +713,23 @@ var isZero = /* #__PURE__ */(0, _factoriesAny.createIsZero)({
|
|
720
713
|
typed: typed
|
721
714
|
});
|
722
715
|
exports.isZero = isZero;
|
723
|
-
var
|
716
|
+
var matrixFromFunction = /* #__PURE__ */(0, _factoriesAny.createMatrixFromFunction)({
|
717
|
+
isZero: isZero,
|
718
|
+
matrix: matrix,
|
724
719
|
typed: typed
|
725
720
|
});
|
726
|
-
exports.
|
721
|
+
exports.matrixFromFunction = matrixFromFunction;
|
722
|
+
var cbrt = /* #__PURE__ */(0, _factoriesAny.createCbrt)({
|
723
|
+
BigNumber: BigNumber,
|
724
|
+
Complex: Complex,
|
725
|
+
Fraction: Fraction,
|
726
|
+
config: _configReadonly.config,
|
727
|
+
isNegative: isNegative,
|
728
|
+
matrix: matrix,
|
729
|
+
typed: typed,
|
730
|
+
unaryMinus: unaryMinus
|
731
|
+
});
|
732
|
+
exports.cbrt = cbrt;
|
727
733
|
var floor = /* #__PURE__ */(0, _factoriesAny.createFloor)({
|
728
734
|
config: _configReadonly.config,
|
729
735
|
equalScalar: equalScalar,
|
@@ -898,6 +904,13 @@ var bignumber = /* #__PURE__ */(0, _factoriesAny.createBignumber)({
|
|
898
904
|
typed: typed
|
899
905
|
});
|
900
906
|
exports.bignumber = bignumber;
|
907
|
+
var matrixFromColumns = /* #__PURE__ */(0, _factoriesAny.createMatrixFromColumns)({
|
908
|
+
flatten: flatten,
|
909
|
+
matrix: matrix,
|
910
|
+
size: size,
|
911
|
+
typed: typed
|
912
|
+
});
|
913
|
+
exports.matrixFromColumns = matrixFromColumns;
|
901
914
|
var lcm = /* #__PURE__ */(0, _factoriesAny.createLcm)({
|
902
915
|
equalScalar: equalScalar,
|
903
916
|
matrix: matrix,
|
@@ -1001,14 +1014,13 @@ var permutations = /* #__PURE__ */(0, _factoriesAny.createPermutations)({
|
|
1001
1014
|
typed: typed
|
1002
1015
|
});
|
1003
1016
|
exports.permutations = permutations;
|
1004
|
-
var
|
1005
|
-
|
1006
|
-
equalScalar: equalScalar,
|
1017
|
+
var matrixFromRows = /* #__PURE__ */(0, _factoriesAny.createMatrixFromRows)({
|
1018
|
+
flatten: flatten,
|
1007
1019
|
matrix: matrix,
|
1008
|
-
|
1020
|
+
size: size,
|
1009
1021
|
typed: typed
|
1010
1022
|
});
|
1011
|
-
exports.
|
1023
|
+
exports.matrixFromRows = matrixFromRows;
|
1012
1024
|
var subtract = /* #__PURE__ */(0, _factoriesAny.createSubtract)({
|
1013
1025
|
DenseMatrix: DenseMatrix,
|
1014
1026
|
addScalar: addScalar,
|
@@ -1082,28 +1094,26 @@ var setSymDifference = /* #__PURE__ */(0, _factoriesAny.createSetSymDifference)(
|
|
1082
1094
|
typed: typed
|
1083
1095
|
});
|
1084
1096
|
exports.setSymDifference = setSymDifference;
|
1085
|
-
var
|
1086
|
-
|
1087
|
-
|
1088
|
-
floor: floor,
|
1097
|
+
var ceil = /* #__PURE__ */(0, _factoriesAny.createCeil)({
|
1098
|
+
config: _configReadonly.config,
|
1099
|
+
equalScalar: equalScalar,
|
1089
1100
|
matrix: matrix,
|
1101
|
+
round: round,
|
1090
1102
|
typed: typed
|
1091
1103
|
});
|
1092
|
-
exports.
|
1093
|
-
var
|
1094
|
-
|
1104
|
+
exports.ceil = ceil;
|
1105
|
+
var xor = /* #__PURE__ */(0, _factoriesAny.createXor)({
|
1106
|
+
DenseMatrix: DenseMatrix,
|
1095
1107
|
matrix: matrix,
|
1096
|
-
range: range,
|
1097
1108
|
typed: typed
|
1098
1109
|
});
|
1099
|
-
exports.
|
1100
|
-
var
|
1101
|
-
|
1102
|
-
|
1103
|
-
subtract: subtract,
|
1110
|
+
exports.xor = xor;
|
1111
|
+
var count = /* #__PURE__ */(0, _factoriesAny.createCount)({
|
1112
|
+
prod: prod,
|
1113
|
+
size: size,
|
1104
1114
|
typed: typed
|
1105
1115
|
});
|
1106
|
-
exports.
|
1116
|
+
exports.count = count;
|
1107
1117
|
var ctranspose = /* #__PURE__ */(0, _factoriesAny.createCtranspose)({
|
1108
1118
|
conj: conj,
|
1109
1119
|
transpose: transpose,
|
@@ -1123,12 +1133,21 @@ var setIsSubset = /* #__PURE__ */(0, _factoriesAny.createSetIsSubset)({
|
|
1123
1133
|
typed: typed
|
1124
1134
|
});
|
1125
1135
|
exports.setIsSubset = setIsSubset;
|
1126
|
-
var
|
1127
|
-
|
1136
|
+
var fix = /* #__PURE__ */(0, _factoriesAny.createFix)({
|
1137
|
+
Complex: Complex,
|
1138
|
+
ceil: ceil,
|
1139
|
+
floor: floor,
|
1128
1140
|
matrix: matrix,
|
1129
1141
|
typed: typed
|
1130
1142
|
});
|
1131
|
-
exports.
|
1143
|
+
exports.fix = fix;
|
1144
|
+
var diff = /* #__PURE__ */(0, _factoriesAny.createDiff)({
|
1145
|
+
matrix: matrix,
|
1146
|
+
number: number,
|
1147
|
+
subtract: subtract,
|
1148
|
+
typed: typed
|
1149
|
+
});
|
1150
|
+
exports.diff = diff;
|
1132
1151
|
var divideScalar = /* #__PURE__ */(0, _factoriesAny.createDivideScalar)({
|
1133
1152
|
numeric: numeric,
|
1134
1153
|
typed: typed
|
@@ -1250,12 +1269,13 @@ var catalan = /* #__PURE__ */(0, _factoriesAny.createCatalan)({
|
|
1250
1269
|
typed: typed
|
1251
1270
|
});
|
1252
1271
|
exports.catalan = catalan;
|
1253
|
-
var
|
1254
|
-
|
1255
|
-
|
1272
|
+
var column = /* #__PURE__ */(0, _factoriesAny.createColumn)({
|
1273
|
+
Index: Index,
|
1274
|
+
matrix: matrix,
|
1275
|
+
range: range,
|
1256
1276
|
typed: typed
|
1257
1277
|
});
|
1258
|
-
exports.
|
1278
|
+
exports.column = column;
|
1259
1279
|
var log = /* #__PURE__ */(0, _factoriesAny.createLog)({
|
1260
1280
|
Complex: Complex,
|
1261
1281
|
config: _configReadonly.config,
|
@@ -1413,16 +1433,33 @@ var eigs = /* #__PURE__ */(0, _factoriesAny.createEigs)({
|
|
1413
1433
|
addScalar: addScalar,
|
1414
1434
|
atan: atan,
|
1415
1435
|
bignumber: bignumber,
|
1436
|
+
column: column,
|
1437
|
+
complex: complex,
|
1416
1438
|
config: _configReadonly.config,
|
1417
1439
|
cos: cos,
|
1440
|
+
diag: diag,
|
1441
|
+
divideScalar: divideScalar,
|
1418
1442
|
equal: equal,
|
1443
|
+
flatten: flatten,
|
1444
|
+
im: im,
|
1419
1445
|
inv: inv,
|
1446
|
+
larger: larger,
|
1447
|
+
log10: log10,
|
1420
1448
|
matrix: matrix,
|
1449
|
+
matrixFromColumns: matrixFromColumns,
|
1421
1450
|
multiply: multiply,
|
1422
1451
|
multiplyScalar: multiplyScalar,
|
1452
|
+
number: number,
|
1453
|
+
qr: qr,
|
1454
|
+
re: re,
|
1455
|
+
round: round,
|
1423
1456
|
sin: sin,
|
1457
|
+
smaller: smaller,
|
1458
|
+
sqrt: sqrt,
|
1424
1459
|
subtract: subtract,
|
1425
|
-
|
1460
|
+
transpose: transpose,
|
1461
|
+
typed: typed,
|
1462
|
+
usolveAll: usolveAll
|
1426
1463
|
});
|
1427
1464
|
exports.eigs = eigs;
|
1428
1465
|
var intersect = /* #__PURE__ */(0, _factoriesAny.createIntersect)({
|
@@ -7,9 +7,7 @@ exports.createParserClass = void 0;
|
|
7
7
|
|
8
8
|
var _factory = require("../utils/factory.js");
|
9
9
|
|
10
|
-
var
|
11
|
-
|
12
|
-
var _customs = require("../utils/customs.js");
|
10
|
+
var _map = require("../utils/map.js");
|
13
11
|
|
14
12
|
var name = 'Parser';
|
15
13
|
var dependencies = ['parse'];
|
@@ -69,7 +67,10 @@ var createParserClass = /* #__PURE__ */(0, _factory.factory)(name, dependencies,
|
|
69
67
|
throw new SyntaxError('Constructor must be called with the new operator');
|
70
68
|
}
|
71
69
|
|
72
|
-
this
|
70
|
+
Object.defineProperty(this, 'scope', {
|
71
|
+
value: (0, _map.createEmptyMap)(),
|
72
|
+
writable: false
|
73
|
+
});
|
73
74
|
}
|
74
75
|
/**
|
75
76
|
* Attach type information
|
@@ -99,7 +100,9 @@ var createParserClass = /* #__PURE__ */(0, _factory.factory)(name, dependencies,
|
|
99
100
|
|
100
101
|
Parser.prototype.get = function (name) {
|
101
102
|
// TODO: validate arguments
|
102
|
-
|
103
|
+
if (this.scope.has(name)) {
|
104
|
+
return this.scope.get(name);
|
105
|
+
}
|
103
106
|
};
|
104
107
|
/**
|
105
108
|
* Get a map with all defined variables
|
@@ -108,7 +111,16 @@ var createParserClass = /* #__PURE__ */(0, _factory.factory)(name, dependencies,
|
|
108
111
|
|
109
112
|
|
110
113
|
Parser.prototype.getAll = function () {
|
111
|
-
return (0,
|
114
|
+
return (0, _map.toObject)(this.scope);
|
115
|
+
};
|
116
|
+
/**
|
117
|
+
* Get a map with all defined variables
|
118
|
+
* @return {Map} values
|
119
|
+
*/
|
120
|
+
|
121
|
+
|
122
|
+
Parser.prototype.getAllAsMap = function () {
|
123
|
+
return this.scope;
|
112
124
|
};
|
113
125
|
/**
|
114
126
|
* Set a symbol (a function or variable) by name from the parsers scope.
|
@@ -118,8 +130,8 @@ var createParserClass = /* #__PURE__ */(0, _factory.factory)(name, dependencies,
|
|
118
130
|
|
119
131
|
|
120
132
|
Parser.prototype.set = function (name, value) {
|
121
|
-
|
122
|
-
return
|
133
|
+
this.scope.set(name, value);
|
134
|
+
return value;
|
123
135
|
};
|
124
136
|
/**
|
125
137
|
* Remove a variable from the parsers scope
|
@@ -128,8 +140,7 @@ var createParserClass = /* #__PURE__ */(0, _factory.factory)(name, dependencies,
|
|
128
140
|
|
129
141
|
|
130
142
|
Parser.prototype.remove = function (name) {
|
131
|
-
|
132
|
-
delete this.scope[name];
|
143
|
+
this.scope["delete"](name);
|
133
144
|
};
|
134
145
|
/**
|
135
146
|
* Clear the scope with variables and functions
|
@@ -137,11 +148,7 @@ var createParserClass = /* #__PURE__ */(0, _factory.factory)(name, dependencies,
|
|
137
148
|
|
138
149
|
|
139
150
|
Parser.prototype.clear = function () {
|
140
|
-
|
141
|
-
if ((0, _object.hasOwnProperty)(this.scope, _name)) {
|
142
|
-
delete this.scope[_name];
|
143
|
-
}
|
144
|
-
}
|
151
|
+
this.scope.clear();
|
145
152
|
};
|
146
153
|
|
147
154
|
return Parser;
|
@@ -413,6 +413,12 @@ var _number = require("./construction/number.js");
|
|
413
413
|
|
414
414
|
var _matrix = require("./construction/matrix.js");
|
415
415
|
|
416
|
+
var _matrixFromFunction = require("./function/matrix/matrixFromFunction.js");
|
417
|
+
|
418
|
+
var _matrixFromRows = require("./function/matrix/matrixFromRows.js");
|
419
|
+
|
420
|
+
var _matrixFromColumns = require("./function/matrix/matrixFromColumns.js");
|
421
|
+
|
416
422
|
var _index = require("./construction/index.js");
|
417
423
|
|
418
424
|
var _fraction = require("./construction/fraction.js");
|
@@ -781,6 +787,9 @@ var embeddedDocs = {
|
|
781
787
|
inv: _inv.invDocs,
|
782
788
|
eigs: _eigs.eigsDocs,
|
783
789
|
kron: _kron.kronDocs,
|
790
|
+
matrixFromFunction: _matrixFromFunction.matrixFromFunctionDocs,
|
791
|
+
matrixFromRows: _matrixFromRows.matrixFromRowsDocs,
|
792
|
+
matrixFromColumns: _matrixFromColumns.matrixFromColumnsDocs,
|
784
793
|
map: _map.mapDocs,
|
785
794
|
ones: _ones.onesDocs,
|
786
795
|
partitionSelect: _partitionSelect.partitionSelectDocs,
|
@@ -10,6 +10,6 @@ var columnDocs = {
|
|
10
10
|
syntax: ['column(x, index)'],
|
11
11
|
description: 'Return a column from a matrix or array.',
|
12
12
|
examples: ['A = [[1, 2], [3, 4]]', 'column(A, 1)', 'column(A, 2)'],
|
13
|
-
seealso: ['row']
|
13
|
+
seealso: ['row', 'matrixFromColumns']
|
14
14
|
};
|
15
15
|
exports.columnDocs = columnDocs;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.matrixFromColumnsDocs = void 0;
|
7
|
+
var matrixFromColumnsDocs = {
|
8
|
+
name: 'matrixFromColumns',
|
9
|
+
category: 'Matrix',
|
10
|
+
syntax: ['math.matrixFromColumns(...arr)', 'math.matrixFromColumns(row1, row2)', 'math.matrixFromColumns(row1, row2, row3)'],
|
11
|
+
description: 'Create a dense matrix from vectors as individual columns.',
|
12
|
+
examples: ['matrixFromColumns([1, 2, 3], [[4],[5],[6]])'],
|
13
|
+
seealso: ['matrix', 'matrixFromRows', 'matrixFromFunction', 'zeros']
|
14
|
+
};
|
15
|
+
exports.matrixFromColumnsDocs = matrixFromColumnsDocs;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.matrixFromFunctionDocs = void 0;
|
7
|
+
var matrixFromFunctionDocs = {
|
8
|
+
name: 'matrixFromFunction',
|
9
|
+
category: 'Matrix',
|
10
|
+
syntax: ['math.matrixFromFunction(size, fn)', 'math.matrixFromFunction(size, fn, format)', 'math.matrixFromFunction(size, fn, format, datatype)', 'math.matrixFromFunction(size, format, fn)', 'math.matrixFromFunction(size, format, datatype, fn)'],
|
11
|
+
description: 'Create a matrix by evaluating a generating function at each index.',
|
12
|
+
examples: ['f(I) = I[1] - I[2]', 'matrixFromFunction([3,3], f)', 'g(I) = I[1] - I[2] == 1 ? 4 : 0', 'matrixFromFunction([100, 100], "sparse", g)', 'matrixFromFunction([5], random)'],
|
13
|
+
seealso: ['matrix', 'matrixFromRows', 'matrixFromColumns', 'zeros']
|
14
|
+
};
|
15
|
+
exports.matrixFromFunctionDocs = matrixFromFunctionDocs;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.matrixFromRowsDocs = void 0;
|
7
|
+
var matrixFromRowsDocs = {
|
8
|
+
name: 'matrixFromRows',
|
9
|
+
category: 'Matrix',
|
10
|
+
syntax: ['math.matrixFromRows(...arr)', 'math.matrixFromRows(row1, row2)', 'math.matrixFromRows(row1, row2, row3)'],
|
11
|
+
description: 'Create a dense matrix from vectors as individual rows.',
|
12
|
+
examples: ['matrixFromRows([1, 2, 3], [[4],[5],[6]])'],
|
13
|
+
seealso: ['matrix', 'matrixFromColumns', 'matrixFromFunction', 'zeros']
|
14
|
+
};
|
15
|
+
exports.matrixFromRowsDocs = matrixFromRowsDocs;
|
@@ -10,6 +10,6 @@ var rowDocs = {
|
|
10
10
|
syntax: ['row(x, index)'],
|
11
11
|
description: 'Return a row from a matrix or array.',
|
12
12
|
examples: ['A = [[1, 2], [3, 4]]', 'row(A, 1)', 'row(A, 2)'],
|
13
|
-
seealso: ['column']
|
13
|
+
seealso: ['column', 'matrixFromRows']
|
14
14
|
};
|
15
15
|
exports.rowDocs = rowDocs;
|
@@ -9,6 +9,8 @@ var _collection = require("../../utils/collection.js");
|
|
9
9
|
|
10
10
|
var _factory = require("../../utils/factory.js");
|
11
11
|
|
12
|
+
var _map = require("../../utils/map.js");
|
13
|
+
|
12
14
|
var name = 'evaluate';
|
13
15
|
var dependencies = ['typed', 'parse'];
|
14
16
|
var createEvaluate = /* #__PURE__ */(0, _factory.factory)(name, dependencies, function (_ref) {
|
@@ -49,19 +51,19 @@ var createEvaluate = /* #__PURE__ */(0, _factory.factory)(name, dependencies, fu
|
|
49
51
|
*/
|
50
52
|
return typed(name, {
|
51
53
|
string: function string(expr) {
|
52
|
-
var scope =
|
54
|
+
var scope = (0, _map.createEmptyMap)();
|
53
55
|
return parse(expr).compile().evaluate(scope);
|
54
56
|
},
|
55
|
-
'string, Object': function
|
57
|
+
'string, Map | Object': function stringMapObject(expr, scope) {
|
56
58
|
return parse(expr).compile().evaluate(scope);
|
57
59
|
},
|
58
60
|
'Array | Matrix': function ArrayMatrix(expr) {
|
59
|
-
var scope =
|
61
|
+
var scope = (0, _map.createEmptyMap)();
|
60
62
|
return (0, _collection.deepMap)(expr, function (entry) {
|
61
63
|
return parse(entry).compile().evaluate(scope);
|
62
64
|
});
|
63
65
|
},
|
64
|
-
'Array | Matrix, Object': function
|
66
|
+
'Array | Matrix, Map | Object': function ArrayMatrixMapObject(expr, scope) {
|
65
67
|
return (0, _collection.deepMap)(expr, function (entry) {
|
66
68
|
return parse(entry).compile().evaluate(scope);
|
67
69
|
});
|
@@ -86,6 +86,7 @@ var createAccessorNode = /* #__PURE__ */(0, _factory.factory)(name, dependencies
|
|
86
86
|
if (this.index.isObjectProperty()) {
|
87
87
|
var prop = this.index.getObjectProperty();
|
88
88
|
return function evalAccessorNode(scope, args, context) {
|
89
|
+
// get a property from an object evaluated using the scope.
|
89
90
|
return (0, _customs.getSafeProperty)(evalObject(scope, args, context), prop);
|
90
91
|
};
|
91
92
|
} else {
|
@@ -132,7 +132,9 @@ var createAssignmentNode = /* #__PURE__ */(0, _factory.factory)(name, dependenci
|
|
132
132
|
}
|
133
133
|
|
134
134
|
return function evalAssignmentNode(scope, args, context) {
|
135
|
-
|
135
|
+
var value = evalValue(scope, args, context);
|
136
|
+
scope.set(name, value);
|
137
|
+
return value;
|
136
138
|
};
|
137
139
|
} else if (this.index.isObjectProperty()) {
|
138
140
|
// apply an object property for example `a.b=2`
|
@@ -140,7 +142,8 @@ var createAssignmentNode = /* #__PURE__ */(0, _factory.factory)(name, dependenci
|
|
140
142
|
return function evalAssignmentNode(scope, args, context) {
|
141
143
|
var object = evalObject(scope, args, context);
|
142
144
|
var value = evalValue(scope, args, context);
|
143
|
-
|
145
|
+
(0, _customs.setSafeProperty)(object, prop, value);
|
146
|
+
return value;
|
144
147
|
};
|
145
148
|
} else if ((0, _is.isSymbolNode)(this.object)) {
|
146
149
|
// update a matrix subset, for example `a[2]=3`
|
@@ -149,7 +152,7 @@ var createAssignmentNode = /* #__PURE__ */(0, _factory.factory)(name, dependenci
|
|
149
152
|
var value = evalValue(scope, args, context);
|
150
153
|
var index = evalIndex(scope, args, childObject); // Important: we pass childObject instead of context
|
151
154
|
|
152
|
-
|
155
|
+
scope.set(name, assign(childObject, index, value));
|
153
156
|
return value;
|
154
157
|
};
|
155
158
|
} else {
|
@@ -17,8 +17,6 @@ var _latex = require("../../utils/latex.js");
|
|
17
17
|
|
18
18
|
var _operators = require("../operators.js");
|
19
19
|
|
20
|
-
var _customs = require("../../utils/customs.js");
|
21
|
-
|
22
20
|
var _factory = require("../../utils/factory.js");
|
23
21
|
|
24
22
|
var name = 'FunctionAssignmentNode';
|
@@ -48,7 +46,7 @@ var createFunctionAssignmentNode = /* #__PURE__ */(0, _factory.factory)(name, de
|
|
48
46
|
if (typeof name !== 'string') throw new TypeError('String expected for parameter "name"');
|
49
47
|
if (!Array.isArray(params)) throw new TypeError('Array containing strings or objects expected for parameter "params"');
|
50
48
|
if (!(0, _is.isNode)(expr)) throw new TypeError('Node expected for parameter "expr"');
|
51
|
-
if (
|
49
|
+
if (_keywords.keywords.has(name)) throw new Error('Illegal function name, "' + name + '" is a reserved keyword');
|
52
50
|
this.name = name;
|
53
51
|
this.params = params.map(function (param) {
|
54
52
|
return param && param.name || param;
|
@@ -103,7 +101,7 @@ var createFunctionAssignmentNode = /* #__PURE__ */(0, _factory.factory)(name, de
|
|
103
101
|
|
104
102
|
var fn = typed(name, signatures);
|
105
103
|
fn.syntax = syntax;
|
106
|
-
|
104
|
+
scope.set(name, fn);
|
107
105
|
return fn;
|
108
106
|
};
|
109
107
|
};
|