Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cshaa/tensors.js
Proof-of-concept tensors for math.js
https://github.com/cshaa/tensors.js
Last synced: about 2 months ago
JSON representation
Proof-of-concept tensors for math.js
- Host: GitHub
- URL: https://github.com/cshaa/tensors.js
- Owner: cshaa
- License: apache-2.0
- Created: 2020-03-01T00:00:35.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-05-12T00:31:25.000Z (over 3 years ago)
- Last Synced: 2024-10-14T19:38:29.677Z (3 months ago)
- Language: TypeScript
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tensors.js
Proof-of-concept tensors for math.js## Intended usage
```typescript
import { vectorSpace, Reals, add, mul } from 'tensorjs';
import { matrix, diag } from 'mathjs';const V = vectorSpace(Reals, 4);
const δ = V.identity;δ.i.i // error
δ.I.i // 4V.setIndexBasis('a..f', V.canon);
δ.A.b // diag([1,1,1,1])
const T = V.tensor(2,0);
mul(T.I.J, δ.K.j) // T.I.K
T.A.B = matrix([
[1, 2, 3, 4],
[0, 1, 0, 0],
[5, 6, 7, 8],
[0, 0, 0,-1]
]);const g = V.tensor(0,2);
g.a.b = diag([-1,1,1,1]);
V.metric = g;T.A.a // 6
T.I.i // 6
```