Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
 public static MyMatrix operator +(MyMatrix first, MyMatrix second)
 {
     return(MyMatrix.Sum(first, second));
 }
Ejemplo n.º 4
0
        public MyMatrix GetTransponedCopy()
        {
            MyMatrix result = new MyMatrix(GetTransponedArray());

            return(result);
        }
Ejemplo n.º 5
0
 public MyMatrix(MyMatrix newMatrix)
 {
     MyMatrix _matrix = newMatrix;
 }
Ejemplo n.º 6
0
 public static MyMatrix operator *(MyMatrix a, MyMatrix b)
 {
     return(MyMatrix.multiply(a, b));
 }
Ejemplo n.º 7
0
 public MyMatrix(MyMatrix mtx)
 {
     matrix = (double[, ])mtx.matrix.Clone();
 }