-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorzKernelBasisVector.m
More file actions
34 lines (27 loc) · 944 Bytes
/
orzKernelBasisVector.m
File metadata and controls
34 lines (27 loc) · 944 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
function [A,D,C,K] = orzKernelBasisVector(X,nSubDim,nSigma, varargin)
%function [A,D,C,K] = orzKernelBasisVector(X,nSubDim,nSigma)
useRFF = false;
if ~isempty(varargin)
numRandFeats = varargin{1};
useRFF = true;
end
nSizeX = size(X);
nSubNum = prod(nSizeX)/prod(nSizeX(1:2));
X = reshape(X,size(X,1),size(X,2),nSubNum);
A = zeros(size(X,2),nSubDim,nSubNum);
D = zeros(nSubDim,nSubNum);
C = zeros(nSubNum,1);
K = zeros(size(X,2),size(X,2),nSubNum);
for I=1:nSubNum
if useRFF
[A(:,:,I),D(:,I),C(I),K(:,:,I)] = orzKPCA(X(:,:,I),nSubDim,nSigma,'R', numRandFeats);
else
[A(:,:,I),D(:,I),C(I),K(:,:,I)] = orzKPCA(X(:,:,I),nSubDim,nSigma, 'R');
end
end
if size(X,3) ~= 1
A = reshape(A,[nSizeX(2),nSubDim,nSizeX(3:end),1]);
D = reshape(D,[nSubDim,nSizeX(3:end),1]);
C = reshape(C,[nSizeX(3:end),1])';
K = reshape(K,[nSizeX(2),nSizeX(2),nSizeX(3:end),1]);
end