Changeset 1009 for trunk/test


Ignore:
Timestamp:
Feb 1, 2008, 5:15:44 AM (14 years ago)
Author:
Peter
Message:

merging branch peter-dev into trunk delta 1008:994

Location:
trunk/test
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/matrix_test.cc

    r1000 r1009  
    3636    : m_(i,j,value) {}
    3737
    38   inline theplu::yat::utility::vector
    39   row(const size_t& i) { return theplu::yat::utility::vector(m_,i); }
     38  inline theplu::yat::utility::vectorView
     39  row(const size_t& i) { return m_.row_vec(i); }
    4040
    4141  inline const theplu::yat::utility::matrix& matrix(void) const { return m_; }
     
    258258    for (size_t j=0; j<m5.columns(); ++j)
    259259      m5_sum2+=m5(i,j);
    260   utility::vector v5subrow(m5,3);
     260  utility::vectorView v5subrow(m5,3);
    261261  double v5subrow_sum=0;
    262262  for (size_t i=0; i<v5subrow.size(); ++i) {
     
    280280    for (size_t j=0; j<m5.columns(); ++j)
    281281      m5_sum3+=m5(i,j);
    282   utility::vector v5subcolumn(m5,0,false);
     282  utility::vectorView v5subcolumn = m5.column_vec(0);
    283283  double v5subcolumn_sum=0;
    284284  for (size_t i=0; i<v5subcolumn.size(); ++i) {
     
    332332  *error << "\tthat class member returns a view" << std::endl;
    333333  matrixwrapper mw(5,2);
    334   utility::vector mwrow=mw.row(2);
     334  utility::vectorView mwrow=mw.row(2);
    335335  if (mwrow.gsl_vector_p()->data != &(mw.matrix()(2,0))) {
    336336    ok=false;
  • trunk/test/score_test.cc

    r1000 r1009  
    3232#include "yat/utility/matrix.h"
    3333#include "yat/utility/vector.h"
     34#include "yat/utility/vectorView.h"
    3435
    3536#include <cmath>
     
    9293  const double tol = 0.001;
    9394  for (size_t i=0; i<data.rows(); i++){
    94     utility::vector vec(data,i);
     95    utility::vectorView vec(data,i);
    9596    if (vec.size()!=target2.size()){
    9697      *error << "vec.size() is " << vec.size() << " and target2.size() is "
     
    108109  utility::vector weight(target2.size(),1);
    109110  for (size_t i=0; i<data.rows(); i++){
    110     utility::vector vec(data,i);
     111    utility::vectorView vec = data.row_vec(i);
    111112    area = auc.score(target2, vec, weight);
    112113    if (area<correct_area(i)-tol || area>correct_area(i)+tol){
  • trunk/test/vector_test.cc

    r1000 r1009  
    2929#include "yat/utility/utility.h"
    3030#include "yat/utility/vector.h"
     31#include "yat/utility/vectorView.h"
    3132
    3233#include <fstream>
     
    7374  for (size_t i=0; i<vec.size(); i+=2)
    7475    sum_before+=vec[i];
    75   utility::vector vec_view(vec,0,6,2);
     76  utility::vectorView vec_view(vec,0,6,2);
    7677  sum_after=utility::sum(vec_view);
    7778  ok &= (sum_after==sum_before);
     
    8788    *message << "const view implementation" << std::endl;
    8889    const utility::vector vv(10,3.0);
    89     utility::vector vview(vv,0,5,1);
     90    utility::vectorView vview(vv,0,5,1);
    9091    // const utility::vector vview(vv,0,5,1); // this is the proper line
    9192    utility::vector vv2(5,2.0);
     
    113114    ok &= (vec_view.size()==vec3.size());
    114115    ok &= (vec3 == vec_view);
    115     ok &= (&vec3 != &vec_view);
    116116    ok &= !vec3.isview();
    117117  }
    118118
     119  /* different sizes are allowed in new design
    119120  // checking that assignment operator throws an exception if vectors
    120121  // differ in size
     
    140141    gsl_set_error_handler(err_handler);
    141142  }
     143  */
    142144
    143145  // checking that assignment operator changes the underlying object when
     
    146148    *message << "assignment operator on view" << std::endl;
    147149    vec[3]=vec[4]=vec[5]=13;
    148     utility::vector vec_view(vec,3,3,1);
     150    utility::vectorView vec_view(vec,3,3,1);
    149151    utility::vector vec2(3,123.0);
    150152    vec_view=vec2;
    151     if (vec[3]!=vec_view[0] || vec[4]!=vec_view[1] || vec[5]!=vec_view[2])
    152       ok=false;
     153    if (vec[3]!=vec_view[0] || vec[4]!=vec_view[1] || vec[5]!=vec_view[2]){
     154      *message << " failed\n";
     155      ok=false;
     156    }
    153157  }
    154158
     
    159163    *message << "\tcloning normal vector" << std::endl;
    160164    utility::vector vec2(3,123.0);
    161     vec2.clone(vec);
     165    vec2 = vec;
    162166    if (vec.size()!=vec2.size())
    163167      this_ok=false;
     
    169173      this_ok=false;
    170174    *message << "\tcloning vector view" << std::endl;
    171     utility::vector* vec_view=new utility::vector(vec,3,3,1);
    172     utility::vector vec_view2;
    173     vec_view2.clone(*vec_view);
     175    utility::vectorView* vec_view=new utility::vectorView(vec,3,3,1);
     176    utility::vectorView vec_view2(*vec_view);
    174177    if (!vec_view2.isview())
    175178      this_ok=false;
Note: See TracChangeset for help on using the changeset viewer.