35 #ifndef MADNESS_MRA_FUNCIMPL_H__INCLUDED 
   36 #define MADNESS_MRA_FUNCIMPL_H__INCLUDED 
   57     template <
typename T, std::
size_t NDIM>
 
   60     template<
typename T, std::
size_t NDIM>
 
   63     template<
typename T, std::
size_t NDIM>
 
   66     template<
typename T, std::
size_t NDIM>
 
   69     template<
typename T, std::
size_t NDIM>
 
   72     template<
typename T, std::
size_t NDIM, std::
size_t MDIM>
 
   84     template<
typename keyT>
 
   98                 return key.hash() % nproc;
 
  103     template <
typename keyT>
 
  114             Level n = key.level();
 
  115             if (n == 0) 
return 0;
 
  117             if (n <= 3 || (n&0x1)) hash = key.hash();
 
  118             else hash = key.parent().hash();
 
  125     template<
typename T, std::
size_t NDIM>
 
  144             _coeffs(), _norm_tree(1e300), _has_children(false) {
 
  154             _coeffs(coeff), _norm_tree(1e300), _has_children(
has_children) {
 
  159             _coeffs(coeff), _norm_tree(norm_tree), _has_children(has_children) {
 
  168             if (
this != &other) {
 
  170                 _norm_tree = other._norm_tree;
 
  171                 _has_children = other._has_children;
 
  192         bool exists()
 const {
return this->has_data();}
 
  197             return _has_children;
 
  203             return !_has_children;
 
  217             MADNESS_ASSERT(_coeffs.
ndim() == -1 || (_coeffs.
dim(0) <= 2
 
  218                                                     * MAXK && _coeffs.
dim(0) >= 0));
 
  219             return const_cast<coeffT&
>(_coeffs);
 
  227             return const_cast<const coeffT&
>(_coeffs);
 
  232             return _coeffs.
size();
 
  245             _has_children = flag;
 
  264             _has_children = 
true;
 
  270             _has_children = !flag;
 
  276             if ((_coeffs.
has_data()) and ((_coeffs.
dim(0) < 0) || (_coeffs.
dim(0)>2*MAXK))) {
 
  277                 print(
"set_coeff: may have a problem");
 
  278                 print(
"set_coeff: coeff.dim[0] =", coeffs.
dim(0), 
", 2* MAXK =", 2*MAXK);
 
  280             MADNESS_ASSERT(coeffs.
dim(0)<=2*MAXK && coeffs.
dim(0)>=0);
 
  289         template <
typename Q>
 
  310         template <
typename Q, 
typename R>
 
  313             if (other.has_children())
 
  314                 _has_children = 
true;
 
  316                 if (other.has_coeff()) {
 
  320                     coeff().scale(alpha);
 
  323             else if (other.has_coeff()) {
 
  332             double cpu0=cpu_time();
 
  350                 if ((!_has_children) && key.
level()> 0) {
 
  355             double cpu1=cpu_time();
 
  363             double cpu0=cpu_time();
 
  388                 if ((!_has_children) && key.
level()> 0) {
 
  393             double cpu1=cpu_time();
 
  408             return this->_coeffs.trace_conj((rhs._coeffs));
 
  411         template <
typename Archive>
 
  413             ar & 
coeff() & _has_children & _norm_tree;
 
  418     template <
typename T, std::
size_t NDIM>
 
  419     std::ostream& operator<<(std::ostream& s, const FunctionNode<T,NDIM>& node) {
 
  420         s << 
"(has_coeff=" << node.has_coeff() << 
", has_children=" << node.has_children() << 
", norm=";
 
  421         double norm = node.has_coeff() ? node.coeff().normf() : 0.0;
 
  424         double nt = node.get_norm_tree();
 
  425         if (nt == 1e300) nt = 0.0;
 
  426         s << norm << 
", norm_tree=" << nt << 
"), rank="<< node.coeff().rank()<<
")";
 
  433     template<
typename T, std::
size_t NDIM>
 
  445             return (not f->
get_coeffs().
find(key).get()->second.has_children());
 
  448         template <
typename Archive> 
void serialize (Archive& ar) {
 
  455     template<
typename T, std::
size_t NDIM>
 
  479             if (key.
level()<2) 
return false;
 
  480             coeffT upsampled=f->
upsample(key,parent);
 
  481             upsampled.scale(-1.0);
 
  483             const double dnorm=upsampled.normf();
 
  488         template <
typename Archive> 
void serialize (Archive& ar) {ar & 
f;}
 
  492     template<
typename T, 
size_t NDIM>
 
  519             if (key.
level()<2) 
return false;
 
  521             std::vector<Slice> s0(
NDIM/2,s);
 
  526             const double fnorm=fcoeff.normf();
 
  527             const double gnorm=gcoeff.normf();
 
  530             const double norm=fnorm*gnorm;  
 
  531             if (norm < thresh) 
return true;
 
  534             const double sfnorm=fcoeff(s0).normf();
 
  535             const double sgnorm=gcoeff(s0).normf();
 
  539             const double ferror=
sqrt(std::abs(fnorm*fnorm-sfnorm*sfnorm));
 
  540             const double gerror=
sqrt(std::abs(gnorm*gnorm-sgnorm*sgnorm));
 
  543             const double error=fnorm*gerror + ferror*gnorm + ferror*gerror;
 
  546             if (error < thresh) 
return true;
 
  549         template <
typename Archive> 
void serialize (Archive& ar) {
 
  556     template<
typename T, 
size_t NDIM, 
typename opT>
 
  572             if (key.
level()<2) 
return false;
 
  573             const double cnorm=coeff.normf();
 
  579             if (key.
level()<2) 
return false;
 
  582             const opkeyT source=op->get_source_key(key);
 
  585             const std::vector<opkeyT>& disp = op->get_disp(key.
level());
 
  586             const opkeyT& d = *disp.begin();         
 
  587             const double opnorm = op->norm(key.
level(), d, source);
 
  588             const double norm=opnorm*cnorm;
 
  593         template <
typename Archive> 
void serialize (Archive& ar) {
 
  602     template<
typename T, 
size_t NDIM, 
size_t LDIM, 
typename opT>
 
  615             : f(f), g(g), op(op) {}
 
  634             if (key.
level()<2) 
return false;
 
  639             const double fnorm=fcoeff.normf();
 
  640             const double gnorm=gcoeff.normf();
 
  643             const double sfnorm=fcoeff(g->
get_cdata().s0).normf();
 
  644             const double sgnorm=gcoeff(g->
get_cdata().s0).normf();
 
  647             const double norm=fnorm*gnorm;  
 
  648             if (norm < thresh) 
return true;
 
  651             const double ferror=
sqrt(fnorm*fnorm-sfnorm*sfnorm);
 
  652             const double gerror=
sqrt(gnorm*gnorm-sgnorm*sgnorm);
 
  655             const double error=fnorm*gerror + ferror*gnorm + ferror*gerror;
 
  656             if (error < thresh) 
return true;
 
  659             const std::vector<Key<NDIM> >& disp = op->get_disp(key.
level());
 
  661             const double opnorm = op->norm(key.
level(), d, key);
 
  662             const double final_norm=opnorm*sfnorm*sgnorm;
 
  663             if (final_norm < thresh) 
return true;
 
  667         template <
typename Archive> 
void serialize (Archive& ar) {
 
  672     template<
typename T, 
size_t NDIM>
 
  679         template <
typename Archive> 
void serialize (Archive& ar) {}
 
  683     template<
typename T, std::
size_t NDIM>
 
  694         void operator()(
const keyT& key, 
const coeffT& coeff, 
const bool& is_leaf)
 const {
 
  697         template <
typename Archive> 
void serialize (Archive& ar) {
 
  703     template<
size_t NDIM>
 
  709         template<
typename T, 
typename R>
 
  711         template <
typename Archive> 
void serialize (Archive& ar) {}
 
  716     template<
typename T, std::
size_t NDIM>
 
  725             : _coeffs(node.
coeff()), _has_children(node._has_children) {}
 
  731         template <
typename Archive>
 
  755     template<
typename T, 
size_t NDIM>
 
  762         enum LeafStatus {no, yes, unknown};
 
  784                                                                                 coeff_(datum.second.
coeff()) {
 
  785             if (datum.second.is_leaf()) is_leaf_=yes;
 
  791                                                   is_leaf_(other.is_leaf_), coeff_(other.coeff_) {}
 
  797         const coeffT& 
coeff()
 const {
return coeff_;}
 
  800         const keyT& 
key()
 const {
return key_;}
 
  809             MADNESS_ASSERT(impl);
 
  816         const LeafStatus& 
is_leaf()
 const {
return is_leaf_;}
 
  822             if ((not impl) or impl->is_on_demand()) 
return CoeffTracker(*
this);
 
  825             MADNESS_ASSERT((is_leaf_==yes) or (is_leaf_==no));
 
  830                 if (is_leaf_==yes) result.key_=key_;
 
  836                 result.is_leaf_=unknown;
 
  856             return impl->world.taskq.add(*const_cast<CoeffTracker*> (
this),
 
  857                                          &CoeffTracker::forward_ctor,*
this,datum1);
 
  868         template <
typename Archive> 
void serialize(
const Archive& ar) {
 
  869             int il=int(is_leaf_);
 
  870             ar & impl & key_ & il & coeff_;
 
  871             is_leaf_=LeafStatus(il);
 
  875     template<
typename T, std::
size_t NDIM>
 
  877     operator<<(std::ostream& s, const CoeffTracker<T,NDIM>& ct) {
 
  878         s << ct.key() << ct.is_leaf() << 
" " << ct.get_impl();
 
  897     template <
typename T, std::
size_t NDIM>
 
  898     class FunctionImpl : 
public WorldObject< FunctionImpl<T,NDIM> > {
 
  900         typedef WorldObject< FunctionImpl<T,NDIM> > woT; 
 
  910         typedef std::pair<const keyT,nodeT> 
datumT; 
 
  922         int max_refine_level; 
 
  925         bool truncate_on_project; 
 
  955             , world(factory._world)
 
  957             , thresh(factory._thresh)
 
  958             , initial_level(factory._initial_level)
 
  959             , max_refine_level(factory._max_refine_level)
 
  960             , truncate_mode(factory._truncate_mode)
 
  961             , autorefine(factory._autorefine)
 
  962             , truncate_on_project(factory._truncate_on_project)
 
  967             , on_demand(factory._is_on_demand)
 
  970             , coeffs(world,factory._pmap,false)
 
  980             bool do_refine = factory.
_refine;
 
  983                 initial_level = 
std::max(0,initial_level - 1);
 
  987             } 
else if (functor) { 
 
  991                     if (it->second.is_leaf())
 
  993                                   functor->special_points());
 
 1003             if (factory.
_fence && functor)
 
 1013         template <
typename Q>
 
 1018             , world(other.world)
 
 1020             , thresh(other.thresh)
 
 1021             , initial_level(other.initial_level)
 
 1022             , max_refine_level(other.max_refine_level)
 
 1023             , truncate_mode(other.truncate_mode)
 
 1024                          , autorefine(other.autorefine)
 
 1025                          , truncate_on_project(other.truncate_on_project)
 
 1026                          , nonstandard(other.nonstandard)
 
 1027                          , targs(other.targs)
 
 1031                          , compressed(other.compressed)
 
 1032                          , redundant(other.redundant)
 
 1033                          , coeffs(world, pmap ? pmap : other.coeffs.
get_pmap())
 
 1049         template <
typename Q>
 
 1054                 const keyT& key = it->first;
 
 1056                 coeffs.
replace(key,node. 
template convert<Q>());
 
 1063         template<
typename Q, 
typename R>
 
 1081         template<
typename Q, 
typename R>
 
 1100                                      const double beta, 
const implT& 
g, 
const bool fence);
 
 1102         template <
typename Q, 
typename R>
 
 1111                 const keyT& key = it->first;
 
 1114                 f->coeffs.send(key, &nodeT:: template gaxpy_inplace<Q,R>, alpha, other_node, beta);
 
 1117             template <
typename Archive>
 
 1122         template <
typename Q, 
typename R>
 
 1127             typedef do_gaxpy_inplace<Q,R> opT;
 
 1133         template <
typename Archive>
 
 1142             ar & thresh & initial_level & max_refine_level & truncate_mode
 
 1143                 & autorefine & truncate_on_project & nonstandard & compressed ; 
 
 1149         template <
typename Archive>
 
 1154             ar & k & thresh & initial_level & max_refine_level & truncate_mode
 
 1155                 & autorefine & truncate_on_project & nonstandard & compressed ; 
 
 1222         void truncate(
double tol, 
bool fence);
 
 1236         void fcube(
const keyT& key,  
T (*f)(
const coordT&), 
const Tensor<double>& qx, tensorT& fval) 
const;
 
 1238         const keyT& 
key0() 
const;
 
 1240         void print_tree(std::ostream& os = std::cout, 
Level maxlevel = 10000) 
const;
 
 1262                     val2=0.7-(0.7/upper)*val2;
 
 1266                     double hue=0.7-(0.7/
limit)*(val);
 
 1285         Tensor<double> 
print_plane_local(
const int xaxis, 
const int yaxis, 
const coordT& el2);
 
 1289                             const int xaxis, 
const int yaxis, 
const coordT el2);
 
 1310         template<
size_t FDIM>
 
 1315             std::ifstream kfile(keyfile.c_str());
 
 1316             std::ifstream gfile(gridfile.c_str());
 
 1320             if (not (std::getline(kfile,line))) 
MADNESS_EXCEPTION(
"failed reading 1st line of key data",0);
 
 1321             if (not (std::istringstream(line) >> ndata)) 
MADNESS_EXCEPTION(
"failed reading k",0);
 
 1322             if (not (std::getline(gfile,line))) 
MADNESS_EXCEPTION(
"failed reading 1st line of grid data",0);
 
 1323             if (not (std::istringstream(line) >> ndata1)) 
MADNESS_EXCEPTION(
"failed reading k",0);
 
 1325             if (not (std::getline(kfile,line))) 
MADNESS_EXCEPTION(
"failed reading 2nd line of key data",0);
 
 1326             if (not (std::getline(gfile,line))) 
MADNESS_EXCEPTION(
"failed reading 2nd line of grid data",0);
 
 1329             const Tensor<double> qx=cdata.
quad_x;
 
 1330             const size_t npt = qx.dim(0);
 
 1333             long npoints=power<NDIM>(npt);
 
 1335             long nboxes=ndata/npoints;
 
 1337             print(
"reading ",nboxes,
"boxes from file",gridfile,keyfile);
 
 1340             Tensor<T> values(cdata.
vk,
false);
 
 1345             while (std::getline(kfile,kline)) {
 
 1347                 double x,y,z,x1,y1,z1,val;
 
 1355                 std::stringstream(kline) >>  nn >> l1 >> l2 >> l3;
 
 1363                 const double h = std::pow(0.5,
double(n));
 
 1370                     for (
int i=0; i<npt; ++i) {
 
 1371                         c[0] = cell(0,0) + h*cell_width[0]*(l[0] + qx(i)); 
 
 1372                         for (
int j=0; j<npt; ++j) {
 
 1373                             c[1] = cell(1,0) + h*cell_width[1]*(l[1] + qx(j)); 
 
 1374                             for (
int k=0; k<npt; ++k) {
 
 1375                                 c[2] = cell(2,0) + h*cell_width[2]*(l[2] + qx(k)); 
 
 1379                                 std::istringstream(gline) >> x >> y >> z >> val;
 
 1380                                 std::istringstream(kline) >> x1 >> y1 >> z1;
 
 1389                                 if (vnuc_functor) val-=(*vnuc_functor)(
c);
 
 1399                 const bool has_children=
false;
 
 1401                 nodeT node(coeff,has_children);
 
 1418         template<
size_t FDIM>
 
 1423             std::ifstream gfile(gridfile.c_str());
 
 1427             if (not (std::getline(gfile,line))) 
MADNESS_EXCEPTION(
"failed reading 1st line of grid data",0);
 
 1428             if (not (std::istringstream(line) >> ndata)) 
MADNESS_EXCEPTION(
"failed reading k",0);
 
 1429             if (not (std::getline(gfile,line))) 
MADNESS_EXCEPTION(
"failed reading 2nd line of grid data",0);
 
 1432             const Tensor<double> qx=cdata.
quad_x;
 
 1433             const size_t npt = qx.dim(0);
 
 1436             long npoints=power<NDIM>(npt);
 
 1438             long nboxes=ndata/npoints;
 
 1440             print(
"reading ",nboxes,
"boxes from file",gridfile);
 
 1443             Tensor<T> values(cdata.
vk,
false);
 
 1448             while (std::getline(gfile,gline)) {
 
 1450                 double x1,y1,z1,val;
 
 1457                 std::stringstream(gline) >>  nn >> l1 >> l2 >> l3;
 
 1464                 const double h = std::pow(0.5,
double(n));
 
 1471                     for (
int i=0; i<npt; ++i) {
 
 1472                         c[0] = cell(0,0) + h*cell_width[0]*(l[0] + qx(i)); 
 
 1473                         for (
int j=0; j<npt; ++j) {
 
 1474                             c[1] = cell(1,0) + h*cell_width[1]*(l[1] + qx(j)); 
 
 1475                             for (
int k=0; k<npt; ++k) {
 
 1476                                 c[2] = cell(2,0) + h*cell_width[2]*(l[2] + qx(k)); 
 
 1479                                 std::istringstream(gline) >> x1 >> y1 >> z1 >> val;
 
 1485                                 if (vnuc_functor) val-=(*vnuc_functor)(
c);
 
 1495                 const bool has_children=
false;
 
 1497                 nodeT node(coeff,has_children);
 
 1512         tensorT 
project(
const keyT& key) 
const;
 
 1522         double truncate_tol(
double tol, 
const keyT& key) 
const;
 
 1526         std::vector<Slice> 
child_patch(
const keyT& child) 
const;
 
 1542         const coeffT 
parent_to_child(
const coeffT& s, 
const keyT& parent, 
const keyT& child) 
const;
 
 1553                                   const coeffT& coeff) 
const;
 
 1564         template <
typename Q>
 
 1580         template <
typename Q>
 
 1582                                      const bool s_only)
 const {
 
 1590             Tensor<double> quad_phit_2k(2*cdata.
k,2*cdata.
npt);
 
 1591             quad_phit_2k(cdata.
s[0],cdata.
s[0])=cdata.
quad_phit;
 
 1592             quad_phit_2k(cdata.
s[1],cdata.
s[1])=cdata.
quad_phit;
 
 1595             const Tensor<double> transf = (s_only)
 
 1597                 : 
inner(cdata.
hg,quad_phit_2k);                                 
 
 1603             return transform(coeff,transf).scale(scale);
 
 1616         template <
typename Q>
 
 1630                 Tensor<double> quad_phi[
NDIM];
 
 1632                 Tensor<double> phi1(cdata.
k,cdata.
npt);
 
 1634                 for (std::size_t d=0; d<
NDIM; ++d) {
 
 1637                     quad_phi[d]=Tensor<double>(cdata.
k,2*cdata.
npt);
 
 1643                     quad_phi[d](_,
Slice(0,k-1))=phi1;
 
 1648                     quad_phi[d](_,
Slice(k,2*k-1))=phi1;
 
 1665         template <
typename Q>
 
 1673             Tensor<double> quad_phit_2k(2*cdata.
npt,2*cdata.
k);
 
 1674             quad_phit_2k(cdata.
s[0],cdata.
s[0])=cdata.
quad_phiw;
 
 1675             quad_phit_2k(cdata.
s[1],cdata.
s[1])=cdata.
quad_phiw;
 
 1678             const Tensor<double> transf=
inner(quad_phit_2k,cdata.
hgT);
 
 1684             return transform(values,transf).scale(scale);
 
 1687         template <
typename Q>
 
 1694         template <
typename Q>
 
 1701         template <
typename Q>
 
 1712         template <
typename Q>
 
 1713         Tensor<Q> 
fcube_for_mul(
const keyT& child, 
const keyT& parent, 
const Tensor<Q>& coeff)
 const {
 
 1719                 MADNESS_EXCEPTION(
"FunctionImpl: fcube_for_mul: child-parent relationship bad?",0);
 
 1722                 Tensor<double> phi[
NDIM];
 
 1723                 for (std::size_t d=0; d<
NDIM; ++d) {
 
 1724                     phi[d] = Tensor<double>(cdata.
k,cdata.
npt);
 
 1737         template <
typename Q>
 
 1744                 MADNESS_EXCEPTION(
"FunctionImpl: fcube_for_mul: child-parent relationship bad?",0);
 
 1747                 Tensor<double> phi[
NDIM];
 
 1748                 for (
size_t d=0; d<
NDIM; d++) {
 
 1749                     phi[d] = Tensor<double>(cdata.
k,cdata.
npt);
 
 1759         template <
typename L, 
typename R>
 
 1760         Void do_mul(
const keyT& key, 
const Tensor<L>& left, 
const std::pair< keyT, Tensor<R> >& 
arg) {
 
 1762             const keyT& rkey = 
arg.first;
 
 1763             const Tensor<R>& rcoeff = 
arg.second;
 
 1769             Tensor<T> tcube(cdata.
vk,
false);
 
 1785         template<
typename R>
 
 1786         Tensor<TENSOR_RESULT_TYPE(T,R)> 
mul(
const Tensor<T>& c1, 
const Tensor<R>& c2,
 
 1787                                             const int npt, 
const keyT& key)
 const {
 
 1793             Tensor<T> c11(cdata2.
vk), c22(cdata2.
vk);
 
 1794             c11(this->cdata.
s0)=c1;
 
 1795             c22(this->cdata.
s0)=c2;
 
 1801             Tensor<resultT> resultvalue(cdata2.
vk,
false);
 
 1807             return copy(result(this->cdata.
s0));
 
 1812         template <
typename L, 
typename R, 
typename opT>
 
 1814                             const std::pair< keyT, Tensor<R> >& 
arg,
 
 1817           const keyT& rkey = 
arg.first;
 
 1818           const Tensor<R>& rcoeff = 
arg.second;
 
 1822           Tensor<T> tcube(cdata.
vk,
false);
 
 1823           op(key, tcube, lcube, rcube);
 
 1836         template <
typename L, 
typename R>
 
 1846                 const keyT& key = it->first;
 
 1848                 coeffs.
send(key, &nodeT:: template gaxpy_inplace<T,L>, 1.0, other_node, alpha);
 
 1854                 const keyT& key = it->first;
 
 1856                 coeffs.
send(key, &nodeT:: template gaxpy_inplace<T,R>, 1.0, other_node, beta);
 
 1863         template <
typename opT>
 
 1867                 const keyT& parent = it->first;
 
 1868                 nodeT& node = it->second;
 
 1883         template <
typename opT>
 
 1887                 const keyT& parent = it->first;
 
 1888                 nodeT& node = it->second;
 
 1896         template <
typename opT>
 
 1899             typedef do_unary_op_value_inplace<opT> xopT;
 
 1906         template <
typename opT>
 
 1909             typedef do_unary_op_value_inplace<opT> xopT;
 
 1930                 const keyT& key = it->first;
 
 1931                 nodeT& node = it->second;
 
 1936                     const double error=d.normf();
 
 1942             template <
typename Archive> 
void serialize(
const Archive& ar) {}
 
 1956                 nodeT& node = it->second;
 
 1960             template <
typename Archive> 
void serialize(
const Archive& ar) {}
 
 1975                 nodeT& node = it->second;
 
 1976                 coeffT s=
copy(node.
coeff()(impl->cdata.s0));
 
 1980             template <
typename Archive> 
void serialize(
const Archive& ar) {}
 
 2002                 nodeT& node = it->second;
 
 2006             template <
typename Archive> 
void serialize(
const Archive& ar) {}
 
 2021                 const keyT& key = it->first;
 
 2022                 const nodeT& fnode = it->second;
 
 2030                 std::vector<long> map(
NDIM);
 
 2031                 map[0]=3; map[1]=4; map[2]=5;
 
 2032                 map[3]=0; map[4]=1; map[5]=2;
 
 2037                 const keyT mapkey(key.
level(),l);
 
 2048                     bool have_c2=mapnode.coeff().has_data() and mapnode.coeff().config().has_data();
 
 2050                     if (have_c1 and have_c2) {
 
 2052                         tensorT c2=mapnode.coeff().full_tensor_copy();
 
 2053                         c2 = 
copy(c2.mapdim(map));
 
 2054                         norm=(c1-c2).normf();
 
 2055                     } 
else if (have_c1) {
 
 2058                     } 
else if (have_c2) {
 
 2059                         tensorT c2=mapnode.coeff().full_tensor_copy();
 
 2065                     norm=fnode.
coeff().normf();
 
 2074             template <
typename Archive> 
void serialize(
const Archive& ar) {
 
 2085         template<
typename Q, 
typename R>
 
 2093                 : other(&other), alpha(alpha), beta(beta) {}
 
 2098                 const keyT& key = it->first;
 
 2099                 const nodeT& fnode = it->second;
 
 2105                     nodeT& gnode=acc->second;
 
 2115             template <
typename Archive> 
void serialize(
const Archive& ar) {
 
 2129             do_mapdim(
const std::vector<long> map, implT& f) : map(map), f(&f) {}
 
 2133                 const keyT& key = it->first;
 
 2134                 const nodeT& node = it->second;
 
 2139                 if (c.size()) c = 
copy(c.mapdim(map));
 
 2145             template <
typename Archive> 
void serialize(
const Archive& ar) {
 
 2163                 const keyT& key = it->first;
 
 2164                 const nodeT& fnode = it->second;
 
 2172                         nodeT& gnode=acc->second;
 
 2181             template <
typename Archive> 
void serialize(
const Archive& ar) {}
 
 2198                 nodeT& node = it->second;
 
 2203             template <
typename Archive> 
void serialize(
const Archive& ar) {}
 
 2216                 it->second.consolidate_buffer(targs);
 
 2219             template <
typename Archive> 
void serialize(
const Archive& ar) {}
 
 2224         template <
typename opT>
 
 2231                 const keyT& key = it->first;
 
 2232                 nodeT& node = it->second;
 
 2241                     t = 
transform(values,impl->cdata.quad_phiw).scale(scale);
 
 2248             template <
typename Archive> 
void serialize(
const Archive& ar) {}
 
 2251         template <
typename Q, 
typename R>
 
 2258             std::vector<unsigned int> ind(vleft.size());
 
 2259             for (
unsigned int i=0; i<vleft.size(); ++i) {
 
 2262             for (
unsigned int i=0; i<vleft.size(); ++i) {
 
 2269                 if (it->second.has_coeff()) {
 
 2272                     double norm = r.normf();
 
 2275                     for (
unsigned int j=0; j<vleft.size(); ++j) {
 
 2276                         unsigned int i = ind[j]; 
 
 2277                         if (std::abs(norm*
c(i)) > keytol) {
 
 2278                             implT* left = vleft[i].get();
 
 2280                             bool newnode = left->coeffs.
insert(acc,key);
 
 2281                             if (newnode && key.
level()>0) {
 
 2285                             nodeT& node = acc->second;
 
 2288                             coeffT& t = node.
coeff();
 
 2289                             t.gaxpy(1.0, r, 
c(i));
 
 2303                                     const std::vector<tensorT>& 
c,
 
 2306         template <
typename opT>
 
 2308             std::vector<tensorT> 
c(v.size());
 
 2309             for (
unsigned int i=0; i<v.size(); i++) {
 
 2310                 c[i] = 
coeffs2values(key, v[i]->coeffs.
find(key).get()->second.coeff().full_tensor_copy()); 
 
 2312             tensorT r = 
op(key, 
c);
 
 2318         template <
typename opT>
 
 2322                 const keyT& key = it->first;
 
 2323                 if (it->second.has_coeff())
 
 2324                     world.
taskq.
add(*
this, &implT:: template multiop_values_doit<opT>, key, op, v);
 
 2332         template <
typename Q, 
typename R>
 
 2338             for (
unsigned int j=0; j<vright.size(); ++j) {
 
 2339                 world.
taskq.
add(*
this, &implT:: template vtransform_doit<Q,R>, vright[j], 
copy(
c(j,_)), vleft, tol);
 
 2346         template <
typename opT>
 
 2349             typedef do_unary_op_value_inplace<opT> xopT;
 
 2356         template <
typename L, 
typename R>
 
 2360                        const std::vector< Tensor<R> >& vrcin,
 
 2366             double lnorm = 1e99;
 
 2367             Tensor<L> lc = lcin;
 
 2368             if (lc.size() == 0) {
 
 2369                 literT it = left->coeffs.find(key).get();
 
 2371                 lnorm = it->second.get_norm_tree();
 
 2372                 if (it->second.has_coeff())
 
 2373                     lc = it->second.coeff().full_tensor_copy();
 
 2377             std::vector<FunctionImpl<T,NDIM>*> vresult;
 
 2378             std::vector<const FunctionImpl<R,NDIM>*> vright;
 
 2379             std::vector< Tensor<R> > vrc;
 
 2380             vresult.reserve(vrightin.size());
 
 2381             vright.reserve(vrightin.size());
 
 2382             vrc.reserve(vrightin.size());
 
 2384             for (
unsigned int i=0; i<vrightin.size(); ++i) {
 
 2387                 Tensor<R> rc = vrcin[i];
 
 2389                 if (rc.size() == 0) {
 
 2390                     riterT it = right->coeffs.
find(key).get();
 
 2392                     rnorm = it->second.get_norm_tree();
 
 2393                     if (it->second.has_coeff())
 
 2394                         rc = it->second.coeff().full_tensor_copy();
 
 2400                 if (rc.size() && lc.size()) { 
 
 2401                     result->task(world.
rank(), &implT:: template do_mul<L,R>, key, lc, std::make_pair(key,rc));
 
 2403                 else if (tol && lnorm*rnorm < 
truncate_tol(tol, key)) {
 
 2404                     result->coeffs.replace(key, 
nodeT(
coeffT(cdata.
vk,targs),
false)); 
 
 2407                     result->coeffs.replace(key, 
nodeT(
coeffT(),
true));
 
 2408                     vresult.push_back(result);
 
 2409                     vright.push_back(right);
 
 2414             if (vresult.size()) {
 
 2417                     Tensor<L> ld(cdata.
v2k);
 
 2418                     ld(cdata.
s0) = lc(___);
 
 2419                     lss = left->unfilter(ld);
 
 2422                 std::vector< Tensor<R> > vrss(vresult.size());
 
 2423                 for (
unsigned int i=0; i<vresult.size(); ++i) {
 
 2424                     if (vrc[i].
size()) {
 
 2425                         Tensor<R> rd(cdata.
v2k);
 
 2426                         rd(cdata.
s0) = vrc[i](___);
 
 2427                         vrss[i] = vright[i]->unfilter(rd);
 
 2432                     const keyT& child = kit.key();
 
 2440                     std::vector< Tensor<R> > vv(vresult.size());
 
 2441                     for (
unsigned int i=0; i<vresult.size(); ++i) {
 
 2443                             vv[i] = 
copy(vrss[i](cp));
 
 2446                     woT::task(coeffs.
owner(child), &implT:: template mulXXveca<L,R>, child, left, ll, vright, vv, vresult, tol);
 
 2453         template <
typename L, 
typename R>
 
 2461             double lnorm=1e99, rnorm=1e99;
 
 2463             Tensor<L> lc = lcin;
 
 2464             if (lc.size() == 0) {
 
 2465                 literT it = left->coeffs.find(key).get();
 
 2467                 lnorm = it->second.get_norm_tree();
 
 2468                 if (it->second.has_coeff())
 
 2469                     lc = it->second.coeff().full_tensor_copy();
 
 2472             Tensor<R> rc = rcin;
 
 2473             if (rc.size() == 0) {
 
 2474                 riterT it = right->coeffs.
find(key).get();
 
 2476                 rnorm = it->second.get_norm_tree();
 
 2477                 if (it->second.has_coeff())
 
 2478                     rc = it->second.coeff().full_tensor_copy();
 
 2482             if (rc.size() && lc.size()) { 
 
 2483                 do_mul<L,R>(key, lc, std::make_pair(key,rc));
 
 2503                 Tensor<L> ld(cdata.
v2k);
 
 2504                 ld(cdata.
s0) = lc(___);
 
 2505                 lss = left->unfilter(ld);
 
 2510                 Tensor<R> rd(cdata.
v2k);
 
 2511                 rd(cdata.
s0) = rc(___);
 
 2516                 const keyT& child = kit.key();
 
 2524                 woT::task(coeffs.
owner(child), &implT:: template mulXXa<L,R>, child, left, ll, right, rr, tol);
 
 2532         template <
typename L, 
typename R, 
typename opT>
 
 2540             Tensor<L> lc = lcin;
 
 2541             if (lc.size() == 0) {
 
 2542                 literT it = left->coeffs.find(key).get();
 
 2544                 if (it->second.has_coeff())
 
 2545                     lc = it->second.coeff().full_tensor_copy();
 
 2548             Tensor<R> rc = rcin;
 
 2549             if (rc.size() == 0) {
 
 2550                 riterT it = right->coeffs.
find(key).get();
 
 2552                 if (it->second.has_coeff())
 
 2553                     rc = it->second.coeff().full_tensor_copy();
 
 2556             if (rc.size() && lc.size()) { 
 
 2557                 do_binary_op<L,R>(key, lc, std::make_pair(key,rc), 
op);
 
 2566                 Tensor<L> ld(cdata.
v2k);
 
 2567                 ld(cdata.
s0) = lc(___);
 
 2568                 lss = left->unfilter(ld);
 
 2573                 Tensor<R> rd(cdata.
v2k);
 
 2574                 rd(cdata.
s0) = rc(___);
 
 2579                 const keyT& child = kit.key();
 
 2587                 woT::task(coeffs.
owner(child), &implT:: template binaryXXa<L,R,opT>, child, left, ll, right, rr, 
op);
 
 2593         template <
typename Q, 
typename opT>
 
 2602                 : impl_func(impl_func), op(op) {}
 
 2607                 Tensor<resultT> outvalues = 
op(key, invalues);
 
 2612             template <
typename Archive>
 
 2614                 ar & impl_func & 
op;
 
 2619         template <
typename Q, 
typename opT>
 
 2624             const Tensor<Q> fc = func->coeffs.
find(key).get()->second.coeff().full_tensor_copy();
 
 2626             if (fc.size() == 0) {
 
 2630                     const keyT& child = kit.key();
 
 2635                 tensorT t=
op(key,fc);
 
 2642         template <
typename L, 
typename R>
 
 2645                 mulXXa(cdata.
key0, left, Tensor<L>(), right, Tensor<R>(), tol);
 
 2652         template <
typename L, 
typename R, 
typename opT>
 
 2654                       const opT& 
op, 
bool fence) {
 
 2656                 binaryXXa(cdata.
key0, left, Tensor<L>(), right, Tensor<R>(), op);
 
 2663         template <
typename Q, 
typename opT>
 
 2673         template <
typename Q, 
typename opT>
 
 2676                 unaryXXa(cdata.
key0, func, coeff_value_adaptor<Q,opT>(func,op));
 
 2683         template <
typename L, 
typename R>
 
 2689             std::vector< Tensor<R> > vr(vright.size());
 
 2691                 mulXXveca(cdata.
key0, left, Tensor<L>(), vright, vr, vresult, tol);
 
 2742                               const coordT& plotlo, 
const coordT& plothi, 
const std::vector<long>& npt,
 
 2743                               bool eval_refine) 
const;
 
 2750                                  const coordT& plothi,
 
 2751                                  const std::vector<long>& npt,
 
 2752                                  const bool eval_refine = 
false) 
const;
 
 2806         void tnorm(
const tensorT& t, 
double* lo, 
double* hi) 
const;
 
 2815         bool noautorefine(
const keyT& key, 
const tensorT& t) 
const;
 
 2835         template<
size_t LDIM>
 
 2851                 : h(h), f(f), g(g), particle(particle) {};
 
 2856             bool screen(
const coeffT& fcoeff, 
const coeffT& gcoeff, 
const keyT& key)
 const {
 
 2857                 double glo=0.0, ghi=0.0, flo=0.0, fhi=0.0;
 
 2863                 const long rank=fcoeff.
rank();
 
 2864                 const long maxk=fcoeff.
dim(0);
 
 2865                 tensorT 
vec=fcoeff.
config().ref_vector(particle-1).reshape(rank,maxk,maxk,maxk);
 
 2866                 for (
long i=0; i<rank; ++i) {
 
 2868                     tensorT 
c=
vec(
Slice(i,i),_,_,_).reshape(maxk,maxk,maxk);
 
 2870                     flo+=lo*fcoeff.
config().weights(i);
 
 2871                     fhi+=hi*fcoeff.
config().weights(i);
 
 2873                 double total_hi=glo*fhi + ghi*flo + fhi*ghi;
 
 2890                 const Key<LDIM> gkey= (particle==1) ? key1 : key2;
 
 2899                 bool is_leaf=
screen(coeff1,coeff2,key);
 
 2900                 if (key.
level()<2) is_leaf=
false;
 
 2912                     const long rank=hvalues.
rank();
 
 2913                     const long maxk=h->
get_k();
 
 2915                     tensorT 
vec=hvalues.
config().ref_vector(particle-1).reshape(rank,maxk,maxk,maxk);
 
 2916                     for (
long i=0; i<rank; ++i) {
 
 2925                 return std::pair<bool,coeffT> (is_leaf,hcoeff);
 
 2933                 const Key<LDIM> gkey= (particle==1) ? key1 : key2;
 
 2945             this_type 
forward_ctor(implT* h1, 
const ctT& 
f1, 
const ctL& g1, 
const int particle) {
 
 2949             template <
typename Archive> 
void serialize(
const Archive& ar) {
 
 2969             add_op(
const ctT& f, 
const ctT& g, 
const double alpha, 
const double beta)
 
 2970                 : f(f), g(g), alpha(alpha), beta(beta){}
 
 2976                 if (not is_leaf) 
return std::pair<bool,coeffT> (is_leaf,
coeffT());
 
 2980                 coeffT hcoeff=
copy(fcoeff);
 
 2981                 hcoeff.gaxpy(alpha,gcoeff,beta);
 
 2983                 return std::pair<bool,coeffT> (is_leaf,hcoeff);
 
 2999             this_type 
forward_ctor(
const ctT& 
f1, 
const ctT& g1, 
const double alpha, 
const double beta) {
 
 3003             template <
typename Archive> 
void serialize(
const Archive& ar) {
 
 3004                 ar & f & g & alpha & 
beta;
 
 3017         template<
size_t LDIM>
 
 3022             if (world.
rank() == coeffs.
owner(key0)) {
 
 3027                 typedef multiply_op<LDIM> coeff_opT;
 
 3028                 coeff_opT coeff_op(
this,ff,gg,particle);
 
 3031                 apply_opT apply_op(
this);
 
 3034                 woT::task(p, &implT:: template forward_traverse<coeff_opT,apply_opT>, coeff_op, apply_op, key0);
 
 3037             this->compressed=
false;
 
 3043         template<
size_t LDIM, 
typename leaf_opT>
 
 3056             hartree_op(implT* result, 
const ctL& p11, 
const ctL& p22, 
const leaf_opT& leaf_op)
 
 3057                 : result(result), p1(p11), p2(p22), leaf_op(leaf_op) {
 
 3068                 const coeffT fcoeff=p1.
coeff(key1);
 
 3069                 const coeffT gcoeff=p2.
coeff(key2);
 
 3071                 if (not is_leaf) 
return std::pair<bool,coeffT> (is_leaf,
coeffT());
 
 3074                 const coeffT s1=fcoeff(p1.
get_impl()->cdata.s0);
 
 3075                 const coeffT s2=gcoeff(p2.
get_impl()->cdata.s0);
 
 3078                 coeffT coeff=
outer(s1,s2);
 
 3082                 return std::pair<bool,coeffT>(is_leaf,coeff);
 
 3097                 return result->
world.
taskq.
add(*const_cast<this_type *> (
this),
 
 3101             this_type 
forward_ctor(implT* result1, 
const ctL& p11, 
const ctL& p22, 
const leaf_opT& leaf_op) {
 
 3102                 return this_type(result1,p11,p22,leaf_op);
 
 3105             template <
typename Archive> 
void serialize(
const Archive& ar) {
 
 3106                 ar & result & p1 & p2 & 
leaf_op;
 
 3117         template<
typename coeff_opT, 
typename apply_opT>
 
 3121             woT::task(world.
rank(), &implT:: template traverse_tree<coeff_opT,apply_opT>, active_coeff, apply_op, key);
 
 3133         template<
typename coeff_opT, 
typename apply_opT>
 
 3137             typedef typename std::pair<bool,coeffT> argT;
 
 3138             const argT 
arg=coeff_op(key);
 
 3139             apply_op.operator()(key,arg.second,arg.first);
 
 3141             const bool has_children=(not arg.first);
 
 3144                     const keyT& child=kit.key();
 
 3145                     coeff_opT child_op=coeff_op.make_child(child);
 
 3149                     madness::Void (implT::*ft)(
const coeff_opT&, 
const apply_opT&, 
const keyT&) 
const = &implT::forward_traverse<coeff_opT,apply_opT>;
 
 3151                     woT::task(p, ft, child_op, apply_op, child);
 
 3164         template<std::
size_t LDIM, 
typename leaf_opT>
 
 3166                              const leaf_opT& 
leaf_op, 
bool fence) {
 
 3179                 typedef hartree_op<LDIM,leaf_opT> coeff_opT;
 
 3180                 coeff_opT coeff_op(
this,iap1,iap2,leaf_op);
 
 3184                 apply_opT apply_op(
this);
 
 3186                 woT::task(world.
rank(), &implT:: template forward_traverse<coeff_opT,apply_opT>,
 
 3187                           coeff_op, apply_op, cdata.
key0);
 
 3191             this->compressed=
false;
 
 3197         template <
typename opT, 
typename R>
 
 3200             const opT* 
op = pop.
ptr;
 
 3202             const double cnorm = c.normf();
 
 3211                 int maxdir = s ? 1 : -1;
 
 3212                 for (
int direction=-1; direction<=maxdir; direction+=2) {
 
 3213                     lnew[axis] = lold + direction*s;
 
 3214                     if (lnew[axis] >= 0 && lnew[axis] < maxs) { 
 
 3215                         const Tensor<typename opT::opT>& r = op->rnlij(n, s*direction, 
true);
 
 3216                         double Rnorm = r.normf();
 
 3222                         if (s <= 1  ||  r.normf()*cnorm > tol) { 
 
 3226                             if (result.normf() > tol*0.3) {
 
 3249         template <
typename opT, 
typename R>
 
 3256             fiterT end = f->coeffs.
end();
 
 3258             for (fiterT it=f->coeffs.
begin(); it!=end; ++it) {
 
 3259                 const fnodeT& node = it->second;
 
 3260                 if (node.has_coeff()) {
 
 3261                     const keyT& key = it->first;
 
 3262                     const Tensor<R>& 
c = node.coeff().full_tensor_copy();
 
 3263                     woT::task(me, &implT:: template apply_1d_realspace_push_op<opT,R>,
 
 3273                               const std::pair<keyT,coeffT>& left,
 
 3274                               const std::pair<keyT,coeffT>& center,
 
 3275                               const std::pair<keyT,coeffT>& right);
 
 3280                       const std::pair<keyT,coeffT>& left,
 
 3281                       const std::pair<keyT,coeffT>& center,
 
 3282                       const std::pair<keyT,coeffT>& right);
 
 3292         keyT 
neighbor(
const keyT& key, 
const keyT& disp, 
const std::vector<bool>& is_periodic) 
const;
 
 3306         coeffT 
multiply(
const coeffT& val_ket, 
const coeffT& val_pot, 
int particle) 
const;
 
 3321                                      const coeffT& vpotential1, 
const coeffT& vpotential2,
 
 3322                                      const tensorT& veri) 
const;
 
 3330         template<
typename opT, 
size_t LDIM>
 
 3349                        const ctL& iap1, 
const ctL& iap2, 
const ctL& iav1, 
const ctL& iav2,
 
 3351                 : result(result), leaf_op(leaf_op), iaket(iaket), iap1(iap1), iap2(iap2)
 
 3352                 , iav1(iav1), iav2(iav2), eri(eri) {
 
 3362                 const bool do_error_measure=leaf_op.do_error_leaf_op();
 
 3375                 is_leaf=
leaf_op(key,sum_coeff);
 
 3378                     return std::pair<bool,coeffT> (
true,
coeffT());
 
 3381                 if (do_error_measure) {
 
 3386                     tensorT d=result->
filter(s_coeffs);
 
 3390                     double error=d.normf();
 
 3398                         return std::pair<bool,coeffT> (
true,
coeffT());
 
 3402                         std::vector<bool> child_is_leaf(1<<
NDIM);
 
 3408                             child_is_leaf[i]=
leaf_op(kit.key(),child_coeff);
 
 3412                             child_is_leaf[i]=child_is_leaf[i] or elop(kit.key(),child_coeff,sum_coeff);
 
 3413                             if (child_is_leaf[i]) result->
small++;
 
 3425                 return std::pair<bool,coeffT> (
true,
coeffT());
 
 3436                                                       const tensorT& coeffs, 
const keyT& key)
 const {
 
 3439                     keyT child=kit.key();
 
 3440                     bool is_leaf=child_is_leaf[i];
 
 3453                         result->
task(p, ft, child_op, no, child);
 
 3458                 return std::pair<bool,coeffT> (
true,
coeffT());
 
 3470                                                    key,eri->
get_functor()->coeff(key).full_tensor());
 
 3472                         val_eri=
tensorT(eri->cdata.vk);
 
 3486                 const coeffT coeff_ket_NS = (iaket.
get_impl())
 
 3490                 coeffT val_potential1, val_potential2;
 
 3499                 coeffT tmp=coeff_ket_NS(result->
get_cdata().s0);
 
 3502                                                      val_potential1,val_potential2,
eri_values(key));
 
 3512                 const coeffT coeff_ket_NS = (iaket.
get_impl())
 
 3517                 const coeffT coeff_ket_unfiltered=result->
unfilter(coeff_ket_NS);
 
 3518                 const coeffT coeff_v1_unfiltered=(iav1.
get_impl())
 
 3520                 const coeffT coeff_v2_unfiltered=(iav2.
get_impl())
 
 3524                 tensorT s_coeffs(result->cdata.v2k);
 
 3533                     coeffT val_potential1, val_potential2;
 
 3542                     const coeffT coeff_ket=coeff_ket_unfiltered(result->
child_patch(kit.key()));
 
 3547                                                                             val_potential1,val_potential2,val_eri);
 
 3573                 return result->
world.
taskq.
add(*const_cast<this_type *> (
this),
 
 3575                                                iaket1,iap11,iap21,iav11,iav21,eri);
 
 3578             this_type 
forward_ctor(implT* result1, 
const opT& leaf_op, 
const ctT& iaket1,
 
 3579                                    const ctL& iap11, 
const ctL& iap21, 
const ctL& iav11, 
const ctL& iav21,
 
 3580                                    const implT* eri1) {
 
 3581                 return this_type(result1,leaf_op,iaket1,iap11,iap21,iav11,iav21,eri1);
 
 3585             template <
typename Archive> 
void serialize(
const Archive& ar) {
 
 3586                 ar & iaket & eri & result & leaf_op & iap1 & iap2 & iav1 & 
iav2;
 
 3597         template<
typename opT>
 
 3600             const size_t LDIM=3;
 
 3623             if (ket) ket->undo_redundant(
false);
 
 3624             if (v1) v1->undo_redundant(
false);
 
 3625             if (v2) v2->undo_redundant(
false);
 
 3626             if (p1) p1->undo_redundant(
false);
 
 3627             if (p2) p2->undo_redundant(
false);  
 
 3630             if (ket) ket->compress(
true,
true,
false,
false);
 
 3631             if (v1) v1->compress(
true,
true,
false,
false);
 
 3632             if (v2) v2->compress(
true,
true,
false,
false);
 
 3633             if (p1) p1->compress(
true,
true,
false,
false);
 
 3634             if (p2) p2->compress(
true,
true,
false,
false);        
 
 3639             if (world.
rank() == coeffs.
owner(key0)) {
 
 3652                 typedef Vphi_op_NS<opT,LDIM> coeff_opT;
 
 3653                 coeff_opT coeff_op(
this,leaf_op,iaket,iap1,iap2,iav1,iav2,eri);
 
 3659                 woT::task(world.
rank(), &implT:: template forward_traverse<coeff_opT,apply_opT>,
 
 3660                           coeff_op, apply_op, cdata.
key0);
 
 3666             this->redundant=
true;
 
 3670             this->compressed=
false;
 
 3671             this->on_demand=
false;
 
 3672             this->redundant=
false;
 
 3673             this->nonstandard=
false;
 
 3680         void mapdim(
const implT& f, 
const std::vector<long>& map, 
bool fence);
 
 3686         void average(
const implT& rhs);
 
 3713         tensorT 
filter(
const tensorT& s) 
const;
 
 3715         coeffT 
filter(
const coeffT& s) 
const;
 
 3732         tensorT 
unfilter(
const tensorT& s) 
const;
 
 3734         coeffT 
unfilter(
const coeffT& s) 
const;
 
 3752         coeffT 
upsample(
const keyT& key, 
const coeffT& coeff) 
const;
 
 3755         void project(
const implT& old, 
bool fence);
 
 3758             bool operator()(
const implT* f, 
const keyT& key, 
const nodeT& t)
 const {
 
 3764         template <
typename opT>
 
 3770             nodeT& node = acc->second;
 
 3771             if (node.has_coeff() && key.
level() < max_refine_level && 
op(
this, key, node)) {
 
 3772                 coeffT d(cdata.
v2k,targs);
 
 3773                 d(cdata.
s0) += 
copy(node.coeff());
 
 3776                 node.set_has_children(
true);
 
 3778                     const keyT& child = kit.key();
 
 3789         template <
typename opT>
 
 3791             nodeT& node = coeffs.
find(key).get()->second;
 
 3803         template <
typename opT>
 
 3822         void broaden(std::vector<bool> is_periodic, 
bool fence);
 
 3845         void compress(
bool nonstandard, 
bool keepleaves, 
bool redundant, 
bool fence);
 
 3908                 const keyT& key = it->first;
 
 3909                 nodeT& node = it->second;
 
 3913                         node.
coeff()(impl->cdata.s0)=0.0;
 
 3922             template <
typename Archive> 
void serialize(
const Archive& ar) {
 
 3929         template<
size_t OPDIM>
 
 3936                 : key(key), d(d), dest(dest), tol(tol), fac(fac), cnorm(cnorm) {}
 
 3937             template <
class Archive>
 
 3949         template <
typename opT, 
typename R, 
size_t OPDIM>
 
 3952             tensorT result = op->apply(args.key, args.d, c, args.tol/args.fac/args.cnorm);
 
 3957             if (result.normf()> 0.3*args.tol/args.fac) {
 
 3982         template <
typename opT, 
typename R, 
size_t OPDIM>
 
 3986             tensorT result_full = op->apply(args.key, args.d, c, args.tol/args.fac/args.cnorm);
 
 3987             const double norm=result_full.normf();
 
 3994             if (norm > 0.3*args.tol/args.fac) {
 
 3997                 double cpu0=cpu_time();
 
 3998                 coeffT result=
coeffT(result_full,apply_targs);
 
 4000                 double cpu1=cpu_time();
 
 4019         template <
typename opT, 
typename R, 
size_t OPDIM>
 
 4024             if (2*OPDIM==
NDIM) result= op->apply2_lowdim(args.key, args.d, coeff, args.tol/args.fac/args.cnorm, args.tol/args.fac);
 
 4025             if (OPDIM==
NDIM) result = op->apply2(args.key, args.d, coeff, args.tol/args.fac/args.cnorm, args.tol/args.fac);
 
 4031             const double result_norm=result.
svd_normf();
 
 4033             if (result_norm> 0.3*args.tol/args.fac) {
 
 4053         template <
typename opT, 
typename R>
 
 4057             typedef typename opT::keyT opkeyT;
 
 4058             static const size_t opdim=opT::opdim;
 
 4060             const opkeyT source=op->get_source_key(key);
 
 4064             double cnorm = c.normf();
 
 4067             const std::vector<opkeyT>& disp = op->get_disp(key.
level());
 
 4070             const std::vector<bool> is_periodic(
NDIM,
false); 
 
 4072             for (
typename std::vector<opkeyT>::const_iterator it=disp.begin(); it != disp.end(); ++it) {
 
 4077                 if (op->particle()==1) d=it->
merge_with(nullkey);
 
 4078                 if (op->particle()==2) d=nullkey.
merge_with(*it);
 
 4080                 keyT dest = 
neighbor(key, d, is_periodic);
 
 4083                     double opnorm = op->norm(key.
level(), *it, source);
 
 4090                     if (cnorm*opnorm> tol/fac) {
 
 4096                             do_op_args<opdim> args(source, *it, dest, tol, fac, cnorm);
 
 4097                             woT::task(where, &implT:: template do_apply_kernel<opT,R,opdim>, op, c, args);
 
 4099                             tensorT result = op->apply(source,*it, c, tol/fac/cnorm);
 
 4100                             if (result.normf()> 0.3*tol/fac) {
 
 4104                     } 
else if (d.
distsq() >= 1)
 
 4113         template <
typename opT, 
typename R>
 
 4120                 const keyT& key = it->first;
 
 4122                 if (node.has_coeff()) {
 
 4123                     if (node.coeff().dim(0) != k || op.doleaves) {
 
 4125                         woT::task(p, &implT:: template do_apply<opT,R>, &op, key, node.coeff().full_tensor_copy());
 
 4132             this->compressed=
true;
 
 4133             this->nonstandard=
true;
 
 4134             this->redundant=
false;
 
 4146         template <
typename opT, 
typename R>
 
 4148                                            const bool& do_kernel) {
 
 4151             typedef typename opT::keyT opkeyT;
 
 4154             std::list<opkeyT> blacklist;
 
 4156             static const size_t opdim=opT::opdim;
 
 4160             const opkeyT source=op->get_source_key(key);
 
 4165             double fac=std::pow(3,
NDIM*0.5);
 
 4166             double cnorm = coeff.normf();
 
 4170             apply_targs.
thresh=tol/fac*0.03;
 
 4176             const std::vector<opkeyT>& disp = op->get_disp(key.
level());
 
 4177             const std::vector<bool> is_periodic(
NDIM,
false); 
 
 4179             for (
typename std::vector<opkeyT>::const_iterator it=disp.begin(); it != disp.end(); ++it) {
 
 4180                 const opkeyT& d = *it;
 
 4182                 const int shell=d.distsq();
 
 4183                 if (do_kernel and (shell>0)) 
break;
 
 4184                 if ((not do_kernel) and (shell==0)) 
continue;
 
 4187                 if (op->particle()==1) disp1=it->
merge_with(nullkey);
 
 4188                 else if (op->particle()==2) disp1=nullkey.
merge_with(*it);
 
 4193                 keyT dest = 
neighbor(key, disp1, is_periodic);
 
 4200                 bool screened=
false;
 
 4201                 typename std::list<opkeyT>::const_iterator it2;
 
 4202                 for (it2=blacklist.begin(); it2!=blacklist.end(); it2++) {
 
 4203                     if (d.is_farther_out_than(*it2)) {
 
 4210                     double opnorm = op->norm(key.
level(), d, source);
 
 4213                     if (cnorm*opnorm> tol/fac) {
 
 4215                         double cost_ratio=op->estimate_costs(source, d, coeff, tol/fac/cnorm, tol/fac);
 
 4219                         if (cost_ratio>0.0) {
 
 4221                             do_op_args<opdim> args(source, d, dest, tol, fac, cnorm);
 
 4223                             if (cost_ratio<1.0) {
 
 4232                     } 
else if (shell >= 12) {
 
 4235                     if (norm<0.3*tol/fac) blacklist.push_back(d);
 
 4243         template <
typename opT, 
typename R>
 
 4252                 const keyT& key = it->first;
 
 4253                 const coeffT& coeff = it->second.coeff();
 
 4257                     woT::task(p, &implT:: template do_apply_directed_screening<opT,R>, &op, key, coeff, 
true);
 
 4258                     woT::task(p, &implT:: template do_apply_directed_screening<opT,R>, &op, key, coeff, 
false);
 
 4276         template<
typename opT, std::
size_t LDIM>
 
 4282             if (world.
rank() == coeffs.
owner(key0)) {
 
 4287                 typedef recursive_apply_op<opT,LDIM> coeff_opT;
 
 4288                 coeff_opT coeff_op(
this,ff,gg,&apply_op);
 
 4294                 woT::task(p, &implT:: template forward_traverse<coeff_opT,apply_opT>, coeff_op, apply_op, key0);
 
 4301         template<
typename opT, std::
size_t LDIM>
 
 4316                                const opT* apply_op) : result(result), iaf(iaf), iag(iag), apply_op(apply_op)
 
 4321                                                                   iag(other.iag), apply_op(other.apply_op) {}
 
 4342                 bool is_leaf=
leaf_op(key,fcoeff,gcoeff);
 
 4346                     const std::vector<Slice>& s0=iaf.
get_impl()->cdata.s0;
 
 4347                     const coeffT coeff = (apply_op->modified())
 
 4356                     result->
task(p,&implT:: template do_apply_directed_screening<opT,T>,
 
 4357                                  apply_op,key,coeff,
false);
 
 4362                     return std::pair<bool,coeffT> (is_leaf,
coeffT());
 
 4367             std::pair<bool,coeffT> 
finalize(
const double kernel_norm, 
const keyT& key,
 
 4368                                             const coeffT& coeff)
 const {
 
 4369                 const double thresh=result->
get_thresh()*0.1;
 
 4370                 bool is_leaf=(kernel_norm<result->
truncate_tol(thresh,key));
 
 4371                 if (key.
level()<2) is_leaf=
false;
 
 4372                 return std::pair<bool,coeffT> (is_leaf,coeff);
 
 4388                 return result->
world.
taskq.
add(*const_cast<this_type *> (
this),
 
 4393                                    const opT* apply_op1) {
 
 4397             template <
typename Archive> 
void serialize(
const Archive& ar) {
 
 4398                 ar & result & iaf & iag & 
apply_op;
 
 4408         template<
typename opT>
 
 4413             if (world.
rank() == coeffs.
owner(key0)) {
 
 4415                 typedef recursive_apply_op2<opT> coeff_opT;
 
 4416                 coeff_opT coeff_op(
this,fimpl,&apply_op);
 
 4421                 woT::task(world.
rank(), &implT:: template forward_traverse<coeff_opT,apply_opT>,
 
 4422                           coeff_op, apply_op, cdata.
key0);
 
 4429         template<
typename opT>
 
 4435             typedef std::pair<bool,coeffT> 
argT;
 
 4444                 : result(result), iaf(iaf), apply_op(apply_op) {}
 
 4447                                                                     iaf(other.iaf), apply_op(other.apply_op) {}
 
 4457                 const coeffT& coeff=iaf.
coeff();
 
 4463                     result->
task(p,&implT:: template do_apply_directed_screening<opT,T>,
 
 4464                                  apply_op, key, coeff, 
false);
 
 4470                     return finalize(norm0,key,coeff,result);
 
 4473                     const bool is_leaf=
true;
 
 4479             argT 
finalize(
const double kernel_norm, 
const keyT& key,
 
 4480                           const coeffT& coeff, 
const implT* r)
 const {
 
 4482                 bool is_leaf=(kernel_norm<r->
truncate_tol(thresh,key));
 
 4483                 if (key.
level()<2) is_leaf=
false;
 
 4484                 return argT(is_leaf,coeff);
 
 4495                 return result->
world.
taskq.
add(*const_cast<this_type *> (
this),
 
 4500             this_type 
forward_ctor(implT* result1, 
const ctT& iaf1, 
const opT* apply_op1) {
 
 4501                 return this_type(result1,iaf1,apply_op1);
 
 4504             template <
typename Archive> 
void serialize(
const Archive& ar) {
 
 4513         template <
typename opT>
 
 4515                        int npt, 
const Tensor<double>& qx, 
const Tensor<double>& quad_phit,
 
 4516                        const Tensor<double>& quad_phiw)
 const {
 
 4518             std::vector<long> vq(
NDIM);
 
 4519             for (std::size_t i=0; i<
NDIM; ++i)
 
 4521             tensorT fval(vq,
false), work(vq,
false), result(vq,
false);
 
 4525             fcube(key, func, qx, fval);
 
 4539             double err = fval.normf();
 
 4543         template <
typename opT>
 
 4549             Tensor<double> quad_phit;
 
 4550             Tensor<double> quad_phiw;
 
 4554             do_err_box(
const implT* impl, 
const opT* func, 
int npt, 
const Tensor<double>& qx,
 
 4555                        const Tensor<double>& quad_phit, 
const Tensor<double>& quad_phiw)
 
 4556                 : impl(impl), func(func), npt(npt), qx(qx), quad_phit(quad_phit), quad_phiw(quad_phiw) {}
 
 4559                 : impl(e.impl), func(e.func), npt(e.npt), qx(e.qx), quad_phit(e.quad_phit), quad_phiw(e.quad_phiw) {}
 
 4562                 const keyT& key = it->first;
 
 4563                 const nodeT& node = it->second;
 
 4565                     return impl->
err_box(key, node, *func, npt, qx, quad_phit, quad_phiw);
 
 4574             template <
typename Archive>
 
 4581         template <
typename opT>
 
 4585             const int npt = cdata.
npt + 1;
 
 4586             Tensor<double> qx, qw, quad_phi, quad_phiw, quad_phit;
 
 4590             rangeT range(coeffs.
begin(), coeffs.
end());
 
 4592                                                                        do_err_box<opT>(
this, &
func, npt, qx, quad_phit, quad_phiw));
 
 4600                 const nodeT& node = it->second;
 
 4614             template <
typename Archive> 
void serialize(
const Archive& ar) {
 
 4615                 throw "NOT IMPLEMENTED";
 
 4624         template<
typename R>
 
 4631                 : other(other), leaves_only(leaves_only) {}
 
 4635                 const keyT& key=it->first;
 
 4636                 const nodeT& fnode = it->second;
 
 4638                     if (other->coeffs.
probe(it->first)) {
 
 4640                         if (gnode.has_coeff()) {
 
 4641                             if (gnode.coeff().dim(0) != fnode.
coeff().
dim(0)) {
 
 4643                                 MADNESS_EXCEPTION(
"functions have different k or compress/reconstruct error", 0);
 
 4646                                 if (gnode.is_leaf() or fnode.
is_leaf()) {
 
 4647                                     sum += fnode.
coeff().trace_conj(gnode.coeff());
 
 4650                                 sum += fnode.
coeff().trace_conj(gnode.coeff());
 
 4662             template <
typename Archive> 
void serialize(
const Archive& ar) {
 
 4663                 throw "NOT IMPLEMENTED";
 
 4670         template <
typename R>
 
 4679             return world.taskq.
reduce<resultT,rangeT,do_inner_local<R> >
 
 4680                 (rangeT(coeffs.begin(),coeffs.end()),do_inner_local<R>(&g, 
leaves_only));
 
 4689             tensorT fvals = 
tensorT(this->cdata.
vk);
 
 4695             return c.trace_conj(fc);
 
 4704             tensorT fvals = 
tensorT(this->cdata.
vk);
 
 4710             return c.trace_conj(fc);
 
 4722             tensorT c_child, inner_child;
 
 4723             T new_inner, result = 0.0;
 
 4726             inner_child = Tensor<double>(pow(2, 
NDIM)); 
 
 4730             if (old_inner == 
T(0)) {
 
 4734             if (coeffs.
find(key).get()->second.has_children()) {
 
 4740                     const keyT& child = it.key();
 
 4741                     tensorT 
cc = coeffs.
find(child).get()->second.coeff().full_tensor_copy();
 
 4744                 new_inner = inner_child.sum();
 
 4745             } 
else if (leaf_refine) {
 
 4762                     const keyT& child = it.key();
 
 4766                 new_inner = inner_child.sum();
 
 4770                 new_inner = old_inner;
 
 4777             if (std::abs(new_inner - old_inner) <= thresh) { 
 
 4782                     const keyT& child = it.key();
 
 4800             tensorT c_child, inner_child;
 
 4801             T new_inner, result = 0.0;
 
 4804             inner_child = Tensor<double>(pow(2, 
NDIM)); 
 
 4808             if (old_inner == 
T(0)) {
 
 4812             if (coeffs.
find(key).get()->second.has_children()) {
 
 4818                     const keyT& child = it.key();
 
 4819                     tensorT 
cc = coeffs.
find(child).get()->second.coeff().full_tensor_copy();
 
 4822                 new_inner = inner_child.sum();
 
 4823             } 
else if (leaf_refine) {
 
 4840                     const keyT& child = it.key();
 
 4844                 new_inner = inner_child.sum();
 
 4848                 new_inner = old_inner;
 
 4855             if (std::abs(new_inner - old_inner) <= thresh) { 
 
 4860                     const keyT& child = it.key();
 
 4874             do_inner_ext_local(
T (*f)(
const coordT&), 
const implT * impl, 
const bool leaf_refine) : 
fptr(f), impl(impl), leaf_refine(leaf_refine) {};
 
 4878                 if (it->first.level() == impl->initial_level) {
 
 4879                     tensorT 
cc = it->second.coeff().full_tensor_copy();
 
 4890             template <
typename Archive> 
void serialize(
const Archive& ar) {
 
 4891                 throw "NOT IMPLEMENTED";
 
 4904                 if (it->first.level() == impl->initial_level) {
 
 4905                     tensorT 
cc = it->second.coeff().full_tensor_copy();
 
 4916             template <
typename Archive> 
void serialize(
const Archive& ar) {
 
 4917                 throw "NOT IMPLEMENTED";
 
 4929                     do_inner_ext_local(f, 
this, leaf_refine));
 
 4940                     do_inner_ext_local_ffi(f, 
this, leaf_refine));
 
 4955         template <
typename L>
 
 4962             tensorT c2 = 
copy(lc);
 
 4963             c2.gaxpy(alpha, fcoeffs, beta);
 
 4980         template <
typename L>
 
 4982                                  Tensor<L> lcin, tensorT c, 
T (*f)(
const coordT&), 
 
 4983                                  T alpha, 
T beta, 
double tol, 
bool below_leaf) {
 
 4989             if (not below_leaf) {
 
 4990                 bool left_leaf = left->coeffs.find(key).get()->second.is_leaf();
 
 4996                         const keyT& child = it.key();
 
 4997                         woT::task(left->coeffs.owner(child), &implT:: template gaxpy_ext_recursive<L>, 
 
 4998                                   child, left, Tensor<L>(), 
tensorT(), 
f, alpha, 
beta, tol, below_leaf);
 
 5005             Tensor<L> lc = lcin;
 
 5006             if (lc.size() == 0) {
 
 5007                 literT it = left->coeffs.find(key).get();
 
 5009                 if (it->second.has_coeff())
 
 5010                     lc = it->second.coeff().full_tensor_copy();
 
 5014             if (c.size() == 0) {
 
 5025             Tensor<L> lc_child = Tensor<L>(cdata.
v2k); 
 
 5026             Tensor<L> ld = Tensor<L>(cdata.
v2k);
 
 5035                 const keyT& child = it.key();
 
 5047             double dnorm = d.normf();
 
 5058                     const keyT& child = it.key();
 
 5061                     woT::task(left->coeffs.owner(child), &implT:: template gaxpy_ext_recursive<L>, 
 
 5062                               child, left, left_coeff, child_coeff, 
f, alpha, 
beta, tol, below_leaf);
 
 5068         template <
typename L>
 
 5071                 gaxpy_ext_recursive<L> (cdata.
key0, left, Tensor<L>(), 
tensorT(), 
f, alpha, 
beta, tol, 
false);
 
 5083         template<
size_t LDIM>
 
 5085                          const int dim, 
const bool fence) {
 
 5089             if (world.
rank() == coeffs.
owner(key0)) {
 
 5092                 typedef project_out_op<LDIM> coeff_opT;
 
 5099                 woT::task(world.
rank(), &implT:: template forward_traverse<coeff_opT,apply_opT>,
 
 5100                           coeff_op, apply_op, cdata.
key0);
 
 5109         template<
size_t LDIM>
 
 5116             typedef std::pair<bool,coeffT> 
argT;
 
 5126                 : fimpl(fimpl), result(result), iag(iag), dim(dim) {}
 
 5128                 : fimpl(other.fimpl), result(other.result), iag(other.iag), dim(other.dim) {}
 
 5150                 const coeffT& fcoeff=fnode.coeff();
 
 5160                 tensorT 
final(result->cdata.vk);
 
 5162                 const int otherdim=(dim+1)%2;
 
 5163                 const int k=fcoeff.
dim(0);
 
 5164                 std::vector<Slice> s(fcoeff.
config().dim_per_vector()+1,_);
 
 5167                 for (
int r=0; r<fcoeff.
rank(); ++r) {
 
 5169                     const tensorT contracted_tensor=fcoeff.
config().ref_vector(dim)(s).reshape(k,k,k);
 
 5170                     const tensorT other_tensor=fcoeff.
config().ref_vector(otherdim)(s).reshape(k,k,k);
 
 5171                     const double ovlp= gtensor.trace_conj(contracted_tensor);
 
 5172                     const double fac=ovlp * fcoeff.
config().weights(r);
 
 5173                     final+=fac*other_tensor;
 
 5185                 const Key<LDIM> gkey = (dim==0) ? key1 : key2;
 
 5193                 return result->
world.
taskq.
add(*const_cast<this_type *> (
this),
 
 5198             this_type 
forward_ctor(
const implT* fimpl1, implL1* result1, 
const ctL& iag1, 
const int dim1) {
 
 5199                 return this_type(fimpl1,result1,iag1,dim1);
 
 5202             template <
typename Archive> 
void serialize(
const Archive& ar) {
 
 5203                 ar & result & iag & fimpl & 
dim;
 
 5216         template<
size_t LDIM>
 
 5219             typedef std::pair< keyT,coeffT > pairT;
 
 5224             fiterator end = f->get_coeffs().end();
 
 5225             for (fiterator it=f->get_coeffs().begin(); it!=end; ++it) {
 
 5228                 const coeffT& fcoeff=fnode.coeff();
 
 5230                 if (fnode.is_leaf() and fcoeff.
has_data()) {
 
 5242                         woT::task(world.
rank(),&implT:: template do_project_out<LDIM>,fcoeff,result,key1,key2,
dim);
 
 5244                     } 
else if (dim==1) {
 
 5252                         woT::task(world.
rank(),&implT:: template do_project_out<LDIM>,fcoeff,result,key2,key1,
dim);
 
 5259             this->compressed=
false;
 
 5260             this->nonstandard=
false;
 
 5261             this->redundant=
true;
 
 5273         template<
size_t LDIM>
 
 5286             tensorT result(cdata.
vk);
 
 5288             const int otherdim=(dim+1)%2;
 
 5289             const int k=fcoeff.
dim(0);
 
 5290             std::vector<Slice> s(fcoeff.
config().dim_per_vector()+1,_);
 
 5293             for (
int r=0; r<fcoeff.
rank(); ++r) {
 
 5295                 const tensorT contracted_tensor=fcoeff.
config().ref_vector(dim)(s).reshape(k,k,k);
 
 5296                 const tensorT other_tensor=fcoeff.
config().ref_vector(otherdim)(s).reshape(k,k,k);
 
 5297                 const double ovlp= gtensor.trace_conj(contracted_tensor);
 
 5298                 const double fac=ovlp * fcoeff.
config().weights(r);
 
 5299                 result+=fac*other_tensor;
 
 5327         std::size_t 
size() 
const;
 
 5342         template <
typename Q, 
typename F>
 
 5346             typename fdcT::const_iterator end = f.coeffs.end();
 
 5347             for (
typename fdcT::const_iterator it=f.coeffs.begin(); it!=end; ++it) {
 
 5348                 const keyT& key = it->first;
 
 5349                 const fnodeT& node = it->second;
 
 5351                 if (node.has_coeff()) {
 
 5352                     coeffs.
replace(key,
nodeT(node.coeff()*q,node.has_children()));
 
 5364         template <
class Archive, 
class T, std::
size_t NDIM>
 
 5376                         MADNESS_EXCEPTION(
"FunctionImpl: remote operation attempting to use a locally uninitialized object",0);
 
 5383         template <
class Archive, 
class T, std::
size_t NDIM>
 
 5386                 bool exists=(ptr) ? 
true : 
false;
 
 5388                 if (exists) ar & ptr->id();
 
 5392         template <
class Archive, 
class T, std::
size_t NDIM>
 
 5404                         MADNESS_EXCEPTION(
"FunctionImpl: remote operation attempting to use a locally uninitialized object",0);
 
 5411         template <
class Archive, 
class T, std::
size_t NDIM>
 
 5414                 bool exists=(ptr) ? 
true : 
false;
 
 5416                 if (exists) ar & ptr->id();
 
 5421         template <
class Archive, 
class T, std::
size_t NDIM>
 
 5430         template <
class Archive, 
class T, std::
size_t NDIM>
 
 5437         template <
class Archive, 
class T, std::
size_t NDIM>
 
 5446         template <
class Archive, 
class T, std::
size_t NDIM>
 
 5456 #endif // MADNESS_MRA_FUNCIMPL_H__INCLUDED 
int np
Definition: tdse1d.cc:166
bool is_leaf() const 
Returns true if this does not have children. 
Definition: funcimpl.h:202
bool do_error_leaf_op() const 
Definition: funcimpl.h:461
bool do_error_leaf_op() const 
Definition: funcimpl.h:498
void serialize(const Archive &ar)
Definition: funcimpl.h:3922
double fac
Definition: funcimpl.h:3933
double tol
Definition: funcimpl.h:3933
Vphi_op_NS()
Definition: funcimpl.h:3347
keyT dest
Definition: funcimpl.h:3932
recursive_apply_op2(implT *result, const ctT &iaf, const opT *apply_op)
Definition: funcimpl.h:4443
bool do_error_leaf_op() const 
Definition: funcimpl.h:437
Void do_binary_op(const keyT &key, const Tensor< L > &left, const std::pair< keyT, Tensor< R > > &arg, const opT &op)
Invoked as a task by do_binary_op with the actual coefficients. 
Definition: funcimpl.h:1813
FunctionNode()
Default constructor makes node without coeff or children. 
Definition: funcimpl.h:143
bool operator()(typename rangeT::iterator &it) const 
Definition: funcimpl.h:2196
const double thresh
Definition: dielectric.cc:185
const implL * g
Definition: funcimpl.h:609
hartree_leaf_op(const implT *f, const long &k)
Definition: funcimpl.h:501
bool operator()(typename rangeT::iterator &it) const 
Definition: funcimpl.h:2215
this_type make_child(const keyT &child) const 
Definition: funcimpl.h:3085
void error(const char *msg)
Definition: world.cc:128
#define ITERATOR(t, exp)
Definition: tensor_macros.h:249
WorldGopInterface & gop
Global operations. 
Definition: worldfwd.h:462
SRConf< T > config() const 
Definition: gentensor.h:201
std::vector< long > map
Definition: funcimpl.h:2125
leaf_opT leaf_op
determine if a given node will be a leaf node 
Definition: funcimpl.h:3052
void mulXXvec(const FunctionImpl< L, NDIM > *left, const std::vector< const FunctionImpl< R, NDIM > * > &vright, const std::vector< FunctionImpl< T, NDIM > * > &vresult, double tol, bool fence)
Definition: funcimpl.h:2684
insert_op()
Definition: funcimpl.h:691
do_check_symmetry_local(const implT &f)
Definition: funcimpl.h:2016
this_type forward_ctor(implT *h1, const ctT &f1, const ctL &g1, const int particle)
Definition: funcimpl.h:2945
Void hartree_product(const FunctionImpl< T, LDIM > *p1, const FunctionImpl< T, LDIM > *p2, const leaf_opT &leaf_op, bool fence)
given two functions of LDIM, perform the Hartree/Kronecker/outer product 
Definition: funcimpl.h:3165
void process_pending()
To be called from derived constructor to process pending messages. 
Definition: worldobj.h:330
void process_pending()
Process pending messages. 
Definition: worlddc.h:903
Void sum_down_spawn(const keyT &key, const coeffT &s)
is this the same as trickle_down() ? 
Definition: mraimpl.h:964
Definition: shared_ptr_bits.h:38
std::shared_ptr< implL > impl_m2
supposedly 1/r2 
Definition: function_interface.h:154
size_t size() const 
Returns the number of coefficients in this node. 
Definition: funcimpl.h:231
this_type forward_ctor(implT *result1, const ctT &iaf1, const opT *apply_op1)
taskq-compatible ctor 
Definition: funcimpl.h:4500
Makes a distributed container with specified attributes. 
Definition: worlddc.h:55
Tensor< Q > fcube_for_mul(const keyT &child, const keyT &parent, const Tensor< Q > &coeff) const 
Compute the function values for multiplication. 
Definition: funcimpl.h:1713
implT * impl
Definition: funcimpl.h:1968
NDIM const Function< R, NDIM > & g
Definition: mra.h:2179
do_reduce_rank()
Definition: funcimpl.h:1993
Tensor< double > hgT
The full twoscale coeff (2k,2k) and transpose. 
Definition: function_common_data.h:107
void set_coeff(const coeffT &coeffs)
Takes a shallow copy of the coeff — same as this->coeff()=coeff. 
Definition: funcimpl.h:274
bool leaves_only
Definition: funcimpl.h:4678
CoeffTracker< T, LDIM > ctL
Definition: funcimpl.h:5114
ctT iaket
the ket of a pair function (exclusive with p1, p2) 
Definition: funcimpl.h:3341
Void mulXXa(const keyT &key, const FunctionImpl< L, NDIM > *left, const Tensor< L > &lcin, const FunctionImpl< R, NDIM > *right, const Tensor< R > &rcin, double tol)
Definition: funcimpl.h:2454
CoeffTracker(const implT *impl)
the initial ctor making the root key 
Definition: funcimpl.h:778
hartree_op(implT *result, const ctL &p11, const ctL &p22, const leaf_opT &leaf_op)
Definition: funcimpl.h:3056
GenTensor< T > coeffT
Definition: funcimpl.h:458
void scale(Q a)
Scale the coefficients of this node. 
Definition: funcimpl.h:290
Void sock_it_to_me_too(const keyT &key, const RemoteReference< FutureImpl< std::pair< keyT, coeffT > > > &ref) const 
Definition: mraimpl.h:2704
do_check_symmetry_local()
Definition: funcimpl.h:2015
std::pair< bool, coeffT > continue_recursion(const std::vector< bool > child_is_leaf, const tensorT &coeffs, const keyT &key) const 
loop over all children and either insert their sum coeffs or continue the recursion ...
Definition: funcimpl.h:3435
T norm(Vector< T, N > v)
Compute norm of a Vector. 
Definition: array.h:447
const implT * eri
2-particle potential, must be on-demand 
Definition: funcimpl.h:3344
const double R
Definition: dielectric.cc:191
static void _init_quadrature(int k, int npt, Tensor< double > &quad_x, Tensor< double > &quad_w, Tensor< double > &quad_phi, Tensor< double > &quad_phiw, Tensor< double > &quad_phit)
Initialize the quadrature information. 
Definition: mraimpl.h:83
AtomicInt small
Definition: funcimpl.h:949
double operator()(double val) const 
Definition: funcimpl.h:1256
std::complex< double > func(int n, int t1, int t2, int t3, double xx, double yy, double zz)
Definition: wannier.cc:98
A pmap that locates children on odd levels with their even level parents. 
Definition: funcimpl.h:104
GenTensor< T > full_tensor_copy() const 
Definition: gentensor.h:184
do_inner_ext_local_ffi(const std::shared_ptr< FunctionFunctorInterface< T, NDIM > > f, const implT *impl, const bool leaf_refine)
Definition: funcimpl.h:4900
bool operator()(typename rangeT::iterator &it) const 
Definition: funcimpl.h:1928
Key< OPDIM > d
Definition: funcimpl.h:3931
double get_thresh() const 
Definition: mraimpl.h:281
void print_plane(const std::string filename, const int xaxis, const int yaxis, const coordT &el2)
Print a plane ("xy", "xz", or "yz") containing the point x to file. 
Definition: mraimpl.h:357
this_type forward_ctor(const ctT &f1, const ctT &g1, const double alpha, const double beta)
taskq-compatible ctor 
Definition: funcimpl.h:2999
void do_print_tree(const keyT &key, std::ostream &os, Level maxlevel) const 
Definition: mraimpl.h:2592
#define IND
Definition: tensor_macros.h:204
static TaskAttributes hipri()
Definition: worldthread.h:277
Header to declare stuff which has not yet found a home. 
FunctionDefaults holds default paramaters as static class members. 
Definition: funcdefaults.h:175
Void apply_1d_realspace_push_op(const archive::archive_ptr< const opT > &pop, int axis, const keyT &key, const Tensor< R > &c)
Definition: funcimpl.h:3199
compute the inner product of this range with other 
Definition: funcimpl.h:4625
const opT * op
the convolution operator 
Definition: funcimpl.h:560
const FunctionImpl< T, NDIM > * f
Definition: funcimpl.h:608
Range< typename dcT::iterator > rangeT
Definition: funcimpl.h:1923
Range< typename FunctionImpl< Q, NDIM >::dcT::const_iterator > rangeT
Definition: funcimpl.h:1104
double get_norm_tree() const 
Gets the value of norm_tree. 
Definition: funcimpl.h:301
coeffT compress_op(const keyT &key, const std::vector< Future< coeffT > > &v, bool nonstandard, bool redundant)
calculate the wavelet coefficients using the sum coefficients of all child nodes 
Definition: mraimpl.h:1650
double operator()(double a, double b) const 
Definition: funcimpl.h:4610
bool operator()(typename rangeT::iterator &it) const 
Definition: funcimpl.h:2230
Void plot_cube_kernel(archive::archive_ptr< Tensor< T > > ptr, const keyT &key, const coordT &plotlo, const coordT &plothi, const std::vector< long > &npt, bool eval_refine) const 
Definition: mraimpl.h:3097
Range< typename dcT::iterator > rangeT
Definition: funcimpl.h:1987
CoeffTracker< T, LDIM > ctL
Definition: funcimpl.h:3337
do_merge_trees()
Definition: funcimpl.h:2091
bool find(accessor &acc, const keyT &key)
Write access to LOCAL value by key. Returns true if found, false otherwise (always false for remote)...
Definition: worlddc.h:740
Void multiply(const implT *f, const FunctionImpl< T, LDIM > *g, const int particle)
multiply f (a pair function of NDIM) with an orbital g (LDIM=NDIM/2) 
Definition: funcimpl.h:3018
int dim
Definition: funcimpl.h:5121
do_consolidate_buffer(const TensorArgs &targs)
Definition: funcimpl.h:2214
error_leaf_op()
Definition: funcimpl.h:462
void apply_source_driven(opT &op, const FunctionImpl< R, NDIM > &f, bool fence)
similar to apply, but for low rank coeffs 
Definition: funcimpl.h:4244
TensorType
low rank representations of tensors (see gentensor.h) 
Definition: tensor.h:275
do_unary_op_value_inplace(implT *impl, const opT &op)
Definition: funcimpl.h:2229
std::pair< bool, coeffT > operator()(const keyT &key) const 
if we are at the bottom of the trees, return the sum of the coeffs 
Definition: funcimpl.h:2973
void insert_zero_down_to_initial_level(const keyT &key)
Initialize nodes to zero function at initial_level of refinement. 
Definition: mraimpl.h:2488
const implT * f
Definition: funcimpl.h:1924
recursive_apply_op2()
Definition: funcimpl.h:4442
add_op(const ctT &f, const ctT &g, const double alpha, const double beta)
Definition: funcimpl.h:2969
bool has_children() const 
Returns true if this node has children. 
Definition: funcimpl.h:196
double operator()(double a, double b) const 
Definition: funcimpl.h:4570
bool _fence
Definition: function_factory.h:93
bool operator()(const Key< NDIM > &key, const T &t) const 
Definition: funcimpl.h:707
void serialize(const Archive &ar)
Definition: funcimpl.h:4397
long ndim() const 
Returns the number of dimensions in the tensor. 
Definition: basetensor.h:144
std::size_t size() const 
Returns the number of coefficients in the function ... collective global sum. 
Definition: mraimpl.h:1829
const Vector< Translation, NDIM > & translation() const 
Definition: key.h:225
void abs_inplace(bool fence)
Definition: mraimpl.h:2958
static void store(const Archive &ar, const std::shared_ptr< const FunctionImpl< T, NDIM > > &ptr)
Definition: funcimpl.h:5432
void serialize(const Archive &ar)
Definition: funcimpl.h:1980
void serialize(const Archive &ar)
serialization 
Definition: funcimpl.h:868
this_type make_child(const keyT &child) const 
Definition: funcimpl.h:5182
Definition: worldhashmap.h:332
const int NDIM
Definition: tdse1.cc:44
void serialize(const Archive &ar)
Definition: funcimpl.h:5202
std::vector< long > v2k
(2k,...) used to initialize Tensors 
Definition: function_common_data.h:94
coeff_value_adaptor(const FunctionImpl< Q, NDIM > *impl_func, const opT &op)
Definition: funcimpl.h:2600
do_inner_ext_local(T(*f)(const coordT &), const implT *impl, const bool leaf_refine)
Definition: funcimpl.h:4874
void refine(const opT &op, bool fence)
Definition: funcimpl.h:3804
CoeffTracker< T, NDIM > ctT
Definition: funcimpl.h:3336
FunctionNode(const coeffT &coeff, bool has_children=false)
Constructor from given coefficients with optional children. 
Definition: funcimpl.h:153
static double lower()
Definition: funcimpl.h:1253
static void load(const Archive &ar, std::shared_ptr< FunctionImpl< T, NDIM > > &ptr)
Definition: funcimpl.h:5439
void serialize(Archive &ar)
Definition: funcimpl.h:412
Key< NDIM+LDIM > merge_with(const Key< LDIM > &rhs) const 
merge with other key (ie concatenate), use level of rhs, not of this 
Definition: key.h:348
const opT * apply_op
need this for randomization 
Definition: funcimpl.h:4439
TensorArgs args
Definition: funcimpl.h:1990
Definition: funcimpl.h:4544
GenTensor< T > coeffT
Type of tensor used to hold coeffs. 
Definition: funcimpl.h:908
void unary_op_coeff_inplace(const opT &op, bool fence)
Unary operation applied inplace to the coefficients WITHOUT refinement, optional fence. 
Definition: funcimpl.h:1864
resultT operator()(typename dcT::const_iterator &it) const 
Definition: funcimpl.h:4632
Range< typename dcT::const_iterator > rangeT
Definition: funcimpl.h:2153
bool has_no_data() const 
Definition: gentensor.h:188
bool operator()(const Key< NDIM > &key, const GenTensor< T > &coeff) const 
no post-determination 
Definition: funcimpl.h:621
bool operator()(const Key< NDIM > &key, const GenTensor< T > &coeff) const 
post-determination: return true if operator and coefficient norms are small 
Definition: funcimpl.h:571
T inner_ext_node(keyT key, tensorT c, T(*f)(const coordT &)) const 
Definition: funcimpl.h:4688
bool screen(const coeffT &fcoeff, const coeffT &gcoeff, const keyT &key) const 
return true if this will be a leaf node 
Definition: funcimpl.h:2856
remove_internal_coeffs()
constructor need impl for cdata 
Definition: funcimpl.h:1952
void square_inplace(bool fence)
Pointwise squaring of function with optional global fence. 
Definition: mraimpl.h:2952
CoeffTracker< T, NDIM > ctT
Definition: funcimpl.h:2839
#define TERNARY_OPTIMIZED_ITERATOR(X, x, Y, y, Z, z, exp)
Definition: tensor_macros.h:719
void serialize(const Archive &ar)
Definition: funcimpl.h:2248
do_convert_to_color(const double limit, const bool log)
Definition: funcimpl.h:1255
const LeafStatus & is_leaf() const 
const reference to is_leaf flag 
Definition: funcimpl.h:816
const mpreal dim(const mpreal &a, const mpreal &b, mp_rnd_t rnd_mode)
Definition: mpreal.h:2201
void merge_trees(const T alpha, const FunctionImpl< Q, NDIM > &other, const R beta, const bool fence=true)
merge the trees of this and other, while multiplying them with the alpha or beta, resp ...
Definition: funcimpl.h:1082
coeffT & coeff()
Returns a non-const reference to the tensor containing the coeffs. 
Definition: funcimpl.h:216
Future< bool > for_each(const rangeT &range, const opT &op)
Apply op(item) for all items in range. 
Definition: worldtask.h:556
Future< this_type > activate() const 
retrieve the coefficients (parent coeffs might be remote) 
Definition: funcimpl.h:5191
ShallowNode()
Definition: funcimpl.h:721
bool is_invalid() const 
Returns true if this node is invalid (no coeffs and no children) 
Definition: funcimpl.h:208
bool operator()(typename rangeT::iterator &it) const 
Definition: funcimpl.h:2131
Tensor< Q > values2coeffs(const keyT &key, const Tensor< Q > &values) const 
Definition: funcimpl.h:1702
CoeffTracker< T, NDIM > ctT
Definition: funcimpl.h:2958
GenTensor< T > outer(const GenTensor< T > &left, const GenTensor< T > &right)
Outer product ... result(i,j,...,p,q,...) = left(i,k,...)*right(p,q,...) 
Definition: gentensor.h:230
coeffT parent_to_child_NS(const keyT &child, const keyT &parent, const coeffT &coeff) const 
Directly project parent NS coeffs to child NS coeffs. 
Definition: mraimpl.h:658
ctT iaf
Definition: funcimpl.h:4438
double svd_normf() const 
Definition: gentensor.h:190
void copy_coeffs(const FunctionImpl< Q, NDIM > &other, bool fence)
Copy coeffs from other into self. 
Definition: funcimpl.h:1050
bool is_compressed() const 
Returns true if the function is compressed. 
Definition: mraimpl.h:231
bool operator()(const Key< NDIM > &key, const coeffT &coeff, const coeffT &parent) const 
post-determination 
Definition: funcimpl.h:477
Provides a tensor with taking advantage of possibly low rank. 
const implT * fimpl
Definition: funcimpl.h:5118
GenTensor< Q > NScoeffs2values(const keyT &key, const GenTensor< Q > &coeff, const bool s_only) const 
convert S or NS coeffs to values on a 2k grid of the children 
Definition: funcimpl.h:1581
CoeffTracker make_child(const keyT &child) const 
make a child of this, ignoring the coeffs 
Definition: funcimpl.h:819
const double L
Definition: 3dharmonic.cc:123
void phi_for_mul(Level np, Translation lp, Level nc, Translation lc, Tensor< double > &phi) const 
Compute the Legendre scaling functions for multiplication. 
Definition: mraimpl.h:2968
std::size_t max_nodes() const 
Returns the max number of nodes on a processor. 
Definition: mraimpl.h:1802
detail::ReferenceWrapper< T > const ref(T &t)
Reference wrapper factory function. 
Definition: ref.h:132
add_op this_type
Definition: funcimpl.h:2959
void serialize(Archive &ar)
Definition: funcimpl.h:3938
implL1 * result
Definition: funcimpl.h:5119
std::size_t max_depth() const 
Returns the maximum depth of the tree ... collective ... global sum/broadcast. 
Definition: mraimpl.h:1794
::std::string string
Definition: gtest-port.h:872
Definition: funcimpl.h:1948
FunctionImpl(const FunctionFactory< T, NDIM > &factory)
Initialize function impl from data in factory. 
Definition: funcimpl.h:953
Void do_square_inplace2(const keyT &parent, const keyT &child, const tensorT &parent_coeff)
FunctionNode(const coeffT &coeff, double norm_tree, bool has_children)
Definition: funcimpl.h:158
do_reduce_rank(const TensorArgs &targs)
Definition: funcimpl.h:1994
do_gaxpy_inplace(FunctionImpl< T, NDIM > *f, T alpha, R beta)
Definition: funcimpl.h:1109
Void vtransform_doit(const std::shared_ptr< FunctionImpl< R, NDIM > > &right, const Tensor< Q > &c, const std::vector< std::shared_ptr< FunctionImpl< T, NDIM > > > &vleft, double tol)
Definition: funcimpl.h:2252
returns true if the result of a hartree_product is a leaf node (compute norm & error) ...
Definition: funcimpl.h:493
void no_delete(T *)
Use this function with shared_ptr to do nothing for the pointer cleanup. 
Definition: boost_checked_delete_bits.h:47
bool randomize() const 
Definition: funcimpl.h:2961
Iterator for distributed container wraps the local iterator. 
Definition: worlddc.h:159
Range< typename dcT::iterator > rangeT
Definition: funcimpl.h:2186
void reduceRank(const double &eps)
reduces the rank of the coefficients (if applicable) 
Definition: funcimpl.h:238
FunctionImpl< T, NDIM > implT
Definition: funcimpl.h:685
void abs_square_inplace(bool fence)
Definition: mraimpl.h:2963
recursive part of recursive_apply 
Definition: funcimpl.h:4302
T alpha
Definition: funcimpl.h:1106
virtual ~FunctionImpl()
Definition: funcimpl.h:1044
double cnorm
Definition: funcimpl.h:3933
std::shared_ptr< implL > impl_p2
supposedly orbital 2 
Definition: function_interface.h:156
Definition: uniqueid.h:46
const implT * f
Definition: funcimpl.h:459
void serialize(const Archive &ar)
Definition: funcimpl.h:3003
error_leaf_op(const implT *f)
Definition: funcimpl.h:463
ctT g
Definition: funcimpl.h:2964
do_mapdim(const std::vector< long > map, implT &f)
Definition: funcimpl.h:2129
hartree_convolute_leaf_op(const implT *f, const implL *g, const opT *op)
Definition: funcimpl.h:614
Void do_diff1(const DerivativeBase< T, NDIM > *D, const implT *f, const keyT &key, const std::pair< keyT, coeffT > &left, const std::pair< keyT, coeffT > ¢er, const std::pair< keyT, coeffT > &right)
Definition: mraimpl.h:1023
LevelPmap(World &world)
Definition: funcimpl.h:110
bool operator()(const Key< NDIM > &key) const 
no pre-determination 
Definition: funcimpl.h:618
void clear()
Clears all local data (no communication) 
Definition: worlddc.h:875
Grossly simplified Boost-like type traits and templates. 
WorldContainer< keyT, nodeT > dcT
Type of container holding the coefficients. 
Definition: funcimpl.h:909
void compress(bool nonstandard, bool keepleaves, bool redundant, bool fence)
compress the wave function 
Definition: mraimpl.h:1462
bool randomize() const 
Definition: funcimpl.h:3333
bool has_coeff() const 
Returns true if there are coefficients in this node. 
Definition: funcimpl.h:188
tensorT gaxpy_ext_node(keyT key, Tensor< L > lc, T(*f)(const coordT &), T alpha, T beta) const 
Definition: funcimpl.h:4956
GenTensor< T > coeffT
Definition: funcimpl.h:128
Definition: mpreal.h:3066
double accumulate(const coeffT &t, const typename FunctionNode< T, NDIM >::dcT &c, const Key< NDIM > &key, const TensorArgs &args)
Accumulate inplace and if necessary connect node to parent. 
Definition: funcimpl.h:361
multiply_op< LDIM > this_type
Definition: funcimpl.h:2841
friend class FunctionImpl
Definition: funcimpl.h:914
this_type forward_ctor(const implT *fimpl1, implL1 *result1, const ctL &iag1, const int dim1)
taskq-compatible ctor 
Definition: funcimpl.h:5198
tensorT downsample(const keyT &key, const std::vector< Future< coeffT > > &v) const 
downsample the sum coefficients of level n+1 to sum coeffs on level n 
Definition: mraimpl.h:1237
void set_functor(const std::shared_ptr< FunctionFunctorInterface< T, NDIM > > functor1)
Definition: mraimpl.h:245
ShallowNode(const FunctionNode< T, NDIM > &node)
Definition: funcimpl.h:722
FunctionImpl< T, NDIM > implT
Definition: funcimpl.h:495
char(& no)[2]
Definition: type_traits_bits.h:172
project_out_op(const implT *fimpl, implL1 *result, const ctL &iag, const int dim)
Definition: funcimpl.h:5125
coeffT truncate_reconstructed_op(const keyT &key, const std::vector< Future< coeffT > > &v, const double tol)
given the sum coefficients of all children, truncate or not 
Definition: mraimpl.h:1584
double norm_tree_op(const keyT &key, const std::vector< Future< double > > &v)
Definition: mraimpl.h:1522
void add_scalar_inplace(T t, bool fence)
Adds a constant to the function. Local operation, optional fence. 
Definition: mraimpl.h:2447
recursive_apply_op2(const recursive_apply_op2 &other)
Definition: funcimpl.h:4446
Definition: funcimpl.h:4895
void apply_1d_realspace_push(const opT &op, const FunctionImpl< R, NDIM > *f, int axis, bool fence)
Definition: funcimpl.h:3251
void nonstandard(World &world, std::vector< Function< T, NDIM > > &v, bool fence=true)
Generates non-standard form of a vector of functions. 
Definition: vmra.h:167
std::size_t real_size() const 
Returns the number of coefficients in the function ... collective global sum. 
Definition: mraimpl.h:1860
const uniqueidT & id() const
Returns the globally unique object ID. 
Definition: worldobj.h:377
Future< this_type > activate() const 
Definition: funcimpl.h:3094
double operator()(typename dcT::const_iterator &it) const 
Definition: funcimpl.h:4599
Future< double > get_norm_tree_recursive(const keyT &key) const 
Definition: mraimpl.h:2667
std::vector< keyT > local_leaf_keys() const 
return the keys of the local leaf boxes 
Definition: mraimpl.h:515
recursive part of recursive_apply 
Definition: funcimpl.h:4430
Void forward_traverse(const coeff_opT &coeff_op, const apply_opT &apply_op, const keyT &key) const 
traverse a non-existing tree 
Definition: funcimpl.h:3118
Definition: funcimpl.h:684
returns true if the function has a leaf node at key (works only locally) 
Definition: funcimpl.h:434
bool operator()(const Key< NDIM > &key, const GenTensor< T > &coeff) const 
no post-determination 
Definition: funcimpl.h:507
Tensor< TENSOR_RESULT_TYPE(T, R)> mul(const Tensor< T > &c1, const Tensor< R > &c2, const int npt, const keyT &key) const 
multiply the values of two coefficient tensors using a custom number of grid points ...
Definition: funcimpl.h:1786
void serialize(Archive &ar)
Definition: funcimpl.h:732
void gaxpy_ext(const FunctionImpl< L, NDIM > *left, T(*f)(const coordT &), T alpha, T beta, double tol, bool fence)
Definition: funcimpl.h:5069
void trickle_down(bool fence)
sum all the contributions from all scales after applying an operator in mod-NS form ...
Definition: mraimpl.h:1388
NDIM & f
Definition: mra.h:2179
bool operator()(const Key< NDIM > &key) const 
pre-determination: we can't know if this will be a leaf node before we got the final coeffs ...
Definition: funcimpl.h:568
given a ket and the 1- and 2-electron potentials, construct the function V phi 
Definition: funcimpl.h:3331
long dim(int i) const 
Returns the size of dmension i. 
Definition: basetensor.h:147
void serialize(const Archive &ar)
Definition: funcimpl.h:4662
void serialize(Archive &ar)
Definition: funcimpl.h:593
std::size_t min_nodes() const 
Returns the min number of nodes on a processor. 
Definition: mraimpl.h:1811
do_err_box()
Definition: funcimpl.h:4552
bool has_data() const 
Definition: gentensor.h:187
do_err_box(const do_err_box &e)
Definition: funcimpl.h:4558
void add_SVD(const GenTensor< T > &rhs, const double &eps)
Definition: gentensor.h:199
void serialize(const Archive &ar)
Definition: funcimpl.h:2145
iterator end()
Returns an iterator past the end of the local data (no communication) 
Definition: worlddc.h:835
ProcessID size() const 
Returns the number of processes in this world (same as MPI_Comm_size()) 
Definition: worldfwd.h:533
do_consolidate_buffer()
Definition: funcimpl.h:2213
double do_apply_kernel2(const opT *op, const Tensor< R > &c, const do_op_args< OPDIM > &args, const TensorArgs &apply_targs)
same as do_apply_kernel, but use full rank tensors as input and low rank tensors as output ...
Definition: funcimpl.h:3983
Provides FunctionDefaults and utilities for coordinate transformation. 
do_merge_trees(const T alpha, const R beta, FunctionImpl< Q, NDIM > &other)
Definition: funcimpl.h:2092
FunctionImpl< T, NDIM > implT
Definition: funcimpl.h:605
Tensor< T > fcube(const Key< NDIM > &, T(*f)(const Vector< double, NDIM > &), const Tensor< double > &)
Definition: mraimpl.h:2047
"put" this on g 
Definition: funcimpl.h:2152
Void gaxpy_inplace(const T &alpha, const FunctionNode< Q, NDIM > &other, const R &beta)
General bi-linear operation — this = this*alpha + other*beta. 
Definition: funcimpl.h:311
int RandomValue< int >()
Random int. 
Definition: ran.cc:250
Future< this_type > activate() const 
retrieve the coefficients (parent coeffs might be remote) 
Definition: funcimpl.h:4493
Wrapper for opaque pointer ... bitwise copy of the pointer ... no remapping performed. 
Definition: archive.h:788
implT * f
Definition: funcimpl.h:2126
const FunctionCommonData< T, NDIM > & get_cdata() const 
Definition: mraimpl.h:302
void recursive_apply(opT &apply_op, const FunctionImpl< T, LDIM > *fimpl, const FunctionImpl< T, LDIM > *gimpl, const bool fence)
traverse a non-existing tree, make its coeffs and apply an operator 
Definition: funcimpl.h:4277
std::pair< bool, coeffT > operator()(const Key< NDIM > &key) const 
make and insert the coefficients into result's tree 
Definition: funcimpl.h:3359
hartree_op()
Definition: funcimpl.h:3055
Void traverse_tree(const coeff_opT &coeff_op, const apply_opT &apply_op, const keyT &key) const 
traverse a non-existing tree 
Definition: funcimpl.h:3134
void average(const implT &rhs)
take the average of two functions, similar to: this=0.5*(this+rhs) 
Definition: mraimpl.h:1150
double beta
Definition: funcimpl.h:2966
do_keep_sum_coeffs(implT *impl)
constructor need impl for cdata 
Definition: funcimpl.h:1971
CoeffTracker< T, LDIM > ctL
Definition: funcimpl.h:2840
std::pair< bool, coeffT > operator()(const Key< NDIM > &key) const 
apply this on a FunctionNode of f and g of Key key 
Definition: funcimpl.h:2882
Tensor< T > tensorT
Type of tensor for anything but to hold coeffs. 
Definition: funcimpl.h:904
const keyT & key() const 
const reference to the key 
Definition: funcimpl.h:800
const implT * impl
Definition: funcimpl.h:4897
ctL iap1
Definition: funcimpl.h:3342
FunctionImpl< T, NDIM > * f
Definition: funcimpl.h:1105
void recursive_apply(opT &apply_op, const implT *fimpl, implT *rimpl, const bool fence)
traverse an existing tree and apply an operator 
Definition: funcimpl.h:4409
Default store of a thingy via serialize(ar,t) 
Definition: archive.h:708
void unaryXX(const FunctionImpl< Q, NDIM > *func, const opT &op, bool fence)
Definition: funcimpl.h:2664
int get_k() const 
Definition: mraimpl.h:293
void norm_tree(World &world, const std::vector< Function< T, NDIM > > &v, bool fence=true)
Makes the norm tree for all functions in a vector. 
Definition: vmra.h:506
std::vector< Slice > child_patch(const keyT &child) const 
Returns patch referring to coeffs of child in parent box. 
Definition: mraimpl.h:641
void change_tensor_type1(const TensorArgs &targs, bool fence)
change the tensor type of the coefficients in the FunctionNode 
Definition: mraimpl.h:1161
const coeffT parent_to_child(const coeffT &s, const keyT &parent, const keyT &child) const 
Directly project parent coeffs to child coeffs. 
Definition: mraimpl.h:2983
Key< NDIM > keyT
Type of key. 
Definition: funcimpl.h:906
uint64_t distsq() const 
Definition: key.h:230
void serialize(const Archive &ar)
Definition: funcimpl.h:2006
static bool get_apply_randomize()
Gets the random load balancing for integral operators flag. 
Definition: funcdefaults.h:324
FunctionImpl< T, NDIM > implT
Definition: funcimpl.h:457
TensorArgs targs
Definition: funcimpl.h:2189
opT op
Definition: funcimpl.h:2597
int k
order of the wavelet 
Definition: function_common_data.h:88
void break_apart(Key< LDIM > &key1, Key< KDIM > &key2) const 
break key into two low-dimensional keys 
Definition: key.h:330
double errsq_local(const opT &func) const 
Returns the sum of squares of errors from local info ... no comms. 
Definition: funcimpl.h:4582
const double beta
Definition: gygi_soltion.cc:63
Tensor< typename Tensor< T >::scalar_type > arg(const Tensor< T > &t)
Return a new tensor holding the argument of each element of t (complex types only) ...
Definition: tensor.h:2429
void binaryXX(const FunctionImpl< L, NDIM > *left, const FunctionImpl< R, NDIM > *right, const opT &op, bool fence)
Definition: funcimpl.h:2653
FunctionImpl holds all Function state to facilitate shallow copy semantics. 
Definition: funcdefaults.h:48
static const Tensor< double > & get_cell()
Gets the user cell for the simulation. 
Definition: funcdefaults.h:369
This header should include pretty much everything needed for the parallel runtime. 
T inner(const vecfunc< T, NDIM > &a, const vecfunc< T, NDIM > &b)
the non-linear solver requires an inner product 
Definition: nemo.h:112
#define PROFILE_MEMBER_FUNC(classname)
Definition: worldprofile.h:199
iterator begin()
Returns an iterator to the beginning of the local data (no communication) 
Definition: worlddc.h:822
T inner_ext_local(const std::shared_ptr< FunctionFunctorInterface< T, NDIM > > f, const bool leaf_refine) const 
Definition: funcimpl.h:4936
Tensor< resultT > operator()(const Key< NDIM > &key, const Tensor< Q > &t) const 
Definition: funcimpl.h:2604
SimplePmap(World &world)
Definition: funcimpl.h:91
Changes non-standard compressed form to standard compressed form. 
Definition: funcimpl.h:3895
bool exists() const 
Definition: funcimpl.h:192
op_leaf_op(const opT *op, const implT *f)
Definition: funcimpl.h:565
FunctionImpl< T, NDIM > implT
Definition: funcimpl.h:558
implT * g
Definition: funcimpl.h:2155
ctL p2
tracking coeffs of the two lo-dim functions 
Definition: funcimpl.h:3051
FunctionImpl< T, NDIM > implT
Definition: funcimpl.h:435
Definition: funcimpl.h:2594
Future< std::pair< keyT, coeffT > > find_me(const keyT &key) const 
find_me. Called by diff_bdry to get coefficients of boundary function 
Definition: mraimpl.h:3059
Void trickle_down_op(const keyT &key, const coeffT &s)
sum all the contributions from all scales after applying an operator in mod-NS form ...
Definition: mraimpl.h:1402
std::vector< long > vk
(k,...) used to initialize Tensors 
Definition: function_common_data.h:93
static World * world_from_id(unsigned long id)
Convert world id to world pointer. 
Definition: worldfwd.h:628
void multiop_values(const opT &op, const std::vector< implT * > &v)
Definition: funcimpl.h:2319
ctL iap2
the particles 1 and 2 (exclusive with ket) 
Definition: funcimpl.h:3342
this_type make_child(const keyT &child) const 
Definition: funcimpl.h:3556
merge the coefficent boxes of this into other's tree 
Definition: funcimpl.h:2086
Void set_norm_tree(double norm_tree)
Sets the value of norm_tree. 
Definition: funcimpl.h:295
FunctionImpl< T, NDIM > implT
Type of this class (implementation) 
Definition: funcimpl.h:902
returnT type
Definition: enable_if.h:47
Defines and implements most of Tensor. 
std::shared_ptr< implT > impl_ket
various MRA functions of NDIM dimensionality 
Definition: function_interface.h:149
leaf_op(const implT *f)
Definition: funcimpl.h:440
bool leaves_only
Definition: funcimpl.h:4627
TensorType get_tensor_type() const 
Definition: mraimpl.h:275
static void load(const Archive &ar, FunctionImpl< T, NDIM > *&ptr)
Definition: funcimpl.h:5394
T inner_ext_recursive(keyT key, tensorT c, const std::shared_ptr< FunctionFunctorInterface< T, NDIM > > f, const bool leaf_refine, T old_inner=T(0)) const 
Definition: funcimpl.h:4798
implT * result
Definition: funcimpl.h:4437
void scale_inplace(const T q, bool fence)
In-place scale by a constant. 
Definition: mraimpl.h:2946
Void mulXXveca(const keyT &key, const FunctionImpl< L, NDIM > *left, const Tensor< L > &lcin, const std::vector< const FunctionImpl< R, NDIM > * > vrightin, const std::vector< Tensor< R > > &vrcin, const std::vector< FunctionImpl< T, NDIM > * > vresultin, double tol)
Definition: funcimpl.h:2357
bool is_valid() const 
Checks if a key is valid. 
Definition: key.h:158
void unary_op_node_inplace(const opT &op, bool fence)
Unary operation applied inplace to the coefficients WITHOUT refinement, optional fence. 
Definition: funcimpl.h:1884
bool noautorefine(const keyT &key, const tensorT &t) const 
Always returns false (for when autorefine is not wanted) 
Definition: mraimpl.h:947
Range< typename dcT::iterator > rangeT
Definition: funcimpl.h:2207
this_type make_child(const keyT &child) const 
Definition: funcimpl.h:4488
CompositeFunctorInterface implements a wrapper of holding several functions and functors. 
Definition: funcimpl.h:73
Timer timer_target_driven
Definition: funcimpl.h:947
do_op_args()
Definition: funcimpl.h:3934
Void unaryXXa(const keyT &key, const FunctionImpl< Q, NDIM > *func, const opT &op)
Definition: funcimpl.h:2620
void serialize(const Archive &ar)
Definition: funcimpl.h:4614
void set_autorefine(bool value)
Definition: mraimpl.h:290
a class to track where relevant (parent) coeffs are 
Definition: funcimpl.h:756
std::size_t max_local_depth() const 
Returns the maximum local depth of the tree ... no communications. 
Definition: mraimpl.h:1780
Timer timer_accumulate
Definition: funcimpl.h:943
T inner_ext_recursive(keyT key, tensorT c, T(*f)(const coordT &), const bool leaf_refine, T old_inner=T(0)) const 
Definition: funcimpl.h:4720
Void erase(const Level &max_level)
truncate tree at a certain level 
Definition: mraimpl.h:823
do_average(implT &g)
Definition: funcimpl.h:2158
bool is_leaf() const 
Definition: funcimpl.h:730
const bool leaf_refine
Definition: funcimpl.h:4898
Range< typename dcT::iterator > rangeT
Definition: funcimpl.h:1967
Void do_apply(const opT *op, const keyT &key, const Tensor< R > &c)
apply an operator on the coeffs c (at node key) 
Definition: funcimpl.h:4054
void do_print_tree_graphviz(const keyT &key, std::ostream &os, Level maxlevel) const 
Definition: mraimpl.h:2620
double thresh
Definition: gentensor.h:128
Simple structure used to manage references/pointers to remote instances. 
Definition: worldref.h:59
Definition: funcimpl.h:2206
T operator()(T a, T b) const 
Definition: funcimpl.h:4912
given an NS tree resulting from a convolution, truncate leafs if appropriate 
Definition: funcimpl.h:1922
Void sock_it_to_me(const keyT &key, const RemoteReference< FutureImpl< std::pair< keyT, coeffT > > > &ref) const 
Walk up the tree returning pair(key,node) for first node with coefficients. 
Definition: mraimpl.h:2678
bool operator()(const Key< NDIM > &key, const Tensor< T > &fcoeff, const Tensor< T > &gcoeff) const 
post-determination: true if f is a leaf and the result is well-represented 
Definition: funcimpl.h:517
Tensor< double > quad_x
quadrature points 
Definition: function_common_data.h:99
Void evaldepthpt(const Vector< double, NDIM > &xin, const keyT &keyin, const typename Future< Level >::remote_refT &ref)
Get the depth of the tree at a point in simulation coordinates. 
Definition: mraimpl.h:2800
insert_op(const insert_op &other)
Definition: funcimpl.h:693
implT * impl
Definition: funcimpl.h:690
void zero_norm_tree()
Definition: mraimpl.h:1329
Void set_has_children_recursive(const typename FunctionNode< T, NDIM >::dcT &c, const Key< NDIM > &key)
Sets has_children attribute to true recurring up to ensure connected. 
Definition: funcimpl.h:251
bool is_local(const keyT &key) const 
Returns true if the key maps to the local processor (no communication) 
Definition: worlddc.h:793
Future< coeffT > truncate_reconstructed_spawn(const keyT &key, const double tol)
truncate using a tree in reconstructed form 
Definition: mraimpl.h:1560
double operator()(double a, double b) const 
Definition: funcimpl.h:2070
T trace_conj(const FunctionNode< T, NDIM > &rhs) const 
Definition: funcimpl.h:407
void print_tree_graphviz(std::ostream &os=std::cout, Level maxlevel=10000) const 
Definition: mraimpl.h:2612
recursive_apply_op2< opT > this_type
Definition: funcimpl.h:4433
CoeffTracker< T, LDIM > iag
Definition: funcimpl.h:4309
void do_print_grid(const std::string filename, const std::vector< keyT > &keys) const 
print the grid in xyz format 
Definition: mraimpl.h:541
const T1 &f1 return GTEST_2_TUPLE_() T(f0, f1)
std::pair< Key< NDIM >, ShallowNode< T, NDIM > > find_datum(keyT key) const 
return the a std::pair, which MUST exist 
Definition: mraimpl.h:1057
Vector< double, NDIM > coordT
Type of vector holding coordinates. 
Definition: funcimpl.h:911
T(* fptr)(const coordT &)
Definition: funcimpl.h:4870
void verify_tree() const 
Verify tree is properly constructed ... global synchronization involved. 
Definition: mraimpl.h:104
implT * result
where to construct the pair function 
Definition: funcimpl.h:3050
static bool randomize()
Definition: funcimpl.h:2838
#define max(a, b)
Definition: lda.h:53
T inner_ext_node(keyT key, tensorT c, const std::shared_ptr< FunctionFunctorInterface< T, NDIM > > f) const 
Definition: funcimpl.h:4703
bool operator()(const Key< NDIM > &key) const 
no pre-determination 
Definition: funcimpl.h:466
bool operator()(const Key< NDIM > &key, const Tensor< T > &fcoeff, const Tensor< T > &gcoeff) const 
post-determination: true if f is a leaf and the result is well-represented 
Definition: funcimpl.h:631
ctL g
Definition: funcimpl.h:2845
void unary_op_value_inplace(const opT &op, bool fence)
Unary operation applied inplace to the values with optional refinement and fence. ...
Definition: funcimpl.h:2347
T * ptr
Definition: archive.h:790
void serialize(const Archive &ar)
Definition: funcimpl.h:2074
Vector< T, 1 > vec(T x)
Your friendly neighborhood factory function. 
Definition: array.h:456
Tensor< double > print_plane_local(const int xaxis, const int yaxis, const coordT &el2)
collect the data for a plot of the MRA structure locally on each node 
Definition: mraimpl.h:378
Key parent(int generation=1) const 
Returns the key of the parent. 
Definition: key.h:248
std::vector< Slice > s0
s[0] in each dimension to get scaling coeff 
Definition: function_common_data.h:91
void scale(World &world, std::vector< Function< T, NDIM > > &v, const std::vector< Q > &factors, bool fence=true)
Scales inplace a vector of functions by distinct values. 
Definition: vmra.h:290
const bool leaf_refine
Definition: funcimpl.h:4872
Future< this_type > activate() const 
Definition: funcimpl.h:4385
void serialize(const Archive &ar)
Definition: funcimpl.h:4916
opT op
Definition: funcimpl.h:2228
Future< argT > operator()(const Key< NDIM > &key) const 
do the actual contraction 
Definition: funcimpl.h:5132
WorldContainer< Key< NDIM >, FunctionNode< T, NDIM > > dcT
Definition: funcimpl.h:141
void scale_oop(const Q q, const FunctionImpl< F, NDIM > &f, bool fence)
Out-of-place scale by a constant. 
Definition: funcimpl.h:5343
Definition: funcimpl.h:557
void serialize(Archive &ar)
Definition: funcimpl.h:697
detail::task_result_type< memfnT >::futureT task(ProcessID dest, memfnT memfn, const TaskAttributes &attr=TaskAttributes()) const
Sends task to derived class method "returnT (this->*memfn)(a1,a2,a3,a4,a5,a6,a7,a8,a9)". 
Definition: worldobj.h:493
void change_tensor_type(GenTensor< T > &t, const TensorArgs &targs)
change representation to targ.tt 
Definition: gentensor.h:1309
Void do_square_inplace(const keyT &key)
void vtransform(const std::vector< std::shared_ptr< FunctionImpl< R, NDIM > > > &vright, const Tensor< Q > &c, const std::vector< std::shared_ptr< FunctionImpl< T, NDIM > > > &vleft, double tol, bool fence)
Transforms a vector of functions left[i] = sum[j] right[j]*c[j,i] using sparsity. ...
Definition: funcimpl.h:2333
Definition: funcimpl.h:1103
T operator()(T a, T b) const 
Definition: funcimpl.h:4886
hartree_leaf_op()
Definition: funcimpl.h:500
std::pair< bool, T > eval_local_only(const Vector< double, NDIM > &xin, Level maxlevel)
Evaluate function only if point is local returning (true,value); otherwise return (false...
Definition: mraimpl.h:2771
const keyT & key0() const 
Definition: mraimpl.h:348
bool operator()(typename rangeT::iterator &it) const 
iterator it points to this 
Definition: funcimpl.h:2161
const FunctionImpl< T, NDIM > * f
Definition: funcimpl.h:496
Definition: function_common_data.h:127
opT leaf_op
deciding if a given FunctionNode will be a leaf node 
Definition: funcimpl.h:3340
ctT f
tracking coeffs of first and second addend 
Definition: funcimpl.h:2964
bool has_children() const 
Definition: funcimpl.h:729
Function< T, NDIM > copy(const Function< T, NDIM > &f, const std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > &pmap, bool fence=true)
Create a new copy of the function with different distribution and optional fence. ...
Definition: mra.h:1835
void gaxpy_oop_reconstructed(const double alpha, const implT &f, const double beta, const implT &g, const bool fence)
perform: this= alpha*f + beta*g, invoked by result 
Definition: mraimpl.h:203
T operator()(typename dcT::const_iterator &it) const 
Definition: funcimpl.h:4902
void serialize(const Archive &ar)
Definition: funcimpl.h:1942
this_type make_child(const keyT &child) const 
Definition: funcimpl.h:2986
Key< OPDIM > key
Definition: funcimpl.h:3931
T alpha
Definition: funcimpl.h:2089
const mpreal log10(const mpreal &v, mp_rnd_t rnd_mode)
Definition: mpreal.h:2227
Range< typename dcT::iterator > rangeT
Definition: funcimpl.h:1949
const mpreal min(const mpreal &x, const mpreal &y)
Definition: mpreal.h:2675
Tensor< TENSOR_RESULT_TYPE(T, Q)> transform_dir(const Tensor< T > &t, const Tensor< Q > &c, int axis)
Transforms one dimension of the tensor t by the matrix c, returns new contiguous tensor. 
Definition: tensor.h:1929
std::pair< bool, coeffT > operator()(const Key< NDIM > &key) const 
make the NS-coefficients and send off the application of the operator 
Definition: funcimpl.h:4327
Definition: funcimpl.h:76
Range< typename dcT::const_iterator > rangeT
Definition: funcimpl.h:4673
void store(Archive &ar)
Definition: funcimpl.h:1150
double alpha
prefactor for f, g 
Definition: funcimpl.h:2966
change representation of nodes' coeffs to low rank, optional fence 
Definition: funcimpl.h:2185
do_average()
Definition: funcimpl.h:2157
CoeffTracker< T, LDIM > ctL
Definition: funcimpl.h:3048
hartree_op< LDIM, leaf_opT > this_type
Definition: funcimpl.h:3047
FunctionNode< T, NDIM > nodeT
Definition: funcimpl.h:688
do_gaxpy_inplace()
Definition: funcimpl.h:1108
recursive_apply_op()
Definition: funcimpl.h:4313
TENSOR_RESULT_TYPE(T, R) inner_local(const FunctionImpl<R
Returns the inner product ASSUMING same distribution. 
coeffT make_redundant_op(const keyT &key, const std::vector< Future< coeffT > > &v)
similar to compress_op, but insert only the sum coefficients in the tree 
Definition: mraimpl.h:1714
FLOAT a(int j, FLOAT z)
Definition: y1.cc:86
void accumulate(const double time) const 
accumulate timer 
Definition: function_common_data.h:141
void project_out(FunctionImpl< T, NDIM-LDIM > *result, const FunctionImpl< T, LDIM > *gimpl, const int dim, const bool fence)
project the low-dim function g on the hi-dim function f: result(x) =  ...
Definition: funcimpl.h:5084
void replace(const pairT &datum)
Inserts/replaces key+value pair (non-blocking communication if key not local) 
Definition: worlddc.h:727
multiply_op()
Definition: funcimpl.h:2848
Void do_project_out(const coeffT &fcoeff, const std::pair< keyT, coeffT > gpair, const keyT &gkey, const Key< NDIM > &dest, const int dim) const 
compute the inner product of two nodes of only some dimensions and accumulate on result ...
Definition: funcimpl.h:5274
std::shared_ptr< implL > impl_p1
supposedly orbital 1 
Definition: function_interface.h:155
double do_apply_kernel3(const opT *op, const GenTensor< R > &coeff, const do_op_args< OPDIM > &args, const TensorArgs &apply_targs)
same as do_apply_kernel2, but use low rank tensors as input and low rank tensors as output ...
Definition: funcimpl.h:4020
void serialize(const Archive &ar)
Definition: funcimpl.h:2219
void reset_timer()
Definition: mraimpl.h:320
void serialize(Archive &ar)
Definition: funcimpl.h:679
void print_grid(const std::string filename) const 
Definition: mraimpl.h:499
do_change_tensor_type()
Definition: funcimpl.h:2192
bool operator()(typename rangeT::iterator &it) const 
return the norm of the difference of this node and its "mirror" node 
Definition: funcimpl.h:2096
recursive_apply_op< opT, LDIM > this_type
Definition: funcimpl.h:4305
Level level() const 
Definition: key.h:220
Void binaryXXa(const keyT &key, const FunctionImpl< L, NDIM > *left, const Tensor< L > &lcin, const FunctionImpl< R, NDIM > *right, const Tensor< R > &rcin, const opT &op)
Definition: funcimpl.h:2533
void reduce_rank(const double &eps)
Definition: gentensor.h:193
do_reduce_rank(const double &thresh)
Definition: funcimpl.h:1995
Default load of a thingy via serialize(ar,t) 
Definition: archive.h:718
Void do_apply_kernel(const opT *op, const Tensor< R > &c, const do_op_args< OPDIM > &args)
for fine-grain parallelism: call the apply method of an operator in a separate task ...
Definition: funcimpl.h:3950
CoeffTracker< T, LDIM > iaf
Definition: funcimpl.h:4308
static const FunctionCommonData< T, NDIM > & get(int k)
Definition: function_common_data.h:111
ProcessID random_proc()
Returns a random process number [0,world.size()) 
Definition: worldfwd.h:690
coeffT upsample(const keyT &key, const coeffT &coeff) const 
upsample the sum coefficients of level 1 to sum coeffs on level n+1 
Definition: mraimpl.h:1267
void print_tree(std::ostream &os=std::cout, Level maxlevel=10000) const 
Definition: mraimpl.h:2583
bool log
Definition: funcimpl.h:1252
void truncate(double tol, bool fence)
Truncate according to the threshold with optional global fence. 
Definition: mraimpl.h:332
TensorArgs holds the arguments for creating a LowRankTensor. 
Definition: gentensor.h:127
ctL iav1
Definition: funcimpl.h:3343
Void reconstruct_op(const keyT &key, const coeffT &s)
Definition: mraimpl.h:1992
bool _empty
Definition: function_factory.h:90
Future< this_type > activate() const 
Definition: funcimpl.h:2938
enable_if_c< NDIM==FDIM >::type read_grid(const std::string keyfile, const std::string gridfile, std::shared_ptr< FunctionFunctorInterface< double, NDIM > > vnuc_functor)
read data from a grid 
Definition: funcimpl.h:1312
FunctionNode< T, NDIM > & operator=(const FunctionNode< T, NDIM > &other)
Definition: funcimpl.h:167
resultT operator()(resultT a, resultT b) const 
Definition: funcimpl.h:4658
void operator()(const keyT &key, const coeffT &coeff, const bool &is_leaf) const 
Definition: funcimpl.h:694
project_out_op(const project_out_op &other)
Definition: funcimpl.h:5127
double check_symmetry_local() const 
Returns some asymmetry measure ... no comms. 
Definition: mraimpl.h:840
coeff_value_adaptor()
Definition: funcimpl.h:2599
ctL p1
Definition: funcimpl.h:3051
Void evalR(const Vector< double, NDIM > &xin, const keyT &keyin, const typename Future< long >::remote_refT &ref)
Get the rank of leaf box of the tree at a point in simulation coordinates. 
Definition: mraimpl.h:2842
shallow-copy, pared-down version of FunctionNode, for special purpose only 
Definition: funcimpl.h:717
void broaden(std::vector< bool > is_periodic, bool fence)
Definition: mraimpl.h:1338
laziness 
Definition: funcimpl.h:3930
LevelPmap()
Definition: funcimpl.h:108
FunctionImpl< Q, NDIM > * other
Definition: funcimpl.h:2088
Implements the functionality of Futures. 
Definition: worldfut.h:157
void flo_unary_op_node_inplace(const opT &op, bool fence)
Unary operation applied inplace to the coefficients WITHOUT refinement, optional fence. 
Definition: funcimpl.h:1897
map this on f 
Definition: funcimpl.h:2122
do_truncate_NS_leafs(const implT *f)
Definition: funcimpl.h:1926
this_type make_child(const keyT &child) const 
Definition: funcimpl.h:4376
return world taskq reduce(rangeT(coeffs.begin(), coeffs.end()), do_inner_local< R >(&g, leaves_only))
An integer with atomic set, get, read+inc, read+dec, dec+test operations. 
Definition: atomicint.h:73
double operator()(typename dcT::const_iterator &it) const 
Definition: funcimpl.h:4561
const implT * get_impl() const 
const reference to impl 
Definition: funcimpl.h:794
bool truncate_op(const keyT &key, double tol, const std::vector< Future< bool > > &v)
Actually do the truncate operation. 
Definition: mraimpl.h:2555
const FunctionImpl< R, NDIM > * other
Definition: funcimpl.h:4626
Range< typename dcT::iterator > rangeT
Definition: funcimpl.h:2123
bool operator()(const implT *f, const keyT &key, const nodeT &t) const 
Definition: funcimpl.h:3758
bool operator()(const Key< NDIM > &key, const double &cnorm) const 
post-determination: return true if operator and coefficient norms are small 
Definition: funcimpl.h:578
this_type forward_ctor(implT *result1, const opT &leaf_op, const ctT &iaket1, const ctL &iap11, const ctL &iap21, const ctL &iav11, const ctL &iav21, const implT *eri1)
Definition: funcimpl.h:3578
bool & is_on_demand()
Definition: mraimpl.h:269
static void load(const Archive &ar, std::shared_ptr< const FunctionImpl< T, NDIM > > &ptr)
Definition: funcimpl.h:5423
const double cc
Definition: navstokes_cosines.cc:108
Implements most parts of a globally addressable object (via unique ID) 
Definition: worldam.h:74
GenTensor< Q > values2NScoeffs(const keyT &key, const GenTensor< Q > &values) const 
convert function values of the a child generation directly to NS coeffs 
Definition: funcimpl.h:1666
opT * apply_op
Definition: funcimpl.h:4310
int particle
if g is g(1) or g(2) 
Definition: funcimpl.h:2846
const implT * impl
Definition: funcimpl.h:4871
void set_thresh(double value)
Definition: mraimpl.h:284
bool is_nonstandard() const 
Definition: mraimpl.h:242
tensorT sqrt(const tensorT &s, double tol=1e-8)
Computes matrix square root (not used any more?) 
Definition: DFcode/moldft.cc:446
Void gaxpy_ext_recursive(const keyT &key, const FunctionImpl< L, NDIM > *left, Tensor< L > lcin, tensorT c, T(*f)(const coordT &), T alpha, T beta, double tol, bool below_leaf)
Definition: funcimpl.h:4981
bool operator()(typename rangeT::iterator &it) const 
Definition: funcimpl.h:1973
A parallel world with full functionality wrapping an MPI communicator. 
Definition: worldfwd.h:416
void fence()
Synchronizes all processes in communicator AND globally ensures no pending AM or tasks. 
Definition: worldgop.cc:52
TensorType tensor_type() const 
Definition: gentensor.h:197
do_convert_to_color()
Definition: funcimpl.h:1254
Timer timer_filter
Definition: funcimpl.h:945
leaf_op()
Definition: funcimpl.h:439
std::shared_ptr< FunctionFunctorInterface< T, NDIM > > get_functor()
Definition: mraimpl.h:251
hartree_convolute_leaf_op()
Definition: funcimpl.h:613
std::shared_ptr< FunctionImpl< T, NDIM > > pimplT
pointer to this class 
Definition: funcimpl.h:903
keep only the sum coefficients in each node 
Definition: funcimpl.h:1966
Hartree product of two LDIM functions to yield a NDIM = 2*LDIM function. 
Definition: funcimpl.h:3044
void reduce_rank(const TensorArgs &targs, bool fence)
reduce the rank of the coefficients tensors 
Definition: mraimpl.h:1169
void reconstruct(bool fence)
Definition: mraimpl.h:1444
std::size_t hashT
The hash value type. 
Definition: worldhash.h:148
T inner_ext_local(T(*f)(const coordT &), const bool leaf_refine) const 
Definition: funcimpl.h:4925
Void project_refine_op(const keyT &key, bool do_refine, const std::vector< Vector< double, NDIM > > &specialpts)
Projection with optional refinement. 
Definition: mraimpl.h:2368
Void refine_spawn(const opT &op, const keyT &key)
Definition: funcimpl.h:3790
argT finalize(const double kernel_norm, const keyT &key, const coeffT &coeff, const implT *r) const 
sole purpose is to wait for the kernel norm, wrap it and send it back to caller 
Definition: funcimpl.h:4479
implT * result
where to construct Vphi, no need to track parents 
Definition: funcimpl.h:3339
bool insert(accessor &acc, const keyT &key)
Write access to LOCAL value by key. Returns true if inserted, false if already exists (throws if remo...
Definition: worlddc.h:754
perform this multiplication: h(1,2) = f(1,2) * g(1) 
Definition: funcimpl.h:2836
Void consolidate_buffer(const TensorArgs &args)
Definition: funcimpl.h:397
void serialize(const Archive &ar)
Definition: funcimpl.h:4890
void load(Archive &ar)
Definition: funcimpl.h:1134
bool randomize() const 
Definition: funcimpl.h:4303
int Level
Definition: key.h:58
GenTensor< Q > NS_fcube_for_mul(const keyT &child, const keyT &parent, const GenTensor< Q > &coeff, const bool s_only) const 
Compute the function values for multiplication. 
Definition: funcimpl.h:1617
Void multiop_values_doit(const keyT &key, const opT &op, const std::vector< implT * > &v)
Definition: funcimpl.h:2307
World & world
Definition: funcimpl.h:916
typedef TENSOR_RESULT_TYPE(T, R) resultT
int ProcessID
Used to clearly identify process number/rank. 
Definition: worldtypes.h:37
const implT * f
the source or result function, needed for truncate_tol 
Definition: funcimpl.h:561
GenTensor< T > coeffT
Definition: funcimpl.h:718
implT * impl
Definition: funcimpl.h:2227
Future< MEMFUN_RETURNT(memfunT) > send(const keyT &key, memfunT memfun)
Sends message "resultT memfun()" to item (non-blocking comm if remote) 
Definition: worlddc.h:919
T trace_local() const 
Returns int(f(x),x) in local volume. 
Definition: mraimpl.h:3000
FunctionImpl< T, NDIM-LDIM > implL1
Definition: funcimpl.h:5115
Definition: funcimpl.h:3757
project_out_op()
Definition: funcimpl.h:5124
std::pair< bool, coeffT > argT
Definition: funcimpl.h:4435
tensorT eri_values(const keyT &key) const 
return the values of the 2-particle potential 
Definition: funcimpl.h:3465
Definition: funcimpl.h:4869
void print_size(const std::string name) const 
print tree size and size 
Definition: mraimpl.h:1874
const mpreal sum(const mpreal tab[], unsigned long int n, mp_rnd_t rnd_mode)
Definition: mpreal.cc:241
FunctionNode holds the coefficients, etc., at each node of the 2^NDIM-tree. 
Definition: derivative.h:58
Tri-diagonal operator traversing tree primarily for derivative operator. 
Definition: derivative.h:73
std::shared_ptr< implT > impl_eri
supposedly 1/r12 
Definition: function_interface.h:150
Abstract base class interface required for functors used as input to Functions. 
Definition: function_interface.h:58
R beta
Definition: funcimpl.h:2090
Tensor< T > eval_plot_cube(const coordT &plotlo, const coordT &plothi, const std::vector< long > &npt, const bool eval_refine=false) const 
Evaluate a cube/slice of points ... plotlo and plothi are already in simulation coordinates. 
Definition: mraimpl.h:3192
ProcessID rank() const 
Returns the process rank in this world (same as MPI_Comm_rank())) 
Definition: worldfwd.h:526
Void accumulate_timer(const double time) const 
Definition: mraimpl.h:305
void serialize(Archive &ar)
Definition: funcimpl.h:2613
check symmetry wrt particle exchange 
Definition: funcimpl.h:2012
Void refine_op(const opT &op, const keyT &key)
Definition: funcimpl.h:3765
archive_array< unsigned char > wrap_opaque(const T *, unsigned int)
Factory function to wrap pointer to contiguous data as opaque (uchar) archive_array. 
Definition: archive.h:827
Defines simple templates for printing to std::cout "a la Python". 
double finalize_apply(const bool fence=true)
after apply we need to do some cleanup; 
Definition: mraimpl.h:1741
project the low-dim function g on the hi-dim function f: result(x) =  ...
Definition: funcimpl.h:5110
static void store(const Archive &ar, const FunctionImpl< T, NDIM > *const &ptr)
Definition: funcimpl.h:5385
project_out_op< LDIM > this_type
Definition: funcimpl.h:5113
void norm_tree(bool fence)
compute for each FunctionNode the norm of the function inside that node 
Definition: mraimpl.h:1514
Void set_has_children(bool flag)
Sets has_children attribute to value of flag. 
Definition: funcimpl.h:244
bool operator()(const Key< NDIM > &key) const 
no pre-determination 
Definition: funcimpl.h:504
ProcessID owner(const keyT &key) const 
Returns processor that logically owns key (no communication) 
Definition: worlddc.h:786
static void store(const Archive &ar, const std::shared_ptr< FunctionImpl< T, NDIM > > &ptr)
Definition: funcimpl.h:5448
bool randomize() const 
Definition: funcimpl.h:3045
bool operator()(const Key< NDIM > &key, const T &t, const R &r) const 
Definition: funcimpl.h:710
void serialize(Archive &ar)
Definition: funcimpl.h:448
void print_stats() const 
print the number of configurations per node 
Definition: mraimpl.h:1898
void add(TaskInterface *t)
Add a new local task taking ownership of the pointer. 
Definition: worldtask.h:473
GenTensor< T > full_tensor() const 
Definition: gentensor.h:182
recursive_apply_op(const recursive_apply_op &other)
Definition: funcimpl.h:4320
recursive_apply_op(implT *result, const CoeffTracker< T, LDIM > &iaf, const CoeffTracker< T, LDIM > &iag, const opT *apply_op)
Definition: funcimpl.h:4314
void unaryXXvalues(const FunctionImpl< Q, NDIM > *func, const opT &op, bool fence)
Definition: funcimpl.h:2674
WorldTaskQueue & taskq
Task queue. 
Definition: worldfwd.h:461
Void broaden_op(const keyT &key, const std::vector< Future< bool > > &v)
Definition: mraimpl.h:1317
GenTensor< T > outer_low_rank(const Tensor< T > &left, const Tensor< T > &right)
Outer product ... result(i,j,...,p,q,...) = left(i,k,...)*right(p,q,...) 
Definition: gentensor.h:238
ctT f
Definition: funcimpl.h:2844
bool is_redundant() const 
Returns true if the function is redundant. 
Definition: mraimpl.h:237
GenTensor< TENSOR_RESULT_TYPE(T, Q)> general_transform(const GenTensor< T > &t, const Tensor< Q > c[])
Transform all dimensions of the tensor t by distinct matrices c. 
Definition: gentensor.h:1342
long box_leaf[1000]
Definition: funcimpl.h:2698
Definition: funcimpl.h:1250
iteratorT iterator
Definition: worldrange.h:55
Definition: funcimpl.h:603
std::size_t tree_size() const 
Returns the size of the tree structure of the function ... collective global sum. ...
Definition: mraimpl.h:1820
const implT * f
Definition: funcimpl.h:436
Vphi_op_NS< opT, LDIM > this_type
Definition: funcimpl.h:3335
Timer timer_compress_svd
Definition: funcimpl.h:946
remote_refT remote_ref(World &world) const 
Returns a structure used to pass references to another process. 
Definition: worldfut.h:552
std::pair< bool, coeffT > argT
Definition: funcimpl.h:5116
Range vaguely a la Intel TBB encapsulates random-access STL-like start and end iterators with chunksi...
Definition: worldrange.h:49
ProcessID owner(const keyT &key) const 
Find the owner of a given key. 
Definition: funcimpl.h:113
implT * h
the result function h(1,2) = f(1,2) * g(1) 
Definition: funcimpl.h:2843
void serialize(Archive &ar)
Definition: funcimpl.h:488
const std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > & get_pmap() const 
Definition: mraimpl.h:187
void clear_coeff()
Clears the coefficients (has_coeff() will subsequently return false) 
Definition: funcimpl.h:284
long size() const 
Returns the number of elements in the tensor. 
Definition: basetensor.h:138
bool do_error_leaf_op() const 
Definition: funcimpl.h:562
T operator()(typename dcT::const_iterator &it) const 
Definition: funcimpl.h:4876
bool randomize() const 
Definition: funcimpl.h:5111
void diff(const DerivativeBase< T, NDIM > *D, const implT *f, bool fence)
Definition: mraimpl.h:1035
void operator()(const Key< NDIM > &key, const GenTensor< T > &coeff, const bool &is_leaf) const 
Definition: funcimpl.h:674
Future< bool > truncate_spawn(const keyT &key, double tol)
Returns true if after truncation this node has coefficients. 
Definition: mraimpl.h:2519
bool operator()(const Key< NDIM > &key, const GenTensor< T > &coeff=GenTensor< T >()) const 
pre/post-determination is the same here 
Definition: funcimpl.h:443
void serialize(const Archive &ar)
Definition: funcimpl.h:2949
do_err_box(const implT *impl, const opT *func, int npt, const Tensor< double > &qx, const Tensor< double > &quad_phit, const Tensor< double > &quad_phiw)
Definition: funcimpl.h:4554
Future< resultT > reduce(const rangeT &range, const opT &op)
Reduce op(item) for all items in range using op(sum,op(item)) 
Definition: worldtask.h:516
void normalize()
Definition: gentensor.h:194
A simple process map. 
Definition: funcimpl.h:85
bool do_error_leaf_op() const 
Definition: funcimpl.h:611
void serialize(Archive &ar)
Definition: funcimpl.h:1118
Definition: funcimpl.h:704
enable_if_c< NDIM==FDIM >::type read_grid2(const std::string gridfile, std::shared_ptr< FunctionFunctorInterface< double, NDIM > > vnuc_functor)
read data from a grid 
Definition: funcimpl.h:1420
void serialize(const Archive &ar)
Definition: funcimpl.h:2181
Range< typename dcT::const_iterator > rangeT
Definition: funcimpl.h:2087
T * ptr_from_id(uniqueidT id) const 
Look up local pointer from world-wide unique id. 
Definition: worldfwd.h:597
double err_box(const keyT &key, const nodeT &node, const opT &func, int npt, const Tensor< double > &qx, const Tensor< double > &quad_phit, const Tensor< double > &quad_phiw) const 
Returns the square of the error norm in the box labeled by key. 
Definition: funcimpl.h:4514
static const Tensor< double > & get_cell_width()
Returns the width of each user cell dimension. 
Definition: funcdefaults.h:391
void standard(bool fence)
Changes non-standard compressed form to standard compressed form. 
Definition: mraimpl.h:1732
CoeffTracker()
default ctor 
Definition: funcimpl.h:775
Future< this_type > activate() const 
Definition: funcimpl.h:3567
Vphi_op_NS(implT *result, const opT &leaf_op, const ctT &iaket, const ctL &iap1, const ctL &iap2, const ctL &iav1, const ctL &iav2, const implT *eri)
Definition: funcimpl.h:3348
opT::resultT resultT
Definition: funcimpl.h:2595
Key< NDIM > simpt2key(const coordT &pt, Level n) const 
Returns the box at level n that contains the given point in simulation coordinates. 
Definition: mraimpl.h:694
TensorArgs targs
Definition: funcimpl.h:2210
GenTensor< Q > values2coeffs(const keyT &key, const GenTensor< Q > &values) const 
Definition: funcimpl.h:1695
NDIM &g const
Definition: funcimpl.h:4671
A future is a possibly yet unevaluated value. 
Definition: ref.h:210
void set_is_leaf(bool flag)
Sets has_children attribute to value of !flag. 
Definition: funcimpl.h:269
A type you can return when you want to return void ... use "return None". 
Definition: typestuff.h:154
void serialize(Archive &ar)
Definition: funcimpl.h:667
Tensor< double > hg
Definition: function_common_data.h:107
void fcube(const keyT &key, const FunctionFunctorInterface< T, NDIM > &f, const Tensor< double > &qx, tensorT &fval) const 
Evaluate function at quadrature points in the specified box. 
Definition: mraimpl.h:2356
double do_apply_directed_screening(const opT *op, const keyT &key, const coeffT &coeff, const bool &do_kernel)
apply an operator on the coeffs c (at node key) 
Definition: funcimpl.h:4147
bool exists_and_has_children(const keyT &key) const 
Definition: mraimpl.h:1306
tensorT coeffs_for_jun(Level n, long q=0)
Get the scaling function coeffs at level n starting from NS form. 
Definition: mraimpl.h:708
const FunctionImpl< Q, NDIM > * impl_func
Definition: funcimpl.h:2596
void serialize(const Archive &ar)
Definition: funcimpl.h:4504
this_type make_child(const keyT &child) const 
Definition: funcimpl.h:2928
Tensor< TENSOR_RESULT_TYPE(T, Q) > & fast_transform(const Tensor< T > &t, const Tensor< Q > &c, Tensor< TENSOR_RESULT_TYPE(T, Q) > &result, Tensor< TENSOR_RESULT_TYPE(T, Q) > &workspace)
Restricted but heavily optimized form of transform() 
Definition: tensor.h:2351
bool operator()(const Key< NDIM > &key, const GenTensor< T > &coeff) const 
no post-determination 
Definition: funcimpl.h:469
std::pair< const keyT, nodeT > datumT
Type of entry in container. 
Definition: funcimpl.h:910
coeffT coeff(const keyT &key) const 
return the coefficients belonging to the passed-in key 
Definition: funcimpl.h:808
Tensor< double > op(const Tensor< double > &x)
Definition: kain.cc:508
Slice s[4]
s[0]=Slice(0,k-1), s[1]=Slice(k,2*k-1), etc. 
Definition: function_common_data.h:90
Interface to be provided by any process map. 
Definition: worlddc.h:64
Future< REMFUTURE(MEMFUN_RETURNT(memfunT)) > task(const keyT &key, memfunT memfun, const TaskAttributes &attr=TaskAttributes())
Adds task "resultT memfun()" in process owning item (non-blocking comm if remote) ...
Definition: worlddc.h:1148
bool operator()(typename rangeT::iterator &it) const 
Definition: funcimpl.h:1954
CoeffTracker(const CoeffTracker &other)
copy ctor 
Definition: funcimpl.h:790
void serialize(const Archive &ar)
serialize this (needed for use in recursive_op) 
Definition: funcimpl.h:3585
implT * result
Definition: funcimpl.h:4307
const T1 & f1
Definition: gtest-tuple.h:680
GenTensor< Q > coeffs2values(const keyT &key, const GenTensor< Q > &coeff) const 
Definition: funcimpl.h:1565
double limit
Definition: funcimpl.h:1251
tensorT make_childrens_sum_coeffs(const keyT &key) const 
make the sum coeffs for all children of key 
Definition: funcimpl.h:3506
coeffT make_sum_coeffs(const keyT &key) const 
make the sum coeffs for key 
Definition: funcimpl.h:3480
void print(const A &a)
Print a single item to std::cout terminating with new line. 
Definition: print.h:122
FunctionCommonData holds all Function data common for given k. 
Definition: function_common_data.h:52
int npt
no. of quadrature points 
Definition: function_common_data.h:89
Key< NDIM > keyT
Definition: funcimpl.h:686
coeffT assemble_coefficients(const keyT &key, const coeffT &coeff_ket, const coeffT &vpotential1, const coeffT &vpotential2, const tensorT &veri) const 
given several coefficient tensors, assemble a result tensor 
Definition: mraimpl.h:1099
R beta
Definition: funcimpl.h:1107
long box_interior[1000]
Definition: funcimpl.h:2699
void project_out2(const FunctionImpl< T, LDIM+NDIM > *f, const FunctionImpl< T, LDIM > *g, const int dim)
project the low-dim function g on the hi-dim function f: this(x) =  ...
Definition: funcimpl.h:5217
void gaxpy_inplace_reconstructed(const T &alpha, const FunctionImpl< Q, NDIM > &g, const R &beta, const bool fence)
perform inplace gaxpy: this = alpha*this + beta*other 
Definition: funcimpl.h:1064
bool _has_children
Definition: funcimpl.h:720
#define MADNESS_EXCEPTION(msg, value)
Definition: worldexc.h:88
GenTensor< T > coeffT
Definition: funcimpl.h:687
tensorT filter(const tensorT &s) const 
Transform sum coefficients at level n to sums+differences at level n-1. 
Definition: mraimpl.h:1188
void print_info() const 
Prints summary of data distribution. 
Definition: mraimpl.h:921
Tensor< Q > coeffs2values(const keyT &key, const Tensor< Q > &coeff) const 
Definition: funcimpl.h:1688
A slice defines a sub-range or patch of a dimension. 
Definition: slice.h:103
Future< coeffT > compress_spawn(const keyT &key, bool nonstandard, bool keepleaves, bool redundant)
Definition: mraimpl.h:3070
bool operator()(typename rangeT::iterator &it) const 
Definition: funcimpl.h:1110
const std::shared_ptr< FunctionFunctorInterface< T, NDIM > > fref
Definition: funcimpl.h:4896
bool exists_and_is_leaf(const keyT &key) const 
Definition: mraimpl.h:1311
FunctionNode< Q, NDIM > convert() const 
Copy with possible type conversion of coefficients, copying all other state. 
Definition: funcimpl.h:182
Void do_print_plane(const std::string filename, std::vector< Tensor< double > > plotinfo, const int xaxis, const int yaxis, const coordT el2)
print the MRA structure 
Definition: mraimpl.h:454
FunctionImpl(const FunctionImpl< Q, NDIM > &other, const std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > &pmap, bool dozero)
Copy constructor. 
Definition: funcimpl.h:1014
Multidimension Key for MRA tree and associated iterators. 
Tensor< T > tensorT
Definition: funcimpl.h:129
long k
Definition: funcimpl.h:497
void serialize(Archive &ar)
Definition: funcimpl.h:549
void serialize(const Archive &ar)
Definition: funcimpl.h:3105
do_op_args(const Key< OPDIM > &key, const Key< OPDIM > &d, const keyT &dest, double tol, double fac, double cnorm)
Definition: funcimpl.h:3935
Definition: gentensor.h:123
multiply_op(implT *h, const ctT &f, const ctL &g, const int particle)
Definition: funcimpl.h:2850
double operator()(typename rangeT::iterator &it) const 
return the norm of the difference of this node and its "mirror" node 
Definition: funcimpl.h:2019
Future< double > norm_tree_spawn(const keyT &key)
Definition: mraimpl.h:1537
coeffT _coeffs
Definition: funcimpl.h:719
FunctionNode(const FunctionNode< T, NDIM > &other)
Definition: funcimpl.h:162
FunctionNode< T, NDIM > nodeT
Type of node. 
Definition: funcimpl.h:907
bool get_autorefine() const 
Definition: mraimpl.h:287
Vector< Translation, NDIM > tranT
Type of array holding translation. 
Definition: funcimpl.h:905
static void store(const Archive &ar, FunctionImpl< T, NDIM > *const &ptr)
Definition: funcimpl.h:5413
void gaxpy_inplace(const T &alpha, const FunctionImpl< Q, NDIM > &other, const R &beta, bool fence)
Inplace general bilinear operation. 
Definition: funcimpl.h:1123
FunctionFactory implements the named-parameter idiom for Function. 
Definition: funcimpl.h:70
FunctionImpl< T, LDIM > implL
Definition: funcimpl.h:606
const coeffT & coeff() const 
Returns a const reference to the tensor containing the coeffs. 
Definition: funcimpl.h:226
bool autorefine_square_test(const keyT &key, const nodeT &t) const 
Returns true if this block of coeffs needs autorefining. 
Definition: mraimpl.h:953
const opT * op
Definition: funcimpl.h:610
void undo_redundant(const bool fence)
convert this from redundant to standard reconstructed form 
Definition: mraimpl.h:1504
Void eval(const Vector< double, NDIM > &xin, const keyT &keyin, const typename Future< T >::remote_refT &ref)
Evaluate the function at a point in simulation coordinates. 
Definition: mraimpl.h:2727
double norm2sq_local() const 
Returns the square of the local norm ... no comms. 
Definition: mraimpl.h:1768
ctL iag
Definition: funcimpl.h:5120
int64_t Translation
Definition: key.h:57
Definition: funcimpl.h:673
reduce the rank of the nodes, optional fence 
Definition: funcimpl.h:1986
void make_Vphi(const opT &leaf_op, const bool fence=true)
assemble the function V*phi using V and phi given from the functor 
Definition: funcimpl.h:3598
do_standard()
Definition: funcimpl.h:3902
add two functions f and g: result=alpha * f + beta * g 
Definition: funcimpl.h:2956
const mpreal fabs(const mpreal &v, mp_rnd_t rnd_mode)
Definition: mpreal.h:2187
returns true if the node is well represented compared to its parent 
Definition: funcimpl.h:456
void gaxpy(T alpha, const FunctionImpl< L, NDIM > &left, T beta, const FunctionImpl< R, NDIM > &right, bool fence)
Invoked by result to perform result += alpha*left+beta*right in wavelet basis. 
Definition: funcimpl.h:1837
Holds machinery to set up Functions/FuncImpls using various Factories and Interfaces. 
Definition: chem/atomutil.cc:45
const dcT & get_coeffs() const 
Definition: mraimpl.h:296
coeffT & coeff()
Definition: funcimpl.h:728
Key< NDIM > key0
Key for root node. 
Definition: function_common_data.h:97
CoeffTracker(const CoeffTracker &other, const datumT &datum)
ctor with a pair 
Definition: funcimpl.h:783
const double c
Definition: gfit.cc:200
std::shared_ptr< implL > impl_m1
various MRA functions of MDIM dimensionality (e.g. 3, if NDIM==6) 
Definition: function_interface.h:153
std::pair< bool, coeffT > finalize(const double kernel_norm, const keyT &key, const coeffT &coeff) const 
sole purpose is to wait for the kernel norm, wrap it and send it back to caller 
Definition: funcimpl.h:4367
void serialize(const Archive &ar)
Definition: funcimpl.h:1960
bool _refine
Definition: function_factory.h:89
std::vector< Function< TENSOR_RESULT_TYPE(T, R), NDIM > > transform(World &world, const std::vector< Function< T, NDIM > > &v, const DistributedMatrix< R > &c, bool fence=true)
Definition: chem/SCF.cc:86
op_leaf_op()
Definition: funcimpl.h:564
Range< typename dcT::const_iterator > rangeT
Definition: funcimpl.h:2013
Future< this_type > activate() const 
retrieve the coefficients (parent coeffs might be remote) 
Definition: funcimpl.h:2991
FLOAT b(int j, FLOAT z)
Definition: y1.cc:79
double accumulate2(const tensorT &t, const typename FunctionNode< T, NDIM >::dcT &c, const Key< NDIM > &key)
Accumulate inplace and if necessary connect node to parent. 
Definition: funcimpl.h:330
Tensor< double > quad_phit
transpose of quad_phi 
Definition: function_common_data.h:102
void print_timer() const 
Definition: mraimpl.h:311
std::pair< bool, coeffT > operator()(const Key< NDIM > &key) const 
Definition: funcimpl.h:3061
Tensor< double > quad_phiw
quad_phiw(i,j) = at x[i] value of w[i]*phi[j] 
Definition: function_common_data.h:103
void swap(mpfr::mpreal &x, mpfr::mpreal &y)
Definition: mpreal.h:3069
this_type forward_ctor(implT *r, const CoeffTracker< T, LDIM > &f1, const CoeffTracker< T, LDIM > &g1, const opT *apply_op1)
Definition: funcimpl.h:4392
void apply(opT &op, const FunctionImpl< R, NDIM > &f, bool fence)
apply an operator on f to return this 
Definition: funcimpl.h:4114
Timer timer_lr_result
Definition: funcimpl.h:944
Void do_mul(const keyT &key, const Tensor< L > &left, const std::pair< keyT, Tensor< R > > &arg)
Invoked as a task by mul with the actual coefficients. 
Definition: funcimpl.h:1760
Definition: funcimpl.h:4598
Key is the index for a node of the 2^NDIM-tree. 
Definition: key.h:69
tensorT unfilter(const tensorT &s) const 
Transform sums+differences at level n to sum coefficients at level n+1. 
Definition: mraimpl.h:1217
AtomicInt large
Definition: funcimpl.h:950
argT operator()(const Key< NDIM > &key) const 
send off the application of the operator 
Definition: funcimpl.h:4455
static void load(const Archive &ar, const FunctionImpl< T, NDIM > *&ptr)
Definition: funcimpl.h:5366
ProcessID owner(const keyT &key) const 
Maps key to processor. 
Definition: funcimpl.h:94
Definition: funcimpl.h:2225
const coeffT & coeff() const 
const reference to the coeffs 
Definition: funcimpl.h:797
tensorT project(const keyT &key) const 
Compute by projection the scaling function coeffs in specified box. 
Definition: mraimpl.h:2646
MADNESS_ASSERT(this->is_redundant()==g.is_redundant())
insert_op(implT *f)
Definition: funcimpl.h:692
Future< CoeffTracker > activate() const 
find the coefficients 
Definition: funcimpl.h:845
bool do_new
Definition: funcimpl.h:948
double truncate_tol(double tol, const keyT &key) const 
Returns the truncation threshold according to truncate_method. 
Definition: mraimpl.h:613
const coeffT & coeff() const 
Definition: funcimpl.h:727
void unset_functor()
Definition: mraimpl.h:263
TensorArgs get_tensor_args() const 
Definition: mraimpl.h:278
bool operator()(const Key< NDIM > &key, const GenTensor< T > &fcoeff, const GenTensor< T > &gcoeff) const 
Definition: funcimpl.h:675
keyT neighbor(const keyT &key, const keyT &disp, const std::vector< bool > &is_periodic) const 
Returns key of general neighbor enforcing BC. 
Definition: mraimpl.h:3042
do_mapdim()
Definition: funcimpl.h:2128
void mulXX(const FunctionImpl< L, NDIM > *left, const FunctionImpl< R, NDIM > *right, double tol, bool fence)
Definition: funcimpl.h:2643
void serialize(const Archive &ar)
Definition: funcimpl.h:4575
do_standard(implT *impl)
Definition: funcimpl.h:3903
CoeffTracker< T, NDIM > ctT
Definition: funcimpl.h:4434
implT * impl
Definition: funcimpl.h:3899
do_change_tensor_type(const TensorArgs &targs)
Definition: funcimpl.h:2193
add_op()
Definition: funcimpl.h:2968
void serialize(const Archive &ar)
Definition: funcimpl.h:2115
bool randomize() const 
Definition: funcimpl.h:4431
ShallowNode(const ShallowNode< T, NDIM > &node)
Definition: funcimpl.h:724
T eval_cube(Level n, coordT &x, const tensorT &c) const 
Definition: mraimpl.h:1938
Void forward_do_diff1(const DerivativeBase< T, NDIM > *D, const implT *f, const keyT &key, const std::pair< keyT, coeffT > &left, const std::pair< keyT, coeffT > ¢er, const std::pair< keyT, coeffT > &right)
Definition: mraimpl.h:1012
Range< typename dcT::iterator > rangeT
Definition: funcimpl.h:3896
void tnorm(const tensorT &t, double *lo, double *hi) const 
Computes norm of low/high-order polyn. coeffs for autorefinement test. 
Definition: mraimpl.h:2885
bool operator()(typename rangeT::iterator &it) const 
Definition: funcimpl.h:3906
this_type forward_ctor(implT *result1, const ctL &p11, const ctL &p22, const leaf_opT &leaf_op)
Definition: funcimpl.h:3101
void sum_down(bool fence)
After 1d push operator must sum coeffs down the tree to restore correct scaling function coefficients...
Definition: mraimpl.h:1004
void flo_unary_op_node_inplace(const opT &op, bool fence) const 
Unary operation applied inplace to the coefficients WITHOUT refinement, optional fence. 
Definition: funcimpl.h:1907
void make_redundant(const bool fence)
convert this to redundant, i.e. have sum coefficients on all levels 
Definition: mraimpl.h:1485
Void refine_to_common_level(const std::vector< FunctionImpl< T, NDIM > * > &v, const std::vector< tensorT > &c, const keyT key)
Refine multiple functions down to the same finest level. 
Definition: mraimpl.h:854
void mapdim(const implT &f, const std::vector< long > &map, bool fence)
Permute the dimensions of f according to map, result on this. 
Definition: mraimpl.h:1138
ctL iav2
potentials for particles 1 and 2 
Definition: funcimpl.h:3343
long rank() const 
Definition: gentensor.h:189
void serialize(const Archive &ar)
Definition: funcimpl.h:2203
Range< typename dcT::iterator > rangeT
Definition: funcimpl.h:2226
Iterates in lexical order thru all children of a key. 
Definition: key.h:61
GenTensor< Q > fcube_for_mul(const keyT &child, const keyT &parent, const GenTensor< Q > &coeff) const 
Compute the function values for multiplication. 
Definition: funcimpl.h:1738
void serialize(Archive &ar)
Definition: funcimpl.h:3761
void serialize(Archive &ar)
Definition: funcimpl.h:711
bool operator()(typename rangeT::iterator &it) const 
Definition: funcimpl.h:2000
const implT * f
Definition: funcimpl.h:2014
Void put_in_box(ProcessID from, long nl, long ni) const 
Definition: mraimpl.h:911
bool probe(const keyT &key) const 
Returns true if local data is immediately available (no communication) 
Definition: worlddc.h:776