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 (  ) 

00713                            {
00714     delete x;
00715     x = 0;
00716   }

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.

00629                           {
00630     x = 0;
00631   }

linalg::vector_view::vector_view ( gsl_vector *  y,
const slice s 
) [private]

See above.

00632                                                        :vector(new gsl_vector){
00633     if(s.end() > y->size - 1){
00634       indexOutOfRange exc;
00635       exc.file = __FILE__;
00636       exc.line = __LINE__;
00637       exc.reason = "invalid vector slice upper range.";
00638       exc.i = s.end();
00639       exc.n = y->size;
00640       throw exc;
00641     }
00642     x -> size = (s.end() - s.begin())/s.stride()+1;
00643     x -> data = gsl_vector_ptr(y,s.begin());
00644     x -> stride = s.stride();
00645     x -> block = 0;
00646     x -> owner = 0;
00647   }

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.

00649                                                                         :vector(new gsl_vector){
00650     if(a.end() > A -> size1 - 1 or j-1 > A -> size2-1){
00651       indexOutOfRange exc;
00652       exc.file = __FILE__;
00653       exc.line = __LINE__;
00654       exc.reason = "invalid matrix view range.";
00655       exc.i = a.end();
00656       exc.j = j;
00657       exc.n = A -> size1;
00658       exc.m = A -> size2;
00659       throw exc;
00660     }
00661     x -> size = (a.end() - a.begin())/a.stride()+1;
00662     x -> data = gsl_matrix_ptr(A, a.begin(), j-1);
00663     x -> stride = a.stride()*(A -> tda); //Note that a longer step is
00664                                          //necessary here.
00665     x -> block = 0;
00666     x -> owner = 0;
00667   }

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.

00669                                                                         :vector(new gsl_vector){
00670     if(b.end() > A -> size2 - 1 or i-1 > A-> size1-1){
00671       indexOutOfRange exc;
00672       exc.file = __FILE__;
00673       exc.line = __LINE__;
00674       exc.reason = "invalid matrix view range.";
00675       exc.i = i;
00676       exc.j = b.end();
00677       exc.n = A -> size1;
00678       exc.m = A -> size2;
00679       throw exc;
00680     }
00681     x -> size = (b.end() - b.begin())/b.stride()+1;
00682     x -> data = gsl_matrix_ptr(A, i-1, b.begin());
00683     x -> stride = b.stride();
00684     x -> block = 0;
00685     x -> owner = 0;
00686   }

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.

00688                                                     {
00689     if(x->size != w.size()){
00690       badArgument exc;
00691       exc.reason =  "Cannot assign to vector view: incomformant sizes.";
00692       exc.file = __FILE__;
00693       exc.line = __LINE__;
00694       throw exc;
00695     }
00696     gsl_vector_memcpy(x,w.x);
00697     return *this;
00698   }

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.

00700                                                          {
00701     if(x->size != w.size()){
00702       badArgument exc;
00703       exc.reason =  "Cannot assign to vector view: incomformant sizes.";
00704       exc.file = __FILE__;
00705       exc.line = __LINE__;
00706       throw exc;
00707     }
00708     gsl_vector_memcpy(x,w.x);
00709     return *this;
00710     
00711   }

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 Mon Sep 29 23:54:13 2008 for RBF-DDM by  doxygen 1.5.6