Skip to content

Commit

Permalink
Further encapsulating sparse-direct solver functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
poulson committed Dec 28, 2016
1 parent 500da31 commit 25a56bf
Show file tree
Hide file tree
Showing 7 changed files with 564 additions and 397 deletions.
22 changes: 0 additions & 22 deletions include/El/lapack_like/factor.hpp
Expand Up @@ -230,28 +230,6 @@ void SolveAfter
AbstractDistMatrix<Field>& B,
bool conjugated );

template<typename Field>
void SolveAfter
( const vector<Int>& invMap, const NodeInfo& info,
const Front<Field>& front, Matrix<Field>& X );
template<typename Field>
void SolveAfter
( const DistMap& invMap, const DistNodeInfo& info,
const DistFront<Field>& front, DistMultiVec<Field>& X );

template<typename Field>
void SolveAfter
( const NodeInfo& info,
const Front<Field>& front, MatrixNode<Field>& X );
template<typename Field>
void SolveAfter
( const DistNodeInfo& info,
const DistFront<Field>& front, DistMultiVecNode<Field>& X );
template<typename Field>
void SolveAfter
( const DistNodeInfo& info,
const DistFront<Field>& front, DistMatrixNode<Field>& X );

// Solve linear system with the implicit representations of L, D, and P
// --------------------------------------------------------------------
template<typename Field>
Expand Down
82 changes: 56 additions & 26 deletions include/El/lapack_like/factor/ldl/sparse/numeric.hpp
Expand Up @@ -468,32 +468,6 @@ void DiagonalSolve
const DistFront<Field>& L,
DistMatrixNode<Field>& X );

template<typename Field>
void LowerSolve
( Orientation orientation, const NodeInfo& info,
const Front<Field>& L, MatrixNode<Field>& X );
template<typename Field>
void LowerSolve
( Orientation orientation, const DistNodeInfo& info,
const DistFront<Field>& L, DistMultiVecNode<Field>& X );
template<typename Field>
void LowerSolve
( Orientation orientation, const DistNodeInfo& info,
const DistFront<Field>& L, DistMatrixNode<Field>& X );

template<typename Field>
void LowerMultiply
( Orientation orientation, const NodeInfo& info,
const Front<Field>& L, MatrixNode<Field>& X );
template<typename Field>
void LowerMultiply
( Orientation orientation, const DistNodeInfo& info,
const DistFront<Field>& L, DistMultiVecNode<Field>& X );
template<typename Field>
void LowerMultiply
( Orientation orientation, const DistNodeInfo& info,
const DistFront<Field>& L, DistMatrixNode<Field>& X );

} // namespace ldl

template<typename Field>
Expand Down Expand Up @@ -528,6 +502,7 @@ class SparseLDLFactorization

// Overwrite 'B' with the solution to 'A X = B'.
void Solve( Matrix<Field>& B ) const;
void Solve( ldl::MatrixNode<Field>& B ) const;

// Overwrite 'B' with the solution to 'A X = B' using Iterative Refinement.
void SolveWithIterativeRefinement
Expand All @@ -536,6 +511,27 @@ class SparseLDLFactorization
const Base<Field>& relTolRefine,
Int maxRefineIts ) const;

void SolveAgainstL
( Orientation orientation, Matrix<Field>& B ) const;
void SolveAgainstL
( Orientation orientation, ldl::MatrixNode<Field>& B ) const;
void MultiplyWithL
( Orientation orientation, Matrix<Field>& B ) const;
void MultiplyWithL
( Orientation orientation, ldl::MatrixNode<Field>& B ) const;

void SolveAgainstD
( Orientation orientation, Matrix<Field>& B ) const;
void SolveAgainstD
( Orientation orientation, ldl::MatrixNode<Field>& B ) const;
void MultiplyWithD
( Orientation orientation, Matrix<Field>& B ) const;
void MultiplyWithD
( Orientation orientation, ldl::MatrixNode<Field>& B ) const;
// TODO(poulson): Apply permutation?

bool Factored() const;

ldl::Front<Field>& Front();
const ldl::Front<Field>& Front() const;

Expand All @@ -552,6 +548,7 @@ class SparseLDLFactorization
const vector<Int>& InverseMap() const;

private:
bool factored_=false;
unique_ptr<ldl::Front<Field>> front_;
unique_ptr<ldl::NodeInfo> info_;
unique_ptr<ldl::Separator> separator_;
Expand Down Expand Up @@ -591,6 +588,8 @@ class DistSparseLDLFactorization

// Overwrite 'B' with the solution to 'A X = B'.
void Solve( DistMultiVec<Field>& B ) const;
void Solve( ldl::DistMultiVecNode<Field>& B ) const;
void Solve( ldl::DistMatrixNode<Field>& B ) const;

// Overwrite 'B' with the solution to 'A X = B' using Iterative Refinement.
void SolveWithIterativeRefinement
Expand All @@ -599,6 +598,36 @@ class DistSparseLDLFactorization
const Base<Field>& relTolRefine,
Int maxRefineIts ) const;

void SolveAgainstL
( Orientation orientation, DistMultiVec<Field>& B ) const;
void SolveAgainstL
( Orientation orientation, ldl::DistMultiVecNode<Field>& B ) const;
void SolveAgainstL
( Orientation orientation, ldl::DistMatrixNode<Field>& B ) const;
void MultiplyWithL
( Orientation orientation, DistMultiVec<Field>& B ) const;
void MultiplyWithL
( Orientation orientation, ldl::DistMultiVecNode<Field>& B ) const;
void MultiplyWithL
( Orientation orientation, ldl::DistMatrixNode<Field>& B ) const;

void SolveAgainstD
( Orientation orientation, DistMultiVec<Field>& B ) const;
void SolveAgainstD
( Orientation orientation, ldl::DistMultiVecNode<Field>& B ) const;
void SolveAgainstD
( Orientation orientation, ldl::DistMatrixNode<Field>& B ) const;
void MultiplyWithD
( Orientation orientation, DistMultiVec<Field>& B ) const;
void MultiplyWithD
( Orientation orientation, ldl::DistMultiVecNode<Field>& B ) const;
void MultiplyWithD
( Orientation orientation, ldl::DistMatrixNode<Field>& B ) const;

// TODO(poulson): Apply permutation?

bool Factored() const;

ldl::DistFront<Field>& Front();
const ldl::DistFront<Field>& Front() const;

Expand All @@ -617,6 +646,7 @@ class DistSparseLDLFactorization
ldl::DistMultiVecNodeMeta& DistMultiVecNodeMeta() const;

private:
bool factored_=false;
unique_ptr<ldl::DistFront<Field>> front_;
unique_ptr<ldl::DistNodeInfo> info_;
unique_ptr<ldl::DistSeparator> separator_;
Expand Down

0 comments on commit 25a56bf

Please sign in to comment.