| getPolyDec(PolyCoef,EncVec,Cmatrix,Moments,Nsvd,noise)
|
function PolyDecWeights = getPolyDec(PolyCoef,EncVec,Cmatrix,Moments,Nsvd,noise)
%% Compute the linear decoding vectors for a polynomial using the results of genDecVecParms.m
%% The Poly coefficients define the f(x) = sum_{n=0}^5(PolyCoef(n)x^n)
%% Nsvd sets the number of singular values used.
%% noise is optional, default is zero.
%% Maximum number of terms is limited to 6 by genDecVecParms.m
%% Feb. 25, 2001 Consolidation
%% Jan. 17, 2001
%% Copyright (C) by Charles. H. Anderson (All Rights Reserved)
%% Dept. Anatomy and Neurobiology
%% Washington Univ. School of Medicine
%% St. Louis, MO
%% cha@shifter.wustl.edu
%
%%
if(nargin==5)
noise = 0;
end
[N, D] = size(EncVec); % Only use for EncVec, also compatible with getBilinearDec.m
if(D~=1)
error('Only 1 dimensional polynomials');
end
[Num, Np] = size(PolyCoef);
if(Np>6)
error('Maximum number of polynomial coefficients is 6');
end
if(Nsvd>N)
msg = sprintf('Changing Nsvd %d to Neuron Number %d',Nsvd,N);
warning(msg);
Nsvd = N;
end
[U,S,UT] = svds(Cmatrix,Nsvd);
S = diag(S);
Sinv = 1./(S+noise^2*ones(Nsvd,1));
Sinv = diag(Sinv);
for(l=1:Num)
V = Moments(:,1:Np)*PolyCoef(l,:)';
PolyDecWeights(:,l) = U*Sinv*(U'*V);
end
|
|