CLIJ2

Logo

GPU accelerated image processing for everyone

CLIJ2 home

multiplyMatrix

Multiplies two matrices with each other.

Category: Math

Availability: Available in Fiji by activating the update sites clij and clij2. This function is part of clij2_-2.5.0.1.jar.

multiplyMatrix often follows after

multiplyMatrix is often followed by

Usage in ImageJ macro

Ext.CLIJ2_multiplyMatrix(Image matrix1, Image matrix2, Image matrix_destination);

Usage in object oriented programming languages

Java
// init CLIJ and GPU
import net.haesleinhuepf.clij2.CLIJ2;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ2 clij2 = CLIJ2.getInstance();

// get input parameters
ClearCLBuffer matrix1 = clij2.push(matrix1ImagePlus);
ClearCLBuffer matrix2 = clij2.push(matrix2ImagePlus);
matrix_destination = clij2.create(matrix1);
// Execute operation on GPU
clij2.multiplyMatrix(matrix1, matrix2, matrix_destination);
// show result
matrix_destinationImagePlus = clij2.pull(matrix_destination);
matrix_destinationImagePlus.show();

// cleanup memory on GPU
clij2.release(matrix1);
clij2.release(matrix2);
clij2.release(matrix_destination);
Matlab
% init CLIJ and GPU
clij2 = init_clatlab();

% get input parameters
matrix1 = clij2.pushMat(matrix1_matrix);
matrix2 = clij2.pushMat(matrix2_matrix);
matrix_destination = clij2.create(matrix1);
% Execute operation on GPU
clij2.multiplyMatrix(matrix1, matrix2, matrix_destination);
% show result
matrix_destination = clij2.pullMat(matrix_destination)

% cleanup memory on GPU
clij2.release(matrix1);
clij2.release(matrix2);
clij2.release(matrix_destination);
Icy JavaScript
// init CLIJ and GPU
importClass(net.haesleinhuepf.clicy.CLICY);
importClass(Packages.icy.main.Icy);

clij2 = CLICY.getInstance();

// get input parameters
matrix1_sequence = getSequence();
matrix1 = clij2.pushSequence(matrix1_sequence);
matrix2_sequence = getSequence();
matrix2 = clij2.pushSequence(matrix2_sequence);
matrix_destination = clij2.create(matrix1);
// Execute operation on GPU
clij2.multiplyMatrix(matrix1, matrix2, matrix_destination);
// show result
matrix_destination_sequence = clij2.pullSequence(matrix_destination)
Icy.addSequence(matrix_destination_sequence);
// cleanup memory on GPU
clij2.release(matrix1);
clij2.release(matrix2);
clij2.release(matrix_destination);
clEsperanto Python (experimental)
import pyclesperanto_prototype as cle

cle.multiply_matrix(matrix1, matrix2, matrix_destination)

Example notebooks

matrix_multiply
multiply_matrices.ipynb
matrix_multiplication.ipynb

Example scripts

matrix_multiply.ijm
matrix_multiply.m
matrix_multiply_benchmarking.m

Back to CLIJ2 reference Back to CLIJ2 documentation

Imprint