https://github.com/emilamaj/js-fmgpu
Fast Matrix GPU: GPU accelerated matrix operations in JS
https://github.com/emilamaj/js-fmgpu
equations-solver gpu-js javascript linear-algebra
Last synced: 13 days ago
JSON representation
Fast Matrix GPU: GPU accelerated matrix operations in JS
- Host: GitHub
- URL: https://github.com/emilamaj/js-fmgpu
- Owner: emilamaj
- Created: 2023-03-30T11:51:54.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-04-20T15:16:42.000Z (about 3 years ago)
- Last Synced: 2025-08-09T09:05:50.119Z (11 months ago)
- Topics: equations-solver, gpu-js, javascript, linear-algebra
- Language: JavaScript
- Homepage:
- Size: 65.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://github.com/emilamaj/js-fmgpu/actions/workflows/main.yml)
# FMGPU: Fast Matrix operations of the GPU
This library allows to efficiently carry out matrix operations using GPU acceleration.
The package is available on npm as [js-fmgpu](https://www.npmjs.com/package/js-fmgpu).
The following functions are currently available:
## Todo
The following functions are to be implemented next:
- det (GPU accelerated)
- map
- inverse
## scale
Multiply input matrix by a scalar value.
`B = fmgpu.scale(A, alpha)`
## add
Add two matrices together.
`C = fmgpu.add(A, B)`
## sub
Subtract second matrix from first one
`C = fmgpu.sub(A, B)`
## transpose
Transpose the given matrix
`B = fmgpu.transpose(A)`
## hadamard
Returns Hadamard product, also known as pointwise product between two matrices
`C = fmgpu.hadamard(A, B)`
## dot
Returns the dot product between two matrices.
`C = fmgpu.dot(A, B)`
## detJS (pure JS)
Returns the determinant of a given matrix. Note that this function is not yet GPU-accelerated.
`B = fmgpu.detJS(A)`
## equals
Returns `true` if two matrices are equal (within some epsilon value)
`eq = fmgpu.equals(A, B, 1e-6)`
## solveLinearSystemSmall (pure JS)
Solves a linear system of equations using pure JS code (less overhead, better for smaller matrices, of size < 200)
`x = fmgpu.solveLinearSystemSmall(A, b)`
## solveLinearSystem
Solves a linear system of equations using GPU-accelerated code. (Adapted for matrices of size N > 200)
`x = fmgpu.solveLinearSystem(A, b)`