pairinteraction
A Rydberg Interaction Calculator
pairinteraction::Basis< Derived > Class Template Referenceabstract

Base class for a basis. More...

#include <Basis.hpp>

+ Inheritance diagram for pairinteraction::Basis< Derived >:
+ Collaboration diagram for pairinteraction::Basis< Derived >:

Data Structures

class  Iterator
 

Public Types

using scalar_t = typename traits::CrtpTraits< Derived >::scalar_t
 
using real_t = typename traits::CrtpTraits< Derived >::real_t
 
using ket_t = typename traits::CrtpTraits< Derived >::ket_t
 
using ketvec_t = typename traits::CrtpTraits< Derived >::ketvec_t
 
- Public Types inherited from pairinteraction::TransformationBuilderInterface< traits::CrtpTraits< Derived >::scalar_t >
using real_t = typename traits::NumTraits< traits::CrtpTraits< Derived >::scalar_t >::real_t
 

Public Member Functions

 Basis ()=delete
 
virtual ~Basis ()=default
 
bool has_quantum_number_f () const
 
bool has_quantum_number_m () const
 
bool has_parity () const
 
const ketvec_tget_kets () const
 
size_t get_number_of_states () const
 
size_t get_number_of_kets () const
 
real_t get_quantum_number_f (size_t state_index) const
 
real_t get_quantum_number_m (size_t state_index) const
 
Parity get_parity (size_t state_index) const
 
std::shared_ptr< const Derived > get_state (size_t state_index) const
 
std::shared_ptr< const ket_tget_ket (size_t ket_index) const
 
std::shared_ptr< const ket_tget_corresponding_ket (size_t state_index) const
 
std::shared_ptr< const ket_tget_corresponding_ket (std::shared_ptr< const Derived > state) const
 
size_t get_corresponding_ket_index (size_t state_index) const
 
size_t get_corresponding_ket_index (std::shared_ptr< const Derived > state) const
 
std::shared_ptr< const Derived > get_corresponding_state (size_t ket_index) const
 
std::shared_ptr< const Derived > get_corresponding_state (std::shared_ptr< const ket_t > ket) const
 
size_t get_corresponding_state_index (size_t ket_index) const
 
size_t get_corresponding_state_index (std::shared_ptr< const ket_t > ket) const
 
std::shared_ptr< const Derived > get_canonical_state_from_ket (size_t ket_index) const
 
std::shared_ptr< const Derived > get_canonical_state_from_ket (std::shared_ptr< const ket_t > ket) const
 
const Eigen::SparseMatrix< scalar_t, Eigen::RowMajor > & get_coefficients () const
 
Eigen::SparseMatrix< scalar_t, Eigen::RowMajor > & get_coefficients ()
 
Eigen::VectorX< scalar_tget_amplitudes (std::shared_ptr< const ket_t > ket) const
 
Eigen::SparseMatrix< scalar_t, Eigen::RowMajor > get_amplitudes (std::shared_ptr< const Derived > other) const
 
Eigen::VectorX< real_tget_overlaps (std::shared_ptr< const ket_t > ket) const
 
Eigen::SparseMatrix< real_t, Eigen::RowMajor > get_overlaps (std::shared_ptr< const Derived > other) const
 
virtual Eigen::VectorX< scalar_tget_matrix_elements (std::shared_ptr< const ket_t > ket, OperatorType type, int q=0) const =0
 
virtual Eigen::SparseMatrix< scalar_t, Eigen::RowMajor > get_matrix_elements (std::shared_ptr< const Derived > other, OperatorType type, int q=0) const =0
 
Iterator begin () const
 
Iterator end () const
 
const Transformation< scalar_t > & get_transformation () const override
 
Transformation< scalar_tget_rotator (real_t alpha, real_t beta, real_t gamma) const override
 
Sorting get_sorter (const std::vector< TransformationType > &labels) const override
 
std::vector< IndicesOfBlockget_indices_of_blocks (const std::vector< TransformationType > &labels) const override
 
void perform_sorter_checks (const std::vector< TransformationType > &labels) const
 
void perform_blocks_checks (const std::set< TransformationType > &unique_labels) const
 
void get_sorter_without_checks (const std::vector< TransformationType > &labels, Sorting &transformation) const
 
void get_indices_of_blocks_without_checks (const std::set< TransformationType > &unique_labels, IndicesOfBlocksCreator &blocks) const
 
std::shared_ptr< const Derived > transformed (const Transformation< scalar_t > &transformation) const
 
