带行主元的 LU 分解
以下函数不使用行透视进行 LU 分解。 R 中是否存在使用行主元进行 LU 分解的现有函数?
> require(Matrix)
> expand(lu(matrix(rnorm(16),4,4)))
$L
4 x 4 Matrix of class "dtrMatrix"
[,1] [,2] [,3] [,4]
[1,] 1.00000000 . . .
[2,] 0.13812836 1.00000000 . .
[3,] 0.27704442 0.39877260 1.00000000 .
[4,] -0.08512341 -0.24699820 0.04347201 1.00000000
$U
4 x 4 Matrix of class "dtrMatrix"
[,1] [,2] [,3] [,4]
[1,] 1.5759031 -0.2074224 -1.5334082 -0.5959756
[2,] . -1.3096874 -0.6301727 1.1953838
[3,] . . 1.6316292 0.6256619
[4,] . . . 0.8078140
$P
4 x 4 sparse Matrix of class "pMatrix"
[1,] | . . .
[2,] . | . .
[3,] . . . |
[4,] . . | .
The following function does not use row pivoting for LU decomposition. Is there an existing function in R that does LU decomposition with row pivot?
> require(Matrix)
> expand(lu(matrix(rnorm(16),4,4)))
$L
4 x 4 Matrix of class "dtrMatrix"
[,1] [,2] [,3] [,4]
[1,] 1.00000000 . . .
[2,] 0.13812836 1.00000000 . .
[3,] 0.27704442 0.39877260 1.00000000 .
[4,] -0.08512341 -0.24699820 0.04347201 1.00000000
$U
4 x 4 Matrix of class "dtrMatrix"
[,1] [,2] [,3] [,4]
[1,] 1.5759031 -0.2074224 -1.5334082 -0.5959756
[2,] . -1.3096874 -0.6301727 1.1953838
[3,] . . 1.6316292 0.6256619
[4,] . . . 0.8078140
$P
4 x 4 sparse Matrix of class "pMatrix"
[1,] | . . .
[2,] . | . .
[3,] . . . |
[4,] . . | .
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论