// Copyright (C) 2010 - H. Nahrstaedt
//
l = [ 1., - 1.  ,    1.  ,  - 1.  ,  - 1.  ,  - 1.  ,    1.  ,    1.  ,    1.  ,    1.  ,  - 1.  ,  - 1. ]';

x=[0.708333,    1. ,   1.       , - 0.320755  , - 0.105023 , - 1.  ,  1. , - 0.419847  , - 1. , - 0.225806  ,  0.  ,  1.      ,  - 1. ;
    0.583333,  - 1.,    0.333333,  - 0.603774 ,    1.      ,  - 1. ,   1. ,   0.358779  , - 1.,  - 0.483871  ,  0. , - 1.      ,    1.;   
    0.166667,    1. , - 0.333333,  - 0.433962 ,  - 0.383562 , - 1. , - 1. ,   0.0687023 , - 1. , - 0.903226 , - 1.  ,- 1.       ,   1. ;  
    0.458333,    1. ,   1.      ,  - 0.358491 ,  - 0.374429 , - 1. , - 1. , - 0.480916  ,   1. , - 0.935484 ,   0. , - 0.333333  ,  1. ;  
    0.875,     - 1. , - 0.333333,  - 0.509434 ,  - 0.347032 , - 1.  ,  1.  ,- 0.236641   ,  1. , - 0.935484 , - 1. , - 0.333333 , - 1. ;  
    0.5  ,       1. ,   1.      ,  - 0.509434 ,  - 0.767123 , - 1. , - 1.  ,  0.0534351 , - 1. , - 0.870968 , - 1. , - 1.        ,  1.  ; 
    0.125,       1. ,   0.333333,  - 0.320755  , - 0.406393 ,   1.  ,  1.  ,  0.0839695 ,   1. , - 0.806452  ,  0. , - 0.333333  ,  0.5 ; 
    0.25 ,       1. ,   1.      ,  - 0.698113 ,  - 0.484018 , - 1.  ,  1.  ,  0.0839695 ,   1. , - 0.612903 ,   0. , - 0.333333 ,   1.  ; 
    0.291667,    1. ,   1.      ,  - 0.132075 ,  - 0.237443 , - 1.  ,  1.  ,  0.51145   , - 1. , - 0.612903  ,  0. ,   0.333333 ,   1.  ; 
    0.416667,  - 1. ,   1.      ,    0.0566038 ,   0.283105  ,- 1.  ,  1.  ,  0.267176  , - 1. ,   0.290323  ,  0.  ,  1.       ,   1.  ; 
    0.25,        1. ,   1.      ,  - 0.226415  , - 0.506849 , - 1.  ,- 1.  ,  0.374046  , - 1. , - 0.83871   ,  0. , - 1.       ,   1.  ; 
    0. ,         1. ,   1.      ,  - 0.0943396 , - 0.543379 , - 1.  ,  1.  ,- 0.389313  ,   1. , - 1.      ,  - 1. , - 1.          1.   ];,

    
fd = mopen(TMPDIR+'/small_demo.txt','wt');   
mfprintf(fd,"+1 1:0.708333 2:1 3:1 4:-0.320755 5:-0.105023 6:-1 7:1 8:-0.419847 9:-1 10:-0.225806 12:1 13:-1\n");
mfprintf(fd,"-1 1:0.583333 2:-1 3:0.333333 4:-0.603774 5:1 6:-1 7:1 8:0.358779 9:-1 10:-0.483871 12:-1 13:1\n");
mfprintf(fd,"+1 1:0.166667 2:1 3:-0.333333 4:-0.433962 5:-0.383562 6:-1 7:-1 8:0.0687023 9:-1 10:-0.903226 11:-1 12:-1 13:1\n");
mfprintf(fd,"-1 1:0.458333 2:1 3:1 4:-0.358491 5:-0.374429 6:-1 7:-1 8:-0.480916 9:1 10:-0.935484 12:-0.333333 13:1\n");
mfprintf(fd,"-1 1:0.875 2:-1 3:-0.333333 4:-0.509434 5:-0.347032 6:-1 7:1 8:-0.236641 9:1 10:-0.935484 11:-1 12:-0.333333 13:-1\n");
mfprintf(fd,"-1 1:0.5 2:1 3:1 4:-0.509434 5:-0.767123 6:-1 7:-1 8:0.0534351 9:-1 10:-0.870968 11:-1 12:-1 13:1\n");
mfprintf(fd,"+1 1:0.125 2:1 3:0.333333 4:-0.320755 5:-0.406393 6:1 7:1 8:0.0839695 9:1 10:-0.806452 12:-0.333333 13:0.5\n");
mfprintf(fd,"+1 1:0.25 2:1 3:1 4:-0.698113 5:-0.484018 6:-1 7:1 8:0.0839695 9:1 10:-0.612903 12:-0.333333 13:1\n");
mfprintf(fd,"+1 1:0.291667 2:1 3:1 4:-0.132075 5:-0.237443 6:-1 7:1 8:0.51145 9:-1 10:-0.612903 12:0.333333 13:1\n");
mfprintf(fd,"+1 1:0.416667 2:-1 3:1 4:0.0566038 5:0.283105 6:-1 7:1 8:0.267176 9:-1 10:0.290323 12:1 13:1\n");
mfprintf(fd,"-1 1:0.25 2:1 3:1 4:-0.226415 5:-0.506849 6:-1 7:-1 8:0.374046 9:-1 10:-0.83871 12:-1 13:1\n");
mfprintf(fd,"-1 2:1 3:1 4:-0.0943396 5:-0.543379 6:-1 7:1 8:-0.389313 9:1 10:-1 11:-1 12:-1 13:1\n");
    mclose(fd);
    

[label_vector, instance_matrix] = libsvmread(TMPDIR+'/small_demo.txt');

assert_checkalmostequal (l,label_vector,%eps);
assert_checkalmostequal (x,full(instance_matrix),%eps);