std::shared_ptr< const Derived > transformed (const Sorting &transformation) const
 
- Public Member Functions inherited from pairinteraction::TransformationBuilderInterface< traits::CrtpTraits< Derived >::scalar_t >
virtual ~TransformationBuilderInterface ()=default
 
virtual const Transformation< traits::CrtpTraits< Derived >::scalar_t > & get_transformation () const=0
 
virtual Transformation< traits::CrtpTraits< Derived >::scalar_t > get_rotator (real_t alpha, real_t beta, real_t gamma) const=0
 
Transformation< traits::CrtpTraits< Derived >::scalar_t > get_rotator (const std::array< real_t, 3 > &to_z_axis, const std::array< real_t, 3 > &to_y_axis) const
 
virtual Sorting get_sorter (const std::vector< TransformationType > &labels) const=0
 
virtual std::vector< IndicesOfBlockget_indices_of_blocks (const std::vector< TransformationType > &labels) const=0
 

Protected Member Functions

 Basis (ketvec_t &&kets)
 
int get_ket_index_from_ket (std::shared_ptr< const ket_t > ket) const
 

Protected Attributes

ketvec_t kets
 

Detailed Description

template<typename Derived>
class pairinteraction::Basis< Derived >

Base class for a basis.

This base class represents a basis. It comprises a list of ket states and a matrix of coefficients. The rows of the coefficient matrix correspond to indices of ket states and the columns to indices of basis vectors. Using CRPT, it is a base class for specific basis implementations. Its constructor is protected to indicate that derived classes should not allow direct instantiation. Instead, a factory class should be provided that is a friend of the derived class and can create instances of it.

Template Parameters
DerivedDerived class.

Definition at line 40 of file Basis.hpp.

Member Typedef Documentation

◆ ket_t

template<typename Derived >
using pairinteraction::Basis< Derived >::ket_t = typename traits::CrtpTraits<Derived>::ket_t

Definition at line 45 of file Basis.hpp.

◆ ketvec_t

template<typename Derived >
using pairinteraction::Basis< Derived >::ketvec_t = typename traits::CrtpTraits<Derived>::ketvec_t

Definition at line 46 of file Basis.hpp.

◆ real_t

template<typename Derived >
using pairinteraction::Basis< Derived >::real_t = typename traits::CrtpTraits<Derived>::real_t

Definition at line 44 of file Basis.hpp.

◆ scalar_t

template<typename Derived >
using pairinteraction::Basis< Derived >::scalar_t = typename traits::CrtpTraits<Derived>::scalar_t

Definition at line 43 of file Basis.hpp.

Constructor & Destructor Documentation

◆ Basis() [1/2]

template<typename Derived >
pairinteraction::Basis< Derived >::Basis ( )
delete

◆ ~Basis()

template<typename Derived >
virtual pairinteraction::Basis< Derived >::~Basis ( )
virtualdefault

◆ Basis() [2/2]

template<typename Derived >
pairinteraction::Basis< Derived >::Basis ( ketvec_t &&  kets)
protected

Definition at line 59 of file Basis.cpp.

Member Function Documentation

◆ begin()

template<typename Derived >
Basis< Derived >::Iterator pairinteraction::Basis< Derived >::begin

Definition at line 335 of file Basis.cpp.

References pairinteraction::Basis< Derived >::begin().

Referenced by pairinteraction::Basis< Derived >::begin().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ end()

template<typename Derived >
Basis< Derived >::Iterator pairinteraction::Basis< Derived >::end

Definition at line 340 of file Basis.cpp.

References pairinteraction::Basis< Derived >::end().

Referenced by pairinteraction::Basis< Derived >::end().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_amplitudes() [1/2]

template<typename Derived >
Eigen::SparseMatrix< typename Basis< Derived >::scalar_t, Eigen::RowMajor > pairinteraction::Basis< Derived >::get_amplitudes ( std::shared_ptr< const Derived >  other) const

Definition at line 152 of file Basis.cpp.

References pairinteraction::Transformation< Scalar >::matrix.

◆ get_amplitudes() [2/2]

template<typename Derived >
Eigen::VectorX< typename Basis< Derived >::scalar_t > pairinteraction::Basis< Derived >::get_amplitudes ( std::shared_ptr< const ket_t ket) const

Definition at line 140 of file Basis.cpp.

◆ get_canonical_state_from_ket() [1/2]

template<typename Derived >
std::shared_ptr< const Derived > pairinteraction::Basis< Derived >::get_canonical_state_from_ket ( size_t  ket_index) const

