linalg::vector_view Class Reference

A vector that doesn't own its data; rather, points to data owned by another vector. More...

#include <linalg.hpp>

Inheritance diagram for linalg::vector_view:

Inheritance graph
[legend]
Collaboration diagram for linalg::vector_view:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 ~vector_view ()
vector_viewoperator= (const vector &w)
vector_viewoperator= (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


Detailed Description

A vector that doesn't own its data; rather, points to data owned by another vector.

Constructor & Destructor Documentation

linalg::vector_view::~vector_view (  ) 

00671                            {
00672     delete x;
00673     x = 0;
00674   }

linalg::vector_view::vector_view (  )  [private]

vector_views are invisible to the user and can only be created using slices and matrix or vector indexing.

00587                           {
00588     x = 0;
00589   }

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   }

Here is the call graph for this function:

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   }

Here is the call graph for this function:

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   }

Here is the call graph for this function:


Member Function Documentation

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   }

Here is the call graph for this function:

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   }

Here is the call graph for this function:


Friends And Related Function Documentation

friend class vector [friend]

friend class matrix [friend]

Reimplemented from linalg::vector.


The documentation for this class was generated from the following files:

Generated on Fri Jun 6 17:28:30 2008 by  doxygen 1.5.6