|
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 // This library is free software; you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as 00012 // published by the Free Software Foundation; either version 2.1 of the 00013 // License, or (at your option) any later version. 00014 // 00015 // This library is distributed in the hope that it will be useful, but 00016 // WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 // Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public 00021 // License along with this library; if not, write to the Free Software 00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00023 // USA 00024 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 00025 // 00026 // *********************************************************************** 00027 // @HEADER 00028 00029 #ifndef SLAP_PERMUTATION_SERIAL_H 00030 #define SLAP_PERMUTATION_SERIAL_H 00031 00032 #include "AbstractLinAlgPack_VectorSpaceSerial.hpp" 00033 #include "AbstractLinAlgPack_Permutation.hpp" 00034 00035 namespace AbstractLinAlgPack { 00036 00046 class PermutationSerial 00047 : public AbstractLinAlgPack::Permutation 00048 { 00049 public: 00050 00053 00055 typedef Teuchos::RCP<const IVector> i_vector_ptr_t; 00056 00058 00061 00064 PermutationSerial( size_type dim = 0 ); 00065 00068 PermutationSerial( 00069 const i_vector_ptr_t &perm 00070 ,const i_vector_ptr_t &inv_perm 00071 ,bool allocate_missing_perm = true 00072 ,bool check_inv_perm = false 00073 ); 00074 00084 void initialize_identity( size_type dim ); 00085 00146 void initialize( 00147 const i_vector_ptr_t &perm 00148 ,const i_vector_ptr_t &inv_perm 00149 ,bool allocate_missing_perm = true 00150 ,bool check_inv_perm = false 00151 ); 00152 00154 00157 00163 const i_vector_ptr_t& perm() const; 00169 const i_vector_ptr_t& inv_perm() const; 00170 00172 00175 00177 const VectorSpace& space() const; 00179 size_type dim() const; 00181 bool is_identity() const; 00183 std::ostream& output(std::ostream& out) const; 00185 void permute( 00186 BLAS_Cpp::Transp P_trans 00187 ,const Vector &x 00188 ,VectorMutable *y 00189 ) const; 00191 void permute( 00192 BLAS_Cpp::Transp P_trans 00193 ,VectorMutable *y 00194 ) const; 00195 00197 00198 private: 00199 00200 #ifdef DOXYGEN_COMPILE 00201 VectorSpaceSerial space; 00202 DenseLinAlgPack::IVector *perm; 00203 DenseLinAlgPack::IVector *inv_perm; 00204 #else 00205 VectorSpaceSerial space_; 00206 i_vector_ptr_t perm_; 00207 i_vector_ptr_t inv_perm_; 00208 #endif 00209 00210 }; // end class PermutationSerial 00211 00212 // ////////////////////////////////////////////// 00213 // Inline members 00214 00215 inline 00216 const PermutationSerial::i_vector_ptr_t& 00217 PermutationSerial::perm() const 00218 { 00219 return perm_; 00220 } 00221 00222 inline 00223 const PermutationSerial::i_vector_ptr_t& 00224 PermutationSerial::inv_perm() const 00225 { 00226 return inv_perm_; 00227 } 00228 00229 } // end namespace AbstractLinAlgPack 00230 00231 #endif // SLAP_PERMUTATION_SERIAL_H
1.7.4