CLIJ2

Logo

GPU accelerated image processing for everyone

CLIJ2 home

multiplyMatrix

Multiplies two matrices with each other.

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 Java

clij2.multiplyMatrix(matrix1, matrix2, matrix_destination);
// 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);

Usage in Matlab

clij2.multiplyMatrix(matrix1, matrix2, matrix_destination);
% 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);

Usage in Icy

clij2.multiplyMatrix(matrix1, matrix2, matrix_destination);
// 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);

Example notebooks

matrix_multiply

Example scripts

matrix_multiply.ijm
matrix_multiply.m
matrix_multiply_benchmarking.m

Back to CLIJ2 reference Back to CLIJ2 documentation

Imprint