Changeset 714 for trunk/yat/utility
- Timestamp:
- Dec 22, 2006, 1:10:54 AM (16 years ago)
- Location:
- trunk/yat/utility
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/utility/vector.cc
r703 r714 189 189 190 190 191 int vector::add(const vector& other) 192 { 193 return gsl_vector_add(v_,other.v_); 194 } 195 196 197 int vector::add(double term) 198 { 199 return gsl_vector_add_constant(v_,term); 200 } 201 202 191 203 gsl_vector* vector::create_gsl_vector_copy(void) const 192 204 { … … 197 209 198 210 211 int vector::div(const vector& other) 212 { 213 return gsl_vector_div(v_,other.v_); 214 } 215 216 217 const gsl_vector* vector::gsl_vector_p(void) const 218 { 219 return proxy_v_; 220 } 221 222 223 gsl_vector* vector::gsl_vector_p(void) 224 { 225 return v_; 226 } 227 228 229 bool vector::isnull(void) const 230 { 231 return gsl_vector_isnull(proxy_v_); 232 } 233 234 235 bool vector::isview(void) const 236 { 237 return view_ || view_const_; 238 } 239 240 241 double vector::max(void) const 242 { 243 return gsl_vector_max(proxy_v_); 244 } 245 246 247 size_t vector::max_index(void) const 248 { 249 return gsl_vector_max_index(proxy_v_); 250 } 251 252 253 double vector::min(void) const 254 { 255 return gsl_vector_min(proxy_v_); 256 } 257 258 259 size_t vector::min_index(void) const 260 { 261 return gsl_vector_min_index(proxy_v_); 262 } 263 264 199 265 std::pair<double,double> vector::minmax(void) const 200 266 { … … 210 276 gsl_vector_minmax_index(proxy_v_, &min_index, &max_index); 211 277 return std::pair<size_t,size_t>(min_index,max_index); 278 } 279 280 281 int vector::mul(const vector& other) 282 { 283 return gsl_vector_mul(v_,other.v_); 284 } 285 286 287 int vector::reverse(void) 288 { 289 return gsl_vector_reverse(v_); 290 } 291 292 293 int vector::scale(double factor) 294 { 295 return gsl_vector_scale(v_,factor); 296 } 297 298 299 int vector::set(const vector& vec) 300 { 301 return gsl_vector_memcpy(v_,vec.v_); 302 } 303 304 305 void vector::set_all(const double& value) 306 { 307 gsl_vector_set_all(v_,value); 308 } 309 310 311 void vector::set_basis(const size_t i) 312 { 313 gsl_vector_set_basis(v_,i); 314 } 315 316 317 void vector::set_zero(void) 318 { 319 gsl_vector_set_zero(v_); 320 } 321 322 323 size_t vector::size(void) const 324 { 325 return proxy_v_->size; 326 } 327 328 329 void vector::sort(void) 330 { 331 gsl_sort_vector(v_); 332 } 333 334 335 int vector::sub(const vector& other) 336 { 337 return gsl_vector_sub(v_,other.v_); 212 338 } 213 339 … … 219 345 sum += (*this)(i); 220 346 return( sum ); 347 } 348 349 350 int vector::swap(vector& other) 351 { 352 return gsl_vector_swap(v_,other.v_); 353 } 354 355 356 int vector::swap_elements(size_t i, size_t j) 357 { 358 return gsl_vector_swap_elements(v_,i,j); 359 } 360 361 362 double& vector::operator()(size_t i) 363 { 364 return *gsl_vector_ptr(v_,i); 365 } 366 367 368 const double& vector::operator()(size_t i) const 369 { 370 return *gsl_vector_const_ptr(proxy_v_,i); 371 } 372 373 374 double& vector::operator[](size_t i) 375 { 376 return *gsl_vector_ptr(v_,i); 377 } 378 379 380 const double& vector::operator[](size_t i) const 381 { 382 return *gsl_vector_const_ptr(proxy_v_,i); 221 383 } 222 384 -
trunk/yat/utility/vector.h
r703 r714 209 209 /// 210 210 // Jari, group as vector_operators 211 in line int add(const vector& other) { return gsl_vector_add(v_,other.v_); }211 int add(const vector& other); 212 212 213 213 /// … … 218 218 /// 219 219 // Jari, group as vector_operators 220 in line int add(double term) { return gsl_vector_add_constant(v_,term); }220 int add(double term); 221 221 222 222 /// … … 227 227 /// 228 228 // Jari, doxygen group as Vector operators 229 in line int div(const vector& other) { return gsl_vector_div(v_,other.v_); }229 int div(const vector& other); 230 230 231 231 /// 232 232 /// @return A const pointer to the internal GSL vector, 233 233 /// 234 inline const gsl_vector* gsl_vector_p(void) const { return proxy_v_; } 234 const gsl_vector* gsl_vector_p(void) const; 235 235 236 236 /// 237 237 /// @return A pointer to the internal GSL vector, 238 238 /// 239 inline gsl_vector* gsl_vector_p(void) { return v_; } 239 gsl_vector* gsl_vector_p(void); 240 240 241 241 /// … … 243 243 /// othwerwise; 244 244 /// 245 inline bool isnull(void) const { return gsl_vector_isnull(proxy_v_); }245 bool isnull(void) const; 246 246 247 247 /// … … 251 251 /// @return True if the object is a view, false othwerwise. 252 252 /// 253 inline bool isview(void) const { return view_ || view_const_; }253 bool isview(void) const; 254 254 255 255 /// … … 257 257 /// 258 258 // Jari, doxygen group as Finding maximum and minimum elements 259 inline double max(void) const { return gsl_vector_max(proxy_v_); }259 double max(void) const; 260 260 261 261 /// … … 264 264 /// 265 265 // Jari, doxygen group as Finding maximum and minimum elements 266 inline size_t 267 max_index(void) const { return gsl_vector_max_index(proxy_v_); } 266 size_t max_index(void) const; 268 267 269 268 /// … … 271 270 /// 272 271 // Jari, doxygen group as Finding maximum and minimum elements 273 inline double min(void) const { return gsl_vector_min(proxy_v_); }272 double min(void) const; 274 273 275 274 /// … … 278 277 /// 279 278 // Jari, doxygen group as Finding maximum and minimum elements 280 inline size_t 281 min_index(void) const { return gsl_vector_min_index(proxy_v_); } 279 size_t min_index(void) const; 282 280 283 281 /// … … 304 302 /// 305 303 // Jari, doxygen group as Vector operators 306 in line int mul(const vector& other) { return gsl_vector_mul(v_,other.v_); }304 int mul(const vector& other); 307 305 308 306 /// … … 312 310 /// 313 311 // Jari, doxygen group as Exchanging elements 314 in line int reverse(void) { return gsl_vector_reverse(v_);}312 int reverse(void); 315 313 316 314 /// … … 320 318 /// 321 319 // Jari, doxygen group as Vector operators 322 in line int scale(double factor) { return gsl_vector_scale(v_,factor); }320 int scale(double factor); 323 321 324 322 /// … … 332 330 /// @see const vector& operator=(const vector&) 333 331 /// 334 in line int set(const vector& vec) { return gsl_vector_memcpy(v_,vec.v_); }332 int set(const vector& vec); 335 333 336 334 /// … … 338 336 /// 339 337 // Jari, doxygen group as Initializing vector elements 340 inline void set_all(const double& value) { gsl_vector_set_all(v_,value); } 338 void set_all(const double& value); 341 339 342 340 /// … … 346 344 /// 347 345 // Jari, doxygen group as Initializing vector elements 348 inline void set_basis(const size_t i) { gsl_vector_set_basis(v_,i); }346 void set_basis(const size_t i); 349 347 350 348 /// … … 352 350 /// 353 351 // Jari, doxygen group as Initializing vector elements 354 inline void set_zero(void) { gsl_vector_set_zero(v_); } 352 void set_zero(void); 355 353 356 354 /// 357 355 /// @return the number of elements in the vector. 358 356 /// 359 inline size_t size(void) const { return proxy_v_->size; }357 size_t size(void) const; 360 358 361 359 /// … … 365 363 /// 366 364 // Markus to Jari, doxygen group as Exchanging elements ???? 367 inline void sort(void) { gsl_sort_vector(v_); }365 void sort(void); 368 366 369 367 /// … … 373 371 /// 374 372 // Jari, doxygen group as Vector operators 375 in line int sub(const vector& other) { return gsl_vector_sub(v_,other.v_); }373 int sub(const vector& other); 376 374 377 375 /// … … 388 386 /// @return GSL_SUCCESS on normal exit. 389 387 /// 390 in line int swap(vector& other) { return gsl_vector_swap(v_,other.v_); }388 int swap(vector& other); 391 389 392 390 /// … … 396 394 /// 397 395 // Jari, doxygen group as Exchanging elements 398 inline int 399 swap_elements(size_t i,size_t j) { return gsl_vector_swap_elements(v_,i,j);} 396 int swap_elements(size_t i,size_t j); 400 397 401 398 /// … … 405 402 /// 406 403 // Jari, doxygen group as Accessing vector elements 407 inline double& operator()(size_t i) { return *gsl_vector_ptr(v_,i); }404 double& operator()(size_t i); 408 405 409 406 /// … … 413 410 /// 414 411 // Jari, doxygen group as Accessing vector elements 415 inline const double& 416 operator()(size_t i) const { return *gsl_vector_const_ptr(proxy_v_,i); } 412 const double& operator()(size_t i) const; 417 413 418 414 /// … … 422 418 /// 423 419 // Jari, doxygen group as Accessing vector elements 424 inline double& operator[](size_t i) { return *gsl_vector_ptr(v_,i); }420 double& operator[](size_t i); 425 421 426 422 /// … … 430 426 /// 431 427 // Jari, doxygen group as Accessing vector elements 432 inline const double& 433 operator[](size_t i) const { return *gsl_vector_const_ptr(proxy_v_,i); } 434 435 /// 436 /// @return The dot product. 437 /// 438 double operator*(const vector&) const; 428 const double& operator[](size_t i) const; 439 429 440 430 /// … … 445 435 /// 446 436 bool operator==(const vector&) const; 437 438 /// 439 /// @return The dot product. 440 /// 441 double operator*(const vector&) const; 447 442 448 443 ///
Note: See TracChangeset
for help on using the changeset viewer.