This library allows to efficiently carry out matrix operations using GPU acceleration. The package is available on npm as js-fmgpu. The following functions are currently available:
The following functions are to be implemented next:
- det (GPU accelerated)
- map
- inverse
Multiply input matrix by a scalar value.
B = fmgpu.scale(A, alpha)
Add two matrices together.
C = fmgpu.add(A, B)
Subtract second matrix from first one
C = fmgpu.sub(A, B)
Transpose the given matrix
B = fmgpu.transpose(A)
Returns Hadamard product, also known as pointwise product between two matrices
C = fmgpu.hadamard(A, B)
Returns the dot product between two matrices.
C = fmgpu.dot(A, B)
Returns the determinant of a given matrix. Note that this function is not yet GPU-accelerated.
B = fmgpu.detJS(A)
Returns true
if two matrices are equal (within some epsilon value)
eq = fmgpu.equals(A, B, 1e-6)
Solves a linear system of equations using pure JS code (less overhead, better for smaller matrices, of size < 200)
x = fmgpu.solveLinearSystemSmall(A, b)
Solves a linear system of equations using GPU-accelerated code. (Adapted for matrices of size N > 200)
x = fmgpu.solveLinearSystem(A, b)