mathjs 10.5.2 → 10.5.3
Sign up to get free protection for your applications and to get access to all the features.
- package/HISTORY.md +8 -0
- package/lib/browser/math.js +3 -3
- package/lib/browser/math.js.map +1 -1
- package/lib/cjs/header.js +2 -2
- package/lib/cjs/version.js +1 -1
- package/lib/esm/version.js +1 -1
- package/package.json +6 -11
- package/docs/command_line_interface.md +0 -87
- package/docs/core/chaining.md +0 -41
- package/docs/core/configuration.md +0 -144
- package/docs/core/extension.md +0 -263
- package/docs/core/index.md +0 -21
- package/docs/core/serialization.md +0 -50
- package/docs/custom_bundling.md +0 -116
- package/docs/datatypes/bignumbers.md +0 -102
- package/docs/datatypes/complex_numbers.md +0 -168
- package/docs/datatypes/fractions.md +0 -75
- package/docs/datatypes/index.md +0 -67
- package/docs/datatypes/matrices.md +0 -375
- package/docs/datatypes/numbers.md +0 -106
- package/docs/datatypes/units.md +0 -444
- package/docs/expressions/algebra.md +0 -110
- package/docs/expressions/customization.md +0 -379
- package/docs/expressions/expression_trees.md +0 -710
- package/docs/expressions/html_classes.md +0 -38
- package/docs/expressions/index.md +0 -21
- package/docs/expressions/parsing.md +0 -224
- package/docs/expressions/security.md +0 -89
- package/docs/expressions/syntax.md +0 -706
- package/docs/getting_started.md +0 -124
- package/docs/index.md +0 -39
- package/docs/reference/classes/densematrix.md +0 -247
- package/docs/reference/classes/fibonacciheap.md +0 -70
- package/docs/reference/classes/matrixindex.md +0 -133
- package/docs/reference/classes/matrixrange.md +0 -158
- package/docs/reference/classes/resultset.md +0 -47
- package/docs/reference/classes/sparsematrix.md +0 -245
- package/docs/reference/classes/unit.md +0 -242
- package/docs/reference/classes.md +0 -86
- package/docs/reference/constants.md +0 -29
- package/docs/reference/functions/abs.md +0 -46
- package/docs/reference/functions/acos.md +0 -49
- package/docs/reference/functions/acosh.md +0 -47
- package/docs/reference/functions/acot.md +0 -48
- package/docs/reference/functions/acoth.md +0 -46
- package/docs/reference/functions/acsc.md +0 -49
- package/docs/reference/functions/acsch.md +0 -46
- package/docs/reference/functions/add.md +0 -59
- package/docs/reference/functions/and.md +0 -53
- package/docs/reference/functions/apply.md +0 -56
- package/docs/reference/functions/arg.md +0 -53
- package/docs/reference/functions/asec.md +0 -49
- package/docs/reference/functions/asech.md +0 -46
- package/docs/reference/functions/asin.md +0 -49
- package/docs/reference/functions/asinh.md +0 -46
- package/docs/reference/functions/atan.md +0 -49
- package/docs/reference/functions/atan2.md +0 -56
- package/docs/reference/functions/atanh.md +0 -46
- package/docs/reference/functions/bellNumbers.md +0 -45
- package/docs/reference/functions/bignumber.md +0 -47
- package/docs/reference/functions/bin.md +0 -45
- package/docs/reference/functions/bitAnd.md +0 -51
- package/docs/reference/functions/bitNot.md +0 -51
- package/docs/reference/functions/bitOr.md +0 -52
- package/docs/reference/functions/bitXor.md +0 -51
- package/docs/reference/functions/boolean.md +0 -50
- package/docs/reference/functions/catalan.md +0 -45
- package/docs/reference/functions/cbrt.md +0 -60
- package/docs/reference/functions/ceil.md +0 -63
- package/docs/reference/functions/chain.md +0 -54
- package/docs/reference/functions/clone.md +0 -43
- package/docs/reference/functions/column.md +0 -45
- package/docs/reference/functions/combinations.md +0 -49
- package/docs/reference/functions/combinationsWithRep.md +0 -49
- package/docs/reference/functions/compare.md +0 -67
- package/docs/reference/functions/compareNatural.md +0 -92
- package/docs/reference/functions/compareText.md +0 -54
- package/docs/reference/functions/compile.md +0 -56
- package/docs/reference/functions/complex.md +0 -17
- package/docs/reference/functions/composition.md +0 -46
- package/docs/reference/functions/concat.md +0 -56
- package/docs/reference/functions/config.md +0 -44
- package/docs/reference/functions/conj.md +0 -50
- package/docs/reference/functions/cos.md +0 -51
- package/docs/reference/functions/cosh.md +0 -46
- package/docs/reference/functions/cot.md +0 -47
- package/docs/reference/functions/coth.md +0 -49
- package/docs/reference/functions/count.md +0 -45
- package/docs/reference/functions/createUnit.md +0 -52
- package/docs/reference/functions/cross.md +0 -58
- package/docs/reference/functions/csc.md +0 -47
- package/docs/reference/functions/csch.md +0 -49
- package/docs/reference/functions/ctranspose.md +0 -50
- package/docs/reference/functions/cube.md +0 -51
- package/docs/reference/functions/cumsum.md +0 -57
- package/docs/reference/functions/deepEqual.md +0 -53
- package/docs/reference/functions/derivative.md +0 -61
- package/docs/reference/functions/det.md +0 -49
- package/docs/reference/functions/diag.md +0 -61
- package/docs/reference/functions/diff.md +0 -70
- package/docs/reference/functions/distance.md +0 -80
- package/docs/reference/functions/divide.md +0 -55
- package/docs/reference/functions/dot.md +0 -48
- package/docs/reference/functions/dotDivide.md +0 -52
- package/docs/reference/functions/dotMultiply.md +0 -52
- package/docs/reference/functions/dotPow.md +0 -49
- package/docs/reference/functions/eigs.md +0 -54
- package/docs/reference/functions/equal.md +0 -75
- package/docs/reference/functions/equalText.md +0 -53
- package/docs/reference/functions/erf.md +0 -49
- package/docs/reference/functions/evaluate.md +0 -56
- package/docs/reference/functions/exp.md +0 -54
- package/docs/reference/functions/expm.md +0 -49
- package/docs/reference/functions/expm1.md +0 -54
- package/docs/reference/functions/factorial.md +0 -49
- package/docs/reference/functions/fft.md +0 -35
- package/docs/reference/functions/filter.md +0 -50
- package/docs/reference/functions/fix.md +0 -62
- package/docs/reference/functions/flatten.md +0 -46
- package/docs/reference/functions/floor.md +0 -66
- package/docs/reference/functions/forEach.md +0 -41
- package/docs/reference/functions/format.md +0 -127
- package/docs/reference/functions/fraction.md +0 -45
- package/docs/reference/functions/gamma.md +0 -49
- package/docs/reference/functions/gcd.md +0 -50
- package/docs/reference/functions/getMatrixDataType.md +0 -59
- package/docs/reference/functions/hasNumericValue.md +0 -55
- package/docs/reference/functions/help.md +0 -42
- package/docs/reference/functions/hex.md +0 -45
- package/docs/reference/functions/hypot.md +0 -51
- package/docs/reference/functions/identity.md +0 -57
- package/docs/reference/functions/ifft.md +0 -35
- package/docs/reference/functions/im.md +0 -53
- package/docs/reference/functions/import.md +0 -68
- package/docs/reference/functions/index.md +0 -55
- package/docs/reference/functions/intersect.md +0 -50
- package/docs/reference/functions/inv.md +0 -45
- package/docs/reference/functions/invmod.md +0 -47
- package/docs/reference/functions/isInteger.md +0 -55
- package/docs/reference/functions/isNaN.md +0 -56
- package/docs/reference/functions/isNegative.md +0 -55
- package/docs/reference/functions/isNumeric.md +0 -55
- package/docs/reference/functions/isPositive.md +0 -57
- package/docs/reference/functions/isPrime.md +0 -54
- package/docs/reference/functions/isZero.md +0 -59
- package/docs/reference/functions/kldivergence.md +0 -41
- package/docs/reference/functions/kron.md +0 -53
- package/docs/reference/functions/larger.md +0 -60
- package/docs/reference/functions/largerEq.md +0 -56
- package/docs/reference/functions/lcm.md +0 -54
- package/docs/reference/functions/leafCount.md +0 -52
- package/docs/reference/functions/leftShift.md +0 -52
- package/docs/reference/functions/lgamma.md +0 -46
- package/docs/reference/functions/log.md +0 -57
- package/docs/reference/functions/log10.md +0 -50
- package/docs/reference/functions/log1p.md +0 -54
- package/docs/reference/functions/log2.md +0 -50
- package/docs/reference/functions/lsolve.md +0 -51
- package/docs/reference/functions/lsolveAll.md +0 -51
- package/docs/reference/functions/lup.md +0 -52
- package/docs/reference/functions/lusolve.md +0 -59
- package/docs/reference/functions/mad.md +0 -50
- package/docs/reference/functions/map.md +0 -65
- package/docs/reference/functions/matrix.md +0 -56
- package/docs/reference/functions/matrixFromColumns.md +0 -49
- package/docs/reference/functions/matrixFromFunction.md +0 -54
- package/docs/reference/functions/matrixFromRows.md +0 -49
- package/docs/reference/functions/max.md +0 -61
- package/docs/reference/functions/mean.md +0 -57
- package/docs/reference/functions/median.md +0 -57
- package/docs/reference/functions/min.md +0 -61
- package/docs/reference/functions/mod.md +0 -59
- package/docs/reference/functions/mode.md +0 -50
- package/docs/reference/functions/multinomial.md +0 -46
- package/docs/reference/functions/multiply.md +0 -60
- package/docs/reference/functions/norm.md +0 -59
- package/docs/reference/functions/not.md +0 -50
- package/docs/reference/functions/nthRoot.md +0 -53
- package/docs/reference/functions/nthRoots.md +0 -58
- package/docs/reference/functions/number.md +0 -49
- package/docs/reference/functions/numeric.md +0 -52
- package/docs/reference/functions/oct.md +0 -45
- package/docs/reference/functions/ones.md +0 -59
- package/docs/reference/functions/or.md +0 -53
- package/docs/reference/functions/parse.md +0 -56
- package/docs/reference/functions/parser.md +0 -70
- package/docs/reference/functions/partitionSelect.md +0 -53
- package/docs/reference/functions/permutations.md +0 -51
- package/docs/reference/functions/pickRandom.md +0 -59
- package/docs/reference/functions/pinv.md +0 -44
- package/docs/reference/functions/pow.md +0 -65
- package/docs/reference/functions/print.md +0 -64
- package/docs/reference/functions/prod.md +0 -55
- package/docs/reference/functions/qr.md +0 -65
- package/docs/reference/functions/quantileSeq.md +0 -62
- package/docs/reference/functions/random.md +0 -54
- package/docs/reference/functions/randomInt.md +0 -53
- package/docs/reference/functions/range.md +0 -70
- package/docs/reference/functions/rationalize.md +0 -68
- package/docs/reference/functions/re.md +0 -53
- package/docs/reference/functions/reshape.md +0 -60
- package/docs/reference/functions/resize.md +0 -51
- package/docs/reference/functions/resolve.md +0 -46
- package/docs/reference/functions/rightArithShift.md +0 -52
- package/docs/reference/functions/rightLogShift.md +0 -52
- package/docs/reference/functions/rotate.md +0 -53
- package/docs/reference/functions/rotationMatrix.md +0 -57
- package/docs/reference/functions/round.md +0 -61
- package/docs/reference/functions/row.md +0 -45
- package/docs/reference/functions/sec.md +0 -47
- package/docs/reference/functions/sech.md +0 -49
- package/docs/reference/functions/setCartesian.md +0 -49
- package/docs/reference/functions/setDifference.md +0 -47
- package/docs/reference/functions/setDistinct.md +0 -43
- package/docs/reference/functions/setIntersect.md +0 -46
- package/docs/reference/functions/setIsSubset.md +0 -47
- package/docs/reference/functions/setMultiplicity.md +0 -46
- package/docs/reference/functions/setPowerset.md +0 -43
- package/docs/reference/functions/setSize.md +0 -47
- package/docs/reference/functions/setSymDifference.md +0 -47
- package/docs/reference/functions/setUnion.md +0 -46
- package/docs/reference/functions/sign.md +0 -52
- package/docs/reference/functions/simplify.md +0 -130
- package/docs/reference/functions/simplifyConstant.md +0 -52
- package/docs/reference/functions/simplifyCore.md +0 -50
- package/docs/reference/functions/sin.md +0 -51
- package/docs/reference/functions/sinh.md +0 -46
- package/docs/reference/functions/size.md +0 -50
- package/docs/reference/functions/slu.md +0 -57
- package/docs/reference/functions/smaller.md +0 -60
- package/docs/reference/functions/smallerEq.md +0 -56
- package/docs/reference/functions/sort.md +0 -56
- package/docs/reference/functions/sparse.md +0 -51
- package/docs/reference/functions/splitUnit.md +0 -37
- package/docs/reference/functions/sqrt.md +0 -50
- package/docs/reference/functions/sqrtm.md +0 -46
- package/docs/reference/functions/square.md +0 -51
- package/docs/reference/functions/squeeze.md +0 -53
- package/docs/reference/functions/std.md +0 -76
- package/docs/reference/functions/stirlingS2.md +0 -52
- package/docs/reference/functions/string.md +0 -49
- package/docs/reference/functions/subset.md +0 -65
- package/docs/reference/functions/subtract.md +0 -54
- package/docs/reference/functions/sum.md +0 -54
- package/docs/reference/functions/symbolicEqual.md +0 -62
- package/docs/reference/functions/tan.md +0 -49
- package/docs/reference/functions/tanh.md +0 -50
- package/docs/reference/functions/to.md +0 -47
- package/docs/reference/functions/trace.md +0 -50
- package/docs/reference/functions/transpose.md +0 -49
- package/docs/reference/functions/typeOf.md +0 -81
- package/docs/reference/functions/typed.md +0 -56
- package/docs/reference/functions/unaryMinus.md +0 -49
- package/docs/reference/functions/unaryPlus.md +0 -48
- package/docs/reference/functions/unequal.md +0 -74
- package/docs/reference/functions/unit.md +0 -48
- package/docs/reference/functions/usolve.md +0 -51
- package/docs/reference/functions/usolveAll.md +0 -51
- package/docs/reference/functions/variance.md +0 -78
- package/docs/reference/functions/xgcd.md +0 -47
- package/docs/reference/functions/xor.md +0 -53
- package/docs/reference/functions/zeros.md +0 -57
- package/docs/reference/functions.md +0 -297
- package/docs/reference/index.md +0 -5
- package/examples/advanced/convert_fraction_to_bignumber.js +0 -59
- package/examples/advanced/custom_argument_parsing.js +0 -98
- package/examples/advanced/custom_datatype.js +0 -56
- package/examples/advanced/custom_evaluate_using_factories.js +0 -19
- package/examples/advanced/custom_evaluate_using_import.js +0 -18
- package/examples/advanced/custom_loading.js +0 -33
- package/examples/advanced/custom_relational_functions.js +0 -62
- package/examples/advanced/custom_scope_objects.js +0 -115
- package/examples/advanced/expression_trees.js +0 -55
- package/examples/advanced/function_transform.js +0 -50
- package/examples/advanced/more_secure_eval.js +0 -36
- package/examples/advanced/use_bigint.js +0 -43
- package/examples/advanced/web_server/math_worker.js +0 -24
- package/examples/advanced/web_server/server.js +0 -80
- package/examples/algebra.js +0 -34
- package/examples/basic_usage.js +0 -49
- package/examples/bignumbers.js +0 -52
- package/examples/browser/angle_configuration.html +0 -134
- package/examples/browser/basic_usage.html +0 -39
- package/examples/browser/currency_conversion.html +0 -125
- package/examples/browser/custom_separators.html +0 -81
- package/examples/browser/plot.html +0 -78
- package/examples/browser/pretty_printing_with_mathjax.html +0 -122
- package/examples/browser/printing_html.html +0 -170
- package/examples/browser/requirejs_loading.html +0 -20
- package/examples/browser/rocket_trajectory_optimization.html +0 -301
- package/examples/browser/webworkers/webworkers.html +0 -80
- package/examples/browser/webworkers/worker.js +0 -28
- package/examples/chaining.js +0 -56
- package/examples/complex_numbers.js +0 -67
- package/examples/expressions.js +0 -188
- package/examples/fractions.js +0 -74
- package/examples/import.js +0 -95
- package/examples/matrices.js +0 -101
- package/examples/objects.js +0 -35
- package/examples/package.json +0 -3
- package/examples/serialization.js +0 -16
- package/examples/sparse_matrices.js +0 -19
- package/examples/units.js +0 -108
package/docs/getting_started.md
DELETED
@@ -1,124 +0,0 @@
|
|
1
|
-
# Getting Started
|
2
|
-
|
3
|
-
This getting started describes how to install, load, and use math.js.
|
4
|
-
|
5
|
-
|
6
|
-
## Install
|
7
|
-
|
8
|
-
Math.js can be installed using various package managers like [npm](https://npmjs.org/), or by just downloading the library from the website: [https://mathjs.org/download.html](https://mathjs.org/download.html).
|
9
|
-
|
10
|
-
To install via npm, run:
|
11
|
-
|
12
|
-
npm install mathjs
|
13
|
-
|
14
|
-
Other ways to install math.js are described on the [website](https://mathjs.org/download.html).
|
15
|
-
|
16
|
-
|
17
|
-
## Load
|
18
|
-
|
19
|
-
Math.js can be used in node.js and in the browser. The library must be loaded
|
20
|
-
and instantiated. When creating an instance, one can optionally provide
|
21
|
-
configuration options as described in
|
22
|
-
[Configuration](core/configuration.md).
|
23
|
-
|
24
|
-
### ES modules
|
25
|
-
|
26
|
-
Load the functions you need and use them:
|
27
|
-
|
28
|
-
```js
|
29
|
-
import { sqrt } from 'mathjs'
|
30
|
-
|
31
|
-
console.log(sqrt(-4).toString()) // 2i
|
32
|
-
```
|
33
|
-
|
34
|
-
To use lightweight, number only implementations of all functions:
|
35
|
-
|
36
|
-
```js
|
37
|
-
import { sqrt } from 'mathjs/number'
|
38
|
-
|
39
|
-
console.log(sqrt(4).toString()) // 2
|
40
|
-
console.log(sqrt(-4).toString()) // NaN
|
41
|
-
```
|
42
|
-
|
43
|
-
You can create a mathjs instance allowing [configuration](core/configuration.md) and importing of external functions as follows:
|
44
|
-
|
45
|
-
```js
|
46
|
-
import { create, all } from 'mathjs'
|
47
|
-
|
48
|
-
const config = { }
|
49
|
-
const math = create(all, config)
|
50
|
-
|
51
|
-
console.log(math.sqrt(-4).toString()) // 2i
|
52
|
-
```
|
53
|
-
|
54
|
-
How to optimize your bundle size using tree-shaking is described on the page
|
55
|
-
[Custom bundling](custom_bundling.md).
|
56
|
-
|
57
|
-
|
58
|
-
### Node.js
|
59
|
-
|
60
|
-
Load math.js in [node.js](https://nodejs.org/) (CommonJS module system):
|
61
|
-
|
62
|
-
```js
|
63
|
-
const { sqrt } = require('mathjs')
|
64
|
-
|
65
|
-
console.log(sqrt(-4).toString()) // 2i
|
66
|
-
```
|
67
|
-
|
68
|
-
|
69
|
-
### Browser
|
70
|
-
|
71
|
-
Math.js can be loaded as a regular JavaScript file in the browser, use the global
|
72
|
-
variable `math` to access the libary once loaded:
|
73
|
-
|
74
|
-
```html
|
75
|
-
<!DOCTYPE HTML>
|
76
|
-
<html>
|
77
|
-
<head>
|
78
|
-
<script src="math.js" type="text/javascript"></script>
|
79
|
-
</head>
|
80
|
-
<body>
|
81
|
-
<script type="text/javascript">
|
82
|
-
console.log(math.sqrt(-4).toString()) // 2i
|
83
|
-
</script>
|
84
|
-
</body>
|
85
|
-
</html>
|
86
|
-
```
|
87
|
-
|
88
|
-
## Use
|
89
|
-
|
90
|
-
Math.js can be used similar to JavaScript's built-in Math library. Besides that,
|
91
|
-
math.js can evaluate expressions (see [Expressions](expressions/index.md)) and
|
92
|
-
supports chaining (see [Chaining](core/chaining.md)).
|
93
|
-
|
94
|
-
The example code below shows how to use math.js. More examples can be found in the
|
95
|
-
section [Examples](https://mathjs.org/examples/index.html).
|
96
|
-
|
97
|
-
```js
|
98
|
-
// functions and constants
|
99
|
-
math.round(math.e, 3) // 2.718
|
100
|
-
math.atan2(3, -3) / math.pi // 0.75
|
101
|
-
math.log(10000, 10) // 4
|
102
|
-
math.sqrt(-4) // 2i
|
103
|
-
math.pow([[-1, 2], [3, 1]], 2) // [[7, 0], [0, 7]]
|
104
|
-
|
105
|
-
// expressions
|
106
|
-
math.evaluate('12 / (2.3 + 0.7)') // 4
|
107
|
-
math.evaluate('12.7 cm to inch') // 5 inch
|
108
|
-
math.evaluate('sin(45 deg) ^ 2') // 0.5
|
109
|
-
math.evaluate('9 / 3 + 2i') // 3 + 2i
|
110
|
-
math.evaluate('det([-1, 2; 3, 1])') // -7
|
111
|
-
|
112
|
-
// chained operations
|
113
|
-
math.chain(3)
|
114
|
-
.add(4)
|
115
|
-
.multiply(2)
|
116
|
-
.done() // 14
|
117
|
-
```
|
118
|
-
|
119
|
-
## Next
|
120
|
-
|
121
|
-
To learn more about math.js, check out the available documentation and examples:
|
122
|
-
|
123
|
-
- [Documentation](index.md)
|
124
|
-
- [Examples](https://mathjs.org/examples/index.html)
|
package/docs/index.md
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
# Documentation
|
2
|
-
|
3
|
-
[Math.js](https://mathjs.org) is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with different data types like numbers, big numbers, complex numbers, fractions, units, and matrices.
|
4
|
-
|
5
|
-
Math.js can be used in the browser, in node.js and in any JavaScript engine. Installation and download instructions are available on the [Download page](https://mathjs.org/download.html) of the website.
|
6
|
-
|
7
|
-
## Getting Started
|
8
|
-
|
9
|
-
- [Getting Started](getting_started.md)
|
10
|
-
- [Examples](//mathjs.org/examples/index.html)
|
11
|
-
|
12
|
-
## Documentation
|
13
|
-
|
14
|
-
- **[Core](core/index.md)**
|
15
|
-
- [Configuration](core/configuration.md)
|
16
|
-
- [Chaining](core/chaining.md)
|
17
|
-
- [Extension](core/extension.md)
|
18
|
-
- [Serialization](core/serialization.md)
|
19
|
-
- **[Expressions](expressions/index.md)**
|
20
|
-
- [Parsing and evaluation](expressions/parsing.md)
|
21
|
-
- [Syntax](expressions/syntax.md)
|
22
|
-
- [Expression trees](expressions/expression_trees.md)
|
23
|
-
- [Algebra](expressions/algebra.md)
|
24
|
-
- [Customization](expressions/customization.md)
|
25
|
-
- [Security](expressions/security.md)
|
26
|
-
- **[Data Types](datatypes/index.md)**
|
27
|
-
- [Numbers](datatypes/numbers.md)
|
28
|
-
- [BigNumbers](datatypes/bignumbers.md)
|
29
|
-
- [Fractions](datatypes/fractions.md)
|
30
|
-
- [Complex Numbers](datatypes/complex_numbers.md)
|
31
|
-
- [Matrices](datatypes/matrices.md)
|
32
|
-
- [Units](datatypes/units.md)
|
33
|
-
- **[Reference](reference/index.md)**
|
34
|
-
- [Classes](reference/classes.md)
|
35
|
-
- [Functions](reference/functions.md)
|
36
|
-
- [Constants](reference/constants.md)
|
37
|
-
- [Custom bundling](custom_bundling.md)
|
38
|
-
- [Command Line Interface](command_line_interface.md)
|
39
|
-
- [History](../HISTORY.md)
|
@@ -1,247 +0,0 @@
|
|
1
|
-
<a name="DenseMatrix"></a>
|
2
|
-
## DenseMatrix
|
3
|
-
Dense Matrix implementation. This type implements an efficient Array format
|
4
|
-
for dense matrices.
|
5
|
-
|
6
|
-
* _instance_
|
7
|
-
* [.storage()](#DenseMatrix+storage) ⇒ <code>string</code>
|
8
|
-
* [.datatype()](#DenseMatrix+datatype) ⇒ <code>string</code>
|
9
|
-
* [.create(data, [datatype])](#DenseMatrix+create)
|
10
|
-
* [.subset(index, [replacement], [defaultValue])](#DenseMatrix+subset)
|
11
|
-
* [.get(index)](#DenseMatrix+get) ⇒ <code>\*</code>
|
12
|
-
* [.set(index, value, [defaultValue])](#DenseMatrix+set) ⇒ <code>DenseMatrix</code>
|
13
|
-
* [.resize(size, [defaultValue], [copy])](#DenseMatrix+resize) ⇒ <code>Matrix</code>
|
14
|
-
* [.clone()](#DenseMatrix+clone) ⇒ <code>DenseMatrix</code>
|
15
|
-
* [.size()](#DenseMatrix+size) ⇒ <code>Array.<number></code>
|
16
|
-
* [.map(callback)](#DenseMatrix+map) ⇒ <code>DenseMatrix</code>
|
17
|
-
* [.forEach(callback)](#DenseMatrix+forEach)
|
18
|
-
* [.toArray()](#DenseMatrix+toArray) ⇒ <code>Array</code>
|
19
|
-
* [.valueOf()](#DenseMatrix+valueOf) ⇒ <code>Array</code>
|
20
|
-
* [.format([options])](#DenseMatrix+format) ⇒ <code>string</code>
|
21
|
-
* [.toString()](#DenseMatrix+toString) ⇒ <code>string</code>
|
22
|
-
* [.toJSON()](#DenseMatrix+toJSON) ⇒ <code>Object</code>
|
23
|
-
* [.diagonal([k])](#DenseMatrix+diagonal) ⇒ <code>Array</code>
|
24
|
-
* [.swapRows(i, j)](#DenseMatrix+swapRows) ⇒ <code>Matrix</code>
|
25
|
-
* _static_
|
26
|
-
* [.diagonal(size, value, [k], [defaultValue])](#DenseMatrix.diagonal) ⇒ <code>DenseMatrix</code>
|
27
|
-
* [.fromJSON(json)](#DenseMatrix.fromJSON) ⇒ <code>DenseMatrix</code>
|
28
|
-
* [.preprocess(data)](#DenseMatrix.preprocess) ⇒ <code>Array</code>
|
29
|
-
|
30
|
-
<a name="DenseMatrix+storage"></a>
|
31
|
-
### denseMatrix.storage() ⇒ <code>string</code>
|
32
|
-
Get the storage format used by the matrix.
|
33
|
-
|
34
|
-
Usage:
|
35
|
-
|
36
|
-
```js
|
37
|
-
const format = matrix.storage() // retrieve storage format
|
38
|
-
```
|
39
|
-
|
40
|
-
**Kind**: instance method of <code>DenseMatrix</code>
|
41
|
-
**Returns**: <code>string</code> - The storage format.
|
42
|
-
<a name="DenseMatrix+datatype"></a>
|
43
|
-
### denseMatrix.datatype() ⇒ <code>string</code>
|
44
|
-
Get the datatype of the data stored in the matrix.
|
45
|
-
|
46
|
-
Usage:
|
47
|
-
|
48
|
-
```js
|
49
|
-
const format = matrix.datatype() // retrieve matrix datatype
|
50
|
-
```
|
51
|
-
|
52
|
-
**Kind**: instance method of <code>DenseMatrix</code>
|
53
|
-
**Returns**: <code>string</code> - The datatype.
|
54
|
-
<a name="DenseMatrix+create"></a>
|
55
|
-
### denseMatrix.create(data, [datatype])
|
56
|
-
Create a new DenseMatrix
|
57
|
-
|
58
|
-
**Kind**: instance method of <code>DenseMatrix</code>
|
59
|
-
|
60
|
-
| Param | Type |
|
61
|
-
| --- | --- |
|
62
|
-
| data | <code>Array</code> |
|
63
|
-
| [datatype] | <code>string</code> |
|
64
|
-
|
65
|
-
<a name="DenseMatrix+subset"></a>
|
66
|
-
### denseMatrix.subset(index, [replacement], [defaultValue])
|
67
|
-
Get a subset of the matrix, or replace a subset of the matrix.
|
68
|
-
|
69
|
-
Usage:
|
70
|
-
|
71
|
-
```js
|
72
|
-
const subset = matrix.subset(index) // retrieve subset
|
73
|
-
const value = matrix.subset(index, replacement) // replace subset
|
74
|
-
```
|
75
|
-
|
76
|
-
**Kind**: instance method of <code>DenseMatrix</code>
|
77
|
-
|
78
|
-
| Param | Type | Default | Description |
|
79
|
-
| --- | --- | --- | --- |
|
80
|
-
| index | <code>Index</code> | | |
|
81
|
-
| [replacement] | <code>Array</code> | <code>DenseMatrix</code>| <code>\*</code> | | |
|
82
|
-
| [defaultValue] | <code>\*</code> | <code>0</code> | Default value, filled in on new entries when the matrix is resized. If not provided, new matrix elements will be filled with zeros. |
|
83
|
-
|
84
|
-
<a name="DenseMatrix+get"></a>
|
85
|
-
### denseMatrix.get(index) ⇒ <code>\*</code>
|
86
|
-
Get a single element from the matrix.
|
87
|
-
|
88
|
-
**Kind**: instance method of <code>DenseMatrix</code>
|
89
|
-
**Returns**: <code>\*</code> - value
|
90
|
-
|
91
|
-
| Param | Type | Description |
|
92
|
-
| --- | --- | --- |
|
93
|
-
| index | <code>Array.<number></code> | Zero-based index |
|
94
|
-
|
95
|
-
<a name="DenseMatrix+set"></a>
|
96
|
-
### denseMatrix.set(index, value, [defaultValue]) ⇒ <code>DenseMatrix</code>
|
97
|
-
Replace a single element in the matrix.
|
98
|
-
|
99
|
-
**Kind**: instance method of <code>DenseMatrix</code>
|
100
|
-
**Returns**: <code>DenseMatrix</code>- self
|
101
|
-
|
102
|
-
| Param | Type | Description |
|
103
|
-
| --- | --- | --- |
|
104
|
-
| index | <code>Array.<number></code> | Zero-based index |
|
105
|
-
| value | <code>\*</code> | |
|
106
|
-
| [defaultValue] | <code>\*</code> | Default value, filled in on new entries when the matrix is resized. If not provided, new matrix elements will be left undefined. |
|
107
|
-
|
108
|
-
<a name="DenseMatrix+resize"></a>
|
109
|
-
### denseMatrix.resize(size, [defaultValue], [copy]) ⇒ <code>Matrix</code>
|
110
|
-
Resize the matrix to the given size. Returns a copy of the matrix when
|
111
|
-
`copy=true`, otherwise return the matrix itself (resize in place).
|
112
|
-
|
113
|
-
**Kind**: instance method of <code>DenseMatrix</code>
|
114
|
-
**Returns**: <code>Matrix</code> - The resized matrix
|
115
|
-
|
116
|
-
| Param | Type | Default | Description |
|
117
|
-
| --- | --- | --- | --- |
|
118
|
-
| size | <code>Array.<number></code> | | The new size the matrix should have. |
|
119
|
-
| [defaultValue] | <code>\*</code> | <code>0</code> | Default value, filled in on new entries. If not provided, the matrix elements will be filled with zeros. |
|
120
|
-
| [copy] | <code>boolean</code> | | Return a resized copy of the matrix |
|
121
|
-
|
122
|
-
<a name="DenseMatrix+clone"></a>
|
123
|
-
### denseMatrix.clone() ⇒ <code>DenseMatrix</code>
|
124
|
-
Create a clone of the matrix
|
125
|
-
|
126
|
-
**Kind**: instance method of <code>DenseMatrix</code>
|
127
|
-
**Returns**: <code>DenseMatrix</code>- clone
|
128
|
-
<a name="DenseMatrix+size"></a>
|
129
|
-
### denseMatrix.size() ⇒ <code>Array.<number></code>
|
130
|
-
Retrieve the size of the matrix.
|
131
|
-
|
132
|
-
**Kind**: instance method of <code>DenseMatrix</code>
|
133
|
-
**Returns**: <code>Array.<number></code> - size
|
134
|
-
<a name="DenseMatrix+map"></a>
|
135
|
-
### denseMatrix.map(callback) ⇒ <code>DenseMatrix</code>
|
136
|
-
Create a new matrix with the results of the callback function executed on
|
137
|
-
each entry of the matrix.
|
138
|
-
|
139
|
-
**Kind**: instance method of <code>DenseMatrix</code>
|
140
|
-
**Returns**: <code>DenseMatrix</code>- matrix
|
141
|
-
|
142
|
-
| Param | Type | Description |
|
143
|
-
| --- | --- | --- |
|
144
|
-
| callback | <code>function</code> | The callback function is invoked with three parameters: the value of the element, the index of the element, and the Matrix being traversed. |
|
145
|
-
|
146
|
-
<a name="DenseMatrix+forEach"></a>
|
147
|
-
### denseMatrix.forEach(callback)
|
148
|
-
Execute a callback function on each entry of the matrix.
|
149
|
-
|
150
|
-
**Kind**: instance method of <code>DenseMatrix</code>
|
151
|
-
|
152
|
-
| Param | Type | Description |
|
153
|
-
| --- | --- | --- |
|
154
|
-
| callback | <code>function</code> | The callback function is invoked with three parameters: the value of the element, the index of the element, and the Matrix being traversed. |
|
155
|
-
|
156
|
-
<a name="DenseMatrix+toArray"></a>
|
157
|
-
### denseMatrix.toArray() ⇒ <code>Array</code>
|
158
|
-
Create an Array with a copy of the data of the DenseMatrix
|
159
|
-
|
160
|
-
**Kind**: instance method of <code>DenseMatrix</code>
|
161
|
-
**Returns**: <code>Array</code> - array
|
162
|
-
<a name="DenseMatrix+valueOf"></a>
|
163
|
-
### denseMatrix.valueOf() ⇒ <code>Array</code>
|
164
|
-
Get the primitive value of the DenseMatrix: a multidimensional array
|
165
|
-
|
166
|
-
**Kind**: instance method of <code>DenseMatrix</code>
|
167
|
-
**Returns**: <code>Array</code> - array
|
168
|
-
<a name="DenseMatrix+format"></a>
|
169
|
-
### denseMatrix.format([options]) ⇒ <code>string</code>
|
170
|
-
Get a string representation of the matrix, with optional formatting options.
|
171
|
-
|
172
|
-
**Kind**: instance method of <code>DenseMatrix</code>
|
173
|
-
**Returns**: <code>string</code> - str
|
174
|
-
|
175
|
-
| Param | Type | Description |
|
176
|
-
| --- | --- | --- |
|
177
|
-
| [options] | <code>Object</code> | <code>number</code> | <code>function</code> | Formatting options. See lib/utils/number:format for a description of the available options. |
|
178
|
-
|
179
|
-
<a name="DenseMatrix+toString"></a>
|
180
|
-
### denseMatrix.toString() ⇒ <code>string</code>
|
181
|
-
Get a string representation of the matrix
|
182
|
-
|
183
|
-
**Kind**: instance method of <code>DenseMatrix</code>
|
184
|
-
**Returns**: <code>string</code> - str
|
185
|
-
<a name="DenseMatrix+toJSON"></a>
|
186
|
-
### denseMatrix.toJSON() ⇒ <code>Object</code>
|
187
|
-
Get a JSON representation of the matrix
|
188
|
-
|
189
|
-
**Kind**: instance method of <code>DenseMatrix</code>
|
190
|
-
<a name="DenseMatrix+diagonal"></a>
|
191
|
-
### denseMatrix.diagonal([k]) ⇒ <code>Array</code>
|
192
|
-
Get the kth Matrix diagonal.
|
193
|
-
|
194
|
-
**Kind**: instance method of <code>DenseMatrix</code>
|
195
|
-
**Returns**: <code>Array</code> - The array vector with the diagonal values.
|
196
|
-
|
197
|
-
| Param | Type | Default | Description |
|
198
|
-
| --- | --- | --- | --- |
|
199
|
-
| [k] | <code>number</code> | <code>BigNumber</code> | <code>0</code> | The kth diagonal where the vector will retrieved. |
|
200
|
-
|
201
|
-
<a name="DenseMatrix+swapRows"></a>
|
202
|
-
### denseMatrix.swapRows(i, j) ⇒ <code>Matrix</code>
|
203
|
-
Swap rows i and j in Matrix.
|
204
|
-
|
205
|
-
**Kind**: instance method of <code>DenseMatrix</code>
|
206
|
-
**Returns**: <code>Matrix</code> - The matrix reference
|
207
|
-
|
208
|
-
| Param | Type | Description |
|
209
|
-
| --- | --- | --- |
|
210
|
-
| i | <code>number</code> | Matrix row index 1 |
|
211
|
-
| j | <code>number</code> | Matrix row index 2 |
|
212
|
-
|
213
|
-
<a name="DenseMatrix.diagonal"></a>
|
214
|
-
### DenseMatrix.diagonal(size, value, [k], [defaultValue]) ⇒ <code>DenseMatrix</code>
|
215
|
-
Create a diagonal matrix.
|
216
|
-
|
217
|
-
**Kind**: static method of <code>DenseMatrix</code>
|
218
|
-
|
219
|
-
| Param | Type | Default | Description |
|
220
|
-
| --- | --- | --- | --- |
|
221
|
-
| size | <code>Array</code> | | The matrix size. |
|
222
|
-
| value | <code>number</code> | <code>Array</code> | | The values for the diagonal. |
|
223
|
-
| [k] | <code>number</code> | <code>BigNumber</code> | <code>0</code> | The kth diagonal where the vector will be filled in. |
|
224
|
-
| [defaultValue] | <code>number</code> | | The default value for non-diagonal |
|
225
|
-
|
226
|
-
<a name="DenseMatrix.fromJSON"></a>
|
227
|
-
### DenseMatrix.fromJSON(json) ⇒ <code>DenseMatrix</code>
|
228
|
-
Generate a matrix from a JSON object
|
229
|
-
|
230
|
-
**Kind**: static method of <code>DenseMatrix</code>
|
231
|
-
|
232
|
-
| Param | Type | Description |
|
233
|
-
| --- | --- | --- |
|
234
|
-
| json | <code>Object</code> | An object structured like `{"mathjs": "DenseMatrix", data: [], size: []}`, where mathjs is optional |
|
235
|
-
|
236
|
-
<a name="DenseMatrix.preprocess"></a>
|
237
|
-
### DenseMatrix.preprocess(data) ⇒ <code>Array</code>
|
238
|
-
Preprocess data, which can be an Array or DenseMatrix with nested Arrays and
|
239
|
-
Matrices. Replaces all nested Matrices with Arrays
|
240
|
-
|
241
|
-
**Kind**: static method of <code>DenseMatrix</code>
|
242
|
-
**Returns**: <code>Array</code> - data
|
243
|
-
|
244
|
-
| Param | Type |
|
245
|
-
| --- | --- |
|
246
|
-
| data | <code>Array</code> |
|
247
|
-
|
@@ -1,70 +0,0 @@
|
|
1
|
-
<a name="FibonacciHeap"></a>
|
2
|
-
## FibonacciHeap
|
3
|
-
* [new FibonacciHeap()](#new_FibonacciHeap_new)
|
4
|
-
* _instance_
|
5
|
-
* [.insert()](#FibonacciHeap+insert)
|
6
|
-
* [.size()](#FibonacciHeap+size)
|
7
|
-
* [.clear()](#FibonacciHeap+clear)
|
8
|
-
* [.isEmpty()](#FibonacciHeap+isEmpty)
|
9
|
-
* [.extractMinimum()](#FibonacciHeap+extractMinimum)
|
10
|
-
* [.remove()](#FibonacciHeap+remove)
|
11
|
-
* _static_
|
12
|
-
* [._decreaseKey()](#FibonacciHeap._decreaseKey)
|
13
|
-
* [._cut()](#FibonacciHeap._cut)
|
14
|
-
* [._cascadingCut()](#FibonacciHeap._cascadingCut)
|
15
|
-
* [._linkNodes()](#FibonacciHeap._linkNodes)
|
16
|
-
|
17
|
-
<a name="new_FibonacciHeap_new"></a>
|
18
|
-
### new FibonacciHeap()
|
19
|
-
Creates a new instance of a Fibonacci Heap.
|
20
|
-
|
21
|
-
<a name="FibonacciHeap+insert"></a>
|
22
|
-
### fibonacciHeap.insert()
|
23
|
-
Inserts a new data element into the heap. No heap consolidation is
|
24
|
-
|
25
|
-
**Kind**: instance method of <code>[FibonacciHeap](#FibonacciHeap)</code>
|
26
|
-
<a name="FibonacciHeap+size"></a>
|
27
|
-
### fibonacciHeap.size()
|
28
|
-
Returns the number of nodes in heap. Running time: O(1) actual.
|
29
|
-
|
30
|
-
**Kind**: instance method of <code>[FibonacciHeap](#FibonacciHeap)</code>
|
31
|
-
<a name="FibonacciHeap+clear"></a>
|
32
|
-
### fibonacciHeap.clear()
|
33
|
-
Removes all elements from this heap.
|
34
|
-
|
35
|
-
**Kind**: instance method of <code>[FibonacciHeap](#FibonacciHeap)</code>
|
36
|
-
<a name="FibonacciHeap+isEmpty"></a>
|
37
|
-
### fibonacciHeap.isEmpty()
|
38
|
-
Returns true if the heap is empty, otherwise false.
|
39
|
-
|
40
|
-
**Kind**: instance method of <code>[FibonacciHeap](#FibonacciHeap)</code>
|
41
|
-
<a name="FibonacciHeap+extractMinimum"></a>
|
42
|
-
### fibonacciHeap.extractMinimum()
|
43
|
-
Extracts the node with minimum key from heap. Amortized running
|
44
|
-
|
45
|
-
**Kind**: instance method of <code>[FibonacciHeap](#FibonacciHeap)</code>
|
46
|
-
<a name="FibonacciHeap+remove"></a>
|
47
|
-
### fibonacciHeap.remove()
|
48
|
-
Removes a node from the heap given the reference to the node. The trees
|
49
|
-
|
50
|
-
**Kind**: instance method of <code>[FibonacciHeap](#FibonacciHeap)</code>
|
51
|
-
<a name="FibonacciHeap._decreaseKey"></a>
|
52
|
-
### FibonacciHeap._decreaseKey()
|
53
|
-
Decreases the key value for a heap node, given the new value to take on.
|
54
|
-
|
55
|
-
**Kind**: static method of <code>[FibonacciHeap](#FibonacciHeap)</code>
|
56
|
-
<a name="FibonacciHeap._cut"></a>
|
57
|
-
### FibonacciHeap._cut()
|
58
|
-
The reverse of the link operation: removes node from the child list of parent.
|
59
|
-
|
60
|
-
**Kind**: static method of <code>[FibonacciHeap](#FibonacciHeap)</code>
|
61
|
-
<a name="FibonacciHeap._cascadingCut"></a>
|
62
|
-
### FibonacciHeap._cascadingCut()
|
63
|
-
Performs a cascading cut operation. This cuts node from its parent and then
|
64
|
-
|
65
|
-
**Kind**: static method of <code>[FibonacciHeap](#FibonacciHeap)</code>
|
66
|
-
<a name="FibonacciHeap._linkNodes"></a>
|
67
|
-
### FibonacciHeap._linkNodes()
|
68
|
-
Make the first node a child of the second one. Running time: O(1) actual.
|
69
|
-
|
70
|
-
**Kind**: static method of <code>[FibonacciHeap](#FibonacciHeap)</code>
|
@@ -1,133 +0,0 @@
|
|
1
|
-
<a name="Index"></a>
|
2
|
-
## Index
|
3
|
-
* [new Index(...ranges)](#new_Index_new)
|
4
|
-
* _instance_
|
5
|
-
* [.valueOf](#Index+valueOf) ⇒ <code>Array</code>
|
6
|
-
* [.clone()](#Index+clone) ⇒ <code>[Index](#Index)</code>
|
7
|
-
* [.size()](#Index+size) ⇒ <code>Array.<number></code>
|
8
|
-
* [.max()](#Index+max) ⇒ <code>Array.<number></code>
|
9
|
-
* [.min()](#Index+min) ⇒ <code>Array.<number></code>
|
10
|
-
* [.forEach(callback)](#Index+forEach)
|
11
|
-
* [.dimension(dim)](#Index+dimension) ⇒ <code>Range</code> | <code>null</code>
|
12
|
-
* [.isScalar()](#Index+isScalar) ⇒ <code>boolean</code>
|
13
|
-
* [.toArray()](#Index+toArray) ⇒ <code>Array</code>
|
14
|
-
* [.toString()](#Index+toString) ⇒ <code>String</code>
|
15
|
-
* [.toJSON()](#Index+toJSON) ⇒ <code>Object</code>
|
16
|
-
* _static_
|
17
|
-
* [.fromJSON(json)](#Index.fromJSON) ⇒ <code>[Index](#Index)</code>
|
18
|
-
|
19
|
-
<a name="new_Index_new"></a>
|
20
|
-
### new Index(...ranges)
|
21
|
-
Create an index. An Index can store ranges and sets for multiple dimensions.
|
22
|
-
Matrix.get, Matrix.set, and math.subset accept an Index as input.
|
23
|
-
|
24
|
-
Usage:
|
25
|
-
```js
|
26
|
-
const index = new Index(range1, range2, matrix1, array1, ...)
|
27
|
-
```
|
28
|
-
|
29
|
-
Where each parameter can be any of:
|
30
|
-
|
31
|
-
- A number
|
32
|
-
- An instance of Range
|
33
|
-
- An Array with the Set values
|
34
|
-
- A Matrix with the Set values
|
35
|
-
|
36
|
-
The parameters start, end, and step must be integer numbers.
|
37
|
-
|
38
|
-
|
39
|
-
| Param | Type |
|
40
|
-
| --- | --- |
|
41
|
-
| ...ranges | <code>\*</code> |
|
42
|
-
|
43
|
-
<a name="Index+valueOf"></a>
|
44
|
-
### index.valueOf ⇒ <code>Array</code>
|
45
|
-
Get the primitive value of the Index, a two dimensional array.
|
46
|
-
Equivalent to Index.toArray().
|
47
|
-
|
48
|
-
**Kind**: instance property of <code>[Index](#Index)</code>
|
49
|
-
**Returns**: <code>Array</code> - array
|
50
|
-
<a name="Index+clone"></a>
|
51
|
-
### index.clone() ⇒ <code>[Index](#Index)</code>
|
52
|
-
Create a clone of the index
|
53
|
-
|
54
|
-
**Kind**: instance method of <code>[Index](#Index)</code>
|
55
|
-
**Returns**: <code>[Index](#Index)</code> - clone
|
56
|
-
<a name="Index+size"></a>
|
57
|
-
### index.size() ⇒ <code>Array.<number></code>
|
58
|
-
Retrieve the size of the index, the number of elements for each dimension.
|
59
|
-
|
60
|
-
**Kind**: instance method of <code>[Index](#Index)</code>
|
61
|
-
**Returns**: <code>Array.<number></code> - size
|
62
|
-
<a name="Index+max"></a>
|
63
|
-
### index.max() ⇒ <code>Array.<number></code>
|
64
|
-
Get the maximum value for each of the indexes ranges.
|
65
|
-
|
66
|
-
**Kind**: instance method of <code>[Index](#Index)</code>
|
67
|
-
**Returns**: <code>Array.<number></code> - max
|
68
|
-
<a name="Index+min"></a>
|
69
|
-
### index.min() ⇒ <code>Array.<number></code>
|
70
|
-
Get the minimum value for each of the indexes ranges.
|
71
|
-
|
72
|
-
**Kind**: instance method of <code>[Index](#Index)</code>
|
73
|
-
**Returns**: <code>Array.<number></code> - min
|
74
|
-
<a name="Index+forEach"></a>
|
75
|
-
### index.forEach(callback)
|
76
|
-
Loop over each of the ranges of the index
|
77
|
-
|
78
|
-
**Kind**: instance method of <code>[Index](#Index)</code>
|
79
|
-
|
80
|
-
| Param | Type | Description |
|
81
|
-
| --- | --- | --- |
|
82
|
-
| callback | <code>function</code> | Called for each range with a Range as first argument, the dimension as second, and the index object as third. |
|
83
|
-
|
84
|
-
<a name="Index+dimension"></a>
|
85
|
-
### index.dimension(dim) ⇒ <code>Range</code> | <code>null</code>
|
86
|
-
Retrieve the dimension for the given index
|
87
|
-
|
88
|
-
**Kind**: instance method of <code>[Index](#Index)</code>
|
89
|
-
**Returns**: <code>Range</code> | <code>null</code> - range
|
90
|
-
|
91
|
-
| Param | Type | Description |
|
92
|
-
| --- | --- | --- |
|
93
|
-
| dim | <code>Number</code> | Number of the dimension |
|
94
|
-
|
95
|
-
<a name="Index+isScalar"></a>
|
96
|
-
### index.isScalar() ⇒ <code>boolean</code>
|
97
|
-
Test whether this index contains only a single value.
|
98
|
-
|
99
|
-
This is the case when the index is created with only scalar values as ranges,
|
100
|
-
not for ranges resolving into a single value.
|
101
|
-
|
102
|
-
**Kind**: instance method of <code>[Index](#Index)</code>
|
103
|
-
**Returns**: <code>boolean</code> - isScalar
|
104
|
-
<a name="Index+toArray"></a>
|
105
|
-
### index.toArray() ⇒ <code>Array</code>
|
106
|
-
Expand the Index into an array.
|
107
|
-
For example new Index([0,3], [2,7]) returns [[0,1,2], [2,3,4,5,6]]
|
108
|
-
|
109
|
-
**Kind**: instance method of <code>[Index](#Index)</code>
|
110
|
-
**Returns**: <code>Array</code> - array
|
111
|
-
<a name="Index+toString"></a>
|
112
|
-
### index.toString() ⇒ <code>String</code>
|
113
|
-
Get the string representation of the index, for example '[2:6]' or '[0:2:10, 4:7, [1,2,3]]'
|
114
|
-
|
115
|
-
**Kind**: instance method of <code>[Index](#Index)</code>
|
116
|
-
**Returns**: <code>String</code> - str
|
117
|
-
<a name="Index+toJSON"></a>
|
118
|
-
### index.toJSON() ⇒ <code>Object</code>
|
119
|
-
Get a JSON representation of the Index
|
120
|
-
|
121
|
-
**Kind**: instance method of <code>[Index](#Index)</code>
|
122
|
-
**Returns**: <code>Object</code> - Returns a JSON object structured as:
|
123
|
-
`{"mathjs": "Index", "ranges": [{"mathjs": "Range", start: 0, end: 10, step:1}, ...]}`
|
124
|
-
<a name="Index.fromJSON"></a>
|
125
|
-
### Index.fromJSON(json) ⇒ <code>[Index](#Index)</code>
|
126
|
-
Instantiate an Index from a JSON object
|
127
|
-
|
128
|
-
**Kind**: static method of <code>[Index](#Index)</code>
|
129
|
-
|
130
|
-
| Param | Type | Description |
|
131
|
-
| --- | --- | --- |
|
132
|
-
| json | <code>Object</code> | A JSON object structured as: `{"mathjs": "Index", "dimensions": [{"mathjs": "Range", start: 0, end: 10, step:1}, ...]}` |
|
133
|
-
|