TBTK
Need a break? Support the development by playing Polarity Puzzles
TBTK::LUSolver Class Reference

Solves Mx = b for x, where M is a SparseMatrix. More...

#include <LUSolver.h>

Inheritance diagram for TBTK::LUSolver:
TBTK::Communicator

Public Types

enum  DataType { None, Double, ComplexDouble }
 

Public Member Functions

 LUSolver ()
 
 ~LUSolver ()
 
void setMatrix (const SparseMatrix< double > &sparseMatrix)
 
void setMatrix (const SparseMatrix< std::complex< double >> &sparseMatrix)
 
DataType getMatrixDataType () const
 
void solve (Matrix< double > &b)
 
void solve (Matrix< std::complex< double >> &b)
 
- Public Member Functions inherited from TBTK::Communicator
 Communicator (bool verbose)
 
void setVerbose (bool verbose)
 
bool getVerbose () const
 

Additional Inherited Members

- Static Public Member Functions inherited from TBTK::Communicator
static void setGlobalVerbose (bool globalVerbose)
 
static bool getGlobalVerbose ()
 

Detailed Description

Solves Mx = b for x, where M is a SparseMatrix.

Member Enumeration Documentation

◆ DataType

Enum class for specifying the data type of the matrix. Used since complex matrices that are purely real are converted to double type for optimization.

Constructor & Destructor Documentation

◆ LUSolver()

TBTK::LUSolver::LUSolver ( )

Constructs a Solver::LUSolver.

◆ ~LUSolver()

TBTK::LUSolver::~LUSolver ( )

Destructor.

Member Function Documentation

◆ getMatrixDataType()

LUSolver::DataType TBTK::LUSolver::getMatrixDataType ( ) const
inline

Get matrix data type. Is None before a matrix has been set, Double if a real matrix has been set, and ComplexDouble if a complex matrix has been set. Note that a SparseMatrix<std::complex<double>> is stored as Double internally if the matrix is real.

Returns
The data type that is used to store the data.

◆ setMatrix() [1/2]

void TBTK::LUSolver::setMatrix ( const SparseMatrix< double > &  sparseMatrix)

Set matrix.

Parameters
sparseMatrixMatrix \(M\) to use in the equation \(Mx = b\).

◆ setMatrix() [2/2]

void TBTK::LUSolver::setMatrix ( const SparseMatrix< std::complex< double >> &  sparseMatrix)

Set matrix.

Parameters
sparseMatrixMatrix \(H\) to use in the equation \(Mx = b\).

◆ solve() [1/2]

void TBTK::LUSolver::solve ( Matrix< double > &  b)

Solve for \(x\) in the equation \(Mx = b\).

Parameters
bThe vector \(b\). Contains the answer \(x\) when finished.

◆ solve() [2/2]

void TBTK::LUSolver::solve ( Matrix< std::complex< double >> &  b)

Solve for \(x\) in the equation \(Mx = b\).

Parameters
bThe vector \(b\). Contains the answer \(x\) when finished.

The documentation for this class was generated from the following file: