Changeset 616 for trunk/test


Ignore:
Timestamp:
Aug 31, 2006, 10:52:02 AM (15 years ago)
Author:
Jari Häkkinen
Message:

Removed gslapi namespace and put the code into utility namespace.
Move #ifndef _header_ idiom to top of touched header files.
Removed unneccesary #includes, and added needed #includes.

Location:
trunk/test
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/alignment_test.cc

    r442 r616  
    33#include <c++_tools/utility/Alignment.h>
    44
    5 #include <c++_tools/gslapi/matrix.h>
     5#include <c++_tools/utility/matrix.h>
    66
    77#include <gsl/gsl_cdf.h>
     
    5454             const std::vector<double>& l2,
    5555             const double sigma,
    56              theplu::gslapi::matrix& dot_matrix,
     56             theplu::utility::matrix& dot_matrix,
    5757             std::vector<std::pair<size_t,size_t> >& path)
    5858{
    59   dot_matrix  = theplu::gslapi::matrix(l1.size(),l2.size());
     59  dot_matrix  = theplu::utility::matrix(l1.size(),l2.size());
    6060  for (size_t i=0; i<l1.size(); i++)
    6161    for (size_t j=0; j<l2.size(); j++) {
     
    7878  for (size_t i=0; i<peaksets.size()-1; i++)
    7979    for (size_t j=i+1; j<peaksets.size(); j++) {
    80       gslapi::matrix dot_m;
     80      utility::matrix dot_m;
    8181      std::vector<std::pair<size_t,size_t> > path;
    8282      score(peaksets[i], peaksets[j], 1.0, dot_m, path);
  • trunk/test/averager_test.cc

    r583 r616  
    55#include <c++_tools/statistics/AveragerPairWeighted.h>
    66#include <c++_tools/statistics/AveragerWeighted.h>
    7 #include <c++_tools/gslapi/vector.h>
     7#include <c++_tools/utility/vector.h>
    88
    99#include <fstream>
     
    9191  // Testing AveragerWeighted
    9292  *error << "testing AveragerWeighted" << std::endl;
    93   theplu::gslapi::vector x(3,0);
     93  theplu::utility::vector x(3,0);
    9494  x(0)=0;
    9595  x(1)=1;
    9696  x(2)=2;
    97   theplu::gslapi::vector w(3,1);
     97  theplu::utility::vector w(3,1);
    9898  theplu::statistics::AveragerWeighted aw;
    9999  aw.add_values(x,w);
     
    152152  AveragerPairWeighted apw;
    153153  x(0)=0; x(1)=1; x(2)=2;
    154   theplu::gslapi::vector y(3,0);
     154  theplu::utility::vector y(3,0);
    155155  x(0)=0; x(1)=0; x(2)=2;
    156156  apw.add_values(x,y,w,w);
  • trunk/test/consensus_inputranker_test.cc

    r615 r616  
    55#include <c++_tools/classifier/ConsensusInputRanker.h>
    66#include <c++_tools/statistics/ROC.h>
    7 #include <c++_tools/gslapi/matrix.h>
     7#include <c++_tools/utility/matrix.h>
    88#include <c++_tools/classifier/MatrixLookup.h>
    99#include <c++_tools/classifier/CrossValidationSampler.h>
     
    3131
    3232  ifstream is("data/rank_data.txt");
    33   theplu::gslapi::matrix data_tmp(is);
     33  theplu::utility::matrix data_tmp(is);
    3434  theplu::classifier::MatrixLookup data(data_tmp);
    3535  is.close();
     
    5656  }
    5757
    58   theplu::gslapi::matrix flag(data.rows(),data.columns(),1);
     58  theplu::utility::matrix flag(data.rows(),data.columns(),1);
    5959  // Peter, fix weighted version instead
    6060  theplu::classifier::ConsensusInputRanker cir2(sampler,data,roc);
  • trunk/test/crossvalidation_test.cc

    r615 r616  
    55#include <c++_tools/classifier/MatrixLookup.h>
    66#include <c++_tools/classifier/Target.h>
    7 #include <c++_tools/gslapi/matrix.h>
     7#include <c++_tools/utility/matrix.h>
    88
    99#include <cstdlib>
     
    4040                 
    4141  classifier::Target target(label);
    42   gslapi::matrix raw_data(10,10);
     42  utility::matrix raw_data(10,10);
    4343  classifier::MatrixLookup data(raw_data);
    4444  classifier::CrossValidationSampler cv(target,3,3);
     
    8181                 
    8282  target=classifier::Target(label);
    83   gslapi::matrix raw_data2(2,9);
     83  utility::matrix raw_data2(2,9);
    8484  for(size_t i=0;i<raw_data2.rows();i++)
    8585    for(size_t j=0;j<raw_data2.columns();j++)
  • trunk/test/data_lookup_1d_test.cc

    r593 r616  
    11// $Id$
    22
    3 #include <c++_tools/gslapi/matrix.h>
     3#include <c++_tools/utility/matrix.h>
    44#include <c++_tools/classifier/DataLookup1D.h>
    55#include <c++_tools/classifier/MatrixLookup.h>
     
    1212using namespace theplu;
    1313
    14 gslapi::matrix matrix(size_t n);
     14utility::matrix matrix(size_t n);
    1515
    1616int main(const int argc,const char* argv[])
     
    3131
    3232  *error << "Testing DataLookup1D" << std::endl;
    33   gslapi::matrix gsl_m1(matrix(5));
     33  utility::matrix gsl_m1(matrix(5));
    3434  std::vector<size_t> index_odd;
    3535  index_odd.push_back(1);
     
    9797
    9898  *error << "Testing that output from ostream operator for DataLookup1D"
    99          << " can be used by the gslapi::vector istream constructor...";
     99         << " can be used by the utility::vector istream constructor...";
    100100
    101101  // First with a vector with no missing values separated by ' '.
     
    104104  my_out.close();
    105105  std::ifstream is("data/tmp_test_datalookup1D.txt");
    106   gslapi::vector v5(is);
     106  utility::vector v5(is);
    107107  is.close();
    108108  if (v5.size()!=v1.size() || v5(0)!=v1(0) || v5(1)!=v1(1) ||
     
    122122  my_out.close();
    123123  is.open("data/tmp_test_datalookup1D.txt");
    124   gslapi::vector v7(is,'\t');
     124  utility::vector v7(is,'\t');
    125125  is.close();
    126126  if (v7.size()!=v6.size() || !std::isnan(v7(1))) {
     
    141141}
    142142
    143 gslapi::matrix matrix(size_t n)
     143utility::matrix matrix(size_t n)
    144144{
    145   gslapi::matrix res(n,n);
     145  utility::matrix res(n,n);
    146146  for (size_t i=0;i<n;i++)
    147147    for (size_t j=0;j<n;j++)
  • trunk/test/ensemble_test.cc

    r615 r616  
    11// $Id$
    22
    3 #include <c++_tools/gslapi/matrix.h>
    4 #include <c++_tools/gslapi/vector.h>
     3#include <c++_tools/utility/matrix.h>
    54#include <c++_tools/classifier/SubsetGenerator.h>
    65#include <c++_tools/classifier/CrossValidationSampler.h>
     
    3938  *error << "loading data" << std::endl;
    4039  std::ifstream is("data/nm_data_centralized.txt");
    41   gslapi::matrix data_core(is);
     40  utility::matrix data_core(is);
    4241  is.close();
    4342
  • trunk/test/inputranker_test.cc

    r604 r616  
    33#include <c++_tools/classifier/InputRanker.h>
    44#include <c++_tools/statistics/ROC.h>
    5 #include <c++_tools/gslapi/matrix.h>
    6 #include <c++_tools/gslapi/matrix.h>
     5#include <c++_tools/utility/matrix.h>
    76#include <c++_tools/classifier/MatrixLookup.h>
    87#include <c++_tools/classifier/Target.h>
     
    2928
    3029  std::ifstream is("data/rank_data.txt");
    31   theplu::gslapi::matrix data_tmp(is);
     30  theplu::utility::matrix data_tmp(is);
    3231  theplu::classifier::MatrixLookup data(data_tmp);
    3332  is.close();
  • trunk/test/kernel_lookup_test.cc

    r559 r616  
    11// $Id$
    22
    3 #include <c++_tools/gslapi/matrix.h>
     3#include <c++_tools/utility/matrix.h>
    44#include <c++_tools/classifier/DataLookup1D.h>
    55#include <c++_tools/classifier/KernelLookup.h>
     
    3030  bool ok =true;
    3131  *error << "\nTesting KernelLookup" << std::endl;
    32   gslapi::matrix data_core(1,5);
     32  utility::matrix data_core(1,5);
    3333  for (size_t i=0; i<data_core.columns(); i++)
    3434    data_core(0,i)=i;
  • trunk/test/kernel_test.cc

    r536 r616  
    11// $Id$
    2 
    32
    43// C++ tools include
    54////////////////////
    6 #include <c++_tools/gslapi/matrix.h>
    7 #include <c++_tools/gslapi/vector.h>
     5#include <c++_tools/utility/matrix.h>
    86#include <c++_tools/classifier/KernelFunction.h>
    97#include <c++_tools/classifier/PolynomialKernelFunction.h>
     
    2523bool test_MEV(const classifier::MatrixLookup& data,
    2624              const classifier::KernelFunction* kf,
    27               const gslapi::matrix& control, const double error_bound,
     25              const utility::matrix& control, const double error_bound,
    2826              std::ostream* error);
    2927
    3028bool test_SEV(const classifier::MatrixLookup& data,
    3129              const classifier::KernelFunction* kf,
    32               const gslapi::matrix& control, const double error_bound,
     30              const utility::matrix& control, const double error_bound,
    3331              std::ostream* error);
    3432
     
    4846  bool ok = true;
    4947
    50   gslapi::matrix data2_core(2,3);
     48  utility::matrix data2_core(2,3);
    5149  data2_core(0,0)=0;
    5250  data2_core(1,0)=0;
     
    7775  double error_bound = 1e-8;
    7876  std::ifstream is("data/nm_data_centralized.txt");
    79   gslapi::matrix data_core(is);
     77  utility::matrix data_core(is);
    8078  is.close();
    8179
     
    8381
    8482  is.open("data/nm_kernel.txt");
    85   gslapi::matrix kernel_matlab(is);
     83  utility::matrix kernel_matlab(is);
    8684  is.close();
    8785  classifier::KernelFunction* kf = new classifier::PolynomialKernelFunction();
     
    9189 
    9290  is.open("data/nm_kernel2.txt");
    93   gslapi::matrix kernel_matlab2(is);
     91  utility::matrix kernel_matlab2(is);
    9492  is.close();
    9593  kf = new classifier::PolynomialKernelFunction(2);
     
    102100  delete kf;
    103101
    104   data_core = gslapi::matrix(1,5);
     102  data_core = utility::matrix(1,5);
    105103  for (size_t i=0; i<data_core.columns(); i++)
    106104    data_core(0,i)=i;
     
    120118bool test_MEV(const classifier::MatrixLookup& data,
    121119              const classifier::KernelFunction* kf,
    122               const gslapi::matrix& control, const double error_bound,
     120              const utility::matrix& control, const double error_bound,
    123121              std::ostream* error)
    124122{
     
    162160bool test_SEV(const classifier::MatrixLookup& data,
    163161              const classifier::KernelFunction* kf,
    164               const gslapi::matrix& control, const double error_bound,
     162              const utility::matrix& control, const double error_bound,
    165163              std::ostream* error)
    166164{
  • trunk/test/matrix_lookup_test.cc

    r537 r616  
    11// $Id$
    22
    3 #include <c++_tools/gslapi/matrix.h>
     3#include <c++_tools/utility/matrix.h>
    44#include <c++_tools/classifier/MatrixLookup.h>
    55
     
    1010using namespace theplu;
    1111
    12 gslapi::matrix matrix(size_t n);
     12utility::matrix matrix(size_t n);
    1313
    1414int main(const int argc,const char* argv[])
     
    2727
    2828  *error << "\nTesting MatrixLookup" << std::endl;
    29   *error << "MatrixLookup::MatrixLookup(const gslapi::matrix& data)...";
    30   gslapi::matrix gsl_m1(matrix(2));
     29  *error << "MatrixLookup::MatrixLookup(const utility::matrix& data)...";
     30  utility::matrix gsl_m1(matrix(2));
    3131  classifier::MatrixLookup m1(gsl_m1);
    3232  if (m1.rows()!=gsl_m1.rows() || m1.columns()!=gsl_m1.columns() ||
     
    4040
    4141 
    42   *error << "MatrixLookup::MatrixLookup(const gslapi::matrix&,\n"
     42  *error << "MatrixLookup::MatrixLookup(const utility::matrix&,\n"
    4343         << "                           const std::vector<size_t>&,\n"
    4444         << "                           const std::vector<size_t>&)...";
    45   gslapi::matrix gsl_m2(matrix(4));
     45  utility::matrix gsl_m2(matrix(4));
    4646  std::vector<size_t> index_odd;
    4747  index_odd.push_back(1);
     
    6161    *error << "Ok" << std::endl;
    6262
    63   *error << "MatrixLookup::MatrixLookup(const gslapi::matrix&,\n"
     63  *error << "MatrixLookup::MatrixLookup(const utility::matrix&,\n"
    6464         << "                           const std::vector<size_t>&,\n"
    6565         << "                           const bool)...";
     
    152152}
    153153
    154 gslapi::matrix matrix(size_t n)
     154utility::matrix matrix(size_t n)
    155155{
    156   gslapi::matrix res(n,n);
     156  utility::matrix res(n,n);
    157157  for (size_t i=0;i<n;i++)
    158158    for (size_t j=0;j<n;j++)
  • trunk/test/matrix_test.cc

    r611 r616  
    11// $Id$
    22
    3 #include <c++_tools/gslapi/matrix.h>
     3#include <c++_tools/utility/matrix.h>
    44
    55#include <unistd.h>
     
    1313    : m_(i,j,value) {}
    1414
    15   inline theplu::gslapi::vector
    16   row(const size_t& i) { return theplu::gslapi::vector(m_,i); }
    17 
    18   inline const theplu::gslapi::matrix& matrix(void) const { return m_; }
     15  inline theplu::utility::vector
     16  row(const size_t& i) { return theplu::utility::vector(m_,i); }
     17
     18  inline const theplu::utility::matrix& matrix(void) const { return m_; }
    1919
    2020private:
    21   theplu::gslapi::matrix m_;
     21  theplu::utility::matrix m_;
    2222};
    2323
     
    3939
    4040  *error << "\tcopy constructor and operator!=" << std::endl;
    41   gslapi::matrix m(3,3,9);
    42   gslapi::matrix m2(m);
     41  utility::matrix m(3,3,9);
     42  utility::matrix m2(m);
    4343  if (m2!=m)
    4444    ok=false;
     
    5151  my_out.close();
    5252  std::ifstream is("data/tmp_test_matrix.txt");
    53   gslapi::matrix m3(is);
     53  utility::matrix m3(is);
    5454  is.close();
    5555  if (m3!=m2)
     
    5858
    5959  *error << "\toperator*(double)" << std::endl;
    60   gslapi::matrix m4(3,3,1);
     60  utility::matrix m4(3,3,1);
    6161  m4 *= 9;
    6262  if (m4!=m) {
     
    7272  // lines and other whitespaces. The file is not expected to break
    7373  // things.
    74   gslapi::matrix m5(is);
     74  utility::matrix m5(is);
    7575  is.close();
    7676  double m5_sum=0;
     
    7878    for (size_t j=0; j<m5.columns(); ++j)
    7979      m5_sum+=m5(i,j);
    80   gslapi::matrix* m5sub=new gslapi::matrix(m5,3,3,3,3);
     80  utility::matrix* m5sub=new utility::matrix(m5,3,3,3,3);
    8181  double m5sub_sum=0;
    8282  for (size_t i=0; i<m5sub->rows(); ++i)
     
    9898  // Checking that the row view works, i.e. mutation to the view are
    9999  // reflected in the viewed object.
    100   gslapi::vector v5subrow(m5,3);
     100  utility::vector v5subrow(m5,3);
    101101  double v5subrow_sum=0;
    102102  for (size_t i=0; i<v5subrow.size(); ++i) {
     
    116116  // Checking that the column view works, i.e. mutation to the view
    117117  // are reflected in the viewed object.
    118   gslapi::vector v5subcolumn(m5,0,false);
     118  utility::vector v5subcolumn(m5,0,false);
    119119  double v5subcolumn_sum=0;
    120120  for (size_t i=0; i<v5subcolumn.size(); ++i) {
     
    143143  // Checking that a view is not inherited through the copy
    144144  // contructor.
    145   gslapi::vector v6(v5subrow);
     145  utility::vector v6(v5subrow);
    146146  v6.set_all(2);
    147147  double v5subrow_sum3=0;
     
    164164  // Checking that vector::operator= indeed makes a view to become a
    165165  // "normal" vector.
    166   v5subrow=gslapi::vector(23,22);
     166  v5subrow=utility::vector(23,22);
    167167  double m5_sum6=0;
    168168  for (size_t i=0; i<m5.rows(); ++i)
     
    178178  *error << "\tthat class member returns a view" << std::endl;
    179179  matrixwrapper mw(5,2);
    180   gslapi::vector mwrow=mw.row(2);
     180  utility::vector mwrow=mw.row(2);
    181181  if (mwrow.gsl_vector_p()->data != &(mw.matrix()(2,0))) {
    182182    ok=false;
     
    186186  *error << "\tsub-matrix of a sub-matrix" << std::endl;
    187187  // Checking that a sub-matrix of a sub-matrix can be created.
    188   gslapi::matrix sub(m5,3,3,3,3);
    189   gslapi::matrix subsub(sub,2,1,1,2);
     188  utility::matrix sub(m5,3,3,3,3);
     189  utility::matrix subsub(sub,2,1,1,2);
    190190  subsub(0,0)=23221121;
    191191  if (&sub(2,1)!=&subsub(0,0) || subsub(0,0)!=m5(5,4) || &subsub(0,0)!=&m5(5,4)){
     
    196196  *error << "\tmatrix::nan()" << std::endl;
    197197  is.open("data/sorlie_centroids.txt");
    198   gslapi::matrix* m_nan = new gslapi::matrix(is,'\t');
    199   gslapi::matrix m_weight;
     198  utility::matrix* m_nan = new utility::matrix(is,'\t');
     199  utility::matrix m_weight;
    200200  m_nan->nan(m_weight);
    201201  is.close();
  • trunk/test/ncc_test.cc

    r593 r616  
    55#include <c++_tools/classifier/NCC.h>
    66#include <c++_tools/classifier/Target.h>
    7 #include <c++_tools/gslapi/matrix.h>
    8 #include <c++_tools/gslapi/vector.h>
     7#include <c++_tools/utility/matrix.h>
    98#include <c++_tools/statistics/PearsonDistance.h>
    109#include <c++_tools/utility/utility.h>
     
    3534
    3635  std::ifstream is("data/sorlie_centroids.txt");
    37   gslapi::matrix data(is,'\t');
     36  utility::matrix data(is,'\t');
    3837  is.close();
    3938
     
    4342
    4443  // Generate weight matrix with 0 for missing values and 1 for others.
    45   gslapi::matrix weights(data.rows(),data.columns(),0.0);
     44  utility::matrix weights(data.rows(),data.columns(),0.0);
    4645  for(size_t i=0;i<data.rows();++i)
    4746    for(size_t j=0;j<data.columns();++j)
     
    5554  ncc.train();
    5655
    57   gslapi::matrix prediction;
     56  utility::matrix prediction;
    5857  ncc.predict(dataview,prediction);
    5958 
    6059  is.open("data/sorlie_centroid_predictions.txt");
    61   gslapi::matrix result(is,'\t');
     60  utility::matrix result(is,'\t');
    6261  is.close();
    6362
  • trunk/test/nni_test.cc

    r335 r616  
    22
    33#include <c++_tools/utility/FileIO.h>
    4 #include <c++_tools/gslapi/matrix.h>
     4#include <c++_tools/utility/matrix.h>
    55#include <c++_tools/utility/kNNI.h>
    66#include <c++_tools/utility/WeNNI.h>
     
    4242  std::ifstream data_stream(knni_data.c_str());
    4343  std::ifstream weight_stream(knni_weight.c_str());
    44   gslapi::matrix data(data_stream);
    45   gslapi::matrix weight(weight_stream);
     44  utility::matrix data(data_stream);
     45  utility::matrix weight(weight_stream);
    4646  utility::kNNI knni(data,weight,neighbours);
    4747  knni.estimate();
    4848  std::ifstream control_stream(knni_result.c_str());
    49   gslapi::matrix control(control_stream);
     49  utility::matrix control(control_stream);
    5050  control-=knni.imputed_data();
    5151  // Jari, should we use GSL defined round off errors? Anyway, the
     
    7575  // test WeNNI
    7676  data_stream.open(wenni_data.c_str());
    77   data=gslapi::matrix(data_stream);
     77  data=utility::matrix(data_stream);
    7878  weight_stream.open(wenni_weight.c_str());
    79   weight=gslapi::matrix(weight_stream);
     79  weight=utility::matrix(weight_stream);
    8080  utility::WeNNI wenni(data,weight,neighbours);
    8181  wenni.estimate();
    8282  control_stream.open(wenni_result.c_str());
    83   control=gslapi::matrix(control_stream);
     83  control=utility::matrix(control_stream);
    8484  control-=wenni.imputed_data();
    8585  for (unsigned int i=0; i<control.rows(); i++)
     
    108108  // test WeNNI with binary weights
    109109  data_stream.open(knni_data.c_str());
    110   data=gslapi::matrix(data_stream);
     110  data=utility::matrix(data_stream);
    111111  weight_stream.open(knni_weight.c_str());
    112   weight=gslapi::matrix(weight_stream);
     112  weight=utility::matrix(weight_stream);
    113113  utility::WeNNI wenni2(data,weight,neighbours);
    114114  wenni2.estimate();
    115115  control_stream.open(knni_result.c_str());
    116   control=gslapi::matrix(control_stream);
     116  control=utility::matrix(control_stream);
    117117  control-=wenni2.imputed_data();
    118118  for (unsigned int i=0; i<control.rows(); i++)
  • trunk/test/pca_test.cc

    r301 r616  
    11// $Id$
    22
     3#include <c++_tools/utility/matrix.h>
    34#include <c++_tools/utility/PCA.h>
    45
     
    910
    1011
    11 
    1212using namespace theplu;
    1313int main()
    1414{
    15   gslapi::matrix A( 3, 4 );
     15  utility::matrix A( 3, 4 );
    1616  for( size_t i = 0; i < 3; ++i )
    1717    for( size_t j = 0; j < 4; ++j )
  • trunk/test/regression_test.cc

    r586 r616  
    11// $Id$
    22
    3 
    4 #include <c++_tools/gslapi/matrix.h>
    53#include <c++_tools/statistics/KernelBox.h>
    64#include <c++_tools/statistics/Linear.h>
     
    119#include <c++_tools/statistics/Polynomial.h>
    1210#include <c++_tools/statistics/PolynomialWeighted.h>
     11#include <c++_tools/utility/matrix.h>
     12#include <c++_tools/utility/vector.h>
    1313
    1414#include <cmath>
     
    3939
    4040  // test data for Linear and Naive (Weighted and non-weighted)
    41   gslapi::vector x(4); x(0)=1970; x(1)=1980; x(2)=1990; x(3)=2000;
    42   gslapi::vector y(4); y(0)=12;   y(1)=11;   y(2)=14;   y(3)=13;
    43   gslapi::vector w(4); w(0)=0.1;  w(1)=0.2;  w(2)=0.3;  w(3)=0.4;
     41  utility::vector x(4); x(0)=1970; x(1)=1980; x(2)=1990; x(3)=2000;
     42  utility::vector y(4); y(0)=12;   y(1)=11;   y(2)=14;   y(3)=13;
     43  utility::vector w(4); w(0)=0.1;  w(1)=0.2;  w(2)=0.3;  w(3)=0.4;
    4444
    4545  *error << "testing regression::LinearWeighted" << std::endl;
     
    8484  {
    8585    std::ifstream s("data/regression_gauss.data");
    86     gslapi::matrix data(s);
    87     gslapi::vector x(data.rows());
    88     gslapi::vector ln_y(data.rows());
     86    utility::matrix data(s);
     87    utility::vector x(data.rows());
     88    utility::vector ln_y(data.rows());
    8989    for (size_t i=0; i<data.rows(); ++i) {
    9090      x(i)=data(i,0);
     
    9494    statistics::regression::Polynomial polynomialfit(2);
    9595    polynomialfit.fit(x,ln_y);
    96     gslapi::vector fit=polynomialfit.fit_parameters();
     96    utility::vector fit=polynomialfit.fit_parameters();
    9797    if (fabs(fit[0]-1.012229646706 + fit[1]-0.012561322528 +
    9898             fit[2]+1.159674470130)>1e-11) {  // Jari, fix number!
     
    132132  rl.fit(10, 100);
    133133
    134   gslapi::vector y = rl.y_predicted();
     134  utility::vector y = rl.y_predicted();
    135135  for (size_t i=0; i<y.size(); i++)
    136136    if (y(i)!=10.0){
  • trunk/test/score_test.cc

    r514 r616  
    11// $Id$
    22
    3 #include <c++_tools/gslapi/matrix.h>
    43#include <c++_tools/statistics/ROC.h>
    54#include <c++_tools/statistics/tScore.h>
    65#include <c++_tools/statistics/Pearson.h>
    76#include <c++_tools/statistics/FoldChange.h>
    8 #include <c++_tools/gslapi/vector.h>
    97#include <c++_tools/statistics/WilcoxonFoldChange.h>
     8#include <c++_tools/utility/matrix.h>
     9#include <c++_tools/utility/vector.h>
    1010
    1111#include <gsl/gsl_cdf.h>
     
    3131
    3232  *error << "testing ROC" << std::endl;
    33   gslapi::vector value(31);
     33  utility::vector value(31);
    3434  std::vector<std::string> label(31,"negative");
    3535  for (size_t i=0; i<16; i++)
     
    6868 
    6969  std::ifstream is("data/rank_data.txt");
    70   gslapi::matrix data(is);
     70  utility::matrix data(is);
    7171  is.close();
    7272
     
    7575  is.close();
    7676 
    77   gslapi::vector correct_area(3);
     77  utility::vector correct_area(3);
    7878  correct_area(0)=8.0/9.0;
    7979  correct_area(1)=6.0/9.0;
     
    8282  const double tol = 0.001;
    8383  for (size_t i=0; i<data.rows(); i++){
    84     gslapi::vector vec(data,i);
     84    utility::vector vec(data,i);
    8585    if (vec.size()!=target2.size()){
    8686      *error << "vec.size() is " << vec.size() << " and target2.size() is "
     
    9696  }
    9797
    98   gslapi::vector weight(target2.size(),1);
     98  utility::vector weight(target2.size(),1);
    9999  for (size_t i=0; i<data.rows(); i++){
    100     gslapi::vector vec(data,i);
     100    utility::vector vec(data,i);
    101101    area = roc.score(target2, vec, weight);
    102102    if (area<correct_area(i)-tol || area>correct_area(i)+tol){
  • trunk/test/statistics_test.cc

    r588 r616  
    22
    33#include <c++_tools/statistics/utility.h>
    4 #include <c++_tools/gslapi/vector.h>
     4#include <c++_tools/utility/vector.h>
    55
    66#include <vector>
     
    1212
    1313  using namespace theplu;
    14   gslapi::vector gsl_vec(10);
     14  utility::vector gsl_vec(10);
    1515  std::vector<double> data;
    1616  for (unsigned int i=0; i<10; i++){
  • trunk/test/svd_test.cc

    r420 r616  
    11// $Id$
    22
     3#include <c++_tools/random/random.h>
     4#include <c++_tools/utility/matrix.h>
    35#include <c++_tools/utility/SVD.h>
    4 #include <c++_tools/gslapi/matrix.h>
    5 #include <c++_tools/random/random.h>
    6 #include <c++_tools/gslapi/vector.h>
     6#include <c++_tools/utility/vector.h>
    77
    88using namespace theplu;
    99
    10 double this_norm(const gslapi::matrix& A)
     10double this_norm(const utility::matrix& A)
    1111{
    1212  double sum=0.0;
     
    2626  // initialise a random test-matrix
    2727  theplu::random::ContinuousUniform rnd;
    28   gslapi::matrix A(m,n);
     28  utility::matrix A(m,n);
    2929  for (size_t i=0; i<m; ++i)
    3030    for(size_t j=0; j<n; ++j)
     
    3333  utility::SVD svd(A);
    3434  svd.decompose(algo);
    35   theplu::gslapi::vector s(svd.s());
    36   gslapi::matrix S(s.size(),s.size());
     35  theplu::utility::vector s(svd.s());
     36  utility::matrix S(s.size(),s.size());
    3737  for (size_t i=0; i<s.size(); ++i)
    3838    S(i,i)=s[i];
    39   gslapi::matrix Vtranspose=svd.V();
     39  utility::matrix Vtranspose=svd.V();
    4040  Vtranspose.transpose();
    4141  // Reconstructing A = U*S*Vtranspose
    42   gslapi::matrix Areconstruct=svd.U();
     42  utility::matrix Areconstruct=svd.U();
    4343  Areconstruct*=S;
    4444  Areconstruct*=Vtranspose;
     
    6363  }
    6464
    65   gslapi::matrix Utranspose=svd.U();
     65  utility::matrix Utranspose=svd.U();
    6666  Utranspose.transpose();
    6767  Utranspose*=svd.U();  // Expect unity matrix
  • trunk/test/svm_test.cc

    r527 r616  
    11// $Id$
    22
    3 #include <c++_tools/gslapi/matrix.h>
    4 #include <c++_tools/gslapi/vector.h>
    53#include <c++_tools/classifier/SVM.h>
    64#include <c++_tools/classifier/Kernel.h>
     
    97#include <c++_tools/classifier/Kernel_MEV.h>
    108#include <c++_tools/classifier/PolynomialKernelFunction.h>
     9#include <c++_tools/utility/matrix.h>
     10#include <c++_tools/utility/vector.h>
    1111
    1212#include <cassert>
     
    3232  bool ok = true;
    3333
    34   gslapi::matrix data2_core(2,3);
     34  utility::matrix data2_core(2,3);
    3535  data2_core(0,0)=0;
    3636  data2_core(1,0)=0;
     
    8888
    8989  std::ifstream is("data/nm_data_centralized.txt");
    90   gslapi::matrix data_core(is);
     90  utility::matrix data_core(is);
    9191  is.close();
    9292
     
    102102
    103103  is.open("data/nm_alpha_linear_matlab.txt");
    104   theplu::gslapi::vector alpha_matlab(is);
     104  theplu::utility::vector alpha_matlab(is);
    105105  is.close();
    106106
     
    112112  }
    113113
    114   theplu::gslapi::vector alpha = svm.alpha();
     114  theplu::utility::vector alpha = svm.alpha();
    115115     
    116116  // Comparing alpha to alpha_matlab
    117   theplu::gslapi::vector diff_alpha(alpha);
     117  theplu::utility::vector diff_alpha(alpha);
    118118  diff_alpha-=alpha_matlab;
    119119  if (diff_alpha*diff_alpha> 1e-10 ){
     
    123123
    124124  // Comparing output to target
    125   theplu::gslapi::vector output(svm.output());
     125  theplu::utility::vector output(svm.output());
    126126  double slack = 0;
    127127  for (unsigned int i=0; i<target.size(); i++){
  • trunk/test/vector_test.cc

    r438 r616  
    33#include <c++_tools/utility/Exception.h>
    44#include <c++_tools/utility/FileIO.h>
    5 #include <c++_tools/gslapi/vector.h>
    6 #include <c++_tools/gslapi/utility.h>
     5#include <c++_tools/utility/utility.h>
     6#include <c++_tools/utility/vector.h>
    77
    88#include <fstream>
     
    2424  bool ok = true;
    2525
    26   gslapi::vector vec(12);
     26  utility::vector vec(12);
    2727  for (unsigned int i=0; i<vec.size(); i++)
    2828    vec(i)=i;
     
    3939  for (unsigned int i=0; i<vec.size(); i+=2)
    4040    sum_before+=vec[i];
    41   gslapi::vector vec_view(vec,0,6,2);
     41  utility::vector vec_view(vec,0,6,2);
    4242  sum_after=vec_view.sum();
    4343  if (sum_after != sum_before)
     
    4949
    5050  // checking that copy constructor creates an independent object
    51   gslapi::vector vec2(vec);
     51  utility::vector vec2(vec);
    5252  if (vec.size()!=vec2.size())
    5353    ok=false;
     
    8585    std::ifstream data_stream3(data3.c_str());
    8686    std::ifstream data_stream4(data4.c_str());
    87     vec=gslapi::vector(data_stream1);
     87    vec=utility::vector(data_stream1);
    8888    if (vec.size()!=9)
    8989      ok=false;
    90     vec=gslapi::vector(data_stream2);
     90    vec=utility::vector(data_stream2);
    9191    if (vec.size()!=9)
    9292      ok=false;
    93     vec=gslapi::vector(data_stream3);
     93    vec=utility::vector(data_stream3);
    9494    if (vec.size()!=12)
    9595      ok=false;
    96     vec=gslapi::vector(data_stream4);
     96    vec=utility::vector(data_stream4);
    9797    if (vec.size()!=12)
    9898      ok=false;
     
    107107  std::stringstream s;
    108108  s << vec;
    109   vec2=gslapi::vector(s);
     109  vec2=utility::vector(s);
    110110  if (!(vec==vec2))
    111111    ok=false;
     
    120120    check_file_access(data5);
    121121    std::ifstream data_stream5(data5.c_str());
    122     vec=gslapi::vector(data_stream5); // this will give an exception
     122    vec=utility::vector(data_stream5); // this will give an exception
    123123  } catch (utility::IO_error& err) {
    124124    if (print)
     
    130130    check_file_access(data);
    131131    std::ifstream data_stream(data.c_str());
    132     vec=gslapi::vector(data_stream); // this will give an exception
     132    vec=utility::vector(data_stream); // this will give an exception
    133133  } catch (utility::IO_error& err) {
    134134    if (print)
     
    143143    check_file_access(data);
    144144    std::ifstream data_stream(data.c_str());
    145     vec=gslapi::vector(data_stream); // this will give an exception
     145    vec=utility::vector(data_stream); // this will give an exception
    146146  } catch (utility::IO_error& err) {
    147147    if (print)
Note: See TracChangeset for help on using the changeset viewer.