コード例 #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));
            }
        }
コード例 #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));
            }
        }