AbstractLinAlgPack: C++ Interfaces For Vectors, Matrices And Related Linear Algebra Objects
Version of the Day
|
Concrete subclass for a default sub-view implementation for a Vector object. More...
#include <AbstractLinAlgPack_VectorSubView.hpp>
Public Member Functions | |
VectorSubView () | |
Constructs to uninitialized. More... | |
VectorSubView (const vec_ptr_t &full_vec, const Range1D &rng) | |
Calls this->initialize() . More... | |
void | initialize (const vec_ptr_t &full_vec, const Range1D &rng) |
Initialize a sub-view based on a full vector. More... | |
void | set_uninitialized () |
Set uninitialized() More... | |
const vec_ptr_t & | full_vec () const |
const VectorSpaceSubSpace & | space_impl () const |
Public Member Functions inherited from AbstractLinAlgPack::Vector | |
Vector () | |
virtual | ~Vector () |
vec_ptr_t | sub_view (const index_type &l, const index_type &u) const |
Inline member function that simply calls this->sub_view(Range1D(l,u)) . More... | |
virtual void | has_changed () const |
Must be called by any vector subclass that modifies this vector object! More... | |
virtual index_type | nz () const |
Return the number of nonzero elements in the vector. More... | |
virtual std::ostream & | output (std::ostream &out, bool print_dim=true, bool newline=true, index_type global_offset=0) const |
Virtual output function. More... | |
virtual vec_mut_ptr_t | clone () const |
Create a clone of this vector objet. More... | |
virtual value_type | norm_1 () const |
One norm. ||v||_1 = sum( |v(i)|, i = 1,,,this->dim() ) More... | |
virtual value_type | norm_2 () const |
Two norm. ||v||_2 = sqrt( sum( v(i)^2, i = 1,,,this->dim() ) ) More... | |
virtual value_type | norm_inf () const |
Infinity norm. ||v||_inf = max( |v(i)|, i = 1,,,this->dim() ) More... | |
virtual value_type | inner_product (const Vector &v) const |
Return the inner product of *this with v . More... | |
Overridden from Vector | |
const VectorSpace & | space () const |
index_type | dim () const |
void | apply_op (const RTOpPack::RTOp &op, const size_t num_vecs, const Vector *vecs[], const size_t num_targ_vecs, VectorMutable *targ_vecs[], RTOpPack::ReductTarget *reduct_obj, const index_type first_ele, const index_type sub_dim, const index_type global_offset) const |
Calls apply_op() on the underlying full vectors. More... | |
value_type | get_ele (index_type i) const |
vec_ptr_t | sub_view (const Range1D &rng) const |
void | get_sub_vector (const Range1D &rng, RTOpPack::SubVector *sub_vec) const |
void | free_sub_vector (RTOpPack::SubVector *sub_vec) const |
Additional Inherited Members | |
Public Types inherited from AbstractLinAlgPack::Vector | |
typedef Teuchos::RCP< const Vector > | vec_ptr_t |
typedef Teuchos::RCP < VectorMutable > | vec_mut_ptr_t |
Protected Member Functions inherited from AbstractLinAlgPack::Vector | |
virtual void | finalize_apply_op (const size_t num_targ_vecs, VectorMutable **targ_vecs) const |
This method usually needs to be called by subclasses at the end of the apply_op() method implementation to insure that has_changed() is called on the transformed vector objects. More... | |
Protected Member Functions inherited from AbstractLinAlgPack::VectorApplyOpSerialBase | |
VectorApplyOpSerialBase () | |
void | apply_op_serial (const RTOpPack::RTOp &op, const size_t num_vecs, const Vector *vecs[], const size_t num_targ_vecs, VectorMutable *targ_vecs[], RTOpPack::ReductTarget *reduct_obj, const index_type first_ele, const index_type sub_dim, const index_type global_offset) const |
Concrete subclass for a default sub-view implementation for a Vector object.
Not all of the methods from Vector are overridden, only those that need to be or may result in better performance.
There is really not much to this vector subclass. The subclass is only possible because of the first_ele
, sub_dim
, and global_offset
options with apply_op()
. The vector space object returned by this->space()
is of type VectorSpaceSubSpace
which in turn relys on VectorSpace::sub_space()
.
The default constructor and copy constructors are allowed but the default assignment operator is not allowed.
Definition at line 66 of file AbstractLinAlgPack_VectorSubView.hpp.
|
inline |
Constructs to uninitialized.
Postconditions: see set_uninitialized()
.
Definition at line 165 of file AbstractLinAlgPack_VectorSubView.hpp.
AbstractLinAlgPack::VectorSubView::VectorSubView | ( | const vec_ptr_t & | full_vec, |
const Range1D & | rng | ||
) |
Calls this->initialize()
.
Definition at line 53 of file AbstractLinAlgPack_VectorSubView.cpp.
void AbstractLinAlgPack::VectorSubView::initialize | ( | const vec_ptr_t & | full_vec, |
const Range1D & | rng | ||
) |
Initialize a sub-view based on a full vector.
Constructs a view of the vector this = vec(rng)
.
Preconditions:
full_vec.get() != NULL
(throw std::invalid_argument
) rng.full_range() == false
] rng.lbound() <= full_vec->dim()
(throw std::out_of_range
). Postconditions:
this->get_ele(i) == full_vec->get_ele(rng.lbound()-1+i)
, for i = 1...rng.size()
full_vec | [in] The original full vector. |
rng | [in] The range of elements in full_vec that this vector will represent. |
Definition at line 58 of file AbstractLinAlgPack_VectorSubView.cpp.
void AbstractLinAlgPack::VectorSubView::set_uninitialized | ( | ) |
Set uninitialized()
Postconditions:
this->dim() == 0
this->full_vec() = NULL
Definition at line 72 of file AbstractLinAlgPack_VectorSubView.cpp.
|
inline |
Definition at line 170 of file AbstractLinAlgPack_VectorSubView.hpp.
|
inline |
Definition at line 176 of file AbstractLinAlgPack_VectorSubView.hpp.
|
virtual |
Implements AbstractLinAlgPack::Vector.
Definition at line 81 of file AbstractLinAlgPack_VectorSubView.cpp.
|
virtual |
Reimplemented from AbstractLinAlgPack::Vector.
Definition at line 86 of file AbstractLinAlgPack_VectorSubView.cpp.
|
virtual |
Calls apply_op()
on the underlying full vectors.
Preconditions:
dynamic_cast<const VectorSubView*>(vecs[k]) != NULL
, for k=0..num_vecs
(throw std::invalid_argument
) dynamic_cast<VectorMutableSubView*>(targ_vecs[k]) != NULL
, for k=0..num_targ_vecs
(throw std::invalid_argument
) dynamic_cast<const VectorSubView*>(vecs[k])->full_vec()->space().is_compatible( this->full_vec()->space() ) == true
, for k=0..num_vecs
(throw VectorSpace::IncompatibleVectorSpaces
) dynamic_cast<VectorMutableSubView>(targ_vecs[k])->full_vec()->space().is_compatible( this->full_vec()->space() ) == true
, for k=0..num_targ_vecs
(throw VectorSpace::IncompatibleVectorSpaces
) Implements AbstractLinAlgPack::Vector.
Definition at line 91 of file AbstractLinAlgPack_VectorSubView.cpp.
|
virtual |
Reimplemented from AbstractLinAlgPack::Vector.
Definition at line 148 of file AbstractLinAlgPack_VectorSubView.cpp.
|
virtual |
Reimplemented from AbstractLinAlgPack::Vector.
Definition at line 155 of file AbstractLinAlgPack_VectorSubView.cpp.
|
virtual |
Reimplemented from AbstractLinAlgPack::Vector.
Definition at line 171 of file AbstractLinAlgPack_VectorSubView.cpp.
|
virtual |
Reimplemented from AbstractLinAlgPack::Vector.
Definition at line 184 of file AbstractLinAlgPack_VectorSubView.cpp.