function [Up,Sp,Vp] = addblock_svd_update( U, S, V, A, force_orth )
% function [Up,Sp,Vp] = addblock_svd_update( U, S, V, A, force_orth )
%
% Given the SVD of
%
% X = U*S*V'
%
% update it to be the SVD of
%
% [X A] = Up*Sp*Vp'
%
% that is, add new columns (ie, data points).
%
% I have found that it is faster to add several (say, 200) data points
% at a time, rather than updating it incrementally with individual
% data points (for 500 dimensional vectors, the speedup was roughly
% 25x). However, in the rank-one case there is structure that I have
% not exploited, so that may still be faster than a block method.
%
% The subspace rotations involved may not preserve orthogonality due
% to numerical round-off errors. To compensate, you can set the
% "force_orth" flag, which will force orthogonality via a QR plus
% another SVD. In a long loop, you may want to force orthogonality
% every so often.
%
% See Matthew Brand, "Fast low-rank modifications of the thin
% singular value decomposition".
%
% D. Wingate 8/17/2007
%
current_rank = size( U, 2 );
% P is an orthogonal basis of the column-space
% of (I-UU')a, which is the component of "a" that is
% orthogonal to U.
m = U' * A;
p = A - U*m;
P = orth( p );
% p may not have full rank. If not, P will be too small. Pad
% with zeros.
P = [ P zeros(size(P,1), size(p,2)-size(P,2)) ];
Ra = P' * p;
%
% Diagonalize K, maintaining rank
%
z = zeros( size(m) );
K = [ S m ; z' Ra ];
[tUp,tSp,tVp] = svds( K, current_rank );
%
% Now update our matrices!
%
Sp = tSp;
Up = [ U P ] * tUp; % this may not preserve orthogonality over
% many repetitions. See below.
% Exploit structure to compute this fast: Vp = [ V Q ] * tVp;
if ( ~isempty(V) )
Vp = V * tVp( 1:current_rank, : );
else
Vp = [];
end;
Vp = [ Vp ; tVp( current_rank+1:size(tVp,1), : ) ];
% The above rotations may not preserve orthogonality, so we explicitly
% deal with that via a QR plus another SVD. In a long loop, you may
% want to force orthogonality every so often.
if ( force_orth )
[UQ,UR] = qr( Up, 0 );
[VQ,VR] = qr( Vp, 0 );
[tUp,tSp,tVp] = svds( UR * Sp * VR', current_rank );
Up = UQ * tUp;
Vp = VQ * tVp;
Sp = tSp;
end;
return;
没有合适的资源?快使用搜索试试~ 我知道了~
Incremental-SVD-updates.rar_Incremental_NEW svd_SVD-DCT_incremen
共3个文件
m:3个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 83 浏览量
2022-09-19
20:04:21
上传
评论
收藏 3KB RAR 举报
温馨提示
增量奇异值分解算法,来至MIT大学的wingate教授,含3个源码.
资源推荐
资源详情
资源评论
收起资源包目录
Incremental-SVD-updates.rar (3个子文件)
Incremental SVD updates
rank_one_svd_update.m 2KB
svd_update.m 2KB
addblock_svd_update.m 2KB
共 3 条
- 1
资源评论
寒泊
- 粉丝: 73
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功