CASM  1.1.0
A Clusters Approach to Statistical Mechanics
CASM::xtal::HermiteCounter Class Reference

#include <HermiteCounter.hh>

Detailed Description

Given the dimensions of a square matrix and its determinant, HermiteCounter will cycle through every possible matrix that maintains it's Hermite normal form: -Upper triangular matrix -Determinant remains constant -row values to the right of the diagonal will always be smaller than the value of the diagonal

In addition, this class is limited to SQUARE matrices, and NONZERO determinants. The idea is to use it for supcercell enumerations, where these conditions are always met.

For a determinant det, the initial value of the counter will be a n x n identity matrix H with H(0,0)=det. The final position will be a n x n identity matrix with H(n-1,n-1)=det. Once the final position for a particular determinant is reached, the counter starts over with the next integer determinant value.

There are two main steps in the counter: -Incrementing the diagonal of the matrix such that its product remains equal to the determinant -Incrementing the upper triangular values such that they never exceed the diagonal

The diagonal increments are achieved by working only with two adjacent values at a time, distributing factors to the next diagonal element only if it equals 1. If not, the next adjacent pair is selected.

Definition at line 40 of file HermiteCounter.hh.

Public Types

typedef Eigen::VectorXi::Scalar value_type
 
typedef CASM::Index Index
 

Public Member Functions

 HermiteCounter (int init_determinant, int init_dim)
 constructor to satisfy iterator requirements. Do not recommend. More...
 
Index position () const
 
Eigen::VectorXi diagonal () const
 
Eigen::MatrixXi current () const
 Get the current matrix the counter is on. More...
 
value_type determinant () const
 Get the current determinant. More...
 
Index dim () const
 Get the dimensions of *this. More...
 
void reset_current ()
 reset the counter to the first iteration of the current determinant More...
 
void next_determinant ()
 Skip the remaining iterations and start at the next determinant value. More...
 
void jump_to_determinant (value_type new_det)
 Reset the diagonal to the specified determinant and set the other elements to zero. More...
 
HermiteCounteroperator++ ()
 Jump to the next available HNF matrix. More...
 
Eigen::MatrixXi operator() () const
 Get the current matrix the counter is on. More...
 

Private Member Functions

Index _increment_diagonal ()
 Go to the next values of diagonal elements that keep the same determinant. More...
 

Private Attributes

Index m_pos
 Keeps track of the current diagonal element that needs to be factored. More...
 
Eigen::VectorXi m_diagonal
 Vector holding diagonal element values. More...
 
EigenVectorXiCounter m_upper_tri
 unrolled vector of the upper triangle (does not include diagonal elements) More...
 

Member Typedef Documentation

◆ Index

◆ value_type

typedef Eigen::VectorXi::Scalar CASM::xtal::HermiteCounter::value_type

Definition at line 42 of file HermiteCounter.hh.

Constructor & Destructor Documentation

◆ HermiteCounter()

CASM::xtal::HermiteCounter::HermiteCounter ( int  init_determinant,
int  init_dim 
)

constructor to satisfy iterator requirements. Do not recommend.

constructor given the desired determinant and square matrix dimensions

Definition at line 5 of file HermiteCounter.cc.

Member Function Documentation

◆ _increment_diagonal()

Index CASM::xtal::HermiteCounter::_increment_diagonal ( )
private

Go to the next values of diagonal elements that keep the same determinant.

Definition at line 39 of file HermiteCounter.cc.

◆ current()

Eigen::MatrixXi CASM::xtal::HermiteCounter::current ( ) const

Get the current matrix the counter is on.

Definition at line 17 of file HermiteCounter.cc.

◆ determinant()

HermiteCounter::value_type CASM::xtal::HermiteCounter::determinant ( ) const

Get the current determinant.

Definition at line 25 of file HermiteCounter.cc.

◆ diagonal()

Eigen::VectorXi CASM::xtal::HermiteCounter::diagonal ( ) const

Definition at line 15 of file HermiteCounter.cc.

◆ dim()

HermiteCounter::Index CASM::xtal::HermiteCounter::dim ( ) const

Get the dimensions of *this.

Definition at line 21 of file HermiteCounter.cc.

◆ jump_to_determinant()

void CASM::xtal::HermiteCounter::jump_to_determinant ( value_type  new_det)

Reset the diagonal to the specified determinant and set the other elements to zero.

Definition at line 71 of file HermiteCounter.cc.

◆ next_determinant()

void CASM::xtal::HermiteCounter::next_determinant ( )

Skip the remaining iterations and start at the next determinant value.

Definition at line 34 of file HermiteCounter.cc.

◆ operator()()

Eigen::MatrixXi CASM::xtal::HermiteCounter::operator() ( ) const

Get the current matrix the counter is on.

Definition at line 23 of file HermiteCounter.cc.

◆ operator++()

HermiteCounter & CASM::xtal::HermiteCounter::operator++ ( )

Jump to the next available HNF matrix.

Definition at line 44 of file HermiteCounter.cc.

◆ position()

HermiteCounter::Index CASM::xtal::HermiteCounter::position ( ) const

Definition at line 13 of file HermiteCounter.cc.

◆ reset_current()

void CASM::xtal::HermiteCounter::reset_current ( )

reset the counter to the first iteration of the current determinant

Definition at line 29 of file HermiteCounter.cc.

Member Data Documentation

◆ m_diagonal

Eigen::VectorXi CASM::xtal::HermiteCounter::m_diagonal
private

Vector holding diagonal element values.

Definition at line 91 of file HermiteCounter.hh.

◆ m_pos

Index CASM::xtal::HermiteCounter::m_pos
private

Keeps track of the current diagonal element that needs to be factored.

Definition at line 88 of file HermiteCounter.hh.

◆ m_upper_tri

EigenVectorXiCounter CASM::xtal::HermiteCounter::m_upper_tri
private

unrolled vector of the upper triangle (does not include diagonal elements)

Definition at line 95 of file HermiteCounter.hh.


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