#include <linalg.hpp>
Public Member Functions | |
~vector_view () | |
vector_view & | operator= (const vector &w) |
vector_view & | operator= (const vector_view &w) |
Assignment, useful for modifying chunks of vectors all at once. | |
Private Member Functions | |
vector_view () | |
vector_view (gsl_vector *y, const slice &s) | |
See above. | |
vector_view (gsl_matrix *A, const slice &a, const size_t j) | |
See above. | |
vector_view (gsl_matrix *A, const size_t i, const slice &b) | |
See above. | |
Friends | |
class | vector |
class | matrix |
linalg::vector_view::vector_view | ( | ) | [private] |
linalg::vector_view::vector_view | ( | gsl_vector * | y, | |
const slice & | s | |||
) | [private] |
See above.
00590 :vector(new gsl_vector){ 00591 if(s.end() > y->size - 1){ 00592 indexOutOfRange exc; 00593 exc.file = __FILE__; 00594 exc.line = __LINE__; 00595 exc.reason = "invalid vector slice upper range."; 00596 exc.i = s.end(); 00597 exc.n = y->size; 00598 throw exc; 00599 } 00600 x -> size = (s.end() - s.begin())/s.stride()+1; 00601 x -> data = gsl_vector_ptr(y,s.begin()); 00602 x -> stride = s.stride(); 00603 x -> block = 0; 00604 x -> owner = 0; 00605 }
linalg::vector_view::vector_view | ( | gsl_matrix * | A, | |
const slice & | a, | |||
const size_t | j | |||
) | [private] |
See above.
00607 :vector(new gsl_vector){ 00608 if(a.end() > A -> size1 - 1 or j-1 > A -> size2-1){ 00609 indexOutOfRange exc; 00610 exc.file = __FILE__; 00611 exc.line = __LINE__; 00612 exc.reason = "invalid matrix view range."; 00613 exc.i = a.end(); 00614 exc.j = j; 00615 exc.n = A -> size1; 00616 exc.m = A -> size2; 00617 throw exc; 00618 } 00619 x -> size = (a.end() - a.begin())/a.stride()+1; 00620 x -> data = gsl_matrix_ptr(A, a.begin(), j-1); 00621 x -> stride = a.stride()*(A -> tda); //Note that a longer step is 00622 //necessary here. 00623 x -> block = 0; 00624 x -> owner = 0; 00625 }
linalg::vector_view::vector_view | ( | gsl_matrix * | A, | |
const size_t | i, | |||
const slice & | b | |||
) | [private] |
See above.
00627 :vector(new gsl_vector){ 00628 if(b.end() > A -> size2 - 1 or i-1 > A-> size1-1){ 00629 indexOutOfRange exc; 00630 exc.file = __FILE__; 00631 exc.line = __LINE__; 00632 exc.reason = "invalid matrix view range."; 00633 exc.i = i; 00634 exc.j = b.end(); 00635 exc.n = A -> size1; 00636 exc.m = A -> size2; 00637 throw exc; 00638 } 00639 x -> size = (b.end() - b.begin())/b.stride()+1; 00640 x -> data = gsl_matrix_ptr(A, i-1, b.begin()); 00641 x -> stride = b.stride(); 00642 x -> block = 0; 00643 x -> owner = 0; 00644 }
vector_view & linalg::vector_view::operator= | ( | const vector & | w | ) |
Assignment to a vector; will share same data in memory as that other vector.
Reimplemented from linalg::vector.
00646 { 00647 if(x->size != w.size()){ 00648 badArgument exc; 00649 exc.reason = "Cannot assign to vector view: incomformant sizes."; 00650 exc.file = __FILE__; 00651 exc.line = __LINE__; 00652 throw exc; 00653 } 00654 gsl_vector_memcpy(x,w.x); 00655 return *this; 00656 }
vector_view & linalg::vector_view::operator= | ( | const vector_view & | w | ) |
Assignment, useful for modifying chunks of vectors all at once.
00658 { 00659 if(x->size != w.size()){ 00660 badArgument exc; 00661 exc.reason = "Cannot assign to vector view: incomformant sizes."; 00662 exc.file = __FILE__; 00663 exc.line = __LINE__; 00664 throw exc; 00665 } 00666 gsl_vector_memcpy(x,w.x); 00667 return *this; 00668 00669 }
friend class vector [friend] |
friend class matrix [friend] |
Reimplemented from linalg::vector.