alexpozdnyakof / tensor-protocol

simple typescript protocol for matrix operations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tensor protocol typings

For parallel matrix calculation through web worker threads.

 type Tensor = Array<number[]>

 type TensorProtocol = {
   sum: {
     income: [Tensor, Tensor]
     outcome: Tensor
   },
   determinant: {
     income: [Tensor]
     outcome: number
   },
   divide: {
     income: [Tensor, Tensor]
     outcome: Tensor
   }
 }

const tensorProtocolThread = createThreadProtocol<TensorProtocol>('./TensorWorker.ts')
const parallelTensorSum = tensorProtocolThread('sum')

parallelTensorSum([[132, 181], [235, 84]], [[335, 116], [374, 23]])
.then(sum => {console.log({sum})})

About

simple typescript protocol for matrix operations


Languages

Language:TypeScript 100.0%