## LU分解 原

SVD

``````function [L,U,p] = lutxloops(A)
%LU Triangular factorization
%   [L,U,p] = lup(A) produces a unit lower triangular matrix L,
%   an upper triangular matrix U and a permutation vector p,
%   so that L*U = A(p,:)

[n,n] = size(A);
p = (1:n)';

for k = 1:n-1

% Find index of largest element below diagonal in k-th column
m = k;
for i = k+1:n
if abs(A(i,k)) > abs(A(m,k))
m = i;
end
end

% Skip elimination if column is zero
if (A(m,k) ~= 0)

% Swap pivot row
if (m ~= k)
for j = 1:n;
A([k m],j) = A([m k],j);
end
p([k m]) = p([m k]);
end

% Compute multipliers
for i = k+1:n;
A(i,k) = A(i,k)/A(k,k);
end

% Update the remainder of the matrix
for j = k+1:n;
for i = k+1:n;
A(i,j) = A(i,j) - A(i,k)*A(k,j);
end
end
end
end

% Separate result
L = tril(A,-1) + eye(n,n);
U = triu(A);``````

L = tril(X,k) returns the elements on and below the kth diagonal of X. k = 0 is the main diagonal, k > 0 is above the main diagonal, and k < 0 is below the main diagonal.

U = triu(X) returns the upper triangular part of X.

``````function [L,U,p] = lutx(A)
%LUTX  Triangular factorization, textbook version
%   [L,U,p] = lutx(A) produces a unit lower triangular matrix L,
%   an upper triangular matrix U, and a permutation vector p,
%   so that L*U = A(p,:)

[n,n] = size(A);
p = (1:n)';

for k = 1:n-1

% Find index of largest element below diagonal in k-th column
[r,m] = max(abs(A(k:n,k)));
m = m+k-1;

% Skip elimination if column is zero
if (A(m,k) ~= 0)

% Swap pivot row
if (m ~= k)
A([k m],:) = A([m k],:);
p([k m]) = p([m k]);
end

% Compute multipliers
i = k+1:n;
A(i,k) = A(i,k)/A(k,k);

% Update the remainder of the matrix
j = k+1:n;
A(i,j) = A(i,j) - A(i,k)*A(k,j);
end
end

% Separate result
L = tril(A,-1) + eye(n,n);
U = triu(A);``````

>> n = 525, A = randn(n,n); tic, lutxloops(A); toc

n =

525

Elapsed time is 2.314373 seconds.

>> n = 525, A = randn(n,n); tic, lutx(A); toc

n =

525

Elapsed time is 0.584623 seconds.

>> n = 1920, A = randn(n,n); tic, lu(A); toc

n =

1920

Elapsed time is 0.191691 seconds.

MATLAB (matrix laboratory) is a multi-paradigm numerical computing environment and fourth-generation programming language. A proprietary programming language developed by MathWorks, MATLAB allows matrix manipulations, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs written in other languages, including C, C++, Java, Fortran and Python.

### SVD

2014/08/01
0
0

Bruce_wjh
2018/04/12
0
0

huhuhaha
2017/05/24
96
0

NMath是一个.NET的数学库，包含了NET平台上的面向对象数字计算的基础类。 产品特点如下： 单精度和双精度复数类 为以下四种数据类型提供全功能的向量和矩阵类：单精度浮点数，双精度浮点数，...

2014/10/24
612
0
Eigen 3.2.0-beta1 发布，线性算术的C++模板库

zino
2013/03/08
923
6

JeeSite4.x 消息管理、消息推送、消息提醒

ThinkGem
13分钟前
3
0
OpenML

https://www.openml.org/search?type=data

shengjuntu
15分钟前
2
0
java强引用,软引用，弱引用和虚引用

woshixin
19分钟前
1
0
dubbo服务在kubernetes中对外暴露服务

29分钟前
1
0
Java获取小程序带参二维码（太阳码）

36分钟前
1
0