diff --git a/mindspore/python/mindspore/scipy/linalg.py b/mindspore/python/mindspore/scipy/linalg.py index 9675e0485c3..407e76e87c6 100755 --- a/mindspore/python/mindspore/scipy/linalg.py +++ b/mindspore/python/mindspore/scipy/linalg.py @@ -218,9 +218,9 @@ def cho_factor(a, lower=False, overwrite_a=False, check_finite=True): (crashes, non-termination) if the inputs do contain infinities or NaNs. Returns: - - Tensor, Matrix whose upper or lower triangle contains the Cholesky factor of `a`. + - Tensor, matrix whose upper or lower triangle contains the Cholesky factor of `a`. Other parts of the matrix contain random data. - - bool, Flag indicating whether the factor is in the lower or upper triangle + - bool, flag indicating whether the factor is in the lower or upper triangle Raises: LinAlgError: Raised if decomposition fails. @@ -263,7 +263,7 @@ def cholesky(a, lower=False, overwrite_a=False, check_finite=True): (crashes, non-termination) if the inputs do contain infinities or NaNs. Returns: - Tensor, Upper- or lower-triangular Cholesky factor of `a`. + Tensor, upper- or lower-triangular Cholesky factor of `a`. Raises: LinAlgError: if decomposition fails. @@ -367,7 +367,7 @@ def eigh(a, b=None, lower=True, eigvals_only=False, overwrite_a=False, and eigenvectors are returned. Default: None. Returns: - - Tensor with shape :math:`(N,)`, The :math:`N (1<=N<=M)` selected eigenvalues, in ascending order, + - Tensor with shape :math:`(N,)`, the :math:`N (1<=N<=M)` selected eigenvalues, in ascending order, each repeated according to its multiplicity. - Tensor with shape :math:`(M, N)`, (if ``eigvals_only == False``) @@ -465,11 +465,12 @@ def lu_factor(a, overwrite_a=False, check_finite=True): .. math:: A = P L U - where P is a permutation matrix, L lower triangular with unit diagonal elements, and U upper triangular. + where :math:`P` is a permutation matrix, :math:`L` lower triangular with unit diagonal elements, + and :math:`U` upper triangular. Args: a (Tensor): square matrix of :math:`(M, M)` to decompose. - overwrite_a (bool, optional): Whether to overwrite data in `A` (may increase performance). Default: False. + overwrite_a (bool, optional): Whether to overwrite data in :math:`A` (may increase performance). Default: False. check_finite (bool, optional): Whether to check that the input matrix contains only finite numbers. Disabling may give a performance gain, but may result in problems (crashes, non-termination) if the inputs do contain infinities or NaNs. Default: True. @@ -518,13 +519,13 @@ def lu(a, permute_l=False, overwrite_a=False, check_finite=True): .. math:: A = P L U - where P is a permutation matrix, L lower triangular with unit - diagonal elements, and U upper triangular. + where :math:`P` is a permutation matrix, :math:`L` lower triangular with unit + diagonal elements, and :math:`U` upper triangular. Args: a (Tensor): a :math:`(M, N)` matrix to decompose. permute_l (bool, optional): Perform the multiplication :math:`P L` (Default: do not permute). Default: False. - overwrite_a (bool, optional): Whether to overwrite data in a (may improve performance). Default: False. + overwrite_a (bool, optional): Whether to overwrite data in :math:`A` (may improve performance). Default: False. check_finite (bool, optional): Whether to check that the input matrix contains only finite numbers. Disabling may give a performance gain, but may result in problems (crashes, non-termination) if the inputs do contain infinities or NaNs. Default: True. @@ -603,7 +604,7 @@ def lu_solve(lu_and_piv, b, trans=0, overwrite_b=False, check_finite=True): if the inputs do contain infinities or NaNs. Returns: - Tesnor, Solution to the system + Tesnor, solution to the system Supported Platforms: ``CPU`` ``GPU`` diff --git a/mindspore/python/mindspore/scipy/ops.py b/mindspore/python/mindspore/scipy/ops.py index db52e843d95..d2316a3b9e8 100644 --- a/mindspore/python/mindspore/scipy/ops.py +++ b/mindspore/python/mindspore/scipy/ops.py @@ -22,34 +22,37 @@ from ..ops import functional as F class SolveTriangular(PrimitiveWithInfer): """ - SolveTriangular op frontend implementation. + Solve the equation `a x = b` for `x`, assuming a is a triangular matrix. Args: - lower (bool): The input Matrix :math:`A` is lower triangular matrix or not. - unit_diagonal (bool): If True, diagonal elements of :math:`A` are assumed to be 1 and - will not be referenced. + A (Tensor): A triangular matrix of shape :math:`(N, N)`. + b (Tensor): A Tensor of shape :math:`(M,)` or :math:`(M, N)`. + Right-hand side matrix in :math:`A x = b`. + lower (bool, optional): Use only data contained in the lower triangle of `a`. + Default is to use upper triangle. trans (0, 1, 2, 'N', 'T', 'C', optional): Type of system to solve: - - ======== ========= - trans system - ======== ========= - 0 or 'N' a x = b - 1 or 'T' a^T x = b - 2 or 'C' a^H x = b - ======== ========= - - Inputs: - - **A** (Tensor) - A triangular matrix of shape :math:`(N, N)`. - - **b** (Tensor) - A Tensor of shape :math:`(M,)` or :math:`(M, N)`. Right-hand side matrix in :math:`A x = b`. + trans: system: + 0 or 'N' a x = b + 1 or 'T' a^T x = b + 2 or 'C' a^H x = b + unit_diagonal (bool, optional): If True, diagonal elements of :math:`A` are assumed to be 1 and + will not be referenced. + overwrite_b (bool, optional): Allow overwriting data in :math:`b` (may enhance performance) + check_finite (bool, optional): Whether to check that the input matrices contain only finite numbers. + Disabling may give a performance gain, but may result in problems + (crashes, non-termination) if the inputs do contain infinities or NaNs. Returns: - - **x** (Tensor) - A Tensor of shape :math:`(M,)` or :math:`(M, N)`, - which is the solution to the system :math:`A x = b`. - Shape of :math:`x` matches :math:`b`. + Tensor of shape :math:`(M,)` or :math:`(M, N)`, + which is the solution to the system :math:`A x = b`. + Shape of :math:`x` matches :math:`b`. + + Raises: + LinAlgError: If :math:`A` is singular Supported Platforms: - ``GPU`` ``CPU`` + ``CPU`` ``GPU`` Examples: Solve the lower triangular system :math:`A x = b`, where: