26 : m_dof_set(_dof_set), m_coeffs(_dof_set.size()) {
34 : m_dof_set(_dof_set), m_coeffs(_coeffs) {}
40 return visitor.
visit(*
this, home_basis_ptr);
46 BasisSet const *home_basis_ptr )
const {
47 return visitor.
visit(*
this, home_basis_ptr);
100 for (index = 0; index <
dof_set().
size(); index++) {
121 std::stringstream tformula, ttex;
123 bool global_special =
false;
128 if (!global_special &&
dof_set()[i].is_locked()) {
131 global_special =
true;
136 if (!var_ind.
size()) {
142 double var_scale(
m_coeffs[var_ind[0]]);
150 if (var_ind.
size() > 1) {
155 for (
Index i = 0; i < var_ind.
size(); i++) {
156 if (i > 0 &&
m_coeffs[var_ind[i]] > 0) {
167 if (i > 0 &&
m_coeffs[var_ind[i]] / var_scale > 0) {
179 if (global_special) {
184 tformula <<
dof_set()[var_ind[i]].var_name() <<
'['
185 <<
dof_set()[var_ind[i]].ID() <<
']';
186 ttex <<
dof_set()[var_ind[i]].var_name() <<
"_{"
187 <<
dof_set()[var_ind[i]].ID() <<
"}";
190 if (var_ind.
size() > 1) {
208 std::cerr <<
"WARNING: Attempting to reference invalid symmetry matrix "
210 <<
symrep_ID() <<
") in Variable::apply_sym! Continuing...\n";
216 std::set<Index> result;
225 const std::vector<DoF::RemoteHandle> &remote_handles) {
228 std::vector<DoF::RemoteHandle>::const_iterator it =
find(
229 remote_handles.begin(), remote_handles.end(),
dof_set()[i].handle());
230 if (it != remote_handles.end()) {
232 throw std::runtime_error(
233 "In Variable::register_remotes(), attempting to register dof with "
237 dof_set()[i].register_remote(*it);
247 const std::vector<Index> &after_IDs) {
266 if (!
dof_set()[i].compare((RHS->
dof_set())[i],
false))
return false;
322 *VRHS(
static_cast<Variable const *
>(RHS));
323 return (VLHS->coeffs()).dot(VRHS->
coeffs());
329 static_cast<const Variable *
>(RHS));
335 std::cerr <<
"WARNING: In-place multiplication of one Variable with another "
350 std::vector<std::shared_ptr<BasisSet> > args;
359 LOffset = LSet.
size();
360 full_dim += RSet.
size();
364 for (
Index i = 0; i < (VLHS->
coeffs()).size(); i++) {
367 for (
Index j = 0; j < (VLHS->
coeffs()).size(); j++) {
369 expon[j + LOffset]++;
370 tcoeffs(expon) = (VLHS->
coeffs())[i] * (VRHS->
coeffs())[j];
371 expon[j + LOffset]--;
Basic std::vector like container (deprecated)
double dot(Function const *LHS, Function const *RHS) const
void set_variable_basis(const DoFSet &_dof_set)
Define the basis set to contain only variables (e.g., x,y,z)
std::shared_ptr< BasisSet > shared_copy() const
const double * d_ptr() const
bool update_IDs(const std::vector< Index > &before_IDs, const std::vector< Index > &after_IDs)
Index size() const
Returns the number of components in this DoFSet.
std::string const & type_name() const
std::string m_tex_formula
virtual Function * copy() const =0
virtual jsonParser & to_json(jsonParser &json) const
static Array< Array< InnerProduct * > > inner_prod_table
static Array< Array< FunctionOperation * > > operation_table
virtual bool visit(Variable const &host, BasisSet const *bset_ptr) const
SymOp is the Coordinate representation of a symmetry operation it keeps fraction (FRAC) and Cartesian...
Eigen::MatrixXd const * get_matrix_rep(SymGroupRepID _rep_ID) const
get pointer to matrix representation corresponding to rep_ID
Function * add(Function const *LHS, Function const *RHS) const
bool compare(Function const *LHS, Function const *RHS) const
Function * add_to(Function *LHS, Function const *RHS) const
Function * multiply(Function const *LHS, Function const *RHS) const
Function * multiply_by(Function *LHS, Function const *RHS) const
Function * subtract_from(Function *LHS, Function const *RHS) const
Function * subtract(Function const *LHS, Function const *RHS) const
Variable(const Variable &old_var)=default
bool _accept(const FunctionVisitor &visitor, BasisSet const *home_basis_ptr=NULL) override
bool is_zero() const override
bool compare(const Variable *RHS) const
const DoFSet & dof_set() const
Function * minus_equals(const Variable *RHS)
void small_to_zero(double tol=TOL) override
double remote_deval(const DoF::RemoteHandle &dvar) const override
double remote_eval() const override
static void fill_dispatch_table()
double get_coefficient(Index i) const override
std::set< Index > dof_IDs() const override
int register_remotes(const std::vector< DoF::RemoteHandle > &remote_handles) override
bool _update_dof_IDs(const std::vector< Index > &before_IDs, const std::vector< Index > &after_IDs) override
const Eigen::VectorXd & coeffs() const
Function * plus_equals(const Variable *RHS)
jsonParser & to_json(jsonParser &json) const override
Index num_terms() const override
SymGroupRepID symrep_ID() const
Function * _apply_sym(const SymOp &op) override
void scale(double scale_factor) override
void make_formula() const override
double leading_coefficient() const override
void push_back(const T &toPush)
std::string to_string(ENUM val)
Return string representation of enum class.
bool almost_equal(ClusterInvariants const &A, ClusterInvariants const &B, double tol)
Check if ClusterInvariants are equal.
jsonParser & to_json(const ClexDescription &desc, jsonParser &json)
bool almost_zero(const T &val, double tol=TOL)
If T is not integral, use std::abs(val) < tol;.
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)
Eigen::MatrixXd::Index EigenIndex
bool valid_index(Index i)
INDEX_TYPE Index
For long integer indexing: