Esempio n. 1
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);
        }
Esempio n. 2
0
        static MatrixList <MatrixList <int> > GetMassiveList(int Qnum)
        {
            Random random = new Random();
            MatrixList <MatrixList <int> > matrixlist = 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(random.Next(0, 2));
                }
                matrixlist.ElemAdd(act);
            }
            return(matrixlist);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }