PEXSI
 All Classes Namespaces Files Functions Variables Typedefs Pages
superlu_dist_internal.hpp
Go to the documentation of this file.
1 /*
2  Copyright (c) 2012 The Regents of the University of California,
3  through Lawrence Berkeley National Laboratory.
4 
5  Author: Mathias Jacquelin and Lin Lin
6 
7  This file is part of PEXSI. All rights reserved.
8 
9  Redistribution and use in source and binary forms, with or without
10  modification, are permitted provided that the following conditions are met:
11 
12  (1) Redistributions of source code must retain the above copyright notice, this
13  list of conditions and the following disclaimer.
14  (2) Redistributions in binary form must reproduce the above copyright notice,
15  this list of conditions and the following disclaimer in the documentation
16  and/or other materials provided with the distribution.
17  (3) Neither the name of the University of California, Lawrence Berkeley
18  National Laboratory, U.S. Dept. of Energy nor the names of its contributors may
19  be used to endorse or promote products derived from this software without
20  specific prior written permission.
21 
22  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
23  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
26  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
29  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 
33  You are under no obligation whatsoever to provide any bug fixes, patches, or
34  upgrades to the features, functionality or performance of the source code
35  ("Enhancements") to anyone; however, if you choose to make your Enhancements
36  available either publicly, or directly to Lawrence Berkeley National
37  Laboratory, without imposing a separate written license agreement for such
38  Enhancements, then you hereby grant the following license: a non-exclusive,
39  royalty-free perpetual license to install, use, modify, prepare derivative
40  works, incorporate into other computer software, distribute, and sublicense
41  such enhancements or derivative works thereof, in binary and source code form.
42  */
46 
47 #ifndef _PEXSI_SUPERLU_INTERNAL_HPP_
48 #define _PEXSI_SUPERLU_INTERNAL_HPP_
49 
50 #include "pexsi/environment.hpp"
51 #include <string>
52 #include "pexsi/sparse_matrix.hpp"
53 #include "pexsi/NumMat.hpp"
54 #include "pexsi/NumVec.hpp"
55 #include "pexsi/SuperLUGrid.hpp"
56 
57 namespace PEXSI{
69 
84  std::string ColPerm;
85 
95  std::string RowPerm;
96  std::string Equil;
97 
99  Int symmetric;
100  Int transpose;
101 
102 
111  std::string Equil;
112 
115 
120 
121 
122  // Member functions to setup the default value
123  SuperLUOptions(): numProcSymbFact(0), ColPerm("MMD_AT_PLUS_A"), Symmetric(1), RowPerm("NOROWPERM"), Transpose(0), Equil("NO") {}
124  };
125 
126 
127  struct SuperNodeType;
128  template<typename T> class PMatrix;
129 
130 class ComplexSuperLUData_internal;
131 class RealSuperLUData_internal;
132 
134  protected:
135  RealSuperLUData_internal * ptrData;
136  public:
137  RealSuperLUData( const SuperLUGrid<Real>& g, const SuperLUOptions& opt );
138  ~RealSuperLUData();
139  RealSuperLUData(const RealSuperLUData & g);
140  RealSuperLUData & operator = (const RealSuperLUData & g);
141 
142  Int m() const;
143  Int n() const;
144  void DistSparseMatrixToSuperMatrixNRloc( DistSparseMatrix<Real>& sparseA , const SuperLUOptions& opt);
145  void DestroyAOnly();
146  void SymbolicFactorize();
147  void Distribute();
148  void NumericalFactorize();
149  void ConvertNRlocToNC ( RealSuperLUData * aptrData );
150  void MultiplyGlobalMultiVector( NumMat<Real>& xGlobal, NumMat<Real>& bGlobal );
151  void DistributeGlobalMultiVector( NumMat<Real>& xGlobal, NumMat<Real>& xLocal );
152  void GatherDistributedMultiVector ( NumMat<Real>& xGlobal, NumMat<Real>& xLocal );
153  void SolveDistMultiVector( NumMat<Real>& bLocal, DblNumVec& berr );
154  void CheckErrorDistMultiVector( NumMat<Real>& xLocal, NumMat<Real>& xTrueLocal );
155  void LUstructToPMatrix( PMatrix<Real>& PMloc );
156  void SymbolicToSuperNode( SuperNodeType& super );
157 };
158 
159 
161  protected:
162  ComplexSuperLUData_internal * ptrData;
163  public:
167  ComplexSuperLUData & operator = (const ComplexSuperLUData & g);
168 
169  Int m() const;
170  Int n() const;
171  void DistSparseMatrixToSuperMatrixNRloc( DistSparseMatrix<Complex>& sparseA , const SuperLUOptions& opt);
172  void DestroyAOnly();
173  void SymbolicFactorize();
174  void Distribute();
175  void NumericalFactorize();
176  void ConvertNRlocToNC ( ComplexSuperLUData * aptrData );
177  void MultiplyGlobalMultiVector( NumMat<Complex>& xGlobal, NumMat<Complex>& bGlobal );
178  void DistributeGlobalMultiVector( NumMat<Complex>& xGlobal, NumMat<Complex>& xLocal );
179  void GatherDistributedMultiVector ( NumMat<Complex>& xGlobal, NumMat<Complex>& xLocal );
180  void SolveDistMultiVector( NumMat<Complex>& bLocal, DblNumVec& berr );
181  void CheckErrorDistMultiVector( NumMat<Complex>& xLocal, NumMat<Complex>& xTrueLocal );
182  void LUstructToPMatrix( PMatrix<Complex>& PMloc );
183  void SymbolicToSuperNode( SuperNodeType& super );
184 };
185 
186 
187 }
188 
189 
190 
191 #endif //_PEXSI_SUPERLU_INTERNAL_HPP_
Environmental variables.
Definition: superlu_dist_internal_real.cpp:112
A thin interface for passing parameters to set the SuperLU options.
Definition: superlu_dist_internal.hpp:62
std::string RowPerm
Option of matrix row permutation strategy.
Definition: superlu_dist_internal.hpp:95
SuperNodeType describes mapping between supernode and column, the permutation information, and potentially the elimination tree (not implemented here).
Definition: pselinv.hpp:165
Definition: superlu_dist_internal.hpp:160
Int Symmetric
Option to specify if matrix is symmetric or not.
Definition: superlu_dist_internal.hpp:114
Definition: superlu_dist_internal_complex.cpp:118
SuperLU processor grid.
std::string Equil
Option whether to equilibrate the system.
Definition: superlu_dist_internal.hpp:96
Sparse matrix and Distributed sparse matrix in compressed column format.
Numerical matrix.
Definition: superlu_dist_internal.hpp:133
Numerical matrix.
Definition: NumMat.hpp:61
std::string ColPerm
Option of matrixi column permutation strategy.
Definition: superlu_dist_internal.hpp:84
Int numProcSymbFact
Number of processors for parallel symbolic factorization.
Definition: superlu_dist_internal.hpp:68
Definition: SuperLUGrid.hpp:124
Definition: SuperLUGrid.hpp:111
Numerical vector.
Int symmetric
Option to specify if matrix is symmetric or not.
Definition: superlu_dist_internal.hpp:99
Int Transpose
Option to specify whether selected elements should be computed in the pattern of the transposed matri...
Definition: superlu_dist_internal.hpp:119