yat  0.16pre
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
theplu::yat::utility::VectorExpression< Derived > Class Template Reference

An expression that can be converted to a Vector. More...

#include <yat/utility/VectorExpression.h>

Inheritance diagram for theplu::yat::utility::VectorExpression< Derived >:
theplu::yat::utility::BasicVector< VectorExpression< Derived > >

Public Types

typedef Derived derived_type
 Derived class.
 

Public Member Functions

 VectorExpression (void)
 default constructor
 
 ~VectorExpression (void)
 destructor, free allocated memory
 
 VectorExpression (const VectorExpression &other)
 Cop constructor.
 
size_t size (void) const
 
double operator() (size_t i) const
 access an element
 
const gsl_vector * gsl_vector_p (void) const
 return a GSL vector pointer
 
gsl_vector * gsl_vector_p (void)
 return a mutable GSL vector pointer
 
void gsl_vector_p (gsl_vector *v)
 set underlying GSL vector
 

Protected Member Functions

void allocate_memory (size_t n) const
 allocate memory and throw if fails
 
void delete_allocated_memory (void)
 clean up
 

Protected Attributes

gsl_vector * v_
 

Detailed Description

template<class Derived>
class theplu::yat::utility::VectorExpression< Derived >

An expression that can be converted to a Vector.

yat uses template expression to implement fast linear algebra operations. This class defines the interface of expression that can be converted to a vector.

The class is used in two ways: 1) Classes that implements an expression that translates to a vector, for example, A * x, should inherit from this class. 2) Functions that takes expression that looks like a vector, but do not accept VectorBase, can pass this class.

To inherit from this class do the following:

1) declare you class class MyClass : public VectorExpression<MyClass>

Implement functions

Since
new in yat 0.15

Member Function Documentation

template<class Derived>
size_t theplu::yat::utility::VectorExpression< Derived >::size ( void  ) const
inline
Returns
number of elements in vector

Member Data Documentation

template<class Derived>
gsl_vector* theplu::yat::utility::VectorExpression< Derived >::v_
mutableprotected

cache variable that is calculated in derived classes via calculate_gsl_vector_p(void);


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

Generated on Thu Jan 10 2019 02:54:20 for yat by  doxygen 1.8.11