TypeScript library to operate with matrix.
npm install matrix-calculusmatrix-calculus is a TypeScript library created to perform common matrix calculations. At first realizations it was created for neural network engine called "Nika" (for game AI aims). The library is successfully working as part of the highloaded game AI service based on Node JS.
bash
npm i --save matrix-calculus
`
Usage
`typescript
import {Matrix, Data} from 'matrix-calculus';
import {SingleColMatrixFactory} from 'matrix-calculus/factories';
const valuesRaw:number[] = [2, 5, 3, 6, 2];
const weightsRaw:number[] = [1.7364, .8255, .01672, 1.8354, .5948];
const values:Matrix = SingleColMatrixFactory.create(valuesRaw);
const weights:Matrix = SingleColMatrixFactory.create(weightsRaw);
const weightedValues:Matrix = values.multiplyTermByTerm(weights);
const weightedValuesTransposed:Matrix = weightedValues.transpose();
const serialized:Data = weightedValuesTransposed.getData();
console.log('Transposed weighted values:', serialized);
``