示例#1
0
 static void PrintMatrix(MatrixList <MatrixList <int> > matrixlist, int Qnum)
 {
     for (int i = 0; i < Qnum; i++)
     {
         MatrixList <int> act = matrixlist.Prepare(i).data;
         act.PrintMatrix();
         Console.WriteLine();
     }
 }
示例#2
0
        static MatrixList <MatrixList <int> > TransposeMatrix(MatrixList <MatrixList <int> > matrixlist, int Qnum)
        {
            MatrixList <MatrixList <int> > transpose = new MatrixList <MatrixList <int> >();

            for (int i = 0; i < Qnum; i++)
            {
                MatrixList <int> act = new MatrixList <int>();
                for (int j = 0; j < Qnum; j++)
                {
                    act.ElemAdd(matrixlist.Prepare(j).data.GetNumber(i));
                }
                transpose.ElemAdd(act);
            }
            return(transpose);
        }
示例#3
0
        static MatrixList <MatrixList <int> > SumMatrix(MatrixList <MatrixList <int> > matrixlist1, MatrixList <MatrixList <int> > matrixlist2, int Qnum)
        {
            MatrixList <MatrixList <int> > sum = new MatrixList <MatrixList <int> >();

            for (int i = 0; i < Qnum; i++)
            {
                MatrixList <int> act1 = matrixlist1.Prepare(i).data;
                MatrixList <int> act2 = matrixlist2.Prepare(i).data;
                MatrixList <int> Act  = new MatrixList <int>();
                for (int j = 0; j < Qnum; j++)
                {
                    Act.ElemAdd(act1.GetNumber(j) + act2.GetNumber(j));
                }
                sum.ElemAdd(Act);
            }
            return(sum);
        }
示例#4
0
        static MatrixList <MatrixList <int> > MultiplyMatrix(MatrixList <MatrixList <int> > matrixlist1, MatrixList <MatrixList <int> > matrixlist2, int Qnum)
        {
            MatrixList <MatrixList <int> > multiply = new MatrixList <MatrixList <int> >();
            int elem = 0;

            for (int i = 0; i < Qnum; i++)
            {
                MatrixList <int> act = new MatrixList <int>();
                for (int j = 0; j < Qnum; j++)
                {
                    for (int k = 0; k < Qnum; k++)
                    {
                        elem += matrixlist1.Prepare(i).data.GetNumber(k) * matrixlist2.Prepare(k).data.GetNumber(j);
                    }
                    act.ElemAdd(elem);
                    elem = 0;
                }
                multiply.ElemAdd(act);
            }
            return(multiply);
        }