Definition at line 296 of file Basis.cpp.

Referenced by pairinteraction::BasisPair< Scalar >::get_matrix_elements().

+ Here is the caller graph for this function:

◆ get_canonical_state_from_ket() [2/2]

template<typename Derived >
std::shared_ptr< const Derived > pairinteraction::Basis< Derived >::get_canonical_state_from_ket ( std::shared_ptr< const ket_t ket) const

Definition at line 326 of file Basis.cpp.

◆ get_coefficients() [1/2]

template<typename Derived >
Eigen::SparseMatrix< typename Basis< Derived >::scalar_t, Eigen::RowMajor > & pairinteraction::Basis< Derived >::get_coefficients

Definition at line 126 of file Basis.cpp.

◆ get_coefficients() [2/2]

template<typename Derived >
const Eigen::SparseMatrix< typename Basis< Derived >::scalar_t, Eigen::RowMajor > & pairinteraction::Basis< Derived >::get_coefficients

Definition at line 120 of file Basis.cpp.

◆ get_corresponding_ket() [1/2]

template<typename Derived >
std::shared_ptr< const typename Basis< Derived >::ket_t > pairinteraction::Basis< Derived >::get_corresponding_ket ( size_t  state_index) const

Definition at line 197 of file Basis.cpp.

◆ get_corresponding_ket() [2/2]

template<typename Derived >
std::shared_ptr< const typename Basis< Derived >::ket_t > pairinteraction::Basis< Derived >::get_corresponding_ket ( std::shared_ptr< const Derived >  state) const

Definition at line 207 of file Basis.cpp.

◆ get_corresponding_ket_index() [1/2]

template<typename Derived >
size_t pairinteraction::Basis< Derived >::get_corresponding_ket_index ( size_t  state_index) const

Definition at line 281 of file Basis.cpp.

◆ get_corresponding_ket_index() [2/2]

template<typename Derived >
size_t pairinteraction::Basis< Derived >::get_corresponding_ket_index ( std::shared_ptr< const Derived >  state) const

Definition at line 290 of file Basis.cpp.

◆ get_corresponding_state() [1/2]

template<typename Derived >
std::shared_ptr< const Derived > pairinteraction::Basis< Derived >::get_corresponding_state ( size_t  ket_index) const

Definition at line 244 of file Basis.cpp.

◆ get_corresponding_state() [2/2]

template<typename Derived >
std::shared_ptr< const Derived > pairinteraction::Basis< Derived >::get_corresponding_state ( std::shared_ptr< const ket_t ket) const

Definition at line 254 of file Basis.cpp.

◆ get_corresponding_state_index() [1/2]

template<typename Derived >
size_t pairinteraction::Basis< Derived >::get_corresponding_state_index ( size_t  ket_index) const

Definition at line 263 of file Basis.cpp.

◆ get_corresponding_state_index() [2/2]

template<typename Derived >
size_t pairinteraction::Basis< Derived >::get_corresponding_state_index ( std::shared_ptr< const ket_t ket) const

Definition at line 272 of file Basis.cpp.

◆ get_indices_of_blocks()

◆ get_indices_of_blocks_without_checks()

template<typename Derived >
void pairinteraction::Basis< Derived >::get_indices_of_blocks_without_checks ( const std::set< TransformationType > &  unique_labels,
IndicesOfBlocksCreator blocks 
) const

◆ get_ket()

template<typename Derived >
std::shared_ptr< const typename Basis< Derived >::ket_t > pairinteraction::Basis< Derived >::get_ket ( size_t  ket_index) const

Definition at line 239 of file Basis.cpp.

◆ get_ket_index_from_ket()

template<typename Derived >
int pairinteraction::Basis< Derived >::get_ket_index_from_ket ( std::shared_ptr< const ket_t ket) const
protected

Definition at line 131 of file Basis.cpp.

Referenced by pairinteraction::Basis< Derived >::get_rotator().

+ Here is the caller graph for this function:

◆ get_kets()

template<typename Derived >
const Basis< Derived >::ketvec_t & pairinteraction::Basis< Derived >::get_kets

Definition at line 114 of file Basis.cpp.

◆ get_matrix_elements() [1/2]

template<typename Derived >
virtual Eigen::SparseMatrix< scalar_t, Eigen::RowMajor > pairinteraction::Basis< Derived >::get_matrix_elements ( std::shared_ptr< const Derived >  other,
OperatorType  type,
int  q = 0 
) const
pure virtual

◆ get_matrix_elements() [2/2]

