cupyx.scipy.sparse.linalg.lsmr#

cupyx.scipy.sparse.linalg.lsmr(A, b, x0=None, damp=0.0, atol=1e-06, btol=1e-06, conlim=100000000.0, maxiter=None)[源代码][源代码]#

用于最小二乘问题的迭代求解器。

lsmr 解决线性方程组 Ax = b。如果系统不一致,它解决最小二乘问题 min ||b - Ax||_2。A 是一个维度为 m×n 的矩形矩阵,其中所有情况都允许:m = n,m > n,或 m < n。B 是一个长度为 m 的向量。矩阵 A 可以是密集的或稀疏的(通常是稀疏的)。

参数:
  • A (ndarray, spmatrix or LinearOperator) – 线性系统的实数或复数矩阵。A 必须是 cupy.ndarraycupyx.scipy.sparse.spmatrixcupyx.scipy.sparse.linalg.LinearOperator

  • b (cupy.ndarray) – 线性系统的右侧,形状为 (m,)(m, 1)

  • x0 (cupy.ndarray) – 解决方案的初始猜测。如果为 None,则使用零。

  • damp (float) – 正则化最小二乘法的阻尼因子。lsmr 解决了正则化最小二乘问题 :: min ||(b) - ( A )x|| ||(0) (damp*I) ||_2 其中 damp 是一个标量。如果 damp 为 None 或 0,则系统在没有正则化的情况下求解。

  • atol (float) – 停止容差。lsmr 会继续迭代,直到某个后向误差估计小于某个取决于 atol 和 btol 的量。

  • btol (float) – 停止容差。lsmr 会继续迭代,直到某个后向误差估计小于某个取决于 atol 和 btol 的量。

  • conlim (float) – lsmr 在估计的 cond(A) 即矩阵的条件数超过 conlim 时终止。如果 conlim 为 None,默认值为 1e+8。

  • maxiter (int) – 最大迭代次数。

返回:

  • x (ndarray): 返回的最小二乘解。

  • istop (int): istop 给出了停止的原因:

    0 means x=0 is a solution.
    
    1 means x is an approximate solution to A*x = B,
    according to atol and btol.
    
    2 means x approximately solves the least-squares problem
    according to atol.
    
    3 means COND(A) seems to be greater than CONLIM.
    
    4 is the same as 1 with atol = btol = eps (machine
    precision)
    
    5 is the same as 2 with atol = eps.
    
    6 is the same as 3 with CONLIM = 1/eps.
    
    7 means ITN reached maxiter before the other stopping
    conditions were satisfied.
    
  • itn (int): 使用的迭代次数。

  • normr (float): norm(b-Ax)

  • normar (float): norm(A^T (b - Ax))

  • norma (float): norm(A)

  • conda (float): A 的条件数。

  • normx (float): norm(x)

返回类型:

tuple

引用

D. C.-L. Fong and M. A. Saunders, “LSMR: An iterative algorithm for sparse least-squares problems”, SIAM J. Sci. Comput., vol. 33, pp. 2950-2971, 2011.