Changeset 825 for trunk/yat/utility/vector.cc
- Timestamp:
- Mar 19, 2007, 1:46:10 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/utility/vector.cc
r810 r825 28 28 #include "matrix.h" 29 29 #include "utility.h" 30 #include "yat/random/random.h" 30 31 31 32 #include <cassert> … … 475 476 476 477 477 std::pair<double,double> minmax(const vector& v)478 {479 std::pair<double,double> minmax;480 gsl_vector_minmax(v.gsl_vector_p(), &minmax.first, &minmax.second);481 return minmax;482 }483 484 485 std::pair<size_t,size_t> minmax_index(const vector& v)486 {487 std::pair<size_t,size_t> minmax;488 gsl_vector_minmax_index(v.gsl_vector_p(), &minmax.first, &minmax.second);489 return minmax;490 }491 492 493 478 bool nan(const vector& templat, vector& flag) 494 479 { … … 515 500 516 501 502 void shuffle(vector& invec) 503 { 504 vector vec(invec); 505 random::DiscreteUniform rnd; 506 for (size_t i=0; i<vec.size(); i++){ 507 size_t index = rnd(vec.size()-i); 508 invec[i]=vec(index); 509 vec(index)=vec(vec.size()-i-1); 510 } 511 } 512 513 517 514 void sort(vector& v) 518 515 {
Note: See TracChangeset
for help on using the changeset viewer.