LU 分解

本文介绍了LU分解的算法来源,引用了Toledo在1997年的论文,并详细阐述了LAPACK中的dgetrf()函数。此外,还讨论了如何使用scipy库进行LU分解,并给出了实例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

待续

1.算法来源

Toledo, S. 1997. Locality of Reference in LU Decomposition with Partial Pivoting. SIAM J. Matrix Anal. Appl. 18, 4 (Oct. 1997),1065-1081.
https://sci-hub.wf/10.1137/s0895479896297744

论文中原始算法:
在这里插入图片描述

2.LAPACK dgetrf()

LAPACK 中 dgetrf() API介绍:
http://www.netlib.org/lapack/explorehtml/dd/d9a/group__double_g_ecomputational_ga0019443faea08275ca60a734d0593e60.html#ga0019443faea08275ca60a734d0593e60

subroutine dgetrf  ( integer  M,  
  integer  N,  
  double precision, dimension( lda, * )  A,  
  integer  LDA,  
  integer, dimension( * )  IPIV,  
  integer  INFO  
 ) 

API的返回值有些难以理解,可参考此描述:
在这里插入图片描述
即返回值也覆盖在A里,L对角线元素都是1,所以返回的A中也就不体现L的对角线元素。
在这里插入图片描述
另外还有P矩阵(permutation/pivot matrix),可能是体现在IPIV?待验证

3.使用scipy进行LU分解实例

直接使用scipy官网中的例子:scipy.linalg.lu

import numpy as np
from scipy.linalg import lu
A = np.array([[2, 5, 8, 7], [5, 2, 2, 8], [7, 5, 6, 6], [5, 4, 4, 8]])
p, l, u = lu(A)
#p
array([[0., 1., 0., 0.],
       [0., 0., 0., 1.],
       [1., 0., 0., 0.],
       [0., 0., 1., 0.]])
#l
array([[ 1.        ,  0.        ,  0.        ,  0.        ],
       [ 0.28571429,  1.        ,  0.        ,  0.        ],
       [ 0.71428571,  0.12      ,  1.        ,  0.        ],
       [ 0.71428571, -0.44      , -0.46153846,  1.        ]])
#u
array([[ 7.        ,  5.        ,  6.        ,  6.        ],
       [ 0.        ,  3.57142857,  6.28571429,  5.28571429],
       [ 0.        ,  0.        , -1.04      ,  3.08      ],
       [ 0.        ,  0.        ,  0.        ,  7.46153846]])

参考文献

[1] LOCALITY OF REFERENCE IN LU DECOMPOSITION WITH PARTIAL PIVOTING
[2]http://www.netlib.org/lapack/explorehtml/dd/d9a/group__double_g_ecomputational_ga0019443faea08275ca60a734d0593e60.html#ga0019443faea08275ca60a734d0593e60
[3] https://docs.scipy.org/doc/scipy/reference/reference/generated/scipy.linalg.lu.html#scipy.linalg.lu

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

外卖猿

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值