Localized Orbital Scaling Correction (LOSC) C library
localization.h
Go to the documentation of this file.
1 
6 #ifndef _LOSC_INCLUDE_C_LOSC_LOCALIZATION_H_
7 #define _LOSC_INCLUDE_C_LOSC_LOCALIZATION_H_
8 
9 #include <c_losc/matrix.h>
10 #include <stddef.h>
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 //**********************************************
17 // ==> Interface for `losc::LocalizerBase`
18 //**********************************************
19 
20 typedef struct _LocalizerBase _LocalizerBase;
21 
29 typedef struct LoscLocalizerBase {
30  _LocalizerBase *_p_base;
31 
32  // List interface of methods exposed to C users bellow.
33 
44  void (*set_max_iter)(const LoscLocalizerBase *self, size_t max_iter);
45 
56  void (*set_convergence)(const LoscLocalizerBase *self, double tol);
57 
68  void (*set_random_permutation)(const LoscLocalizerBase *self, bool flag);
69 
96  void (*lo_U)(const LoscLocalizerBase *self, losc_matrix *L, losc_matrix *U);
98 
99 //**********************************************
100 // ==> Interface for `losc::LoscLocalizerV2`
101 //**********************************************
102 
121 typedef struct _LoscLocalizerV2 _LoscLocalizerV2;
122 
130 typedef struct LoscLocalizerV2 {
135  _LoscLocalizerV2 *_p_v2;
136 
146 
147  // @note
148  // If `losc::LoscLocalizerV2` has new public functions (new functions added
149  // in `losc::LoscLocalizerV2` not in its base class) in the future, add the
150  // corresponding C interface with new function pointers below.
152 
164  const losc_matrix *C_lo_basis, const losc_matrix *H_ao,
165  const losc_matrix *D_ao[3]);
166 
172 #define losc_localizer_v2_free(ptr) _losc_localizer_v2_free(&(ptr))
173 void *_losc_localizer_v2_free(LoscLocalizerV2 **pptr_self);
174 
175 #ifdef __cplusplus
176 }
177 #endif
178 
179 #endif
struct LoscLocalizerBase LoscLocalizerBase
The C interface for LOSC localizer base.
The C interface for LOSC localizer base.
Definition: localization.h:29
The C interface for LOSC localizer version 2.
Definition: localization.h:130
void(* set_max_iter)(const LoscLocalizerBase *self, size_t max_iter)
Set the maximum iteration number for localization.
Definition: localization.h:44
struct LoscLocalizerV2 LoscLocalizerV2
The C interface for LOSC localizer version 2.
void(* set_convergence)(const LoscLocalizerBase *self, double tol)
Set the convergence of localization.
Definition: localization.h:56
The C interface of matrix used in LOSC.
void(* set_random_permutation)(const LoscLocalizerBase *self, bool flag)
Set flag for doing random permutation or not for Jacobi-Sweep algorithm.
Definition: localization.h:68
LoscLocalizerBase * p_base
A pointer to a LoscLocalizerBase variable.
Definition: localization.h:145
void(* lo_U)(const LoscLocalizerBase *self, losc_matrix *L, losc_matrix *U)
Calculate the LOs and the unitary.
Definition: localization.h:96
LoscLocalizerV2 * losc_localizer_v2_create(const losc_matrix *C_lo_basis, const losc_matrix *H_ao, const losc_matrix *D_ao[3])
Constructor of LoscLoscLocalizerV2.