v2DM-DOCI  1.0
simanneal::UnitaryMatrix Class Reference

#include <UnitaryMatrix.h>

+ Collaboration diagram for simanneal::UnitaryMatrix:

Public Member Functions

 UnitaryMatrix (const OptIndex &)
 Constructor. More...
 
 UnitaryMatrix (const UnitaryMatrix &unit)
 Copy constructor. More...
 
 UnitaryMatrix (UnitaryMatrix &&unit)
 
virtual ~UnitaryMatrix ()=default
 Destructor. More...
 
UnitaryMatrixoperator= (const UnitaryMatrix &unit)
 
UnitaryMatrixoperator= (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
 

Detailed Description

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.

Constructor & Destructor Documentation

UnitaryMatrix::UnitaryMatrix ( const OptIndex index_in)

Constructor.

Parameters
_hamindexIn

Definition at line 43 of file UnitaryMatrix.cpp.

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.

virtual simanneal::UnitaryMatrix::~UnitaryMatrix ( )
virtualdefault

Destructor.

Member Function Documentation

void UnitaryMatrix::build_skew_symm_x ( const int  irrep,
double *  xblock,
const double *  Xelem 
) const

Definition at line 348 of file UnitaryMatrix.cpp.

+ Here is the caller graph for this function:

void UnitaryMatrix::CheckDeviationFromUnitary ( double *  work) const

Calculate the two-norm of U^T*U - I.

Parameters
workWork memory

Definition at line 417 of file UnitaryMatrix.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void simanneal::UnitaryMatrix::copyXsolutionBack ( double *  vector)

Copy the x solution back (NR, augmented NR, ...)

Parameters
vectorThe 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 ( )

Definition at line 552 of file UnitaryMatrix.cpp.

+ Here is the caller graph for this function:

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.

Parameters
irrepThe irreducible representation
Returns
Pointer to the desired unitary block

Definition at line 148 of file UnitaryMatrix.cpp.

+ Here is the caller graph for this function:

int simanneal::UnitaryMatrix::getFirstIndex ( const int  linearindex) const

Get the first Hamiltonian index corresponding to linearindex.

Parameters
linearindexThe linear index of the x-parametrization
Returns
The first Hamiltonian index corresponding to linearindex
unsigned int UnitaryMatrix::getNumVariablesX ( ) const

Get the number of variables in the x-parametrization of the unitary update.

Returns
The number of unique variables in the x-matrix

Definition at line 146 of file UnitaryMatrix.cpp.

int simanneal::UnitaryMatrix::getSecondIndex ( const int  linearindex) const

Get the second Hamiltonian index corresponding to linearindex.

Parameters
linearindexThe linear index of the x-parametrization
Returns
The second Hamiltonian index corresponding to linearindex
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 ( )

Definition at line 571 of file UnitaryMatrix.cpp.

+ Here is the caller graph for this function:

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.

+ Here is the caller graph for this function:

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.

Parameters
eigenvecsThe NO eigenbasis
workWork memory

Definition at line 373 of file UnitaryMatrix.cpp.

+ Here is the call graph for this function:

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.

Parameters
workmem1Work memory
workmem2Work memory

Definition at line 235 of file UnitaryMatrix.cpp.

+ Here is the call graph for this function:

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)

Parameters
temp1temporarily storage
temp2temporarily storage
Xthe X matrix
replaceif true replace the current unitary matrix with exp(X), else do exp(X)*U

Definition at line 158 of file UnitaryMatrix.cpp.

+ Here is the call graph for this function:

Member Data Documentation

std::unique_ptr<OptIndex> simanneal::UnitaryMatrix::_index
private

Definition at line 119 of file UnitaryMatrix.h.

std::vector< std::unique_ptr<double []> > simanneal::UnitaryMatrix::unitary
private

Definition at line 125 of file UnitaryMatrix.h.

unsigned int simanneal::UnitaryMatrix::x_linearlength
private

Definition at line 122 of file UnitaryMatrix.h.


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