@smockle/matrix 3.0.6 → 4.0.0
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/.github/CODEOWNERS +1 -0
- package/.github/workflows/publish.yml +33 -0
- package/.github/workflows/test.yml +30 -0
- package/LICENSE +21 -13
- package/README.md +97 -82
- package/package.json +28 -39
- package/src/__tests__/index.test.ts +540 -0
- package/src/index.ts +290 -0
- package/tsconfig.json +17 -0
- package/.editorconfig +0 -7
- package/.eslintignore +0 -1
- package/.eslintrc.json +0 -6
- package/.flowconfig +0 -27
- package/.prettierignore +0 -1
- package/.travis.yml +0 -19
- package/appveyor.yml +0 -21
- package/flow-typed/npm/@std/esm_vx.x.x.js +0 -33
- package/flow-typed/npm/codecov_vx.x.x.js +0 -276
- package/flow-typed/npm/colortape_vx.x.x.js +0 -80
- package/flow-typed/npm/eslint-config-standard_vx.x.x.js +0 -45
- package/flow-typed/npm/eslint-plugin-import_vx.x.x.js +0 -333
- package/flow-typed/npm/eslint-plugin-node_vx.x.x.js +0 -249
- package/flow-typed/npm/eslint-plugin-promise_vx.x.x.js +0 -150
- package/flow-typed/npm/eslint-plugin-standard_vx.x.x.js +0 -87
- package/flow-typed/npm/eslint_vx.x.x.js +0 -2363
- package/flow-typed/npm/flow-bin_v0.x.x.js +0 -6
- package/flow-typed/npm/flow-typed_vx.x.x.js +0 -193
- package/flow-typed/npm/husky_vx.x.x.js +0 -88
- package/flow-typed/npm/jsdoc-to-markdown_vx.x.x.js +0 -95
- package/flow-typed/npm/lint-staged_vx.x.x.js +0 -143
- package/flow-typed/npm/lodash_v4.x.x.js +0 -530
- package/flow-typed/npm/mathjs_vx.x.x.js +0 -5561
- package/flow-typed/npm/nyc_vx.x.x.js +0 -108
- package/flow-typed/npm/prettier-eslint-cli_vx.x.x.js +0 -74
- package/jsdoc.json +0 -6
- package/jsdoc2md/README.hbs +0 -41
- package/lib/matrix.js +0 -4
- package/lib/matrix.mjs +0 -312
- package/test/matrix.mjs +0 -243
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* @smockle
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [created]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
id-token: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
name: Test
|
|
14
|
+
uses: smockle/matrix/.github/workflows/test.yml@main
|
|
15
|
+
secrets: inherit
|
|
16
|
+
publish:
|
|
17
|
+
needs: [test]
|
|
18
|
+
name: Publish
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
- uses: actions/setup-node@v4
|
|
23
|
+
with:
|
|
24
|
+
node-version: 22
|
|
25
|
+
registry-url: https://registry.npmjs.org/
|
|
26
|
+
cache: npm
|
|
27
|
+
- run: npm ci
|
|
28
|
+
- run: npm version ${TAG_NAME} --git-tag-version=false
|
|
29
|
+
env:
|
|
30
|
+
TAG_NAME: ${{ github.event.release.tag_name }}
|
|
31
|
+
- run: npm whoami; npm --ignore-scripts publish --provenance --access public
|
|
32
|
+
env:
|
|
33
|
+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_call:
|
|
5
|
+
secrets:
|
|
6
|
+
CODECOV_TOKEN:
|
|
7
|
+
required: true
|
|
8
|
+
pull_request:
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
test:
|
|
15
|
+
name: Test
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
- uses: actions/setup-node@v4
|
|
20
|
+
with:
|
|
21
|
+
node-version: 22
|
|
22
|
+
registry-url: https://registry.npmjs.org/
|
|
23
|
+
cache: npm
|
|
24
|
+
- run: npm ci
|
|
25
|
+
- run: npm test
|
|
26
|
+
- if: github.actor != 'dependabot[bot]'
|
|
27
|
+
name: Upload coverage reports to Codecov
|
|
28
|
+
uses: codecov/codecov-action@v5
|
|
29
|
+
with:
|
|
30
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
package/LICENSE
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016-2025 Clay Miller
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
[](https://www.npmjs.com/package/@smockle/matrix)
|
|
2
|
-
[](https://travis-ci.org/smockle/matrix)
|
|
3
|
-
[](https://ci.appveyor.com/project/smockle/matrix)
|
|
4
2
|
[](https://codecov.io/gh/smockle/matrix)
|
|
5
|
-
[](https://snyk.io/test/github/smockle/matrix)
|
|
6
|
-
[](https://greenkeeper.io/)
|
|
7
3
|
|
|
8
4
|
# matrix
|
|
9
5
|
|
|
@@ -16,7 +12,7 @@ Run `npm install --save @smockle/matrix` to add `matrix` to your project.
|
|
|
16
12
|
## Usage
|
|
17
13
|
|
|
18
14
|
```JavaScript
|
|
19
|
-
|
|
15
|
+
import Matrix from '@smockle/matrix'
|
|
20
16
|
|
|
21
17
|
// 1x1 Matrix
|
|
22
18
|
const m11 = Matrix(3)
|
|
@@ -30,40 +26,42 @@ const m31 = Matrix([[1], [2], [3]])
|
|
|
30
26
|
|
|
31
27
|
## API Reference
|
|
32
28
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
29
|
+
- [matrix](#module_matrix)
|
|
30
|
+
- [Matrix](#exp_module_matrix--Matrix) ⏏
|
|
31
|
+
- [new Matrix(x)](#new_module_matrix--Matrix_new)
|
|
32
|
+
- _instance_
|
|
33
|
+
- [.countRows()](#module_matrix--Matrix+countRows) ⇒ <code>number</code>
|
|
34
|
+
- [.countColumns()](#module_matrix--Matrix+countColumns) ⇒ <code>number</code>
|
|
35
|
+
- [.addable(y)](#module_matrix--Matrix+addable) ⇒ <code>boolean</code>
|
|
36
|
+
- [.add(y)](#module_matrix--Matrix+add) ⇒ <code>Matrix</code>
|
|
37
|
+
- [.multipliable(y)](#module_matrix--Matrix+multipliable) ⇒ <code>boolean</code>
|
|
38
|
+
- [.multiply(y)](#module_matrix--Matrix+multiply) ⇒ <code>Matrix</code>
|
|
39
|
+
- [.transpose()](#module_matrix--Matrix+transpose) ⇒ <code>Matrix</code>
|
|
40
|
+
- [.invert()](#module_matrix--Matrix+invert) ⇒ <code>Matrix</code>
|
|
41
|
+
- [.map()](#module_matrix--Matrix+map) ⇒ <code>Matrix</code>
|
|
42
|
+
- [.valueOf()](#module_matrix--Matrix+valueOf) ⇒ <code>number</code> \| <code>Array.<number></code>
|
|
43
|
+
- [.inspect()](#module_matrix--Matrix+inspect) ⇒ <code>string</code>
|
|
44
|
+
- [~padding](#module_matrix--Matrix+inspect..padding) : <code>string</code>
|
|
45
|
+
- _static_
|
|
46
|
+
- [.addable(x, y)](#module_matrix--Matrix.addable) ⇒ <code>boolean</code>
|
|
47
|
+
- [.add(x, y)](#module_matrix--Matrix.add) ⇒ <code>Matrix</code>
|
|
48
|
+
- [.multipliable(x, y)](#module_matrix--Matrix.multipliable) ⇒ <code>boolean</code>
|
|
49
|
+
- [.multiply(x, y)](#module_matrix--Matrix.multiply) ⇒ <code>Matrix</code>
|
|
50
|
+
- [~z](#module_matrix--Matrix.multiply..z) : <code>Matrix</code>
|
|
51
|
+
- [.invert(Matrix)](#module_matrix--Matrix.invert) ⇒ <code>Matrix</code>
|
|
52
|
+
- _inner_
|
|
53
|
+
- [~matrix](#module_matrix--Matrix..matrix) : <code>Matrix</code>
|
|
54
|
+
- [~innerproduct(x, y, i)](#module_matrix--Matrix..innerproduct) ⇒ <code>number</code>
|
|
59
55
|
|
|
60
56
|
<a name="exp_module_matrix--Matrix"></a>
|
|
61
57
|
|
|
62
58
|
### Matrix ⏏
|
|
59
|
+
|
|
63
60
|
**Kind**: Exported class
|
|
64
61
|
<a name="new_module_matrix--Matrix_new"></a>
|
|
65
62
|
|
|
66
63
|
#### new Matrix(x)
|
|
64
|
+
|
|
67
65
|
Creates a Matrix
|
|
68
66
|
|
|
69
67
|
**Returns**: <code>Matrix</code> - Single or multi dimensional matrix
|
|
@@ -71,14 +69,14 @@ Creates a Matrix
|
|
|
71
69
|
|
|
72
70
|
- <code>TypeError</code> Argument x must be a number or number array
|
|
73
71
|
|
|
74
|
-
|
|
75
|
-
|
|
|
76
|
-
|
|
|
77
|
-
| x | <code>number</code> \| <code>Array.<number></code> | Values to store in matrix |
|
|
72
|
+
| Param | Type | Description |
|
|
73
|
+
| ----- | -------------------------------------------------------- | ------------------------- |
|
|
74
|
+
| x | <code>number</code> \| <code>Array.<number></code> | Values to store in matrix |
|
|
78
75
|
|
|
79
76
|
<a name="module_matrix--Matrix+countRows"></a>
|
|
80
77
|
|
|
81
78
|
#### matrix.countRows() ⇒ <code>number</code>
|
|
79
|
+
|
|
82
80
|
Counts rows in this matrix
|
|
83
81
|
|
|
84
82
|
**Kind**: instance method of [<code>Matrix</code>](#exp_module_matrix--Matrix)
|
|
@@ -86,6 +84,7 @@ Counts rows in this matrix
|
|
|
86
84
|
<a name="module_matrix--Matrix+countColumns"></a>
|
|
87
85
|
|
|
88
86
|
#### matrix.countColumns() ⇒ <code>number</code>
|
|
87
|
+
|
|
89
88
|
Counts columns in this matrix
|
|
90
89
|
|
|
91
90
|
**Kind**: instance method of [<code>Matrix</code>](#exp_module_matrix--Matrix)
|
|
@@ -93,54 +92,59 @@ Counts columns in this matrix
|
|
|
93
92
|
<a name="module_matrix--Matrix+addable"></a>
|
|
94
93
|
|
|
95
94
|
#### matrix.addable(y) ⇒ <code>boolean</code>
|
|
95
|
+
|
|
96
96
|
Determines whether this matrix can be summed
|
|
97
97
|
|
|
98
98
|
**Kind**: instance method of [<code>Matrix</code>](#exp_module_matrix--Matrix)
|
|
99
|
-
**Returns**: <code>boolean</code> - Whether this matrix can be summed (using matrix addition)
|
|
99
|
+
**Returns**: <code>boolean</code> - Whether this matrix can be summed (using matrix addition)
|
|
100
100
|
|
|
101
|
-
| Param | Type
|
|
102
|
-
|
|
|
103
|
-
| y
|
|
101
|
+
| Param | Type | Description |
|
|
102
|
+
| ----- | ------------------- | --------------- |
|
|
103
|
+
| y | <code>Matrix</code> | Matrix to check |
|
|
104
104
|
|
|
105
105
|
<a name="module_matrix--Matrix+add"></a>
|
|
106
106
|
|
|
107
107
|
#### matrix.add(y) ⇒ <code>Matrix</code>
|
|
108
|
+
|
|
108
109
|
Adds this matrix using matrix addition
|
|
109
110
|
|
|
110
111
|
**Kind**: instance method of [<code>Matrix</code>](#exp_module_matrix--Matrix)
|
|
111
|
-
**Returns**: <code>Matrix</code> - New matrix with the summation
|
|
112
|
+
**Returns**: <code>Matrix</code> - New matrix with the summation
|
|
112
113
|
|
|
113
|
-
| Param | Type
|
|
114
|
-
|
|
|
115
|
-
| y
|
|
114
|
+
| Param | Type | Description |
|
|
115
|
+
| ----- | ------------------- | ------------- |
|
|
116
|
+
| y | <code>Matrix</code> | Matrix to add |
|
|
116
117
|
|
|
117
118
|
<a name="module_matrix--Matrix+multipliable"></a>
|
|
118
119
|
|
|
119
120
|
#### matrix.multipliable(y) ⇒ <code>boolean</code>
|
|
121
|
+
|
|
120
122
|
Determines whether this matrix can be multiplied
|
|
121
123
|
|
|
122
124
|
**Kind**: instance method of [<code>Matrix</code>](#exp_module_matrix--Matrix)
|
|
123
|
-
**Returns**: <code>boolean</code> - Whether two matrices can be summed (using matrix multiplication)
|
|
125
|
+
**Returns**: <code>boolean</code> - Whether two matrices can be summed (using matrix multiplication)
|
|
124
126
|
|
|
125
|
-
| Param | Type
|
|
126
|
-
|
|
|
127
|
-
| y
|
|
127
|
+
| Param | Type | Description |
|
|
128
|
+
| ----- | ------------------- | --------------- |
|
|
129
|
+
| y | <code>Matrix</code> | Matrix to check |
|
|
128
130
|
|
|
129
131
|
<a name="module_matrix--Matrix+multiply"></a>
|
|
130
132
|
|
|
131
133
|
#### matrix.multiply(y) ⇒ <code>Matrix</code>
|
|
134
|
+
|
|
132
135
|
Calculates the dot product of this matrix
|
|
133
136
|
|
|
134
137
|
**Kind**: instance method of [<code>Matrix</code>](#exp_module_matrix--Matrix)
|
|
135
|
-
**Returns**: <code>Matrix</code> - New matrix with the dot product
|
|
138
|
+
**Returns**: <code>Matrix</code> - New matrix with the dot product
|
|
136
139
|
|
|
137
|
-
| Param | Type
|
|
138
|
-
|
|
|
139
|
-
| y
|
|
140
|
+
| Param | Type | Description |
|
|
141
|
+
| ----- | ------------------- | ------------------ |
|
|
142
|
+
| y | <code>Matrix</code> | Matrix to multiply |
|
|
140
143
|
|
|
141
144
|
<a name="module_matrix--Matrix+transpose"></a>
|
|
142
145
|
|
|
143
146
|
#### matrix.transpose() ⇒ <code>Matrix</code>
|
|
147
|
+
|
|
144
148
|
Calculates the transpose of this matrix
|
|
145
149
|
|
|
146
150
|
**Kind**: instance method of [<code>Matrix</code>](#exp_module_matrix--Matrix)
|
|
@@ -148,6 +152,7 @@ Calculates the transpose of this matrix
|
|
|
148
152
|
<a name="module_matrix--Matrix+invert"></a>
|
|
149
153
|
|
|
150
154
|
#### matrix.invert() ⇒ <code>Matrix</code>
|
|
155
|
+
|
|
151
156
|
Inverts this matrix
|
|
152
157
|
|
|
153
158
|
**Kind**: instance method of [<code>Matrix</code>](#exp_module_matrix--Matrix)
|
|
@@ -155,6 +160,7 @@ Inverts this matrix
|
|
|
155
160
|
<a name="module_matrix--Matrix+map"></a>
|
|
156
161
|
|
|
157
162
|
#### matrix.map() ⇒ <code>Matrix</code>
|
|
163
|
+
|
|
158
164
|
Maps over this matrix
|
|
159
165
|
|
|
160
166
|
**Kind**: instance method of [<code>Matrix</code>](#exp_module_matrix--Matrix)
|
|
@@ -162,6 +168,7 @@ Maps over this matrix
|
|
|
162
168
|
<a name="module_matrix--Matrix+valueOf"></a>
|
|
163
169
|
|
|
164
170
|
#### matrix.valueOf() ⇒ <code>number</code> \| <code>Array.<number></code>
|
|
171
|
+
|
|
165
172
|
Returns the number or number array value
|
|
166
173
|
|
|
167
174
|
**Kind**: instance method of [<code>Matrix</code>](#exp_module_matrix--Matrix)
|
|
@@ -169,6 +176,7 @@ Returns the number or number array value
|
|
|
169
176
|
<a name="module_matrix--Matrix+inspect"></a>
|
|
170
177
|
|
|
171
178
|
#### matrix.inspect() ⇒ <code>string</code>
|
|
179
|
+
|
|
172
180
|
Formats and prints the matrix value
|
|
173
181
|
|
|
174
182
|
**Kind**: instance method of [<code>Matrix</code>](#exp_module_matrix--Matrix)
|
|
@@ -176,25 +184,28 @@ Formats and prints the matrix value
|
|
|
176
184
|
<a name="module_matrix--Matrix+inspect..padding"></a>
|
|
177
185
|
|
|
178
186
|
##### inspect~padding : <code>string</code>
|
|
187
|
+
|
|
179
188
|
Output array filled with zeroes
|
|
180
189
|
|
|
181
190
|
**Kind**: inner constant of [<code>inspect</code>](#module_matrix--Matrix+inspect)
|
|
182
191
|
<a name="module_matrix--Matrix.addable"></a>
|
|
183
192
|
|
|
184
193
|
#### Matrix.addable(x, y) ⇒ <code>boolean</code>
|
|
194
|
+
|
|
185
195
|
Determines whether two matrices can be summed
|
|
186
196
|
|
|
187
197
|
**Kind**: static method of [<code>Matrix</code>](#exp_module_matrix--Matrix)
|
|
188
|
-
**Returns**: <code>boolean</code> - Whether two matrices can be summed (using matrix addition)
|
|
198
|
+
**Returns**: <code>boolean</code> - Whether two matrices can be summed (using matrix addition)
|
|
189
199
|
|
|
190
|
-
| Param | Type
|
|
191
|
-
|
|
|
192
|
-
| x
|
|
193
|
-
| y
|
|
200
|
+
| Param | Type | Description |
|
|
201
|
+
| ----- | ------------------- | --------------- |
|
|
202
|
+
| x | <code>Matrix</code> | Matrix to check |
|
|
203
|
+
| y | <code>Matrix</code> | Matrix to check |
|
|
194
204
|
|
|
195
205
|
<a name="module_matrix--Matrix.add"></a>
|
|
196
206
|
|
|
197
207
|
#### Matrix.add(x, y) ⇒ <code>Matrix</code>
|
|
208
|
+
|
|
198
209
|
Adds two matrices using matrix addition
|
|
199
210
|
|
|
200
211
|
**Kind**: static method of [<code>Matrix</code>](#exp_module_matrix--Matrix)
|
|
@@ -203,76 +214,80 @@ Adds two matrices using matrix addition
|
|
|
203
214
|
|
|
204
215
|
- <code>TypeError</code> Matrices are not addable
|
|
205
216
|
|
|
206
|
-
|
|
207
|
-
|
|
|
208
|
-
|
|
|
209
|
-
|
|
|
210
|
-
| y | <code>Matrix</code> | Matrix to add |
|
|
217
|
+
| Param | Type | Description |
|
|
218
|
+
| ----- | ------------------- | ------------- |
|
|
219
|
+
| x | <code>Matrix</code> | Matrix to add |
|
|
220
|
+
| y | <code>Matrix</code> | Matrix to add |
|
|
211
221
|
|
|
212
222
|
<a name="module_matrix--Matrix.multipliable"></a>
|
|
213
223
|
|
|
214
224
|
#### Matrix.multipliable(x, y) ⇒ <code>boolean</code>
|
|
225
|
+
|
|
215
226
|
Determines whether two matrices can be multiplied
|
|
216
227
|
|
|
217
228
|
**Kind**: static method of [<code>Matrix</code>](#exp_module_matrix--Matrix)
|
|
218
|
-
**Returns**: <code>boolean</code> - Whether two matrices can be summed (using matrix multiplication)
|
|
229
|
+
**Returns**: <code>boolean</code> - Whether two matrices can be summed (using matrix multiplication)
|
|
219
230
|
|
|
220
|
-
| Param | Type
|
|
221
|
-
|
|
|
222
|
-
| x
|
|
223
|
-
| y
|
|
231
|
+
| Param | Type | Description |
|
|
232
|
+
| ----- | ------------------- | --------------- |
|
|
233
|
+
| x | <code>Matrix</code> | Matrix to check |
|
|
234
|
+
| y | <code>Matrix</code> | Matrix to check |
|
|
224
235
|
|
|
225
236
|
<a name="module_matrix--Matrix.multiply"></a>
|
|
226
237
|
|
|
227
238
|
#### Matrix.multiply(x, y) ⇒ <code>Matrix</code>
|
|
239
|
+
|
|
228
240
|
Calculates the dot product of two matrices
|
|
229
241
|
|
|
230
242
|
**Kind**: static method of [<code>Matrix</code>](#exp_module_matrix--Matrix)
|
|
231
|
-
**Returns**: <code>Matrix</code> - New matrix with the dot product
|
|
243
|
+
**Returns**: <code>Matrix</code> - New matrix with the dot product
|
|
232
244
|
|
|
233
|
-
| Param | Type
|
|
234
|
-
|
|
|
235
|
-
| x
|
|
236
|
-
| y
|
|
245
|
+
| Param | Type | Description |
|
|
246
|
+
| ----- | ------------------- | ------------------ |
|
|
247
|
+
| x | <code>Matrix</code> | Matrix to multiply |
|
|
248
|
+
| y | <code>Matrix</code> | Matrix to multiply |
|
|
237
249
|
|
|
238
250
|
<a name="module_matrix--Matrix.multiply..z"></a>
|
|
239
251
|
|
|
240
252
|
##### multiply~z : <code>Matrix</code>
|
|
253
|
+
|
|
241
254
|
New matrix with the dot product
|
|
242
255
|
|
|
243
256
|
**Kind**: inner constant of [<code>multiply</code>](#module_matrix--Matrix.multiply)
|
|
244
257
|
<a name="module_matrix--Matrix.invert"></a>
|
|
245
258
|
|
|
246
259
|
#### Matrix.invert(Matrix) ⇒ <code>Matrix</code>
|
|
260
|
+
|
|
247
261
|
Inverts a matrix
|
|
248
262
|
|
|
249
263
|
**Kind**: static method of [<code>Matrix</code>](#exp_module_matrix--Matrix)
|
|
250
|
-
**Returns**: <code>Matrix</code> - Matrix inverse
|
|
264
|
+
**Returns**: <code>Matrix</code> - Matrix inverse
|
|
251
265
|
|
|
252
|
-
| Param
|
|
253
|
-
|
|
|
254
|
-
| Matrix | <code>x</code> | to invert
|
|
266
|
+
| Param | Type | Description |
|
|
267
|
+
| ------ | -------------- | ----------- |
|
|
268
|
+
| Matrix | <code>x</code> | to invert |
|
|
255
269
|
|
|
256
270
|
<a name="module_matrix--Matrix..matrix"></a>
|
|
257
271
|
|
|
258
272
|
#### Matrix~matrix : <code>Matrix</code>
|
|
273
|
+
|
|
259
274
|
Single or multi dimensional matrix
|
|
260
275
|
|
|
261
276
|
**Kind**: inner constant of [<code>Matrix</code>](#exp_module_matrix--Matrix)
|
|
262
277
|
<a name="module_matrix--Matrix..innerproduct"></a>
|
|
263
278
|
|
|
264
279
|
#### Matrix~innerproduct(x, y, i) ⇒ <code>number</code>
|
|
280
|
+
|
|
265
281
|
Calculates the inner product of two matrices
|
|
266
282
|
|
|
267
283
|
**Kind**: inner method of [<code>Matrix</code>](#exp_module_matrix--Matrix)
|
|
268
|
-
**Returns**: <code>number</code> - Inner product of matrices
|
|
269
|
-
|
|
270
|
-
| Param | Type | Description |
|
|
271
|
-
| --- | --- | --- |
|
|
272
|
-
| x | <code>Matrix</code> | Matrix to multiply |
|
|
273
|
-
| y | <code>Matrix</code> | Matrix to multiply |
|
|
274
|
-
| i | <code>number</code> | Column in matrix y to multiply |
|
|
284
|
+
**Returns**: <code>number</code> - Inner product of matrices
|
|
275
285
|
|
|
286
|
+
| Param | Type | Description |
|
|
287
|
+
| ----- | ------------------- | ------------------------------ |
|
|
288
|
+
| x | <code>Matrix</code> | Matrix to multiply |
|
|
289
|
+
| y | <code>Matrix</code> | Matrix to multiply |
|
|
290
|
+
| i | <code>number</code> | Column in matrix y to multiply |
|
|
276
291
|
|
|
277
292
|
## Testing
|
|
278
293
|
|
package/package.json
CHANGED
|
@@ -1,57 +1,46 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smockle/matrix",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Single and multi dimensional matrices and matrix functions.",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"test": "node -r @std/esm test/matrix.mjs | colortape",
|
|
11
|
-
"coverage": "nyc --require @std/esm --extension .mjs --reporter=lcov node test/matrix.mjs | colortape",
|
|
12
|
-
"postcoverage": "nyc report",
|
|
13
|
-
"prepublishOnly": "npm test",
|
|
14
|
-
"precommit": "lint-staged"
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"test": "jest"
|
|
15
10
|
},
|
|
16
11
|
"repository": {
|
|
17
12
|
"type": "git",
|
|
18
13
|
"url": "git+https://github.com/smockle/matrix.git"
|
|
19
14
|
},
|
|
20
15
|
"author": "Clay Miller <clay@smockle.com> (https://smockle.com)",
|
|
21
|
-
"license": "
|
|
16
|
+
"license": "MIT",
|
|
22
17
|
"bugs": {
|
|
23
18
|
"url": "https://github.com/smockle/matrix/issues"
|
|
24
19
|
},
|
|
25
20
|
"homepage": "https://github.com/smockle/matrix#readme",
|
|
26
|
-
"devDependencies": {
|
|
27
|
-
"codecov": "^3.0.0",
|
|
28
|
-
"colortape": "^0.1.2",
|
|
29
|
-
"eslint": "^4.1.0",
|
|
30
|
-
"eslint-config-standard": "^10.0.0",
|
|
31
|
-
"eslint-plugin-import": "^2.2.0",
|
|
32
|
-
"eslint-plugin-node": "^5.0.0",
|
|
33
|
-
"eslint-plugin-promise": "^3.5.0",
|
|
34
|
-
"eslint-plugin-standard": "^3.0.0",
|
|
35
|
-
"flow-bin": "^0.61.0",
|
|
36
|
-
"husky": "^0.14.0",
|
|
37
|
-
"jsdoc-to-markdown": "git://github.com/smockle/jsdoc-to-markdown.git#update-dmd",
|
|
38
|
-
"lint-staged": "^6.0.0",
|
|
39
|
-
"nyc": "^11.0.2",
|
|
40
|
-
"prettier-eslint-cli": "^4.3.0"
|
|
41
|
-
},
|
|
42
|
-
"lint-staged": {
|
|
43
|
-
"*.{js,mjs}": [
|
|
44
|
-
"./node_modules/.bin/prettier-eslint --write",
|
|
45
|
-
"git add"
|
|
46
|
-
]
|
|
47
|
-
},
|
|
48
|
-
"@std/esm": {
|
|
49
|
-
"cjs": true
|
|
50
|
-
},
|
|
51
21
|
"dependencies": {
|
|
52
|
-
"@std/esm": "^0.18.0",
|
|
53
|
-
"flow-typed": "^2.1.5",
|
|
54
22
|
"lodash": "^4.17.4",
|
|
55
|
-
"mathjs": "^
|
|
23
|
+
"mathjs": "^14.0.1"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/lodash": "^4.17.14",
|
|
27
|
+
"jest": "^29.7.0",
|
|
28
|
+
"ts-jest": "^29.1.1",
|
|
29
|
+
"typescript": "^5.2.2"
|
|
30
|
+
},
|
|
31
|
+
"jest": {
|
|
32
|
+
"preset": "ts-jest/presets/default-esm",
|
|
33
|
+
"collectCoverage": true,
|
|
34
|
+
"extensionsToTreatAsEsm": [
|
|
35
|
+
".ts"
|
|
36
|
+
],
|
|
37
|
+
"roots": [
|
|
38
|
+
"<rootDir>/src"
|
|
39
|
+
],
|
|
40
|
+
"testRegex": "\\.test\\.ts$",
|
|
41
|
+
"moduleNameMapper": {
|
|
42
|
+
"^(\\.{1,2}/.*)\\.js$": "$1",
|
|
43
|
+
"^@/(.*)\\.js$": "<rootDir>/src/$1"
|
|
44
|
+
}
|
|
56
45
|
}
|
|
57
46
|
}
|