@thi.ng/dual-algebra 0.3.7 → 0.4.2
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/CHANGELOG.md +57 -24
- package/README.md +1 -1
- package/ops.js +11 -11
- package/package.json +88 -83
package/CHANGELOG.md
CHANGED
|
@@ -1,53 +1,86 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
- **Last updated**: 2021-11-21T17:09:28Z
|
|
4
|
+
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
|
+
|
|
3
6
|
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
7
|
+
See [Conventional Commits](https://conventionalcommits.org/) for commit guidelines.
|
|
8
|
+
|
|
9
|
+
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
|
+
and/or version bumps of transitive dependencies.
|
|
5
11
|
|
|
6
|
-
## [0.
|
|
12
|
+
## [0.4.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/dual-algebra@0.4.0) (2021-11-17)
|
|
7
13
|
|
|
8
|
-
|
|
14
|
+
#### 🚀 Features
|
|
9
15
|
|
|
16
|
+
- Using workspaces for local tools ([bf7a404](https://github.com/thi-ng/umbrella/commit/bf7a404))
|
|
17
|
+
Improving the overall build ergonomics
|
|
18
|
+
- introduced a tools workspaces
|
|
19
|
+
- imported it in all needed packages/examples
|
|
20
|
+
- inclusive project root
|
|
10
21
|
|
|
22
|
+
#### ♻️ Refactoring
|
|
11
23
|
|
|
24
|
+
- testrunner to binary ([4ebbbb2](https://github.com/thi-ng/umbrella/commit/4ebbbb2))
|
|
25
|
+
this commit reverts (partly) changes made in:
|
|
26
|
+
ef346d7a8753590dc9094108a3d861a8dbd5dd2c
|
|
27
|
+
overall purpose is better testament ergonomics:
|
|
28
|
+
instead of having to pass NODE_OPTIONS with every invocation
|
|
29
|
+
having a binary to handle this for us.
|
|
12
30
|
|
|
31
|
+
### [0.3.8](https://github.com/thi-ng/umbrella/tree/@thi.ng/dual-algebra@0.3.8) (2021-11-10)
|
|
13
32
|
|
|
14
|
-
|
|
33
|
+
#### ♻️ Refactoring
|
|
15
34
|
|
|
35
|
+
- update all countdown loops ([a5f374b](https://github.com/thi-ng/umbrella/commit/a5f374b))
|
|
16
36
|
|
|
17
|
-
###
|
|
37
|
+
### [0.3.1](https://github.com/thi-ng/umbrella/tree/@thi.ng/dual-algebra@0.3.1) (2021-10-13)
|
|
18
38
|
|
|
19
|
-
|
|
39
|
+
#### ♻️ Refactoring
|
|
20
40
|
|
|
41
|
+
- update imports in all tests/pkgs ([effd591](https://github.com/thi-ng/umbrella/commit/effd591))
|
|
42
|
+
- update imports in all pkgs ([5fa2b6f](https://github.com/thi-ng/umbrella/commit/5fa2b6f))
|
|
43
|
+
- add .js suffix for all relative imports
|
|
21
44
|
|
|
22
|
-
|
|
45
|
+
## [0.3.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/dual-algebra@0.3.0) (2021-10-12)
|
|
23
46
|
|
|
24
|
-
|
|
47
|
+
#### 🛑 Breaking changes
|
|
25
48
|
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
|
|
31
|
-
-
|
|
49
|
+
- major update of ALL pkgs (export maps, ESM only) ([0d1d6ea](https://github.com/thi-ng/umbrella/commit/0d1d6ea))
|
|
50
|
+
- BREAKING CHANGE: discontinue CommonJS & UMD versions
|
|
51
|
+
- only ESM modules will be published from now on
|
|
52
|
+
- CJS obsolete due to ESM support in recent versions of node:
|
|
53
|
+
- i.e. launch NodeJS via:
|
|
54
|
+
- `node --experimental-specifier-resolution=node --experimental-repl-await`
|
|
55
|
+
- in the node REPL use `await import(...)` instead of `require()`
|
|
56
|
+
- UMD obsolete due to widespread browser support for ESM
|
|
57
|
+
Also:
|
|
58
|
+
- normalize/restructure/reorg all package.json files
|
|
59
|
+
- cleanup all build scripts, remove obsolete
|
|
60
|
+
- switch from mocha to [@thi.ng/testament](https://github.com/thi-ng/umbrella/tree/main/packages/testament) for all tests
|
|
32
61
|
|
|
33
|
-
|
|
34
|
-
- normalize/restructure/reorg all package.json files
|
|
35
|
-
- cleanup all build scripts, remove obsolete
|
|
36
|
-
- switch from mocha to @thi.ng/testament for all tests
|
|
62
|
+
#### ♻️ Refactoring
|
|
37
63
|
|
|
64
|
+
- update all test stubs ([f2d6d53](https://github.com/thi-ng/umbrella/commit/f2d6d53))
|
|
65
|
+
- update all tests in _all_ pkgs ([8b582bc](https://github.com/thi-ng/umbrella/commit/8b582bc))
|
|
66
|
+
- update all to use [@thi.ng/testament](https://github.com/thi-ng/umbrella/tree/main/packages/testament)
|
|
38
67
|
|
|
68
|
+
## [0.2.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/dual-algebra@0.2.0) (2021-09-03)
|
|
39
69
|
|
|
70
|
+
#### 🚀 Features
|
|
40
71
|
|
|
72
|
+
- add mix(), add vector ops ([091f872](https://github.com/thi-ng/umbrella/commit/091f872))
|
|
41
73
|
|
|
74
|
+
#### ♻️ Refactoring
|
|
42
75
|
|
|
43
|
-
|
|
76
|
+
- dedupe vector ops ([95499ed](https://github.com/thi-ng/umbrella/commit/95499ed))
|
|
44
77
|
|
|
45
|
-
|
|
78
|
+
## [0.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/dual-algebra@0.1.0) (2020-09-13)
|
|
46
79
|
|
|
47
|
-
|
|
80
|
+
#### 🚀 Features
|
|
48
81
|
|
|
49
|
-
|
|
82
|
+
- import as new package ([eec4f1c](https://github.com/thi-ng/umbrella/commit/eec4f1c))
|
|
50
83
|
|
|
51
|
-
|
|
84
|
+
#### ♻️ Refactoring
|
|
52
85
|
|
|
53
|
-
-
|
|
86
|
+
- update deps, imports, use new Fn types ([2438054](https://github.com/thi-ng/umbrella/commit/2438054))
|
package/README.md
CHANGED
package/ops.js
CHANGED
|
@@ -47,7 +47,7 @@ export const mul = defOp(([ar, ad], [br, bd]) => [ar * br, ar * bd + ad * br], (
|
|
|
47
47
|
const ar = a[0];
|
|
48
48
|
const br = b[0];
|
|
49
49
|
const out = [ar * br];
|
|
50
|
-
for (let i = a.length; --
|
|
50
|
+
for (let i = a.length; i-- > 1;) {
|
|
51
51
|
out[i] = ar * b[i] + a[i] * br;
|
|
52
52
|
}
|
|
53
53
|
return out;
|
|
@@ -57,7 +57,7 @@ export const div = defOp(([ar, ad], [br, bd]) => [ar / br, (ad * br - ar * bd) /
|
|
|
57
57
|
const br = b[0];
|
|
58
58
|
const ibr = 1 / (br * br);
|
|
59
59
|
const out = [ar / br];
|
|
60
|
-
for (let i = a.length; --
|
|
60
|
+
for (let i = a.length; i-- > 1;) {
|
|
61
61
|
out[i] = (a[i] * br - ar * b[i]) * ibr;
|
|
62
62
|
}
|
|
63
63
|
return out;
|
|
@@ -65,7 +65,7 @@ export const div = defOp(([ar, ad], [br, bd]) => [ar / br, (ad * br - ar * bd) /
|
|
|
65
65
|
export const abs = defOp(([ar, ad]) => [Math.abs(ar), ad * Math.sign(ar)], (a) => {
|
|
66
66
|
const s = Math.sign(a[0]);
|
|
67
67
|
const out = [Math.abs(a[0])];
|
|
68
|
-
for (let i = a.length; --
|
|
68
|
+
for (let i = a.length; i-- > 1;) {
|
|
69
69
|
out[i] = s * a[i];
|
|
70
70
|
}
|
|
71
71
|
return out;
|
|
@@ -77,7 +77,7 @@ export const sqrt = defOp((a) => {
|
|
|
77
77
|
const s = Math.sqrt(a[0]);
|
|
78
78
|
const si = 0.5 / s;
|
|
79
79
|
const out = [s];
|
|
80
|
-
for (let i = a.length; --
|
|
80
|
+
for (let i = a.length; i-- > 1;) {
|
|
81
81
|
out[i] = si * a[i];
|
|
82
82
|
}
|
|
83
83
|
return out;
|
|
@@ -88,7 +88,7 @@ export const exp = defOp(([ar, ad]) => {
|
|
|
88
88
|
}, (a) => {
|
|
89
89
|
const ar = Math.exp(a[0]);
|
|
90
90
|
const out = [ar];
|
|
91
|
-
for (let i = a.length; --
|
|
91
|
+
for (let i = a.length; i-- > 1;) {
|
|
92
92
|
out[i] = ar * a[i];
|
|
93
93
|
}
|
|
94
94
|
return out;
|
|
@@ -97,7 +97,7 @@ export const log = defOp(([ar, ad]) => [Math.log(ar), ad / ar], (a) => {
|
|
|
97
97
|
const ar = Math.log(a[0]);
|
|
98
98
|
const iar = 1 / ar;
|
|
99
99
|
const out = [ar];
|
|
100
|
-
for (let i = a.length; --
|
|
100
|
+
for (let i = a.length; i-- > 1;) {
|
|
101
101
|
out[i] = iar * a[i];
|
|
102
102
|
}
|
|
103
103
|
return out;
|
|
@@ -105,7 +105,7 @@ export const log = defOp(([ar, ad]) => [Math.log(ar), ad / ar], (a) => {
|
|
|
105
105
|
export const pow = defOp(([ar, ad], k) => [ar ** k, ad * k * ar ** (k - 1)], (a, k) => {
|
|
106
106
|
const f = k * a[0] ** (k - 1);
|
|
107
107
|
const out = [a[0] ** k];
|
|
108
|
-
for (let i = a.length; --
|
|
108
|
+
for (let i = a.length; i-- > 1;) {
|
|
109
109
|
out[i] = f * a[i];
|
|
110
110
|
}
|
|
111
111
|
return out;
|
|
@@ -113,7 +113,7 @@ export const pow = defOp(([ar, ad], k) => [ar ** k, ad * k * ar ** (k - 1)], (a,
|
|
|
113
113
|
export const sin = defOp(([ar, ad]) => [Math.sin(ar), ad * Math.cos(ar)], (a) => {
|
|
114
114
|
const c = Math.cos(a[0]);
|
|
115
115
|
const out = [Math.sin(a[0])];
|
|
116
|
-
for (let i = a.length; --
|
|
116
|
+
for (let i = a.length; i-- > 1;) {
|
|
117
117
|
out[i] = c * a[i];
|
|
118
118
|
}
|
|
119
119
|
return out;
|
|
@@ -121,7 +121,7 @@ export const sin = defOp(([ar, ad]) => [Math.sin(ar), ad * Math.cos(ar)], (a) =>
|
|
|
121
121
|
export const cos = defOp(([ar, ad]) => [Math.cos(ar), -ad * Math.sin(ar)], (a) => {
|
|
122
122
|
const s = -Math.sin(a[0]);
|
|
123
123
|
const out = [Math.cos(a[0])];
|
|
124
|
-
for (let i = a.length; --
|
|
124
|
+
for (let i = a.length; i-- > 1;) {
|
|
125
125
|
out[i] = s * a[i];
|
|
126
126
|
}
|
|
127
127
|
return out;
|
|
@@ -133,7 +133,7 @@ export const tan = defOp(([ar, ad]) => {
|
|
|
133
133
|
const c = Math.cos(a[0]);
|
|
134
134
|
const ic = 1 / (c * c);
|
|
135
135
|
const out = [Math.tan(a[0])];
|
|
136
|
-
for (let i = a.length; --
|
|
136
|
+
for (let i = a.length; i-- > 1;) {
|
|
137
137
|
out[i] = ic * a[i];
|
|
138
138
|
}
|
|
139
139
|
return out;
|
|
@@ -142,7 +142,7 @@ export const atan = defOp(([ar, ad]) => [Math.atan(ar), ad / (1 + ar * ar)], (a)
|
|
|
142
142
|
const ar = a[0];
|
|
143
143
|
const iar = 1 / (1 + ar * ar);
|
|
144
144
|
const out = [Math.atan(ar)];
|
|
145
|
-
for (let i = a.length; --
|
|
145
|
+
for (let i = a.length; i-- > 1;) {
|
|
146
146
|
out[i] = iar * a[i];
|
|
147
147
|
}
|
|
148
148
|
return out;
|
package/package.json
CHANGED
|
@@ -1,90 +1,95 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
"name": "@thi.ng/dual-algebra",
|
|
3
|
+
"version": "0.4.2",
|
|
4
|
+
"description": "Multivariate dual number algebra, automatic differentiation",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"module": "./index.js",
|
|
7
|
+
"typings": "./index.d.ts",
|
|
8
|
+
"sideEffects": false,
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/thi-ng/umbrella.git"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://github.com/thi-ng/umbrella/tree/master/packages/dual-algebra#readme",
|
|
14
|
+
"funding": [
|
|
15
|
+
{
|
|
16
|
+
"type": "github",
|
|
17
|
+
"url": "https://github.com/sponsors/postspectacular"
|
|
12
18
|
},
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
|
|
19
|
+
{
|
|
20
|
+
"type": "patreon",
|
|
21
|
+
"url": "https://patreon.com/thing_umbrella"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"author": "Karsten Schmidt <k+npm@thi.ng>",
|
|
25
|
+
"license": "Apache-2.0",
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "yarn clean && tsc --declaration",
|
|
28
|
+
"clean": "rimraf '*.js' '*.d.ts' '*.map' doc",
|
|
29
|
+
"doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
|
|
30
|
+
"doc:ae": "mkdir -p .ae/doc .ae/temp && api-extractor run --local --verbose",
|
|
31
|
+
"doc:readme": "yarn doc:stats && tools:readme",
|
|
32
|
+
"doc:stats": "tools:module-stats",
|
|
33
|
+
"pub": "yarn npm publish --access public",
|
|
34
|
+
"test": "testament test"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@thi.ng/api": "^8.3.2"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@microsoft/api-extractor": "^7.18.19",
|
|
41
|
+
"@thi.ng/testament": "^0.2.2",
|
|
42
|
+
"rimraf": "^3.0.2",
|
|
43
|
+
"tools": "^0.0.1",
|
|
44
|
+
"typedoc": "^0.22.9",
|
|
45
|
+
"typescript": "^4.5.2"
|
|
46
|
+
},
|
|
47
|
+
"keywords": [
|
|
48
|
+
"algebra",
|
|
49
|
+
"datastructure",
|
|
50
|
+
"derivative",
|
|
51
|
+
"descend",
|
|
52
|
+
"differentiation",
|
|
53
|
+
"dual",
|
|
54
|
+
"gradient",
|
|
55
|
+
"math",
|
|
56
|
+
"multivariate",
|
|
57
|
+
"typescript",
|
|
58
|
+
"vector"
|
|
59
|
+
],
|
|
60
|
+
"publishConfig": {
|
|
61
|
+
"access": "public"
|
|
62
|
+
},
|
|
63
|
+
"engines": {
|
|
64
|
+
"node": ">=12.7"
|
|
65
|
+
},
|
|
66
|
+
"files": [
|
|
67
|
+
"*.js",
|
|
68
|
+
"*.d.ts"
|
|
69
|
+
],
|
|
70
|
+
"exports": {
|
|
71
|
+
".": {
|
|
72
|
+
"import": "./index.js"
|
|
38
73
|
},
|
|
39
|
-
"
|
|
40
|
-
|
|
74
|
+
"./api": {
|
|
75
|
+
"import": "./api.js"
|
|
41
76
|
},
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
"datastructure",
|
|
45
|
-
"derivative",
|
|
46
|
-
"descend",
|
|
47
|
-
"differentiation",
|
|
48
|
-
"dual",
|
|
49
|
-
"gradient",
|
|
50
|
-
"math",
|
|
51
|
-
"multivariate",
|
|
52
|
-
"typescript",
|
|
53
|
-
"vector"
|
|
54
|
-
],
|
|
55
|
-
"publishConfig": {
|
|
56
|
-
"access": "public"
|
|
77
|
+
"./ops": {
|
|
78
|
+
"import": "./ops.js"
|
|
57
79
|
},
|
|
58
|
-
"
|
|
59
|
-
|
|
80
|
+
"./poly": {
|
|
81
|
+
"import": "./poly.js"
|
|
60
82
|
},
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
83
|
+
"./vector": {
|
|
84
|
+
"import": "./vector.js"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"thi.ng": {
|
|
88
|
+
"related": [
|
|
89
|
+
"math"
|
|
64
90
|
],
|
|
65
|
-
"
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"import": "./api.js"
|
|
71
|
-
},
|
|
72
|
-
"./ops": {
|
|
73
|
-
"import": "./ops.js"
|
|
74
|
-
},
|
|
75
|
-
"./poly": {
|
|
76
|
-
"import": "./poly.js"
|
|
77
|
-
},
|
|
78
|
-
"./vector": {
|
|
79
|
-
"import": "./vector.js"
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
"thi.ng": {
|
|
83
|
-
"related": [
|
|
84
|
-
"math"
|
|
85
|
-
],
|
|
86
|
-
"status": "alpha",
|
|
87
|
-
"year": 2020
|
|
88
|
-
},
|
|
89
|
-
"gitHead": "852cd2450617c86d15d18477dc634f17f04202eb"
|
|
90
|
-
}
|
|
91
|
+
"status": "alpha",
|
|
92
|
+
"year": 2020
|
|
93
|
+
},
|
|
94
|
+
"gitHead": "e8a7c2a40191b391cef182c2978e5a6c85987a87\n"
|
|
95
|
+
}
|