v2DM-DOCI
1.0
|
#include <UnitaryMatrix.h>
Public Member Functions | |
UnitaryMatrix (const OptIndex &) | |
Constructor. More... | |
UnitaryMatrix (const UnitaryMatrix &unit) | |
Copy constructor. More... | |
UnitaryMatrix (UnitaryMatrix &&unit) | |
virtual | ~UnitaryMatrix ()=default |
Destructor. More... | |
UnitaryMatrix & | operator= (const UnitaryMatrix &unit) |
UnitaryMatrix & | operator= (UnitaryMatrix &&unit) |
unsigned int | getNumVariablesX () const |
Get the number of variables in the x-parametrization of the unitary update. More... | |
int | getFirstIndex (const int linearindex) const |
Get the first Hamiltonian index corresponding to linearindex. More... | |
int | getSecondIndex (const int linearindex) const |
Get the second Hamiltonian index corresponding to linearindex. More... | |
double * | getBlock (const int irrep) const |
Get the unitary rotation for block irrep. More... | |
void | copyXsolutionBack (double *vector) |
Copy the x solution back (NR, augmented NR, ...) More... | |
void | updateUnitary (double *workmem1, double *workmem2, double *vector, const bool multiply) |
Update the unitary transformation based on the new vector and the previous unitary. More... | |
void | rotate_active_space_vectors (double *eigenvecs, double *work) |
Rotate the unitary matrix to the NO eigenbasis. More... | |
void | CheckDeviationFromUnitary (double *work) const |
Calculate the two-norm of U^T*U - I. More... | |
void | saveU (std::string savename) const |
Save the unitary to disk. More... | |
void | loadU (std::string loadname) |
Load the unitary from disk. More... | |
void | deleteStoredUnitary (std::string name) const |
Delete the stored unitary (on disk) More... | |
void | jacobi_rotation (int irrep, int i, int j, double angle) |
Implements a simple jacobi rotation of the i, and j th orbital. More... | |
void | reset_unitary () |
Resets the unitary matrix. More... | |
void | print_unitary () const |
void | build_skew_symm_x (const int irrep, double *xblock, const double *Xelem) const |
void | sendreceive (int) |
int | get_Nirrep () const |
void | updateUnitary (double *, double *, const UnitaryMatrix &, bool) |
void | fill_random () |
void | make_skew_symmetric () |
Private Attributes | |
std::unique_ptr< OptIndex > | _index |
unsigned int | x_linearlength |
std::vector< std::unique_ptr< double[]> > | unitary |
unitary class. The UnitaryMatrix class is a storage and manipulation class for the unitary matrix. This matrix is blockdiagonal in the irreducible representations, and is formed by stepwise multiplying in new unitary rotations due to the Newton-Raphson algorithm.
Definition at line 30 of file UnitaryMatrix.h.
UnitaryMatrix::UnitaryMatrix | ( | const OptIndex & | index_in | ) |
UnitaryMatrix::UnitaryMatrix | ( | const UnitaryMatrix & | unit | ) |
Copy constructor.
Definition at line 66 of file UnitaryMatrix.cpp.
UnitaryMatrix::UnitaryMatrix | ( | UnitaryMatrix && | unit | ) |
Definition at line 82 of file UnitaryMatrix.cpp.
|
virtualdefault |
Destructor.
void UnitaryMatrix::build_skew_symm_x | ( | const int | irrep, |
double * | xblock, | ||
const double * | Xelem | ||
) | const |
void UnitaryMatrix::CheckDeviationFromUnitary | ( | double * | work | ) | const |
Calculate the two-norm of U^T*U - I.
work | Work memory |
Definition at line 417 of file UnitaryMatrix.cpp.
void simanneal::UnitaryMatrix::copyXsolutionBack | ( | double * | vector | ) |
Copy the x solution back (NR, augmented NR, ...)
vector | The x-solution |
void UnitaryMatrix::deleteStoredUnitary | ( | std::string | name | ) | const |
Delete the stored unitary (on disk)
Definition at line 505 of file UnitaryMatrix.cpp.
void UnitaryMatrix::fill_random | ( | ) |
int UnitaryMatrix::get_Nirrep | ( | ) | const |
Definition at line 547 of file UnitaryMatrix.cpp.
double * UnitaryMatrix::getBlock | ( | const int | irrep | ) | const |
Get the unitary rotation for block irrep.
irrep | The irreducible representation |
Definition at line 148 of file UnitaryMatrix.cpp.
int simanneal::UnitaryMatrix::getFirstIndex | ( | const int | linearindex | ) | const |
Get the first Hamiltonian index corresponding to linearindex.
linearindex | The linear index of the x-parametrization |
unsigned int UnitaryMatrix::getNumVariablesX | ( | ) | const |
Get the number of variables in the x-parametrization of the unitary update.
Definition at line 146 of file UnitaryMatrix.cpp.
int simanneal::UnitaryMatrix::getSecondIndex | ( | const int | linearindex | ) | const |
Get the second Hamiltonian index corresponding to linearindex.
linearindex | The linear index of the x-parametrization |
void UnitaryMatrix::jacobi_rotation | ( | int | irrep, |
int | i, | ||
int | j, | ||
double | angle | ||
) |
Implements a simple jacobi rotation of the i, and j th orbital.
Definition at line 114 of file UnitaryMatrix.cpp.
void UnitaryMatrix::loadU | ( | std::string | loadname | ) |
Load the unitary from disk.
Definition at line 480 of file UnitaryMatrix.cpp.
void UnitaryMatrix::make_skew_symmetric | ( | ) |
UnitaryMatrix & UnitaryMatrix::operator= | ( | const UnitaryMatrix & | unit | ) |
Definition at line 88 of file UnitaryMatrix.cpp.
UnitaryMatrix & UnitaryMatrix::operator= | ( | UnitaryMatrix && | unit | ) |
Definition at line 106 of file UnitaryMatrix.cpp.
void UnitaryMatrix::print_unitary | ( | ) | const |
cout << std::setprecision(5);
Definition at line 514 of file UnitaryMatrix.cpp.
void UnitaryMatrix::reset_unitary | ( | ) |
Resets the unitary matrix.
Definition at line 134 of file UnitaryMatrix.cpp.
void UnitaryMatrix::rotate_active_space_vectors | ( | double * | eigenvecs, |
double * | work | ||
) |
Rotate the unitary matrix to the NO eigenbasis.
eigenvecs | The NO eigenbasis |
work | Work memory |
Definition at line 373 of file UnitaryMatrix.cpp.
void UnitaryMatrix::saveU | ( | std::string | savename | ) | const |
Save the unitary to disk.
Definition at line 452 of file UnitaryMatrix.cpp.
void UnitaryMatrix::sendreceive | ( | int | orig | ) |
Spread the UnitaryMatrix from rank orig to all other UnitaryMatrices in the world
Definition at line 536 of file UnitaryMatrix.cpp.
void UnitaryMatrix::updateUnitary | ( | double * | workmem1, |
double * | workmem2, | ||
double * | vector, | ||
const bool | multiply | ||
) |
Update the unitary transformation based on the new vector and the previous unitary.
workmem1 | Work memory |
workmem2 | Work memory |
Definition at line 235 of file UnitaryMatrix.cpp.
void UnitaryMatrix::updateUnitary | ( | double * | temp1, |
double * | temp2, | ||
const UnitaryMatrix & | X, | ||
bool | replace | ||
) |
Calculate the unitary matrix: exp(X). Depending on replace, do exp(X)*U or replace by exp(X)
temp1 | temporarily storage |
temp2 | temporarily storage |
X | the X matrix |
replace | if true replace the current unitary matrix with exp(X), else do exp(X)*U |
Definition at line 158 of file UnitaryMatrix.cpp.
|
private |
Definition at line 119 of file UnitaryMatrix.h.
|
private |
Definition at line 125 of file UnitaryMatrix.h.
|
private |
Definition at line 122 of file UnitaryMatrix.h.