Changeset 784
- Timestamp:
- Mar 6, 2007, 5:02:30 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/vector_test.cc
r782 r784 173 173 ok=false; 174 174 175 // test of const view implementation (make sure no zero pointer used. 176 const utility::vector vv(10,3.0); 177 const utility::vector vview(vv,0,5,1); 178 utility::vector vv2(5,2.0); 179 vv2.mul(vview); // should work without an abort due to zero pointer in mul 180 vv2.div(vview); // should work without an abort due to zero pointer in mul 181 175 182 return (ok ? 0 : -1); 176 183 } -
trunk/yat/utility/vector.cc
r783 r784 212 212 void vector::div(const vector& other) 213 213 { 214 assert(v_); assert(other.v_);215 int status=gsl_vector_div(v_,other. v_);214 assert(v_); 215 int status=gsl_vector_div(v_,other.gsl_vector_p()); 216 216 if (status) 217 217 throw utility::GSL_error(std::string("vector::div",status)); … … 239 239 void vector::mul(const vector& other) 240 240 { 241 assert(v_); assert(other.v_);242 int status=gsl_vector_mul(v_,other. v_);241 assert(v_); 242 int status=gsl_vector_mul(v_,other.gsl_vector_p()); 243 243 if (status) 244 244 throw utility::GSL_error(std::string("vector::mul",status)); … … 255 255 void vector::set(const vector& vec) 256 256 { 257 assert(v_); assert(vec.v_);258 if (gsl_vector_memcpy(v_,vec. v_))257 assert(v_); 258 if (gsl_vector_memcpy(v_,vec.gsl_vector_p())) 259 259 throw utility::GSL_error("vector::set dimension mis-match"); 260 260 } … … 357 357 { 358 358 assert(v_); 359 int status=gsl_vector_add(v_, other. v_);359 int status=gsl_vector_add(v_, other.gsl_vector_p()); 360 360 if (status) 361 361 throw utility::GSL_error(std::string("vector::add", status)); … … 375 375 { 376 376 assert(v_); 377 int status=gsl_vector_sub(v_, other. v_);377 int status=gsl_vector_sub(v_, other.gsl_vector_p()); 378 378 if (status) 379 379 throw utility::GSL_error(std::string("vector::sub", status));
Note: See TracChangeset
for help on using the changeset viewer.