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_MatrixConvertToSparseEncap.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 MATRIX_CONVERT_TO_SPARSE_ENCAP_H
43 #define MATRIX_CONVERT_TO_SPARSE_ENCAP_H
44 
45 #include "AbstractLinAlgPack_MatrixConvertToSparse.hpp"
46 #include "Teuchos_RCP.hpp"
47 
48 namespace AbstractLinAlgPack {
49 
55  : virtual public MatrixConvertToSparse
56 {
57 public:
58 
61 
66 
68 
71 
75 
79  const mese_ptr_t &mese
81  ,const Range1D &row_rng
83  ,const Range1D &col_rng
85  ,const value_type alpha = 1.0
86  );
87 
94  void initialize(
95  const mese_ptr_t &mese
97  ,const Range1D &row_rng
99  ,const Range1D &col_rng
101  ,const value_type alpha = 1.0
102  );
103 
108  void set_uninitialized();
109 
111 
114 
116  const mese_ptr_t& mese() const;
118  const i_vector_ptr_t& inv_row_perm() const;
120  const Range1D& row_rng() const;
122  const i_vector_ptr_t& inv_col_perm() const;
124  const Range1D& col_rng() const;
126  const BLAS_Cpp::Transp mese_trans() const;
128  const value_type alpha() const;
129 
131 
134 
136  const VectorSpace& space_cols() const;
138  const VectorSpace& space_rows() const;
140  size_type rows() const;
142  size_type cols() const;
144  size_type nz() const;
145 
147 
150 
152  index_type num_nonzeros(
153  EExtractRegion extract_region
154  ,EElementUniqueness element_uniqueness
155  ) const;
156 
159  EExtractRegion extract_region
160  ,EElementUniqueness element_uniqueness
161  ,const index_type len_Aval
162  ,value_type Aval[]
163  ,const index_type len_Aij
164  ,index_type Arow[]
165  ,index_type Acol[]
166  ,const index_type row_offset
167  ,const index_type col_offset
168  ) const;
169 
171 
172 private:
173 
175 
176 #ifdef DOXYGEN_COMPILE
182 #else
183  mese_ptr_t mese_;
184  BLAS_Cpp::Transp mese_trans_;
185  value_type alpha_;
186  Range1D row_rng_;
187  Range1D col_rng_;
188  i_vector_ptr_t inv_row_perm_;
189  i_vector_ptr_t inv_col_perm_;
190  size_type nz_full_;
191  space_ptr_t space_cols_;
192  space_ptr_t space_rows_;
193 #endif
194 
195 }; // end class MatrixConvertToSparseEncap
196 
197 // /////////////////////////////////////////////
198 // Inline members
199 
200 // Access
201 
202 inline
205 {
206  return mese_;
207 }
208 
209 inline
212 {
213  return inv_row_perm_;
214 }
215 
216 inline
217 const Range1D& MatrixConvertToSparseEncap::row_rng() const
218 {
219  return row_rng_;
220 }
221 
222 inline
225 {
226  return inv_col_perm_;
227 }
228 
229 inline
230 const Range1D& MatrixConvertToSparseEncap::col_rng() const
231 {
232  return col_rng_;
233 }
234 
235 inline
236 const BLAS_Cpp::Transp
238 {
239  return mese_trans_;
240 }
241 
242 inline
243 const value_type MatrixConvertToSparseEncap::alpha() const
244 {
245  return alpha_;
246 }
247 
248 } // end namespace AbstractLinAlgPack
249 
250 #endif // MATRIX_CONVERT_TO_SPARSE_ENCAP_H
const i_vector_ptr_t & inv_row_perm() const
index_type num_nonzeros(EExtractRegion extract_region, EElementUniqueness element_uniqueness) const
Interface for extracting nonzero elements from a banded subregion of a permuted sparse matrix in one ...
const i_vector_ptr_t & inv_col_perm() const
Abstract interface for objects that represent a space for mutable coordinate vectors.
Mix-in interface for extracing explicit elements from a sparse matrix in one of several Fortran compa...
void coor_extract_nonzeros(EExtractRegion extract_region, EElementUniqueness element_uniqueness, const index_type len_Aval, value_type Aval[], const index_type len_Aij, index_type Arow[], index_type Acol[], const index_type row_offset, const index_type col_offset) const
void initialize(const mese_ptr_t &mese, const i_vector_ptr_t &inv_row_perm, const Range1D &row_rng, const i_vector_ptr_t &inv_col_perm, const Range1D &col_rng, const BLAS_Cpp::Transp mese_trans, const value_type alpha=1.0)
Initialize a permuted view of a sparse matrix.
Sparse conversion subclass based on views of a MatrixExtractSparseElements object.
Transp