|
AbstractLinAlgPack: C++ Interfaces For Vectors, Matrices And Related Linear Algebra Objects
Version of the Day
|
00001 // @HEADER 00002 // *********************************************************************** 00003 // 00004 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization 00005 // Copyright (2003) Sandia Corporation 00006 // 00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 // license for use of this work by or on behalf of the U.S. Government. 00009 // 00010 // Redistribution and use in source and binary forms, with or without 00011 // modification, are permitted provided that the following conditions are 00012 // met: 00013 // 00014 // 1. Redistributions of source code must retain the above copyright 00015 // notice, this list of conditions and the following disclaimer. 00016 // 00017 // 2. Redistributions in binary form must reproduce the above copyright 00018 // notice, this list of conditions and the following disclaimer in the 00019 // documentation and/or other materials provided with the distribution. 00020 // 00021 // 3. Neither the name of the Corporation nor the names of the 00022 // contributors may be used to endorse or promote products derived from 00023 // this software without specific prior written permission. 00024 // 00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY 00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE 00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00036 // 00037 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 00038 // 00039 // *********************************************************************** 00040 // @HEADER 00041 00042 #ifndef MATRIX_CONVERT_TO_SPARSE_ENCAP_H 00043 #define MATRIX_CONVERT_TO_SPARSE_ENCAP_H 00044 00045 #include "AbstractLinAlgPack_MatrixConvertToSparse.hpp" 00046 #include "Teuchos_RCP.hpp" 00047 00048 namespace AbstractLinAlgPack { 00049 00054 class MatrixConvertToSparseEncap 00055 : virtual public MatrixConvertToSparse 00056 { 00057 public: 00058 00061 00063 typedef Teuchos::RCP<const MatrixExtractSparseElements> mese_ptr_t; 00065 typedef Teuchos::RCP<const IVector> i_vector_ptr_t; 00066 00068 00071 00074 MatrixConvertToSparseEncap(); 00075 00078 MatrixConvertToSparseEncap( 00079 const mese_ptr_t &mese 00080 ,const i_vector_ptr_t &inv_row_perm 00081 ,const Range1D &row_rng 00082 ,const i_vector_ptr_t &inv_col_perm 00083 ,const Range1D &col_rng 00084 ,const BLAS_Cpp::Transp mese_trans 00085 ,const value_type alpha = 1.0 00086 ); 00087 00094 void initialize( 00095 const mese_ptr_t &mese 00096 ,const i_vector_ptr_t &inv_row_perm 00097 ,const Range1D &row_rng 00098 ,const i_vector_ptr_t &inv_col_perm 00099 ,const Range1D &col_rng 00100 ,const BLAS_Cpp::Transp mese_trans 00101 ,const value_type alpha = 1.0 00102 ); 00103 00108 void set_uninitialized(); 00109 00111 00114 00116 const mese_ptr_t& mese() const; 00118 const i_vector_ptr_t& inv_row_perm() const; 00120 const Range1D& row_rng() const; 00122 const i_vector_ptr_t& inv_col_perm() const; 00124 const Range1D& col_rng() const; 00126 const BLAS_Cpp::Transp mese_trans() const; 00128 const value_type alpha() const; 00129 00131 00134 00136 const VectorSpace& space_cols() const; 00138 const VectorSpace& space_rows() const; 00140 size_type rows() const; 00142 size_type cols() const; 00144 size_type nz() const; 00145 00147 00150 00152 index_type num_nonzeros( 00153 EExtractRegion extract_region 00154 ,EElementUniqueness element_uniqueness 00155 ) const; 00156 00158 void coor_extract_nonzeros( 00159 EExtractRegion extract_region 00160 ,EElementUniqueness element_uniqueness 00161 ,const index_type len_Aval 00162 ,value_type Aval[] 00163 ,const index_type len_Aij 00164 ,index_type Arow[] 00165 ,index_type Acol[] 00166 ,const index_type row_offset 00167 ,const index_type col_offset 00168 ) const; 00169 00171 00172 private: 00173 00174 typedef Teuchos::RCP<const VectorSpace> space_ptr_t; 00175 00176 #ifdef DOXYGEN_COMPILE 00177 const MatrixExtractSparseElements *mese; 00178 const DenseLinAlgPack::IVector *inv_row_perm; 00179 Range1D row_rng; 00180 const DenseLinAlgPack::IVector *inv_col_perm; 00181 Range1D col_rng; 00182 #else 00183 mese_ptr_t mese_; 00184 BLAS_Cpp::Transp mese_trans_; 00185 value_type alpha_; 00186 Range1D row_rng_; 00187 Range1D col_rng_; 00188 i_vector_ptr_t inv_row_perm_; 00189 i_vector_ptr_t inv_col_perm_; 00190 size_type nz_full_; 00191 space_ptr_t space_cols_; 00192 space_ptr_t space_rows_; 00193 #endif 00194 00195 }; // end class MatrixConvertToSparseEncap 00196 00197 // ///////////////////////////////////////////// 00198 // Inline members 00199 00200 // Access 00201 00202 inline 00203 const MatrixConvertToSparseEncap::mese_ptr_t& 00204 MatrixConvertToSparseEncap::mese() const 00205 { 00206 return mese_; 00207 } 00208 00209 inline 00210 const MatrixConvertToSparseEncap::i_vector_ptr_t& 00211 MatrixConvertToSparseEncap::inv_row_perm() const 00212 { 00213 return inv_row_perm_; 00214 } 00215 00216 inline 00217 const Range1D& MatrixConvertToSparseEncap::row_rng() const 00218 { 00219 return row_rng_; 00220 } 00221 00222 inline 00223 const MatrixConvertToSparseEncap::i_vector_ptr_t& 00224 MatrixConvertToSparseEncap::inv_col_perm() const 00225 { 00226 return inv_col_perm_; 00227 } 00228 00229 inline 00230 const Range1D& MatrixConvertToSparseEncap::col_rng() const 00231 { 00232 return col_rng_; 00233 } 00234 00235 inline 00236 const BLAS_Cpp::Transp 00237 MatrixConvertToSparseEncap::mese_trans() const 00238 { 00239 return mese_trans_; 00240 } 00241 00242 inline 00243 const value_type MatrixConvertToSparseEncap::alpha() const 00244 { 00245 return alpha_; 00246 } 00247 00248 } // end namespace AbstractLinAlgPack 00249 00250 #endif // MATRIX_CONVERT_TO_SPARSE_ENCAP_H
1.7.6.1