15 for(
Index i = 0; i < _template.size(); i++) {
16 if(_template[i] ==
'%') {
20 if((++i) + 1 < _template.size())
33 m_ss.str(std::string());
70 for(
Index i = 0; i < _template.size(); i++) {
71 if(_template[i] ==
'%') {
75 if((++i) + 1 < _template.size())
89 std::stringstream tformula, ttex;
104 double var_scale(host.
coeffs()[var_ind[0]]);
112 if(var_ind.
size() > 1) {
118 for(
Index i = 0; i < var_ind.
size(); i++) {
120 coeff = host.
coeffs()[var_ind[i]];
122 if(i > 0 && coeff > 0) {
133 if(i > 0 && coeff / var_scale > 0) {
139 if(!
almost_zero(std::abs(coeff / var_scale) - 1)) {
146 ttex << var_compon.ID();
147 tformula << var_compon.ID();
156 std::string prefix = var_compon.type_name_prefix();
163 std::string suffix = var_compon.type_name_suffix();
171 tformula << m_sub_strings[j];
175 if(var_ind.
size() > 1) {
196 for(
Index i = 0; i < _template.size(); i++) {
197 if(_template[i] ==
'%') {
201 if((++i) + 1 < _template.size())
237 m_ss.str(std::string());
255 if(f < bset_ptr->size())
bool almost_zero(const T &val, double tol=TOL)
If T is not integral, use std::abs(val) < tol;.
bool visit(Variable &host, BasisSet const *bset_ptr) const
void push_back(const T &toPush)
const Eigen::VectorXd & coeffs() const
Array< std::string > m_sub_strings
const std::string & name() const
bool visit(Variable &host, BasisSet const *bset_ptr) const
EigenIndex Index
For long integer indexing:
SubExpressionLabeler(const std::string &_bset_name, const std::string &_template)
Array< std::string > m_sub_strings
Iterator find(Iterator begin, Iterator end, const T &value, BinaryCompare q)
Equivalent to std::find(begin, end, value), but with custom comparison.
std::string irrational_to_tex_string(double val, int lim, int max_pow=2)
bool _generic_visit(Function &host, BasisSet const *bset_ptr) const
OccFuncLabeler(const std::string &_template)
void set_tex_formula(const std::string &new_formula)
Index find(const T &test_elem) const
void set_basis_ind(int new_ind)
Array< std::string > m_sub_strings
void set_formula(const std::string &new_formula)
VariableLabeler(const std::string &_template)
bool visit(OccupantFunction &host, BasisSet const *bset_ptr) const
bool visit(OccupantFunction &host, BasisSet const *bset_ptr) const
Index occ_func_ind() const
const Array< ContinuousDoF > & var_compon() const
const DiscreteDoF & dof() const
const Array< Index > & dof_IDs() const
bool valid_index(Index i)