Ejemplo n.º 1
0
        public static Vector Solve(this Matrix matrix, Vector vector, MatrixMethod method = MatrixMethod.LU)
        {
            switch (method)
            {
            case MatrixMethod.LU:
                return(LU.Solve(matrix, vector));

            case MatrixMethod.Cholesky:
                return(Cholesky.Solve(matrix, vector));

            case MatrixMethod.SVD:
                return(SVD.Solve(matrix, vector));

            default:
                throw new IndexOutOfRangeException(nameof(method));
            }
        }
Ejemplo n.º 2
0
        public static Matrix Inverse(this Matrix matrix, MatrixMethod method = MatrixMethod.LU)
        {
            switch (method)
            {
            case MatrixMethod.LU:
                return(LU.Inverse(matrix));

            case MatrixMethod.Cholesky:
                return(Cholesky.Inverse(matrix));

            case MatrixMethod.SVD:
                return(SVD.Inverse(matrix));

            default:
                throw new IndexOutOfRangeException(nameof(method));
            }
        }