[Master Index] [Index for PublicToolbox/regutools]

tsvd

(PublicToolbox/regutools/tsvd.m in BrainStorm 2.0 (Alpha))


Function Synopsis

x_k = tsvd(U,s,V,b,k)

Help Text

TSVD Truncated SVD regularization.

 x_k = tsvd(U,s,V,b,k)

 Computes the truncated SVD solution
    x_k = V(:,1:k)*inv(diag(s(1:k)))*U(:,1:k)'*b .
 If k is a vector, then x_k is a matrix such that
    x_k = [ x_k(1), x_k(2), ... ] .

Cross-Reference Information

This function is called by

Listing of function C:\BrainStorm_2001\PublicToolbox\regutools\tsvd.m

function x_k = tsvd(U,s,V,b,k)
%TSVD Truncated SVD regularization.
%
% x_k = tsvd(U,s,V,b,k)
%
% Computes the truncated SVD solution
%    x_k = V(:,1:k)*inv(diag(s(1:k)))*U(:,1:k)'*b .
% If k is a vector, then x_k is a matrix such that
%    x_k = [ x_k(1), x_k(2), ... ] .

% Per Christian Hansen, UNI-C, 11/18/91.

% Initialization.
[n,p] = size(V); lk = length(k);
if (min(k)<1 | max(k)>p)
  error('Illegal truncation parameter k')
end
x_k = zeros(n,lk); xi = (U(:,1:p)'*b)./s;

% Treat each k separately.
for j=1:lk
  i = k(j);
  x_k(:,j) = V(:,1:i)*xi(1:i);
end

Produced by color_mat2html, a customized BrainStorm 2.0 (Alpha) version of mat2html on Tue Oct 12 12:05:14 2004
Cross-Directory links are: ON