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
AbstractLinAlgPack_VectorMutableDense.hpp
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
5 // Copyright (2003) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov)
38 //
39 // ***********************************************************************
40 // @HEADER
41 
42 #ifndef VECTOR_WITH_OP_MUTABLE_DENSE_H
43 #define VECTOR_WITH_OP_MUTABLE_DENSE_H
44 
45 #include "AbstractLinAlgPack_VectorSpaceSerial.hpp"
46 #include "AbstractLinAlgPack_VectorMutable.hpp"
47 #include "AbstractLinAlgPack_VectorApplyOpSerialBase.hpp"
48 #include "DenseLinAlgPack_DVectorClass.hpp"
49 #include "Teuchos_RCP.hpp"
50 #include "ReleaseResource.hpp"
51 
52 namespace AbstractLinAlgPack {
53 
85  : virtual public VectorMutable
86  , virtual private VectorApplyOpSerialBase
87 {
88 public:
89 
91  typedef Teuchos::RCP<
93 
96 
100  const size_type dim = 0
101  );
105  DVectorSlice v
106  ,const release_resource_ptr_t& v_release
107  );
111  void initialize(
112  const size_type dim
113  );
116  void initialize(
117  DVectorSlice v
118  ,const release_resource_ptr_t& v_release
119  );
120 
122 
125 
139  const DVectorSlice get_vec() const;
143  const release_resource_ptr_t& vec_release() const;
144 
146 
149 
151  const VectorSpace& space() const;
153  void apply_op(
154  const RTOpPack::RTOp& op
155  ,const size_t num_vecs, const Vector* vecs[]
156  ,const size_t num_targ_vecs, VectorMutable* targ_vecs[]
157  ,RTOpPack::ReductTarget *reduct_obj
158  ,const index_type first_ele, const index_type sub_dim, const index_type global_offset
159  ) const;
161  index_type dim() const;
163  value_type get_ele(index_type i) const;
165  void get_sub_vector( const Range1D& rng, RTOpPack::SubVector* sub_vec ) const;
167  void free_sub_vector( RTOpPack::SubVector* sub_vec ) const;
168 
170 
173 
175  VectorMutable& operator=(value_type alpha);
177  VectorMutable& operator=(const Vector& v);
181  void set_ele( index_type i, value_type val );
183  vec_mut_ptr_t sub_view( const Range1D& rng );
185  void get_sub_vector( const Range1D& rng, RTOpPack::MutableSubVector* sub_vec );
187  void commit_sub_vector( RTOpPack::MutableSubVector* sub_vec );
189  void set_sub_vector( const RTOpPack::SparseSubVector& sub_vec );
191  void Vp_StMtV(
192  value_type alpha
193  ,const GenPermMatrixSlice &P
194  ,BLAS_Cpp::Transp P_trans
195  ,const Vector &x
196  ,value_type beta
197  );
198 
200 
203  {
204  return this;
205  }
206 private:
207 
208  // ///////////////////////////////////////
209  // Private data members
210 
211  DVectorSlice v_;
212  release_resource_ptr_t v_release_;
213  VectorSpaceSerial space_;
214 
215  // Not defined and not to be called
216  //VectorMutableDense(const VectorMutableDense&);
218 
219 }; // end class VectorMutableDense
220 
221 // //////////////////////////////////////
222 // Inline members
223 
224 inline
225 DVectorSlice
227 {
228  this->has_changed();
229  return v_;
230 }
231 
232 inline
233 const DVectorSlice
235 {
236  return v_;
237 }
238 
239 inline
242 {
243  return v_release_;
244 }
245 
246 } // end namespace AbstractLinAlgPack
247 
248 #endif // VECTOR_WITH_OP_MUTABLE_DENSE_H
DVector "Adaptor" subclass for DenseLinAlgPack::DVectorSlice or DenseLinAlgPack::DVector objects...
const release_resource_ptr_t & vec_release() const
Return a RCP<> pointer to the object that will release the associated resource.
Abstract interface for immutable, finite dimensional, coordinate vectors {abstract}.
const DVectorSlice get_vec() const
Return a const dense vector.
void commit_sub_vector(RTOpPack::MutableSubVector *sub_vec)
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
VectorMutableDense(const size_type dim=0)
Calls this->initialize(dim).
virtual void has_changed() const
Must be called by any vector subclass that modifies this vector object!
Abstract interface for objects that represent a space for mutable coordinate vectors.
void set_sub_vector(const RTOpPack::SparseSubVector &sub_vec)
void initialize(const size_type dim)
Call this->initialize(v,v_release) with an allocated DenseLinAlgPack::DVector object.
Teuchos::RCP< MemMngPack::ReleaseResource > release_resource_ptr_t
This is a base class that is meant to be inherited by Vector subclasses that wish to call TSFCore::ap...
Abstract interface for mutable coordinate vectors {abstract}.
void Vp_StMtV(value_type alpha, const GenPermMatrixSlice &P, BLAS_Cpp::Transp P_trans, const Vector &x, value_type beta)
DVectorSlice set_vec()
Return the non-const dense vector.
Subclass for serial vector space objects that create VectorMutableDense vector and MultiVectorMutable...
void get_sub_vector(const Range1D &rng, RTOpPack::SubVector *sub_vec) const
Transp
void free_sub_vector(RTOpPack::SubVector *sub_vec) const
Concrete matrix type to represent general permutation (mapping) matrices.