1 function B = model_PCA_fixspace(model,model_data,X,XFix,k)
2 %
function B = model_PCA_fixspace(model,model_data,X,XFix [, [A], [k] ])
4 %
function computing a PCA basis of the set of column vectors X projected
5 % on the orthogonal complement of span(XFix)
6 % The computation is performed explicitly
using the
8 % Additionally, the sparse matrix of the inner product A on the
9 % vector space can be provided, i.e.
10 % i.e. <x,x
'> = x'*A*x
11 % Additionally, the number of principal components can be specified
13 % 5.10.2005 Bernard Haasdonk
16 % epsilon = eps; % = 2e-16
18 % trivial weighting
if matrix is not given:
26 % the following is expensive, use of matlab-
function instead ?
27 XFixON = model_orthonormalize(model,model_data,XFix);
31 Xo = X - XFixON * (XFixON' * A * X);
36 %if size(Xo,1)<size(Xo,2) % ordinary correlation matrix
37 % [e,v] = eig(Xo*Xo');
40 % evalues = evalues(end:-1:1);
41 % fi = find(abs(evalues)>epsilon);
44 % via gram matrix of orthogonalized trajectory
46 K = 0.5*(K+K'); % required for rounding problems
48 % generate descending list of eigenvectors/values:
56 evalues = evalues(end:-1:1);
58 %fi = find(abs(evalues)>=epsilon);
59 fi = 1:length(evalues);
61 % project Xo vectors on eigenvectors
62 B = Xo * ep(:,fi) * diag(evalues(fi).^(-0.5));
65 % ensure that only real valued vectors are returned
67 % disp('complex eigenvector occured: please check!');
72 % the following is theoretically superfluous, but does improve the
73 % orthogonality, i.e. e' A e => identity up to 1e-8
74 % B' A B => identity up to 1e-16
75 %B = orthonormalize(B,A);
function Xdel = delzerocolumns(X, epsilon, A)
function deleting zero-columns from matrix X.