@cortex-js/compute-engine 0.28.0 → 0.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{compute-engine.js → compute-engine.cjs} +22673 -23299
- package/dist/compute-engine.esm.js +22673 -23299
- package/dist/compute-engine.min.cjs +129 -0
- package/dist/compute-engine.min.esm.js +48 -64
- package/dist/{math-json.js → math-json.cjs} +2 -2
- package/dist/math-json.esm.js +2 -2
- package/dist/{math-json.min.js → math-json.min.cjs} +2 -2
- package/dist/math-json.min.esm.js +2 -2
- package/dist/types/common/ansi-codes.d.ts +1 -1
- package/dist/types/common/fuzzy-string-match.d.ts +1 -1
- package/dist/types/common/grapheme-splitter.d.ts +1 -1
- package/dist/types/common/interruptible.d.ts +1 -1
- package/dist/types/common/json5.d.ts +1 -1
- package/dist/types/common/one-of.d.ts +2 -1
- package/dist/types/common/signals.d.ts +1 -2
- package/dist/types/common/type/boxed-type.d.ts +2 -1
- package/dist/types/common/type/parse.d.ts +1 -1
- package/dist/types/common/type/primitive.d.ts +1 -1
- package/dist/types/common/type/serialize.d.ts +1 -1
- package/dist/types/common/type/subtype.d.ts +1 -1
- package/dist/types/common/type/types.d.ts +102 -107
- package/dist/types/common/type/utils.d.ts +1 -1
- package/dist/types/common/utils.d.ts +1 -1
- package/dist/types/compute-engine/assume.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +11 -14
- package/dist/types/compute-engine/boxed-expression/apply.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/arithmetic-add.d.ts +3 -3
- package/dist/types/compute-engine/boxed-expression/arithmetic-mul-div.d.ts +27 -0
- package/dist/types/compute-engine/boxed-expression/arithmetic-power.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/ascii-math.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/box.d.ts +5 -5
- package/dist/types/compute-engine/boxed-expression/boxed-function-definition.d.ts +12 -13
- package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +4 -7
- package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +6 -8
- package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/boxed-string.d.ts +2 -3
- package/dist/types/compute-engine/boxed-expression/boxed-symbol-definition.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +6 -7
- package/dist/types/compute-engine/boxed-expression/boxed-tensor.d.ts +5 -8
- package/dist/types/compute-engine/boxed-expression/cache.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/canonical.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/compare.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/expand.d.ts +3 -3
- package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/factor.d.ts +1 -3
- package/dist/types/compute-engine/boxed-expression/flatten.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/hold.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/match.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/negate.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/numerics.d.ts +3 -3
- package/dist/types/compute-engine/boxed-expression/order.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/polynomials.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/product.d.ts +5 -5
- package/dist/types/compute-engine/boxed-expression/rules.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/serialize.d.ts +3 -3
- package/dist/types/compute-engine/boxed-expression/sgn.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/simplify.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/solve.d.ts +1 -2
- package/dist/types/compute-engine/boxed-expression/terms.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/trigonometry.d.ts +2 -9
- package/dist/types/compute-engine/boxed-expression/utils.d.ts +13 -4
- package/dist/types/compute-engine/boxed-expression/validate.d.ts +8 -9
- package/dist/types/compute-engine/collection-utils.d.ts +1 -1
- package/dist/types/compute-engine/compile.d.ts +2 -4
- package/dist/types/compute-engine/cost-function.d.ts +1 -1
- package/dist/types/compute-engine/function-utils.d.ts +1 -1
- package/dist/types/compute-engine/{boxed-expression/public.d.ts → global-types.d.ts} +835 -807
- package/dist/types/compute-engine/{compute-engine.d.ts → index.d.ts} +7 -10
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-algebra.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-calculus.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-complex.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-core.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-linear-algebra.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-logic.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-other.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-relational-operators.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-sets.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-statistics.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-symbols.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions.d.ts +2 -2
- package/dist/types/compute-engine/latex-syntax/parse-identifier.d.ts +2 -2
- package/dist/types/compute-engine/latex-syntax/parse.d.ts +2 -2
- package/dist/types/compute-engine/latex-syntax/serialize-number.d.ts +2 -2
- package/dist/types/compute-engine/latex-syntax/serializer-style.d.ts +2 -2
- package/dist/types/compute-engine/latex-syntax/serializer.d.ts +2 -2
- package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/{public.d.ts → types.d.ts} +3 -1
- package/dist/types/compute-engine/library/arithmetic.d.ts +1 -2
- package/dist/types/compute-engine/library/calculus.d.ts +1 -1
- package/dist/types/compute-engine/library/collections.d.ts +2 -2
- package/dist/types/compute-engine/library/complex.d.ts +1 -1
- package/dist/types/compute-engine/library/control-structures.d.ts +1 -1
- package/dist/types/compute-engine/library/core.d.ts +1 -1
- package/dist/types/compute-engine/library/invisible-operator.d.ts +2 -2
- package/dist/types/compute-engine/library/library.d.ts +3 -3
- package/dist/types/compute-engine/library/linear-algebra.d.ts +1 -1
- package/dist/types/compute-engine/library/logic.d.ts +1 -1
- package/dist/types/compute-engine/library/polynomials.d.ts +1 -1
- package/dist/types/compute-engine/library/random-expression.d.ts +1 -1
- package/dist/types/compute-engine/library/relational-operator.d.ts +1 -1
- package/dist/types/compute-engine/library/sets.d.ts +1 -1
- package/dist/types/compute-engine/library/statistics.d.ts +1 -1
- package/dist/types/compute-engine/library/trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/library/utils.d.ts +1 -1
- package/dist/types/compute-engine/numeric-value/big-numeric-value.d.ts +3 -4
- package/dist/types/compute-engine/numeric-value/exact-numeric-value.d.ts +3 -5
- package/dist/types/compute-engine/numeric-value/machine-numeric-value.d.ts +3 -4
- package/dist/types/compute-engine/numeric-value/{public.d.ts → types.d.ts} +9 -5
- package/dist/types/compute-engine/numerics/bigint.d.ts +1 -1
- package/dist/types/compute-engine/numerics/expression.d.ts +1 -1
- package/dist/types/compute-engine/numerics/interval.d.ts +1 -1
- package/dist/types/compute-engine/numerics/monte-carlo.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-bigint.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-bignum.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-complex.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric.d.ts +2 -7
- package/dist/types/compute-engine/numerics/primes.d.ts +1 -1
- package/dist/types/compute-engine/numerics/rationals.d.ts +1 -5
- package/dist/types/compute-engine/numerics/richardson.d.ts +1 -1
- package/dist/types/compute-engine/numerics/special-functions.d.ts +4 -4
- package/dist/types/compute-engine/numerics/statistics.d.ts +2 -2
- package/dist/types/compute-engine/numerics/strings.d.ts +1 -1
- package/dist/types/compute-engine/numerics/types.d.ts +30 -0
- package/dist/types/compute-engine/symbolic/derivative.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/distribute.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-rules.d.ts +1 -1
- package/dist/types/compute-engine/{boxed-expression → tensor}/tensor-fields.d.ts +19 -18
- package/dist/types/compute-engine/tensor/tensors.d.ts +9 -12
- package/dist/types/compute-engine/types.d.ts +11 -0
- package/dist/types/compute-engine.d.ts +3 -6
- package/dist/types/math-json/identifiers.d.ts +1 -1
- package/dist/types/math-json/types.d.ts +4 -2
- package/dist/types/math-json/utils.d.ts +1 -1
- package/dist/types/math-json.d.ts +2 -2
- package/package.json +7 -7
- package/dist/compute-engine.min.js +0 -145
- package/dist/types/common/buffer.d.ts +0 -9
- package/dist/types/common/styled-text.d.ts +0 -28
- package/dist/types/common/syntax-highlighter.d.ts +0 -40
- package/dist/types/common/terminal.d.ts +0 -19
- package/dist/types/compute-engine/boxed-expression/arithmetic-divide.d.ts +0 -12
- package/dist/types/compute-engine/boxed-expression/arithmetic-multiply.d.ts +0 -16
- package/dist/types/compute-engine/debug.d.ts +0 -3
- package/dist/types/compute-engine/numerics/bignum.d.ts +0 -12
- package/dist/types/compute-engine/private.d.ts +0 -29
- package/dist/types/compute-engine/public.d.ts +0 -42
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
/* 0.
|
|
2
|
-
import type { BoxedExpression, CollectionHandlers, CompiledExpression, EvaluateOptions, Sign } from './public';
|
|
3
|
-
import { Type, TypeString } from '../../common/type/types';
|
|
1
|
+
/* 0.29.1 */
|
|
4
2
|
import { OneOf } from '../../common/one-of';
|
|
5
3
|
import { BoxedType } from '../../common/type/boxed-type';
|
|
4
|
+
import type { FunctionDefinition, BoxedExpression, BoxedFunctionDefinition, CollectionHandlers, CompiledExpression, EvaluateOptions, ComputeEngine, RuntimeScope, Sign } from '../global-types';
|
|
6
5
|
export declare class _BoxedFunctionDefinition implements BoxedFunctionDefinition {
|
|
7
|
-
engine:
|
|
6
|
+
engine: ComputeEngine;
|
|
8
7
|
scope: RuntimeScope;
|
|
9
8
|
name: string;
|
|
10
9
|
description?: string | string[];
|
|
@@ -21,34 +20,34 @@ export declare class _BoxedFunctionDefinition implements BoxedFunctionDefinition
|
|
|
21
20
|
signature: BoxedType;
|
|
22
21
|
inferredSignature: boolean;
|
|
23
22
|
type?: (ops: ReadonlyArray<BoxedExpression>, options: {
|
|
24
|
-
engine:
|
|
23
|
+
engine: ComputeEngine;
|
|
25
24
|
}) => BoxedType | Type | TypeString | undefined;
|
|
26
25
|
sgn?: (ops: ReadonlyArray<BoxedExpression>, options: {
|
|
27
|
-
engine:
|
|
26
|
+
engine: ComputeEngine;
|
|
28
27
|
}) => Sign | undefined;
|
|
29
28
|
eq?: (a: BoxedExpression, b: BoxedExpression) => boolean | undefined;
|
|
30
29
|
neq?: (a: BoxedExpression, b: BoxedExpression) => boolean | undefined;
|
|
31
30
|
even?: (ops: ReadonlyArray<BoxedExpression>, options: {
|
|
32
|
-
engine:
|
|
31
|
+
engine: ComputeEngine;
|
|
33
32
|
}) => boolean | undefined;
|
|
34
33
|
canonical?: (ops: ReadonlyArray<BoxedExpression>, options: {
|
|
35
|
-
engine:
|
|
34
|
+
engine: ComputeEngine;
|
|
36
35
|
}) => BoxedExpression | null;
|
|
37
36
|
evaluate?: (ops: ReadonlyArray<BoxedExpression>, options: Partial<EvaluateOptions> & {
|
|
38
|
-
engine:
|
|
37
|
+
engine: ComputeEngine;
|
|
39
38
|
}) => BoxedExpression | undefined;
|
|
40
39
|
evaluateAsync?: (ops: ReadonlyArray<BoxedExpression>, options?: Partial<EvaluateOptions> & {
|
|
41
|
-
engine?:
|
|
40
|
+
engine?: ComputeEngine;
|
|
42
41
|
}) => Promise<BoxedExpression | undefined>;
|
|
43
42
|
evalDimension?: (ops: ReadonlyArray<BoxedExpression>, options: {
|
|
44
|
-
engine:
|
|
43
|
+
engine: ComputeEngine;
|
|
45
44
|
}) => BoxedExpression;
|
|
46
45
|
compile?: (expr: BoxedExpression) => CompiledExpression;
|
|
47
46
|
collection?: Partial<CollectionHandlers>;
|
|
48
|
-
constructor(ce:
|
|
47
|
+
constructor(ce: ComputeEngine, name: string, def: FunctionDefinition);
|
|
49
48
|
infer(sig: Type): void;
|
|
50
49
|
update(def: FunctionDefinition): void;
|
|
51
50
|
reset(): void;
|
|
52
51
|
}
|
|
53
|
-
export declare function makeFunctionDefinition(engine:
|
|
52
|
+
export declare function makeFunctionDefinition(engine: ComputeEngine, name: string, def: OneOf<[FunctionDefinition | BoxedFunctionDefinition]>): BoxedFunctionDefinition;
|
|
54
53
|
export declare function isBoxedFunctionDefinition(x: any): x is BoxedFunctionDefinition;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/* 0.
|
|
2
|
-
import type {
|
|
3
|
-
import
|
|
4
|
-
import { NumericValue } from '../numeric-value/public';
|
|
1
|
+
/* 0.29.1 */
|
|
2
|
+
import type { SimplifyOptions, ReplaceOptions, PatternMatchOptions, BoxedExpression, BoxedBaseDefinition, BoxedFunctionDefinition, BoxedRuleSet, BoxedSubstitution, CanonicalOptions, EvaluateOptions, ComputeEngine, Metadata, Rule, RuntimeScope, Sign, Substitution } from '../global-types';
|
|
3
|
+
import { NumericValue } from '../numeric-value/types';
|
|
5
4
|
import { _BoxedExpression } from './abstract-boxed-expression';
|
|
6
5
|
import { Type } from '../../common/type/types';
|
|
7
6
|
import { BoxedType } from '../../common/type/boxed-type';
|
|
@@ -16,8 +15,6 @@ import { BoxedType } from '../../common/type/boxed-type';
|
|
|
16
15
|
* The definition contains the signature of the function, and the
|
|
17
16
|
* implementation of the function.
|
|
18
17
|
*
|
|
19
|
-
* @noInheritDoc
|
|
20
|
-
*
|
|
21
18
|
*/
|
|
22
19
|
export declare class BoxedFunction extends _BoxedExpression {
|
|
23
20
|
private readonly _name;
|
|
@@ -32,7 +29,7 @@ export declare class BoxedFunction extends _BoxedExpression {
|
|
|
32
29
|
private _valueN;
|
|
33
30
|
private _sgn;
|
|
34
31
|
private _type;
|
|
35
|
-
constructor(ce:
|
|
32
|
+
constructor(ce: ComputeEngine, name: string, ops: ReadonlyArray<BoxedExpression>, options?: {
|
|
36
33
|
metadata?: Metadata;
|
|
37
34
|
canonical?: boolean;
|
|
38
35
|
structural?: boolean;
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.29.1 */
|
|
2
2
|
import { Decimal } from 'decimal.js';
|
|
3
|
-
import type { BoxedExpression, IComputeEngine, Metadata, PatternMatchOptions, BoxedSubstitution, EvaluateOptions, BoxedRuleSet, ReplaceOptions, Rule, Substitution, CanonicalOptions, SimplifyOptions, Sign } from '../public';
|
|
4
3
|
import type { Expression, MathJsonNumber } from '../../math-json';
|
|
5
|
-
import { SmallInteger } from '../numerics/
|
|
6
|
-
import {
|
|
7
|
-
import { ExactNumericValueData, NumericValue, NumericValueData } from '../numeric-value/public';
|
|
4
|
+
import type { Rational, SmallInteger } from '../numerics/types';
|
|
5
|
+
import { ExactNumericValueData, NumericValue, NumericValueData } from '../numeric-value/types';
|
|
8
6
|
import { _BoxedExpression } from './abstract-boxed-expression';
|
|
9
7
|
import { BoxedType } from '../../common/type/boxed-type';
|
|
8
|
+
import type { BoxedRuleSet, BoxedSubstitution, CanonicalOptions, EvaluateOptions, ComputeEngine, Metadata, Rule, Sign, Substitution, BoxedExpression, PatternMatchOptions, ReplaceOptions, SimplifyOptions } from '../global-types';
|
|
10
9
|
/**
|
|
11
10
|
* BoxedNumber
|
|
12
11
|
*
|
|
13
|
-
* @noInheritDoc
|
|
14
12
|
*/
|
|
15
13
|
export declare class BoxedNumber extends _BoxedExpression {
|
|
16
14
|
protected readonly _value: SmallInteger | NumericValue;
|
|
@@ -27,7 +25,7 @@ export declare class BoxedNumber extends _BoxedExpression {
|
|
|
27
25
|
* We may store as a machine number if a Decimal is passed that is in machine
|
|
28
26
|
* range
|
|
29
27
|
*/
|
|
30
|
-
constructor(ce:
|
|
28
|
+
constructor(ce: ComputeEngine, value: SmallInteger | NumericValueData | ExactNumericValueData | NumericValue, options?: {
|
|
31
29
|
metadata?: Metadata;
|
|
32
30
|
canonical?: boolean;
|
|
33
31
|
});
|
|
@@ -90,4 +88,4 @@ export declare class BoxedNumber extends _BoxedExpression {
|
|
|
90
88
|
evaluate(options?: Partial<EvaluateOptions>): BoxedExpression;
|
|
91
89
|
N(): BoxedExpression;
|
|
92
90
|
}
|
|
93
|
-
export declare function canonicalNumber(ce:
|
|
91
|
+
export declare function canonicalNumber(ce: ComputeEngine, value: number | bigint | string | Decimal | Complex | Rational | NumericValue | MathJsonNumber): number | NumericValue;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
2
|
-
import type { BoxedExpression } from '
|
|
1
|
+
/* 0.29.1 */
|
|
2
|
+
import type { BoxedExpression } from '../global-types';
|
|
3
3
|
export declare function isWildcard(expr: BoxedExpression): expr is BoxedSymbol;
|
|
4
4
|
export declare function wildcardName(expr: BoxedExpression): string | null;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.29.1 */
|
|
2
2
|
import { _BoxedExpression } from './abstract-boxed-expression';
|
|
3
3
|
import { BoxedType } from '../../common/type/boxed-type';
|
|
4
4
|
/**
|
|
5
5
|
* BoxedString
|
|
6
6
|
*
|
|
7
|
-
* @noInheritDoc
|
|
8
7
|
*/
|
|
9
8
|
export declare class BoxedString extends _BoxedExpression {
|
|
10
9
|
private readonly _string;
|
|
11
|
-
constructor(ce:
|
|
10
|
+
constructor(ce: ComputeEngine, expr: string, metadata?: Metadata);
|
|
12
11
|
get json(): string;
|
|
13
12
|
get hash(): number;
|
|
14
13
|
get operator(): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.29.1 */
|
|
2
2
|
import { Type, TypeString } from '../../common/type/types';
|
|
3
3
|
import { BoxedType } from '../../common/type/boxed-type';
|
|
4
4
|
/**
|
|
@@ -44,7 +44,7 @@ export declare class _BoxedSymbolDefinition implements BoxedSymbolDefinition {
|
|
|
44
44
|
neq?: (a: BoxedExpression) => boolean | undefined;
|
|
45
45
|
cmp?: (a: BoxedExpression) => '=' | '>' | '<' | undefined;
|
|
46
46
|
collection?: Partial<CollectionHandlers>;
|
|
47
|
-
constructor(ce:
|
|
47
|
+
constructor(ce: ComputeEngine, name: string, def: SymbolDefinition);
|
|
48
48
|
get isFunction(): boolean;
|
|
49
49
|
get isConstant(): boolean;
|
|
50
50
|
/** The symbol was previously inferred, but now it has a declaration. Update the def accordingly (we can't replace defs, as other expressions may be referencing them) */
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.29.1 */
|
|
2
2
|
import type { Expression } from '../../math-json/types';
|
|
3
3
|
import type { Type, TypeString } from '../../common/type/types';
|
|
4
|
-
import type { BoxedExpression,
|
|
5
|
-
import { NumericValue } from '../numeric-value/
|
|
4
|
+
import type { BoxedExpression, SimplifyOptions, PatternMatchOptions, ReplaceOptions, RuntimeScope, BoxedSymbolDefinition, BoxedFunctionDefinition, ComputeEngine, Metadata, CanonicalOptions, BoxedBaseDefinition, BoxedSubstitution, EvaluateOptions, Rule, BoxedRule, BoxedRuleSet, Substitution, Sign } from '../global-types';
|
|
5
|
+
import { NumericValue } from '../numeric-value/types';
|
|
6
6
|
import { _BoxedExpression } from './abstract-boxed-expression';
|
|
7
|
-
import { BigNum } from '../numerics/
|
|
7
|
+
import type { BigNum } from '../numerics/types';
|
|
8
8
|
import type { OneOf } from '../../common/one-of';
|
|
9
9
|
import { BoxedType } from '../../common/type/boxed-type';
|
|
10
10
|
/**
|
|
@@ -20,7 +20,6 @@ import { BoxedType } from '../../common/type/boxed-type';
|
|
|
20
20
|
* not a function expression, i.e. `Sin`, not `["Sin", "Pi"]`. This is used
|
|
21
21
|
* for example in `["InverseFunction", "Sin"]`
|
|
22
22
|
*
|
|
23
|
-
* @noInheritDoc
|
|
24
23
|
*
|
|
25
24
|
*/
|
|
26
25
|
export declare class BoxedSymbol extends _BoxedExpression {
|
|
@@ -29,7 +28,7 @@ export declare class BoxedSymbol extends _BoxedExpression {
|
|
|
29
28
|
private _hash;
|
|
30
29
|
private _def;
|
|
31
30
|
private _isStructural;
|
|
32
|
-
constructor(ce:
|
|
31
|
+
constructor(ce: ComputeEngine, name: string, options?: {
|
|
33
32
|
metadata?: Metadata;
|
|
34
33
|
canonical?: CanonicalOptions;
|
|
35
34
|
structural?: boolean;
|
|
@@ -129,4 +128,4 @@ export declare class BoxedSymbol extends _BoxedExpression {
|
|
|
129
128
|
indexOf(expr: BoxedExpression): number;
|
|
130
129
|
subsetOf(rhs: BoxedExpression, strict: boolean): boolean;
|
|
131
130
|
}
|
|
132
|
-
export declare function makeCanonicalSymbol(ce:
|
|
131
|
+
export declare function makeCanonicalSymbol(ce: ComputeEngine, name: string): BoxedExpression;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
/* 0.
|
|
2
|
-
import
|
|
3
|
-
import { TensorDataType } from './tensor-fields';
|
|
4
|
-
import { NumericValue } from '../numeric-value/public';
|
|
1
|
+
/* 0.29.1 */
|
|
2
|
+
import { NumericValue } from '../numeric-value/types';
|
|
5
3
|
import { _BoxedExpression } from './abstract-boxed-expression';
|
|
6
|
-
import { AbstractTensor
|
|
4
|
+
import { AbstractTensor } from '../tensor/tensors';
|
|
7
5
|
import { BoxedType } from '../../common/type/boxed-type';
|
|
6
|
+
import type { ComputeEngine, TensorDataType, Metadata, BoxedBaseDefinition, BoxedFunctionDefinition, BoxedSubstitution, EvaluateOptions, TensorData, BoxedExpression, SimplifyOptions, PatternMatchOptions } from '../global-types';
|
|
8
7
|
/**
|
|
9
8
|
* A boxed tensor represents an expression that can be represented by a tensor.
|
|
10
9
|
* This could be a vector, matrix or multi-dimensional array.
|
|
@@ -15,8 +14,6 @@ import { BoxedType } from '../../common/type/boxed-type';
|
|
|
15
14
|
* The structural counterpart (expression if input is tensor, or tensor
|
|
16
15
|
* if input is expression) is created lazily.
|
|
17
16
|
*
|
|
18
|
-
* @noInheritDoc
|
|
19
|
-
*
|
|
20
17
|
*/
|
|
21
18
|
export declare class BoxedTensor extends _BoxedExpression {
|
|
22
19
|
readonly options?: {
|
|
@@ -27,7 +24,7 @@ export declare class BoxedTensor extends _BoxedExpression {
|
|
|
27
24
|
private readonly _operator?;
|
|
28
25
|
private readonly _ops?;
|
|
29
26
|
private _expression;
|
|
30
|
-
constructor(ce:
|
|
27
|
+
constructor(ce: ComputeEngine, input: {
|
|
31
28
|
op?: string;
|
|
32
29
|
ops: ReadonlyArray<BoxedExpression>;
|
|
33
30
|
} | AbstractTensor<'expression'>, options?: {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.29.1 */
|
|
2
2
|
export declare function canonicalForm(expr: BoxedExpression, forms: CanonicalOptions): BoxedExpression;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/* 0.
|
|
2
|
-
export declare function expandProducts(ce:
|
|
1
|
+
/* 0.29.1 */
|
|
2
|
+
export declare function expandProducts(ce: ComputeEngine, ops: ReadonlyArray<BoxedExpression>): BoxedExpression | null;
|
|
3
3
|
export declare function choose(n: number, k: number): number;
|
|
4
4
|
/** Attempt to transform the expression (h, ops) into a sum */
|
|
5
|
-
export declare function expandFunction(ce:
|
|
5
|
+
export declare function expandFunction(ce: ComputeEngine, h: string, ops: ReadonlyArray<BoxedExpression>): BoxedExpression | null;
|
|
6
6
|
/** Apply the distributive law if the expression is a product of sums.
|
|
7
7
|
* For example, a(b + c) = ab + ac
|
|
8
8
|
* Expand the expression if it is a power of a sum.
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
2
|
-
import { NumericValue } from '../numeric-value/public';
|
|
1
|
+
/* 0.29.1 */
|
|
3
2
|
/** Combine rational expressions into a single fraction */
|
|
4
3
|
export declare function together(op: BoxedExpression): BoxedExpression;
|
|
5
4
|
/**
|
|
@@ -9,4 +8,3 @@ export declare function together(op: BoxedExpression): BoxedExpression;
|
|
|
9
8
|
* - (2x) * (2y) -> 4xy
|
|
10
9
|
*/
|
|
11
10
|
export declare function factor(expr: BoxedExpression): BoxedExpression;
|
|
12
|
-
export declare function getPiTerm(expr: BoxedExpression): [k: NumericValue, t: NumericValue];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.29.1 */
|
|
2
2
|
export declare function canonicalNegate(expr: BoxedExpression): BoxedExpression;
|
|
3
3
|
/**
|
|
4
4
|
* Distribute `Negate` (multiply by -1) if expr is a number literal, an
|
|
@@ -8,4 +8,4 @@ export declare function canonicalNegate(expr: BoxedExpression): BoxedExpression;
|
|
|
8
8
|
* `-3x` -> ["Negate, ["Multiply", 3, "x"]] -> ["Multiply, -3, x]
|
|
9
9
|
*/
|
|
10
10
|
export declare function negate(expr: BoxedExpression): BoxedExpression;
|
|
11
|
-
export declare function negateProduct(ce:
|
|
11
|
+
export declare function negateProduct(ce: ComputeEngine, args: ReadonlyArray<BoxedExpression>): BoxedExpression;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/* 0.
|
|
2
|
-
import type { Rational } from '../numerics/
|
|
3
|
-
import type { BoxedExpression } from '
|
|
1
|
+
/* 0.29.1 */
|
|
2
|
+
import type { Rational } from '../numerics/types';
|
|
3
|
+
import type { BoxedExpression } from '../global-types';
|
|
4
4
|
export declare function asRational(expr: BoxedExpression): Rational | undefined;
|
|
5
5
|
export declare function asBigint(expr: BoxedExpression | undefined): bigint | null;
|
|
6
6
|
export declare function asBignum(expr: BoxedExpression | undefined): Decimal | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/* 0.
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
/* 0.29.1 */
|
|
2
|
+
import { NumericValue } from '../numeric-value/types';
|
|
3
|
+
import type { BoxedExpression, ComputeEngine } from '../global-types';
|
|
4
4
|
/**
|
|
5
5
|
* Group terms in a product by common term.
|
|
6
6
|
*
|
|
@@ -21,7 +21,7 @@ export declare class Product {
|
|
|
21
21
|
readonly options?: {
|
|
22
22
|
canonical?: boolean;
|
|
23
23
|
};
|
|
24
|
-
engine:
|
|
24
|
+
engine: ComputeEngine;
|
|
25
25
|
coefficient: NumericValue;
|
|
26
26
|
terms: {
|
|
27
27
|
term: BoxedExpression;
|
|
@@ -29,7 +29,7 @@ export declare class Product {
|
|
|
29
29
|
}[];
|
|
30
30
|
private _isCanonical;
|
|
31
31
|
static from(expr: BoxedExpression): Product;
|
|
32
|
-
constructor(ce:
|
|
32
|
+
constructor(ce: ComputeEngine, xs?: ReadonlyArray<BoxedExpression>, options?: {
|
|
33
33
|
canonical?: boolean;
|
|
34
34
|
});
|
|
35
35
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.29.1 */
|
|
2
2
|
export declare const ConditionParent: {
|
|
3
3
|
boolean: string;
|
|
4
4
|
string: string;
|
|
@@ -100,7 +100,7 @@ export declare function checkConditions(x: BoxedExpression, conditions: string[]
|
|
|
100
100
|
/**
|
|
101
101
|
* Create a boxed rule set from a collection of non-boxed rules
|
|
102
102
|
*/
|
|
103
|
-
export declare function boxRules(ce:
|
|
103
|
+
export declare function boxRules(ce: ComputeEngine, rs: Rule | ReadonlyArray<Rule | BoxedRule> | BoxedRuleSet | undefined | null, options?: {
|
|
104
104
|
canonical?: boolean;
|
|
105
105
|
}): BoxedRuleSet;
|
|
106
106
|
/**
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* 0.
|
|
2
|
-
import type {
|
|
3
|
-
export declare function serializeJson(ce:
|
|
1
|
+
/* 0.29.1 */
|
|
2
|
+
import type { ComputeEngine, BoxedExpression, JsonSerializationOptions } from '../global-types';
|
|
3
|
+
export declare function serializeJson(ce: ComputeEngine, expr: BoxedExpression, options: Readonly<JsonSerializationOptions>): Expression;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.29.1 */
|
|
2
2
|
export declare class Terms {
|
|
3
3
|
private engine;
|
|
4
4
|
private terms;
|
|
5
|
-
constructor(ce:
|
|
5
|
+
constructor(ce: ComputeEngine, terms: ReadonlyArray<BoxedExpression>);
|
|
6
6
|
private add;
|
|
7
7
|
private find;
|
|
8
8
|
N(): BoxedExpression;
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.29.1 */
|
|
2
2
|
export declare function Fu(exp: BoxedExpression): RuleStep | undefined;
|
|
3
3
|
/** Assuming x in an expression in radians, convert to current angular unit. */
|
|
4
4
|
export declare function radiansToAngle(x: BoxedExpression | undefined): BoxedExpression | undefined;
|
|
5
5
|
export declare function evalTrig(name: string, op: BoxedExpression | undefined): BoxedExpression | undefined;
|
|
6
|
-
export declare function processInverseFunction(ce:
|
|
6
|
+
export declare function processInverseFunction(ce: ComputeEngine, xs: ReadonlyArray<BoxedExpression>): BoxedExpression | undefined;
|
|
7
7
|
export declare function trigSign(operator: string, x: BoxedExpression): Sign | undefined;
|
|
8
8
|
export declare function isConstructible(x: string | BoxedExpression): boolean;
|
|
9
9
|
export declare function constructibleValues(operator: string, x: BoxedExpression | undefined): undefined | BoxedExpression;
|
|
10
|
-
/**
|
|
11
|
-
* Return the angle in the range [0, 2π) that is equivalent to the given angle.
|
|
12
|
-
*
|
|
13
|
-
* @param x
|
|
14
|
-
* @returns
|
|
15
|
-
*/
|
|
16
|
-
export declare function canonicalAngle(x: BoxedExpression | undefined): BoxedExpression | undefined;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.29.1 */
|
|
2
2
|
import { Type } from '../../common/type/types';
|
|
3
|
+
import { NumericValue } from '../types';
|
|
3
4
|
export declare function isBoxedExpression(x: unknown): x is BoxedExpression;
|
|
4
5
|
/**
|
|
5
6
|
* For any numeric result, if `bignumPreferred()` is true, calculate using
|
|
6
7
|
* bignums. If `bignumPreferred()` is false, calculate using machine numbers
|
|
7
8
|
*/
|
|
8
|
-
export declare function bignumPreferred(ce:
|
|
9
|
+
export declare function bignumPreferred(ce: ComputeEngine): boolean;
|
|
9
10
|
export declare function isLatexString(s: unknown): s is string;
|
|
10
11
|
export declare function asLatexString(s: unknown): string | null;
|
|
11
12
|
export declare function hashCode(s: string): number;
|
|
@@ -40,6 +41,14 @@ export declare function getImaginaryFactor(expr: number | BoxedExpression): Boxe
|
|
|
40
41
|
export declare function normalizeFlags(flags: Partial<NumericFlags> | undefined): NumericFlags | undefined;
|
|
41
42
|
export declare function isSymbolDefinition(def: any): def is SymbolDefinition;
|
|
42
43
|
export declare function isFunctionDefinition(def: any): def is FunctionDefinition;
|
|
43
|
-
export declare function semiCanonical(ce:
|
|
44
|
-
export declare function canonical(ce:
|
|
44
|
+
export declare function semiCanonical(ce: ComputeEngine, xs: ReadonlyArray<SemiBoxedExpression>): ReadonlyArray<BoxedExpression>;
|
|
45
|
+
export declare function canonical(ce: ComputeEngine, xs: ReadonlyArray<SemiBoxedExpression>): ReadonlyArray<BoxedExpression>;
|
|
45
46
|
export declare function domainToType(expr: BoxedExpression): Type;
|
|
47
|
+
/**
|
|
48
|
+
* Return the angle in the range [0, 2π) that is equivalent to the given angle.
|
|
49
|
+
*
|
|
50
|
+
* @param x
|
|
51
|
+
* @returns
|
|
52
|
+
*/
|
|
53
|
+
export declare function canonicalAngle(x: BoxedExpression | undefined): BoxedExpression | undefined;
|
|
54
|
+
export declare function getPiTerm(expr: BoxedExpression): [k: NumericValue, t: NumericValue];
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
/* 0.
|
|
2
|
-
import type {
|
|
3
|
-
import { Type } from '../../common/type/types';
|
|
1
|
+
/* 0.29.1 */
|
|
2
|
+
import type { BoxedExpression, ComputeEngine } from '../global-types';
|
|
4
3
|
/**
|
|
5
4
|
* Check that the number of arguments is as expected.
|
|
6
5
|
*
|
|
7
6
|
* Converts the arguments to canonical, and flattens the sequence.
|
|
8
7
|
*/
|
|
9
|
-
export declare function checkArity(ce:
|
|
8
|
+
export declare function checkArity(ce: ComputeEngine, ops: ReadonlyArray<BoxedExpression>, count: number): ReadonlyArray<BoxedExpression>;
|
|
10
9
|
/**
|
|
11
10
|
* Validation of arguments is normally done by checking the signature of the
|
|
12
11
|
* function vs the arguments of the expression. However, we have a fastpath
|
|
@@ -23,7 +22,7 @@ export declare function checkArity(ce: IComputeEngine, ops: ReadonlyArray<BoxedE
|
|
|
23
22
|
*
|
|
24
23
|
* Flattens sequence expressions.
|
|
25
24
|
*/
|
|
26
|
-
export declare function checkNumericArgs(ce:
|
|
25
|
+
export declare function checkNumericArgs(ce: ComputeEngine, ops: ReadonlyArray<BoxedExpression>, options?: number | {
|
|
27
26
|
count?: number;
|
|
28
27
|
flatten?: string;
|
|
29
28
|
}): ReadonlyArray<BoxedExpression>;
|
|
@@ -32,12 +31,12 @@ export declare function checkNumericArgs(ce: IComputeEngine, ops: ReadonlyArray<
|
|
|
32
31
|
*
|
|
33
32
|
* Converts the arguments to canonical
|
|
34
33
|
*/
|
|
35
|
-
export declare function checkType(ce:
|
|
36
|
-
export declare function checkTypes(ce:
|
|
34
|
+
export declare function checkType(ce: ComputeEngine, arg: BoxedExpression | undefined | null, type: Type | undefined): BoxedExpression;
|
|
35
|
+
export declare function checkTypes(ce: ComputeEngine, args: ReadonlyArray<BoxedExpression>, types: Type[]): ReadonlyArray<BoxedExpression>;
|
|
37
36
|
/**
|
|
38
37
|
* Check that the argument is pure.
|
|
39
38
|
*/
|
|
40
|
-
export declare function checkPure(ce:
|
|
39
|
+
export declare function checkPure(ce: ComputeEngine, arg: BoxedExpression | BoxedExpression | undefined | null): BoxedExpression;
|
|
41
40
|
/**
|
|
42
41
|
*
|
|
43
42
|
* If the arguments match the parameters, return null.
|
|
@@ -46,4 +45,4 @@ export declare function checkPure(ce: IComputeEngine, arg: BoxedExpression | Box
|
|
|
46
45
|
* arguments.
|
|
47
46
|
*
|
|
48
47
|
*/
|
|
49
|
-
export declare function validateArguments(ce:
|
|
48
|
+
export declare function validateArguments(ce: ComputeEngine, ops: ReadonlyArray<BoxedExpression>, signature: Type, lazy?: boolean, threadable?: boolean): ReadonlyArray<BoxedExpression> | null;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
/* 0.
|
|
2
|
-
import
|
|
3
|
-
export type CompiledType = boolean | number | string | object;
|
|
4
|
-
export type JSSource = string;
|
|
1
|
+
/* 0.29.1 */
|
|
2
|
+
import { BoxedExpression, CompiledType, JSSource } from './global-types';
|
|
5
3
|
export type CompiledOperators = Record<MathJsonIdentifier, [
|
|
6
4
|
op: string,
|
|
7
5
|
prec: number
|