DenseLinAlgPack_PermVecMat.hpp

Go to the documentation of this file.
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 // Utilities for pivoting VectorSlices and GenMatrixSlices.
00030 
00031 #ifndef PIVOTVECMAT_H
00032 #define PIVOTVECMAT_H
00033 
00034 #include <stdexcept>
00035 
00036 #include "DenseLinAlgPack_Types.hpp"
00037 
00038 /* * @name {\bf DVector / Matrix Permutations}.
00039   *
00040   * These are functions for pivoting the elements of a vector and the 
00041   * rows and/or columns of a rectandular matrix.
00042   *
00043   * For DVector and DVectorSlice pivot funcitions the #perm# argument
00044   * gives the mapping from the new sequence to the old sequence.
00045   * The statement #i_old = perm(i_new)# gives the index in the
00046   * old vector.  After the permutation is performed the postcondition:
00047   \verbatim
00048 
00049     perm_vs(i) == vs(perm(i)), for i = 1,2,...,vs.size()
00050 
00051   \endverbatim
00052   * is true.
00053   *
00054   * For the DMatrix permutation functions the #row_perm# argument
00055   * gives the row permutations and the #col_perm# argument gives the column
00056   * permutations respectively.
00057   *
00058   * In each of these functions the permuted object can be the same
00059   * as the unpermuted object.
00060   */
00061 
00062 // @{
00063 
00064 // @Include: DenseLinAlgPack_IVector.hpp
00065 
00066 // /////////////////////////////////////////////////////////////////////////////////////////
00067 // Public Permutation functions
00068 
00069 namespace DenseLinAlgPack {
00070 
00072 /* * Initialize a permutation to the identiy permutation.
00073   *
00074   * Preconditions: <ul>
00075   * <li> #perm.size() > 0# (throw std::length_error)
00076   * </ul>
00077   *
00078   * Postconditions: <ul>
00079   * <li> #perm(i) = i#, for i = 1, 2, ... m #perm.size()#
00080   * </ul>
00081   */
00082 void identity_perm(IVector* perm);
00083 
00085 /* * Find the inverse permutation (inv_perm) given a permutation vector (perm).
00086   *
00087   * Postconditions: <ul>
00088   * <li> #inv_perm.size() == perm.size()#
00089   * </ul>
00090   */
00091 void inv_perm(const IVector& perm, IVector* inv_perm);
00092 
00094 void perm_ele(const IVector& perm, DVectorSlice* vs);
00095 
00097 void perm_ele(const DVectorSlice& x, const IVector& perm, DVectorSlice* y);
00098 
00100 void inv_perm_ele(const DVectorSlice& y, const IVector& perm, DVectorSlice* x);
00101 
00103 void perm_rows(const IVector& row_perm, DMatrixSlice* gms);
00104 
00106 void perm_cols(const IVector& col_perm, DMatrixSlice* gms);
00107 
00109 void perm_rows_cols(const IVector& row_perm, const IVector& col_perm, DMatrixSlice* gms);
00110 
00111 #ifdef TEUCHOS_DEBUG
00112 extern bool PermVecMat_print;
00113 #endif
00114 
00115 } // end namespace DenseLinAlgPack
00116 
00117 // @}
00118 
00119 #endif // PIVOTVECMAT_H

Generated on Tue Oct 20 12:51:46 2009 for MOOCHO (Single Doxygen Collection) by doxygen 1.4.7