I want to create a pixel bender script that does this (linear algebraic multiplication) on 2 matrices: for (j=0;j<$rows;j++) { for (k=0;k<$columns;k++) { for (s=0;s<m2.$rows;s++) $m[j][k] += m1.$m[j][s]*m2.$m[s][k]; } } } }
Matrix math is built into Pixel Bender.
Are you trying to do multiplication on matrices of any size? 2x2, 3x3 and 4x4 matrices are built into Pixel Bender and can be multiplied simply:
float4x4 matrix1, matrix2, matrix3;
matrix3 = matrix1 * matrix2;
You could do the same for 2x2, 3x3 or 4x4 matrices. There isn't a simple way to encode arbitrary size matrices in Pixel Bender, but there are ways to hack them...
+