view core/magnatagatune/tests_evals/rbm_subspace/simple_dist.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
line wrap: on
line source
function [dis_s12,dis_s13] = simple_dist(index_list,vector_list,index_map)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% compute the distance vector from 2 vector                                     %
% sontran2013                                                                   %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
s_num = size(index_list,1);
s_len = size(vector_list,2);

dis_s12 = zeros(s_num,s_len);
dis_s13 = zeros(s_num,s_len);

% Convert list of assigned indices to ordered indices
[checker index_list] = ismember(index_list,index_map);

if all(all(checker(:,1:3)))
  dis_s12 = abs(vector_list(index_list(:,1),:)-vector_list(index_list(:,2),:));
  dis_s13 = abs(vector_list(index_list(:,1),:)-vector_list(index_list(:,3),:));
else
  fprintf('Some indices are not mapped\n');
end

end
% simple_dist(sontest{1},sonfeatures,sonindex)