Ejemplo n.º 1
0
        private static SquareMatrix <T> Addition(SquareMatrix <T> matrixA, SymmetricalMatrix <T> matrixB)
        {
            var newMatrix = new SquareMatrix <T>(matrixA.Size);

            for (int i = 0; i < matrixB.Size; i++)
            {
                for (int j = 0; j < matrixB.Size; j++)
                {
                    newMatrix[i, j] = (dynamic)matrixA[i, j] + (dynamic)matrixB[i, j];
                }
            }

            return(newMatrix);
        }
Ejemplo n.º 2
0
        private static SymmetricalMatrix <T> Addition(DiagonalMatrix <T> matrixA, SymmetricalMatrix <T> matrixB)
        {
            var newMatrix = new SymmetricalMatrix <T>(matrixA.Size);

            for (int i = 0; i < matrixB.Size; i++)
            {
                for (int j = 0; j < matrixB.Size; j++)
                {
                    if (i == j)
                    {
                        newMatrix[i, j] = (dynamic)matrixA[i, j] + (dynamic)matrixB[i, j];
                    }
                    else
                    {
                        newMatrix[i, j] = matrixB[i, j];
                    }
                }
            }

            return(newMatrix);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Finds sum with symmetric matrix
 /// </summary>
 /// <param name="matrix">symmetric matrix which is added to existing matrix</param>
 /// <returns>new square matrix as result of sum two matrixes</returns>
 public SquareMatrix <T> Visit(SymmetricalMatrix <T> matrix) => Sum(matrix);