Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
boris committed Aug 2, 2016
1 parent 6dd01c9 commit f8f94e1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pca_zca_whiten.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,15 @@
end
else
projection = false;
if (size(data,1) <= 1)
error('data are invalid')
end
if (isfield(opts,'pca_dim') && ~isempty(opts.pca_dim))
dim = opts.pca_dim; % the number of PCA dimensionalities (principal components)
dim_str = num2str(dim);
if (size(data,2) <= dim && isempty(strfind(opts.pca_mode,'zca')))
error('the number of samples must be greater than the number of desired dimensions')
end
elseif (isfield(opts,'pca_fraction'))
pca_fraction = opts.pca_fraction;
dim = [];
Expand Down Expand Up @@ -78,6 +84,7 @@
select_dim = true;
else
select_dim = false;
dim = min(dim, size(data,2));
end
if (opts.pca_fast)
[evectors,evalues,~] = fsvd(data', dim, 2);
Expand Down

0 comments on commit f8f94e1

Please sign in to comment.