Attachment 'U01_test_distmat.m'

Download

   1 function U01_test_distmat
   2 %U01_TEST_DISTMAT            Test distmat.
   3 %
   4 %usage
   5 %  U06_test_distmat
   6 %
   7 %author
   8 %  saputra@cs.tu-berlin.de
   9 
  10 % Data
  11 X = [ 0.9, 2, 0.1, -3, 7.5; -2.4, 2.1, 0.3, -8, 4; 3.2, 1.1, -0.6, -0.9, 8; 9.4, -1.2, 2.1, 9.8, 7];
  12 
  13 % Correct distances
  14 correct_dist = [
  15                    0  11.757125499032490   8.698275691193054   7.971198153351853  10.645186705737011
  16   11.757125499032490                   0   4.542025979670306  15.874822833657074  12.194670967270907
  17    8.698275691193054   4.542025979670306                   0  11.742231474468557  12.900387591076479
  18    7.971198153351853  15.874822833657074  11.742231474468557                   0  18.474306482247176
  19   10.645186705737011  12.194670967270907  12.900387591076479  18.474306482247176                   0 ];
  20 
  21 % Run test.
  22 
  23 if exist('distmat.m', 'file') 
  24   fprintf('Testing distmat.m ...\n');
  25   [D1, D2, td] = distmat(X);
  26 
  27   if max(max(abs(D1 - correct_dist))) > 1e-10
  28     fprintf('D1 failed (discrepancy > 1e-10).\n');
  29   else
  30     fprintf('D1 OK.\n'); 
  31   end
  32 
  33   if max(max(abs(D2 - correct_dist))) > 1e-10
  34     fprintf('D2 failed (discrepancy > 1e-10).\n');
  35   else
  36     fprintf('D2 OK.\n'); 
  37   end
  38 end

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2010-04-14 16:11:55, 64.5 KB) [[attachment:ML_Praktikum_U01.pdf]]
  • [get | view] (2010-04-20 12:09:43, 77.0 KB) [[attachment:ML_Praktikum_U02.pdf]]
  • [get | view] (2010-05-10 10:05:42, 66.6 KB) [[attachment:ML_Praktikum_U03.pdf]]
  • [get | view] (2010-06-22 21:26:11, 157.1 KB) [[attachment:ML_Praktikum_U04.pdf]]
  • [get | view] (2010-06-28 07:56:26, 124.2 KB) [[attachment:ML_Praktikum_U05.pdf]]
  • [get | view] (2010-03-30 07:52:44, 65.8 KB) [[attachment:Praktikum_ML_Info_SS10.pdf]]
  • [get | view] (2010-04-14 16:13:22, 1.2 KB) [[attachment:U01_test_distmat.m]]
  • [get | view] (2010-04-14 16:13:25, 1.0 KB) [[attachment:U01_test_mydet.m]]
  • [get | view] (2010-04-23 10:12:56, 4053.5 KB) [[attachment:U01_usps.mat]]
  • [get | view] (2010-04-20 12:14:45, 39.4 KB) [[attachment:U02_tests.zip]]
  • [get | view] (2010-05-25 10:11:01, 6.3 KB) [[attachment:U03_2gaussians.dat]]
  • [get | view] (2010-05-25 10:11:10, 15.6 KB) [[attachment:U03_5gaussians.dat]]
  • [get | view] (2010-05-25 11:05:44, 8.9 KB) [[attachment:U03_tests.zip]]
  • [get | view] (2010-06-07 09:33:08, 1018.4 KB) [[attachment:U04_datasets.tar.gz]]
  • [get | view] (2010-06-07 09:32:04, 1.1 KB) [[attachment:U04_test_CV_krr.m]]
  • [get | view] (2010-06-28 09:40:50, 6.4 KB) [[attachment:U05_datasets.zip]]
  • [get | view] (2010-04-23 10:10:14, 60.1 KB) [[attachment:fishbowl.mat]]
  • [get | view] (2010-04-23 10:10:18, 22.7 KB) [[attachment:flatroll.mat]]
  • [get | view] (2010-04-14 16:10:51, 371.8 KB) [[attachment:guide.pdf]]
  • [get | view] (2010-04-28 09:06:05, 496.0 KB) [[attachment:lle_talk.pdf]]
  • [get | view] (2010-04-23 10:10:23, 45.3 KB) [[attachment:swissroll.mat]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.