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_DirectSparseSolverDense.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 DIRECT_SPARSE_SOLVER_DENSE_H
43 #define DIRECT_SPARSE_SOLVER_DENSE_H
44 
45 #include <valarray>
46 #include <vector>
47 #include <string>
48 
49 #include "AbstractLinAlgPack_DirectSparseSolverImp.hpp"
50 #include "DenseLinAlgPack_DMatrixClass.hpp"
51 #include "DenseLinAlgPack_IVector.hpp"
53 
54 namespace AbstractLinAlgPack {
55 
61 public:
62 
65 
68 
70 
73 
78 
80 
81 protected:
82 
85 
88  class BasisMatrixDense : public BasisMatrixImp {
89  public:
90 
93 
97  void V_InvMtV(
98  VectorMutable* v_lhs, BLAS_Cpp::Transp trans_rhs1
99  ,const Vector& v_rhs2) const ;
100 
102 
103  }; // end class BasisMatrixDense
104 
107  class FactorizationStructureDense : public FactorizationStructure {
108  public:
109  friend class DirectSparseSolverDense;
110  friend class BasisMatrixDense;
111  private:
112  FortranTypes::f_int m_; // Number of rows in A
113  FortranTypes::f_int n_; // Number of columns in A
114  FortranTypes::f_int nz_; // Number of nonzeros in A
115  FortranTypes::f_int rank_; // Rank of the basis
116  IVector col_perm_; // First rank entries selects the basis of A
117  IVector inv_col_perm_; // Inverse of col_perm_
119  }; // end class FactorizationStructureDense
120 
124  public:
125  typedef FortranTypes::f_int f_int;
126  friend class DirectSparseSolverDense;
127  friend class BasisMatrixDense;
128  private:
129  DMatrix LU_;
130  bool rect_analyze_and_factor_; // true for n > m analyze_and_factor()
131  std::valarray<f_int> ipiv_; // The permutation sent to xGETRS (identity if rect_analyze_and_factor_==true)
132  IVector basis_perm_; // Only used if rect_analyze_and_factor_==true
133  }; // end class FactorizationNonzerosDense
134 
136 
139 
147  ,FactorizationStructure *fact_struc
148  ,FactorizationNonzeros *fact_nonzeros
149  ,DenseLinAlgPack::IVector *row_perm
150  ,DenseLinAlgPack::IVector *col_perm
151  ,size_type *rank
152  ,std::ostream *out
153  );
155  void imp_factor(
157  ,const FactorizationStructure &fact_struc
158  ,FactorizationNonzeros *fact_nonzeros
159  ,std::ostream *out
160  );
161 
163 
164 }; // end class DirectSparseSolverDense
165 
166 } // end namespace AbstractLinAlgPack
167 
168 #endif // DIRECT_SPARSE_SOLVER_DENSE_H
void imp_factor(const AbstractLinAlgPack::MatrixConvertToSparse &A, const FactorizationStructure &fact_struc, FactorizationNonzeros *fact_nonzeros, std::ostream *out)
Abstract interface for immutable, finite dimensional, coordinate vectors {abstract}.
void V_InvMtV(VectorMutable *v_lhs, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2) const
void imp_analyze_and_factor(const AbstractLinAlgPack::MatrixConvertToSparse &A, FactorizationStructure *fact_struc, FactorizationNonzeros *fact_nonzeros, DenseLinAlgPack::IVector *row_perm, DenseLinAlgPack::IVector *col_perm, size_type *rank, std::ostream *out)
Concreate sparse solver subclass that uses the dense LAPACK routines.
Mix-in interface for extracing explicit elements from a sparse matrix in one of several Fortran compa...
const Teuchos::RCP< FactorizationStructure > create_fact_struc() const
const Teuchos::RCP< FactorizationNonzeros > create_fact_nonzeros() const
Implementation node class for DirectSparseSolver that takes care of the memory management details...
Abstract class for objects that represent the factorization structure of a particular matrix...
Abstract interface for mutable coordinate vectors {abstract}.
Abstract class for objects that represent the factorization nonzeros of a particular matrix...
Transp