+ 2

Does the .NET Framework Class Library provide any features for computing the product of two 2D arrays?

I've created a function that can multiply two double[3,3] arrays using for loops however, I was wondering if there's vectorised technique for doing the same task?

17th Mar 2017, 3:25 AM
Adder
Adder - avatar
5 Antworten
+ 1
Any chance you know of any alternative way of achieving this?
24th Mar 2017, 3:56 PM
Adder
Adder - avatar
+ 1
Sure, it's just basic 3x3 matrix multiplication: public double[,] matrixMulti(double[,] a, double[,] b) { double[,] result = new double[3,3]; if(a.GetLength(0) == b.GetLength(1)){ for(int i = 0; I < a.GetLength(0); I++){ for(int j = 0; j < b.GetLength(1) j++){ for(int k = 0; k < a.GetLength(1); k++){ result[ i, j ] += a[ i, k] * b[ k, j ]; } } } } return result; }
24th Mar 2017, 5:03 PM
Adder
Adder - avatar
0
This question still hasn't really been answered so, any solutions would be greatly welcome.
27th Mar 2017, 12:37 AM
Adder
Adder - avatar