20 #ifndef _libint2_src_bin_libint_uncontract_h_ 21 #define _libint2_src_bin_libint_uncontract_h_ 56 typedef TargetType ChildType;
57 typedef typename I::BasisFunctionType BFSet;
67 SafePtr<TargetType>
target()
const {
return target_; };
69 SafePtr<ChildType> child(
unsigned int i)
const;
71 SafePtr<DGVertex>
rr_target()
const {
return static_pointer_cast<
DGVertex,TargetType>(target()); }
73 SafePtr<DGVertex>
rr_child(
unsigned int i)
const {
return static_pointer_cast<
DGVertex,ChildType>(child(i)); }
81 SafePtr<TargetType> target_;
82 vector< SafePtr<ChildType> > children_;
86 std::string generate_label()
const {
88 os <<
"Generic Contract";
93 std::string spfunction_call(
const SafePtr<CodeContext>& context,
94 const SafePtr<ImplicitDimensions>& dims)
const;
106 typedef typename I::BraType bratype;
107 typedef typename I::KetType kettype;
108 typedef typename I::OperType opertype;
109 bratype bra_unc = target_->bra();
110 kettype ket_unc = target_->ket();
112 bool target_is_contracted =
false;
114 const unsigned int np = bra_unc.num_part();
115 for(
unsigned int p=0; p<np; ++p) {
116 const unsigned int nf = bra_unc.num_members(p);
117 for(
unsigned int f=0; f<nf; ++f) {
118 target_is_contracted |= bra_unc.member(p,f).contracted();
119 bra_unc.member(p,f).uncontract();
124 const unsigned int np = ket_unc.num_part();
125 for(
unsigned int p=0; p<np; ++p) {
126 const unsigned int nf = ket_unc.num_members(p);
127 for(
unsigned int f=0; f<nf; ++f) {
128 target_is_contracted |= ket_unc.member(p,f).contracted();
129 ket_unc.member(p,f).uncontract();
133 opertype oper_unc = target_->oper();
134 const bool oper_contracted = oper_unc.descr().contracted();
135 target_is_contracted |= oper_contracted;
136 oper_unc.descr().uncontract();
138 if (target_is_contracted) {
140 std::cout <<
"Uncontract_Integral: " << target_->description() <<
" is contracted" << std::endl;
142 SafePtr<ChildType> c = ChildType::Instance(bra_unc, ket_unc,
145 children_.push_back(c);
150 SafePtr<typename Uncontract_Integral<I>::ChildType>
153 return children_.at(i);
159 const SafePtr<ImplicitDimensions>& dims)
const {
161 const unsigned int s = target_->size();
163 SafePtr<Entity> bvecdim;
164 bool vectorize =
false;
165 if (!dims->vecdim_is_static()) {
168 bvecdim = vecdim * bdim;
172 vectorize = vecdim->value() == 1 ?
false :
true;
173 bvecdim = vecdim * bdim;
179 os <<
"_libint2_static_api_inc1_short_(" 180 << context->value_to_pointer(rr_target()->symbol()) <<
"," 181 << context->value_to_pointer(rr_child(0)->symbol()) <<
"," 183 <<
")" << context->end_of_stat() << endl;
186 os <<
"_libint2_static_api_inc1_short_(" 187 << context->value_to_pointer(rr_target()->symbol()) <<
"+vi," 188 << context->value_to_pointer(rr_child(0)->symbol()) <<
",1)" << context->end_of_stat() << endl;
190 unsigned int& nflops_ref =
const_cast<unsigned int&
>(nflops_);
191 nflops_ref += target_->size();
198 bool operator()(
const SafePtr<DGVertex>& V) {
199 const unsigned int outdegree = V->num_exit_arcs();
200 if (outdegree == 0)
return false;
202 const SafePtr<DGArc> arc0 = *(V->first_exit_arc());
204 const SafePtr<DGArcRR> arcrr = dynamic_pointer_cast<
DGArcRR,
DGArc>(arc0);
205 if (arcrr == 0)
return false;
bool is_simple() const
to inline this would require a unary operator (+=).
Definition: uncontract.h:76
TrivialBFSet<T> defines static member result, which is true if T is a basis function set consisting o...
Definition: bfset.h:879
CTimeEntity is an Entity of type T that exists at compile-time of the generated code (hence has a val...
Definition: entity.h:183
Defaults definitions for various parameters assumed by Libint.
Definition: algebra.cc:23
SafePtr< TargetType > target() const
target() returns pointer to target
Definition: uncontract.h:67
Definition: stdarray.h:18
const std::string & id() const
Return id string.
Definition: entity.h:83
SafePtr< DGVertex > rr_target() const
Implementation of RecurrenceRelation's target()
Definition: uncontract.h:71
This is a vertex of a Directed Graph (DG)
Definition: dgvertex.h:42
Class DGArcRR describes arcs correspond to recurrence relations.
Definition: dgarc.h:67
Uncontract_Integral_base is dummy class used for dynamic casts only.
Definition: uncontract.h:43
RTimeEntity is an Entity of type T that exists at runtime of the generated code (hence has no value k...
Definition: entity.h:99
Entity is a base class for all objects that exist at compile or runtime of the generated code...
Definition: entity.h:78
AlgebraicOperator is an algebraic operator that acts on objects of type T.
Definition: algebra.h:47
return true if V is a decontracted IntegralSet
Definition: uncontract.h:197
Class DGArc describes arcs in a directed graph.
Definition: dgarc.h:33
RecurrenceRelation::ExprType ExprType
The type of expressions in which RecurrenceRelations result.
Definition: uncontract.h:59
SafePtr< DGVertex > rr_child(unsigned int i) const
Implementation of RecurrenceRelation's child()
Definition: uncontract.h:73
RecurrenceRelation describes all recurrence relations.
Definition: rr.h:100
Uncontract_Integral converts (a set of) contracted integral(s) to its uncontracted counterpart...
Definition: uncontract.h:52
unsigned int num_children() const
Implementation of RecurrenceRelation::num_children()
Definition: uncontract.h:65