17 Basis(std::vector<std::string> idents, Eigen::Index
dim) {
18 Eigen::Index count = 0;
19 for(
const auto& ident : idents) {
20 auto entry = std::make_tuple(ident,count);
21 data_.push_back(entry);
28 std::vector<std::string> idents(
dim,
"");
39 void push_back(
const std::vector<std::string> &idents) {
40 for (
const auto &ident:idents)
47 bool find( std::string ident_in ) {
48 for(
const auto& elem :
data_) {
auto [ident,num] = elem;
if (ident == ident_in) {
return true;}}
51 Eigen::Index
location( std::string ident_in ) {
52 for(
const auto& elem :
data_) {
auto [ident,num] = elem;
if (ident == ident_in) {
return num;}}
53 return std::numeric_limits<Eigen::Index>::max();
66 std::string
print()
const;
68 std::vector<std::tuple<std::string,Eigen::Index> >::iterator
begin() {
return data_.begin(); }
69 std::vector<std::tuple<std::string,Eigen::Index> >::iterator
end() {
return data_.end(); }
71 std::vector<std::tuple<std::string,Eigen::Index> >::const_iterator
cbegin()
const {
return data_.cbegin(); }
72 std::vector<std::tuple<std::string,Eigen::Index> >::const_iterator
cend()
const {
return data_.cend(); }
82 std::array<Eigen::Index,2>
source(Eigen::Index combined_num)
const
84 Eigen::Index tmp = combined_num /
dim1;
85 return {{combined_num -
dim1*tmp, tmp}};
89 std::vector<std::tuple<std::string,Eigen::Index> >
data_;
99 for (
const auto &[ident,num] :
data_)
103 for (
const auto &[ident,num] : other.
data_)
117 for(
const auto& [ident2,num2] : other.
data_)
118 for(
const auto& [ident1,num1] : this->
data_)
121 out.
data_.push_back(std::make_tuple(
"",num1 + this->
size()*num2));
129 std::stringstream out;
130 TextTable t(
'-',
'|',
'+' );
134 for (
const auto& [ident,num] :
data_)
136 std::stringstream ss, tt;
std::ostream & operator<<(std::ostream &os, const Basis &basis)
size_t dim(const PivotMatrix0< Symmetry, Scalar, MpoScalar > &H)
Basis combine(const Basis &other) const
friend ostream & operator<<(ostream &os, const Basis &basis)
Eigen::Index size() const
std::vector< std::tuple< std::string, Eigen::Index > >::iterator begin()
std::vector< std::tuple< std::string, Eigen::Index > >::iterator end()
Eigen::Index location(std::string ident_in)
void push_back(const std::string &ident)
void push_back(const std::vector< std::string > &idents)
Basis(std::vector< std::string > idents, Eigen::Index dim)
std::string print() const
std::vector< std::tuple< std::string, Eigen::Index > > data_
bool operator==(const Basis &other) const
bool find(std::string ident_in)
std::vector< std::tuple< std::string, Eigen::Index > >::const_iterator cbegin() const
Basis add(const Basis &other) const
std::vector< std::tuple< std::string, Eigen::Index > >::const_iterator cend() const
std::array< Eigen::Index, 2 > source(Eigen::Index combined_num) const