ml-matrix-convolution

Matrix convolution: It offers the direct and the fourier transform convolution

Usage no npm install needed!

<script type="module">
  import mlMatrixConvolution from 'https://cdn.skypack.dev/ml-matrix-convolution';
</script>

README

ml-matrix-convolution

NPM version build status Test coverage npm download

Matrix convolution.

Installation

npm i ml-matrix-convolution
const MatrixConvolution = require('ml-matrix-convolution');

let matrix = [
  [1, 1, 1, 1, 1],
  [1, 1, 1, 1, 1],
  [1, 1, 1, 1, 1],
  [1, 1, 1, 1, 1],
  [1, 1, 1, 1, 1],
];

let kernel = [
  [1, 1, 1],
  [1, 1, 1],
  [1, 1, 1],
];

let conv1 = MatrixConvolution.direct(matrix, kernel);

let conv2 = MatrixConvolution.fft(matrix, kerne11);

console.log({ conv1, conv2 }); // both should be equal

License

MIT