📄 sparsealignments.m.svn-base
字号:
function [alignments, bs] = sparseAlignments(K, Kj, Y, Yj, columnIndices)
%Compute the alignments of the columns of the kernel matrix. The variable
%called bs is the values of the selected b's
if (nargin ~= 5)
fprintf('%s\n', help(sprintf('%s', mfilename)));
error('Incorrect number of inputs - see above usage instructions.');
end
numExamples = size(K, 1);
numColumns = size(K, 2);
tol = 10^6;
warning('off','MATLAB:divideByZero');
invNormVector = 1./sum(Kj.^2, 1)';
warning('on','MATLAB:divideByZero');
infiniteIndices = find(invNormVector > tol);
invNormVector(infiniteIndices) = 0;
%This bit is slow so can remove it (but then the results aren't strictly
%alignments)
%YY = Y'*Y;
%YTerm = sqrt(sum(sum(YY.^2, 1)));
YK = (Y'*Kj);
%alignments = abs(sum(YK.^2, 1)' .* invNormVector)/YTerm;
alignments = abs(sum(YK.^2, 1)' .* invNormVector);
bs = sqrt(invNormVector);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -