AbstractLinAlgPack: C++ Interfaces For Vectors, Matrices And Related Linear Algebra Objects  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | List of all members
AbstractLinAlgPack::VectorSubView Class Reference

Concrete subclass for a default sub-view implementation for a Vector object. More...

#include <AbstractLinAlgPack_VectorSubView.hpp>

Inheritance diagram for AbstractLinAlgPack::VectorSubView:
Inheritance graph
[legend]

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_tfull_vec () const
 
const VectorSpaceSubSpacespace_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 VectorSpacespace () 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
 

Detailed Description

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.

Constructor & Destructor Documentation

AbstractLinAlgPack::VectorSubView::VectorSubView ( )
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.

Member Function Documentation

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

Definition at line 72 of file AbstractLinAlgPack_VectorSubView.cpp.

const VectorSubView::vec_ptr_t & AbstractLinAlgPack::VectorSubView::full_vec ( ) const
inline

Definition at line 170 of file AbstractLinAlgPack_VectorSubView.hpp.

const VectorSpaceSubSpace & AbstractLinAlgPack::VectorSubView::space_impl ( ) const
inline

Definition at line 176 of file AbstractLinAlgPack_VectorSubView.hpp.

const VectorSpace & AbstractLinAlgPack::VectorSubView::space ( ) const
virtual

Implements AbstractLinAlgPack::Vector.

Definition at line 81 of file AbstractLinAlgPack_VectorSubView.cpp.

index_type AbstractLinAlgPack::VectorSubView::dim ( ) const
virtual

Reimplemented from AbstractLinAlgPack::Vector.

Definition at line 86 of file AbstractLinAlgPack_VectorSubView.cpp.

void AbstractLinAlgPack::VectorSubView::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
virtual

Calls apply_op() on the underlying full vectors.

Preconditions:

Implements AbstractLinAlgPack::Vector.

Definition at line 91 of file AbstractLinAlgPack_VectorSubView.cpp.

value_type AbstractLinAlgPack::VectorSubView::get_ele ( index_type  i) const
virtual

Reimplemented from AbstractLinAlgPack::Vector.

Definition at line 148 of file AbstractLinAlgPack_VectorSubView.cpp.

Vector::vec_ptr_t AbstractLinAlgPack::VectorSubView::sub_view ( const Range1D rng) const
virtual

Reimplemented from AbstractLinAlgPack::Vector.

Definition at line 155 of file AbstractLinAlgPack_VectorSubView.cpp.

void AbstractLinAlgPack::VectorSubView::get_sub_vector ( const Range1D rng,
RTOpPack::SubVector *  sub_vec 
) const
virtual

Reimplemented from AbstractLinAlgPack::Vector.

Definition at line 171 of file AbstractLinAlgPack_VectorSubView.cpp.

void AbstractLinAlgPack::VectorSubView::free_sub_vector ( RTOpPack::SubVector *  sub_vec) const
virtual

Reimplemented from AbstractLinAlgPack::Vector.

Definition at line 184 of file AbstractLinAlgPack_VectorSubView.cpp.


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