ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
hsolver::LinearCGS< T, Device > Class Template Referencefinal

Right-preconditioned CGS with a compact active set of columns. More...

#include <linear_cgs.h>

Collaboration diagram for hsolver::LinearCGS< T, Device >:

Public Member Functions

 LinearCGS (const double tolerance, const diag_comm_info &comm)
LinearSolveResult solve (const LinearOperator< T, Device > &op, const LinearOperator< T, Device > &preconditioner, int ld, int nband, int dim, T *x, const T *b, const T *initial_residual, const int max_iterations)
 Solve A*x=b in Device memory, preserving padding and caller column order.

Private Types

enum  WorkspaceSlot {
  residual_slot = 0 , shadow_slot = 1 , direction_slot = 2 , q_slot = 3 ,
  u_slot = 4 , image_slot = 5 , scratch_slot = 6 , update_slot = 7 ,
  solution_slot = 8
}

Private Member Functions

bool iterate (const LinearOperator< T, Device > &op, const LinearOperator< T, Device > &preconditioner, const bool first_iteration, LinearSolveResult *result)
void retire_converged ()

Private Attributes

const double tolerance_
LinearWorkspace< T, Device > work_
int ld_ = 0
int dim_ = 0
int active_ = 0
std::vector< T > beta_
std::vector< T > rho_
std::vector< T > rho_prev_
std::vector< T > alpha_
std::vector< T > denominator_
std::vector< T > norm_
std::vector< double > threshold_
std::vector< int > original_
std::vector< int > swaps_

Detailed Description

template<typename T, typename Device = base_device::DEVICE_CPU>
class hsolver::LinearCGS< T, Device >

Right-preconditioned CGS with a compact active set of columns.

Member Enumeration Documentation

◆ WorkspaceSlot

template<typename T, typename Device = base_device::DEVICE_CPU>
enum hsolver::LinearCGS::WorkspaceSlot
private
Enumerator
residual_slot 
shadow_slot 
direction_slot 
q_slot 
u_slot 
image_slot 
scratch_slot 
update_slot 
solution_slot 

Constructor & Destructor Documentation

◆ LinearCGS()

template<typename T, typename Device>
hsolver::LinearCGS< T, Device >::LinearCGS ( const double tolerance,
const diag_comm_info & comm )

Member Function Documentation

◆ iterate()

template<typename T, typename Device>
bool hsolver::LinearCGS< T, Device >::iterate ( const LinearOperator< T, Device > & op,
const LinearOperator< T, Device > & preconditioner,
const bool first_iteration,
LinearSolveResult * result )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ retire_converged()

template<typename T, typename Device>
void hsolver::LinearCGS< T, Device >::retire_converged ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ solve()

template<typename T, typename Device>
LinearSolveResult hsolver::LinearCGS< T, Device >::solve ( const LinearOperator< T, Device > & op,
const LinearOperator< T, Device > & preconditioner,
int ld,
int nband,
int dim,
T * x,
const T * b,
const T * initial_residual,
const int max_iterations )

Solve A*x=b in Device memory, preserving padding and caller column order.

Parameters
initial_residualOptional initial residual, reused on the first cycle only; otherwise nullptr.
max_iterationsIteration budget for this call, shared by all restart cycles.
Note
Uses tolerance*norm(b), or tolerance for a zero right-hand side.
Here is the call graph for this function:

Member Data Documentation

◆ active_

template<typename T, typename Device = base_device::DEVICE_CPU>
int hsolver::LinearCGS< T, Device >::active_ = 0
private

◆ alpha_

template<typename T, typename Device = base_device::DEVICE_CPU>
std::vector<T> hsolver::LinearCGS< T, Device >::alpha_
private

◆ beta_

template<typename T, typename Device = base_device::DEVICE_CPU>
std::vector<T> hsolver::LinearCGS< T, Device >::beta_
private

◆ denominator_

template<typename T, typename Device = base_device::DEVICE_CPU>
std::vector<T> hsolver::LinearCGS< T, Device >::denominator_
private

◆ dim_

template<typename T, typename Device = base_device::DEVICE_CPU>
int hsolver::LinearCGS< T, Device >::dim_ = 0
private

◆ ld_

template<typename T, typename Device = base_device::DEVICE_CPU>
int hsolver::LinearCGS< T, Device >::ld_ = 0
private

◆ norm_

template<typename T, typename Device = base_device::DEVICE_CPU>
std::vector<T> hsolver::LinearCGS< T, Device >::norm_
private

◆ original_

template<typename T, typename Device = base_device::DEVICE_CPU>
std::vector<int> hsolver::LinearCGS< T, Device >::original_
private

◆ rho_

template<typename T, typename Device = base_device::DEVICE_CPU>
std::vector<T> hsolver::LinearCGS< T, Device >::rho_
private

◆ rho_prev_

template<typename T, typename Device = base_device::DEVICE_CPU>
std::vector<T> hsolver::LinearCGS< T, Device >::rho_prev_
private

◆ swaps_

template<typename T, typename Device = base_device::DEVICE_CPU>
std::vector<int> hsolver::LinearCGS< T, Device >::swaps_
private

◆ threshold_

template<typename T, typename Device = base_device::DEVICE_CPU>
std::vector<double> hsolver::LinearCGS< T, Device >::threshold_
private

◆ tolerance_

template<typename T, typename Device = base_device::DEVICE_CPU>
const double hsolver::LinearCGS< T, Device >::tolerance_
private

◆ work_

template<typename T, typename Device = base_device::DEVICE_CPU>
LinearWorkspace<T, Device> hsolver::LinearCGS< T, Device >::work_
private

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