AbstractLinAlgPack: C++ Interfaces For Vectors, Matrices And Related Linear Algebra Objects
Version of the Day
|
Extract a constant DenseLinAlgPack::DVectorSlice
view of a Vector
object.
More...
#include <AbstractLinAlgPack_VectorDenseEncap.hpp>
Public Member Functions | |
VectorDenseEncap (const Vector &vec) | |
Calls vec.get_sub_vector(Range1D(),DENSE,&sub_vec) to get the view. More... | |
~VectorDenseEncap () | |
Calls vec.free_sub_vector(&sub_vec) to release the view. More... | |
const DVectorSlice & | operator() () const |
Returns a reference to a constant view of the dense vector. More... | |
Extract a constant DenseLinAlgPack::DVectorSlice
view of a Vector
object.
This class is only to be used with Vector
objects that store all of their elements in the local address space or can easily access all of the vector elements in this process (or thread). It is generally to be used in serial applications but might also find use in parallel appliations where a vector is replicated across processes.
This utility class is defined purly in terms of the abstract interfaces. It is only to be used as an automatic variable on the stack. For example, to extract a DVectorSlice
view of an abstract vector and use it to copy to another DVectorSlice
object you could write a function like:
In the above code, if the underlying Vector
object does not have to perform any dynamic memory allocations and copy in the method Vector::get_sub_vector()
then the above code will only have a constant time overhead. However, the above approach will work for any Vector
object (no matter how inefficient it may be).
Definition at line 78 of file AbstractLinAlgPack_VectorDenseEncap.hpp.
|
inline |
Calls vec.get_sub_vector(Range1D(),DENSE,&sub_vec)
to get the view.
Definition at line 134 of file AbstractLinAlgPack_VectorDenseEncap.hpp.
|
inline |
Calls vec.free_sub_vector(&sub_vec)
to release the view.
Definition at line 147 of file AbstractLinAlgPack_VectorDenseEncap.hpp.
|
inline |
Returns a reference to a constant view of the dense vector.
Definition at line 153 of file AbstractLinAlgPack_VectorDenseEncap.hpp.