Changeset 65
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/vector.cc
r64 r65 129 129 130 130 131 std::pair< u_int,u_int> vector::minmax_index() const131 std::pair<size_t,size_t> vector::minmax_index(void) const 132 132 { 133 133 size_t min_index=0; 134 134 size_t max_index=0; 135 135 void gsl_vector_minmax_index (const gsl_vector * v_, size_t * min_index, size_t * max_index); 136 return std::pair< u_int,u_int>(min_index, max_index);136 return std::pair<size_t,size_t>(min_index, max_index); 137 137 } 138 138 … … 140 140 141 141 //Peter, add default checking all elements using GSL 142 std::pair< u_int,u_int> vector::minmax_index(const std::vector<u_int>& subset ) const143 { 144 u_int min_index = subset[0];145 u_int max_index = subset[0];142 std::pair<size_t,size_t> vector::minmax_index(const std::vector<size_t>& subset ) const 143 { 144 size_t min_index = subset[0]; 145 size_t max_index = subset[0]; 146 146 for (unsigned int i=1; i<subset.size(); i++) { 147 147 if (gsl_vector_get( v_, subset[i]) < gsl_vector_get( v_, min_index)) … … 150 150 max_index = subset[i]; 151 151 } 152 return std::pair< u_int,u_int>(min_index, max_index);152 return std::pair<size_t,size_t>(min_index, max_index); 153 153 } 154 154 -
trunk/src/vector.h
r64 r65 96 96 ///and largest value. 97 97 /// 98 std::pair< u_int,u_int> vector::minmax_index() const;98 std::pair<size_t,size_t> vector::minmax_index(void) const; 99 99 100 100 ///This function returns the indices of the minimum and maximum values in … … 118 118 /// Set all elements to \a value. 119 119 /// 120 inline void set_all(const double& value) { gsl_vector_set_all(v_,value); } 120 inline void set_all(const double& value) { gsl_vector_set_all(v_,value); } 121 122 /// 123 /// Makes a basis vector byy settin all elements to 124 /// zero except the \a i-th element which is set to 125 /// one.. 126 /// 127 inline void set_basis(const size_t i) { gsl_vector_set_basis(v_,i); } 128 /// 129 /// Set all elements to zero. 130 /// 131 inline void set_zero(void) { gsl_vector_set_zero(v_); } 121 132 122 133 /// … … 145 156 /// 146 157 inline const double& operator()(size_t i) const 147 { return *gsl_vector_ ptr(v_,i); }158 { return *gsl_vector_const_ptr(v_,i); } 148 159 149 160 /// … … 152 163 /// @return Reference to element \a i. 153 164 /// 154 inline double& operator[](size_t i) { return (*this)(i); }165 inline double& operator[](size_t i) { return *gsl_vector_ptr(v_,i); } 155 166 156 167 /// … … 159 170 /// @return The value of element \a i. 160 171 /// 161 inline const double& operator[](size_t i) const { return (*this)(i); } 172 inline const double& operator[](size_t i) const 173 { return *gsl_vector_const_ptr(v_,i); } 162 174 163 175 ///
Note: See TracChangeset
for help on using the changeset viewer.