template<typename Derived >
virtual Eigen::VectorX< scalar_t > pairinteraction::Basis< Derived >::get_matrix_elements ( std::shared_ptr< const ket_t ket,
OperatorType  type,
int  q = 0 
) const
pure virtual

◆ get_number_of_kets()

template<typename Derived >
size_t pairinteraction::Basis< Derived >::get_number_of_kets

Definition at line 369 of file Basis.cpp.

References pairinteraction::Transformation< Scalar >::matrix.

◆ get_number_of_states()

template<typename Derived >
size_t pairinteraction::Basis< Derived >::get_number_of_states

Definition at line 364 of file Basis.cpp.

References pairinteraction::Transformation< Scalar >::matrix.

◆ get_overlaps() [1/2]

template<typename Derived >
Eigen::SparseMatrix< typename Basis< Derived >::real_t, Eigen::RowMajor > pairinteraction::Basis< Derived >::get_overlaps ( std::shared_ptr< const Derived >  other) const

Definition at line 164 of file Basis.cpp.

◆ get_overlaps() [2/2]

template<typename Derived >
Eigen::VectorX< typename Basis< Derived >::real_t > pairinteraction::Basis< Derived >::get_overlaps ( std::shared_ptr< const ket_t ket) const

Definition at line 158 of file Basis.cpp.

◆ get_parity()

template<typename Derived >
Parity pairinteraction::Basis< Derived >::get_parity ( size_t  state_index) const

Definition at line 187 of file Basis.cpp.

◆ get_quantum_number_f()

template<typename Derived >
Basis< Derived >::real_t pairinteraction::Basis< Derived >::get_quantum_number_f ( size_t  state_index) const

Definition at line 169 of file Basis.cpp.

◆ get_quantum_number_m()

template<typename Derived >
Basis< Derived >::real_t pairinteraction::Basis< Derived >::get_quantum_number_m ( size_t  state_index) const

Definition at line 178 of file Basis.cpp.

◆ get_rotator()

template<typename Derived >
Transformation< typename Basis< Derived >::scalar_t > pairinteraction::Basis< Derived >::get_rotator ( real_t  alpha,
real_t  beta,
real_t  gamma 
) const
override

◆ get_sorter()

◆ get_sorter_without_checks()

◆ get_state()

template<typename Derived >
std::shared_ptr< const Derived > pairinteraction::Basis< Derived >::get_state ( size_t  state_index) const

Definition at line 212 of file Basis.cpp.

◆ get_transformation()

template<typename Derived >
const Transformation< typename Basis< Derived >::scalar_t > & pairinteraction::Basis< Derived >::get_transformation
overridevirtual

◆ has_parity()

template<typename Derived >
bool pairinteraction::Basis< Derived >::has_parity

Definition at line 104 of file Basis.cpp.

◆ has_quantum_number_f()

template<typename Derived >
bool pairinteraction::Basis< Derived >::has_quantum_number_f

Definition at line 94 of file Basis.cpp.

◆ has_quantum_number_m()

template<typename Derived >
bool pairinteraction::Basis< Derived >::has_quantum_number_m

Definition at line 99 of file Basis.cpp.

◆ perform_blocks_checks()

template<typename Derived >
void pairinteraction::Basis< Derived >::perform_blocks_checks ( const std::set< TransformationType > &  unique_labels) const

Definition at line 36 of file Basis.cpp.

References pairinteraction::utils::is_sorting().

Referenced by pairinteraction::Basis< Derived >::get_indices_of_blocks().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ perform_sorter_checks()

template<typename Derived >
void pairinteraction::Basis< Derived >::perform_sorter_checks ( const std::vector< TransformationType > &  labels) const

Definition at line 26 of file Basis.cpp.

References pairinteraction::utils::is_sorting().

Referenced by pairinteraction::Basis< Derived >::get_indices_of_blocks(), and pairinteraction::Basis< Derived >::get_sorter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ transformed() [1/2]

template<typename Derived >
std::shared_ptr< const Derived > pairinteraction::Basis< Derived >::transformed ( const Sorting transformation) const

◆ transformed() [2/2]

template<typename Derived >
std::shared_ptr< const Derived > pairinteraction::Basis< Derived >::transformed ( const Transformation< scalar_t > &  transformation) const

Field Documentation

◆ kets

template<typename Derived >
ketvec_t pairinteraction::Basis< Derived >::kets
protected

Definition at line 121 of file Basis.hpp.

Referenced by pairinteraction::Basis< Derived >::get_rotator().


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