1 function [U,s] = svds_batch(X,k_per_part,n_parts)
2 %
function [U,s] = svds_batch(X,k_per_part,n_parts)
4 %
function computing k_per_part * n_parts POD modes of
5 % the matrix X and singular values in vector s
6 %
function can be used
if svds(X,k_per_part*n_parts) gives
9 % exact orthogonality is not obtained and some zero vectors can be returned!
11 % Bernard Haasdonk 29.5.2010
13 k = k_per_part*n_parts;
14 U = zeros(size(X,1),k);
19 error(
'too many modes requested.');
22 part_start_index = floor((0:n_parts)*(k/n_parts))+1;
23 found_zero_vector = 0;
26 ind = part_start_index(p):(part_start_index(p+1)-1);
27 disp([
'computing mode ',num2str(ind(end)),
'...']);
29 [Unew,S] = svds(X,k_per_part);
30 ind2 = ind(1:size(Unew,2));
33 disp([
'orthogonalization ...']);
35 X = X - U(:,1:ind(end))*(U(:,1:ind(end))
'*X);
37 found_zero_vector = 1;
41 %disp(['orthonormaization with qr ...
']);
42 %U = orthonormalize_qr(U);
43 disp(['svds_batch finished
']);