12#include <Eigen/SparseCore>
15#include <unordered_map>
39template <
typename Derived>
61 std::shared_ptr<const Derived>
get_state(
size_t state_index)
const;
62 std::shared_ptr<const ket_t>
get_ket(
size_t ket_index)
const;
72 std::shared_ptr<const Derived>
74 const Eigen::SparseMatrix<scalar_t, Eigen::RowMajor> &
get_coefficients()
const;
77 Eigen::SparseMatrix<scalar_t, Eigen::RowMajor>
80 Eigen::SparseMatrix<real_t, Eigen::RowMajor>
81 get_overlaps(std::shared_ptr<const Derived> other)
const;
85 std::shared_ptr<const Derived> other,
OperatorType type,
int q = 0)
const = 0;
89 Iterator(
typename ketvec_t::const_iterator it);
91 std::shared_ptr<const ket_t>
operator*()
const;
95 typename ketvec_t::const_iterator it;
103 Sorting get_sorter(
const std::vector<TransformationType> &labels)
const override;
104 std::vector<IndicesOfBlock>
110 Sorting &transformation)
const;
114 std::shared_ptr<const Derived>
124 const Derived &derived()
const;
127 std::size_t operator()(
const std::shared_ptr<const ket_t> &k)
const;
131 bool operator()(
const std::shared_ptr<const ket_t> &lhs,
132 const std::shared_ptr<const ket_t> &rhs)
const;
135 Transformation<scalar_t> coefficients;
137 std::unordered_map<std::shared_ptr<const ket_t>, size_t, hash, equal_to> ket_to_ket_index;
138 std::vector<size_t> ket_index_to_state_index;
140 std::vector<real_t> state_index_to_quantum_number_f;
141 std::vector<real_t> state_index_to_quantum_number_m;
142 std::vector<Parity> state_index_to_parity;
143 std::vector<size_t> state_index_to_ket_index;
145 bool _has_quantum_number_f{
true};
146 bool _has_quantum_number_m{
true};
147 bool _has_parity{
true};
Iterator(typename ketvec_t::const_iterator it)
std::shared_ptr< const ket_t > operator*() const
bool operator!=(const Iterator &other) const
Eigen::VectorX< real_t > get_overlaps(std::shared_ptr< const ket_t > ket) const
const Transformation< scalar_t > & get_transformation() const override
virtual Eigen::SparseMatrix< scalar_t, Eigen::RowMajor > get_matrix_elements(std::shared_ptr< const Derived > other, OperatorType type, int q=0) const =0
void get_indices_of_blocks_without_checks(const std::set< TransformationType > &unique_labels, IndicesOfBlocksCreator &blocks) const
const ketvec_t & get_kets() const
void get_sorter_without_checks(const std::vector< TransformationType > &labels, Sorting &transformation) const
int get_ket_index_from_ket(std::shared_ptr< const ket_t > ket) const
std::shared_ptr< const Derived > get_canonical_state_from_ket(size_t ket_index) const
typename traits::CrtpTraits< Derived >::ketvec_t ketvec_t
size_t get_corresponding_ket_index(size_t state_index) const
size_t get_number_of_states() const
virtual Eigen::VectorX< scalar_t > get_matrix_elements(std::shared_ptr< const ket_t > ket, OperatorType type, int q=0) const =0
Eigen::VectorX< scalar_t > get_amplitudes(std::shared_ptr< const ket_t > ket) const
typename traits::CrtpTraits< Derived >::scalar_t scalar_t
std::shared_ptr< const Derived > get_corresponding_state(size_t ket_index) const
typename traits::CrtpTraits< Derived >::ket_t ket_t
Transformation< scalar_t > get_rotator(real_t alpha, real_t beta, real_t gamma) const override
std::shared_ptr< const Derived > get_state(size_t state_index) const
void perform_sorter_checks(const std::vector< TransformationType > &labels) const
real_t get_quantum_number_m(size_t state_index) const
void perform_blocks_checks(const std::set< TransformationType > &unique_labels) const
std::shared_ptr< const ket_t > get_ket(size_t ket_index) const
Parity get_parity(size_t state_index) const
std::vector< IndicesOfBlock > get_indices_of_blocks(const std::vector< TransformationType > &labels) const override
real_t get_quantum_number_f(size_t state_index) const
bool has_quantum_number_m() const
std::shared_ptr< const ket_t > get_corresponding_ket(size_t state_index) const
typename traits::CrtpTraits< Derived >::real_t real_t
bool has_quantum_number_f() const
std::shared_ptr< const Derived > transformed(const Transformation< scalar_t > &transformation) const
Sorting get_sorter(const std::vector< TransformationType > &labels) const override
size_t get_corresponding_state_index(size_t ket_index) const
const Eigen::SparseMatrix< scalar_t, Eigen::RowMajor > & get_coefficients() const
size_t get_number_of_kets() const
Matrix< Type, Dynamic, 1 > VectorX
Helper struct to extract types from a derived basis type. Must be specialized for each derived basis ...