コード例 #1
0
        public static MyMatrix multiply(MyMatrix a, MyMatrix b)
        {
            double[,] array1 = new double[a.GetHeight(), b.GetWidth()];
            for (int i = 0; i < a.GetWidth(); i++)
            {
                for (int i1 = 0; i1 < b.GetWidth(); i1++)
                {
                    for (int i2 = 0; i2 < b.GetWidth(); i2++)
                    {
                        array1[i, i1] += a[i, i2] * b[i2, i1];
                    }
                }
            }
            MyMatrix resMass = new MyMatrix(array1);

            return(resMass);
        }
コード例 #2
0
        public static MyMatrix Sum(MyMatrix first, MyMatrix second)
        {
            double[,] array1 = new double[first.GetHeight(), first.GetWidth()];
            if (first.GetHeight() != second.GetHeight() || first.GetWidth() != second.GetWidth())
            {
                Console.WriteLine("Impossible. Matrixes not the same!");
            }
            else
            {
                for (int i = 0; i < first.GetHeight(); i++)
                {
                    for (int j = 0; j < first.GetWidth(); j++)
                    {
                        array1[i, j] = first[i, j] + second[i, j];
                    }
                }
            }
            MyMatrix resMass = new MyMatrix(array1);

            return(resMass);
        }
コード例 #3
0
 public static MyMatrix operator +(MyMatrix first, MyMatrix second)
 {
     return(MyMatrix.Sum(first, second));
 }
コード例 #4
0
        public MyMatrix GetTransponedCopy()
        {
            MyMatrix result = new MyMatrix(GetTransponedArray());

            return(result);
        }
コード例 #5
0
 public MyMatrix(MyMatrix newMatrix)
 {
     MyMatrix _matrix = newMatrix;
 }
コード例 #6
0
 public static MyMatrix operator *(MyMatrix a, MyMatrix b)
 {
     return(MyMatrix.multiply(a, b));
 }
コード例 #7
0
ファイル: MyMatrix.cs プロジェクト: semikss1805/OOP
 public MyMatrix(MyMatrix mtx)
 {
     matrix = (double[, ])mtx.matrix.Clone();
 }