using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ManyWorldsTheory { class GFG { // rowa and cola are no of rows // and columns of matrix A // rowb and colb are no of rows // and columns of matrix B static int cola = 3, rowa = 3; static int colb = 3, rowb = 3; // Function to computes the Kronecker // Product of two matrices public static TAlex.MathCore.LinearAlgebra.CMatrix Kroneckerproduct(TAlex.MathCore.LinearAlgebra.CMatrix A, TAlex.MathCore.LinearAlgebra.CMatrix B) { TAlex.MathCore.LinearAlgebra.CMatrix matr = new TAlex.MathCore.LinearAlgebra.CMatrix(new double[3,3]); // i loops till rowa for (int i = 0; i < rowa; i++) { // k loops till rowb for (int k = 0; k < rowb; k++) { // j loops till cola for (int j = 0; j < cola; j++) { // l loops till colb for (int l = 0; l < colb; l++) { matr[i + l + 1, j + k + 1] = A[i, j] * B[k, l]; }; //Das stand normalerweise drin // Each element of matrix A is // multiplied by whole Matrix B // resp and stored as Matrix C //C[i + l + 1, j + k + 1] = A[i, j] * // B[k, l]; //Console.Write(C[i + l + 1, // j + k + 1] + " "); //} // } // //Console.WriteLine(); // } // } // } // } //} } } } return new TAlex.MathCore.LinearAlgebra.CMatrix(matr); } } }