Localized Orbital Scaling Correction (LOSC) C library
LoscLocalizerBase Struct Reference

The C interface for LOSC localizer base. More...

#include <localization.h>

Public Attributes

void(* set_max_iter )(const LoscLocalizerBase *self, size_t max_iter)
 Set the maximum iteration number for localization. More...
 
void(* set_convergence )(const LoscLocalizerBase *self, double tol)
 Set the convergence of localization. More...
 
void(* set_random_permutation )(const LoscLocalizerBase *self, bool flag)
 Set flag for doing random permutation or not for Jacobi-Sweep algorithm. More...
 
void(* lo_U )(const LoscLocalizerBase *self, losc_matrix *L, losc_matrix *U)
 Calculate the LOs and the unitary. More...
 

Detailed Description

The C interface for LOSC localizer base.

Note
This struct exports all the functions for LOSC localization base class. This struct servers as helper class to avoid code duplication for the implementation of C interface. There is no need for C users to create a such struct in practice.

Member Data Documentation

void(* LoscLocalizerBase::lo_U) (const LoscLocalizerBase *self, losc_matrix *L, losc_matrix *U)

Calculate the LOs and the unitary.

Parameters
[in,out]LA matrix with dimension of [nbasis, nlo]. The data of L is ignored at entrace. At exit, it stores the LO coefficient matrix.
[in,out]UA matrix with dimension of [nlo, nlo]. At entrance, it stores a unitary matrix as the initial guess for the localization. The unitarity of the input U matrix is not verified. At exit, it is updated by the localization process.
Note
The dimensions of input matrices will be check. It will throw an exception if they do not match the expectation.
The relation between the LOs and AOs is \( \displaystyle \psi_i = \sum_\mu C_{\mu i} \phi_{\mu}, \) in which \( \psi_i \) is the LO, \( C_{\mu i} \) is the LO coefficient matrix and \( \phi_i \) is the AO. The dimension of LO coefficient matrix is [nbasis, nlo]. The relation between the LOs and LO basis is \( \displaystyle \psi_i = \sum_j U_{\mu i} \phi_\mu, \) in which \( \psi_i \) is the LO, \( U_{\mu i} \) is the U matrix and \( \phi_\mu \) is the LO basis. The dimension of the U matrix is [nlo, nlo].
void(* LoscLocalizerBase::set_convergence) (const LoscLocalizerBase *self, double tol)

Set the convergence of localization.

Parameters
[in]tolThe localization convergence tolerance.
Example
// Assume `pbase` is a existing variable with type `LoscLocalizerBase *`.
// Demo: set the tolerance to be 1e-6.
pbase->set_convergence(pbase, 1.0e-6);
void(* LoscLocalizerBase::set_max_iter) (const LoscLocalizerBase *self, size_t max_iter)

Set the maximum iteration number for localization.

Parameters
[in]max_iterThe maximum number of iteration.
Example
// Assume `pbase` is a existing variable with type `LoscLocalizerBase *`.
// Demo: set max iteration number to be 100.
pbase->set_max_iter(pbase, 100);
void(* LoscLocalizerBase::set_random_permutation) (const LoscLocalizerBase *self, bool flag)

Set flag for doing random permutation or not for Jacobi-Sweep algorithm.

Parameters
[in]flagTrue for doing random permutation False otherwise.
Example
// Assume `pbase` is a existing variable with type `LoscLocalizerBase *`.
// Demo: set to false.
pbase->set_random_permutation(pbase, false);