MADNESS 0.10.1
madness::FunctionImpl< T, NDIM > Class Template Reference

FunctionImpl holds all Function state to facilitate shallow copy semantics. More...

#include <funcimpl.h>

Inheritance diagram for madness::FunctionImpl< T, NDIM >:
Collaboration diagram for madness::FunctionImpl< T, NDIM >:

Classes

struct  add_op
 add two functions f and g: result=alpha * f + beta * g More...
struct  coeff_value_adaptor
struct  do_accumulate_trees
 merge the coefficent boxes of this into result's tree More...
struct  do_average
 "put" this on g More...
struct  do_change_tensor_type
 change representation of nodes' coeffs to low rank, optional fence More...
struct  do_check_symmetry_local
 check symmetry wrt particle exchange More...
struct  do_compute_snorm_and_dnorm
 compute the norm of the wavelet coefficients More...
struct  do_consolidate_buffer
struct  do_convert_to_color
struct  do_dot_local
 compute the inner product of this range with other More...
class  do_err_box
struct  do_gaxpy_inplace
 functor for the gaxpy_inplace method More...
struct  do_inner_ext_local_ffi
struct  do_inner_local
 compute the inner product of this range with other More...
struct  do_inner_local_on_demand
 compute the inner product of this range with other More...
struct  do_keep_sum_coeffs
 keep only the sum coefficients in each node More...
struct  do_map_and_mirror
 mirror dimensions of this, write result on f More...
struct  do_mapdim
 map this on f More...
struct  do_mirror
 mirror dimensions of this, write result on f More...
struct  do_norm2sq_local
struct  do_op_args
 laziness More...
struct  do_reduce_rank
 reduce the rank of the nodes, optional fence More...
struct  do_standard
 Changes non-standard compressed form to standard compressed form. More...
struct  do_truncate_NS_leafs
 given an NS tree resulting from a convolution, truncate leafs if appropriate More...
struct  do_unary_op_value_inplace
struct  hartree_op
 Hartree product of two LDIM functions to yield a NDIM = 2*LDIM function. More...
struct  multiply_op
 perform this multiplication: h(1,2) = f(1,2) * g(1) More...
struct  pointwise_multiplier
struct  project_out_op
 project the low-dim function g on the hi-dim function f: result(x) = <f(x,y) | g(y)> More...
struct  recursive_apply_op
 recursive part of recursive_apply More...
struct  recursive_apply_op2
 recursive part of recursive_apply More...
struct  recursive_apply_op_vec
 recursive part of recursive_apply for a vector of matched pairs More...
struct  remove_internal_coeffs
 remove all coefficients of internal nodes More...
struct  remove_leaf_coeffs
 remove all coefficients of leaf nodes More...
struct  true_refine_test
struct  Vphi_ij_u_op_NS
struct  Vphi_op_NS
 given a ket and the 1- and 2-electron potentials, construct the function V phi More...

Public Types

typedef GenTensor< T > coeffT
 Type of tensor used to hold coeffs.
typedef std::pair< coeffT, std::pair< double, double > > compressT
 s coefficients plus the (snorm_tree, dnorm_tree) pair propagated up by compress
typedef Vector< double, NDIM > coordT
 Type of vector holding coordinates.
typedef std::pair< const keyT, nodeT > datumT
 Type of entry in container.
typedef WorldContainer< keyT, nodeT > dcT
 Type of container holding the coefficients.
typedef FunctionImpl< T, NDIM > implT
 Type of this class (implementation).
typedef Key< NDIM > keyT
 Type of key.
typedef ConcurrentHashMap< keyT, mapvecT > mapT
 Type of the map returned by make_key_vec_map.
typedef std::vector< std::pair< int, const coeffT * > > mapvecT
 Type of the entry in the map returned by make_key_vec_map.
typedef FunctionNode< T, NDIM > nodeT
 Type of node.
typedef std::shared_ptr< FunctionImpl< T, NDIM > > pimplT
 pointer to this class
typedef Range< typename dcT::const_iterator > rangeT
typedef Range< typename dcT::const_iterator > rangeT
typedef Range< typename dcT::const_iterator > rangeT
typedef Tensor< T > tensorT
 Type of tensor for anything but to hold coeffs.
typedef Vector< Translation, NDIM > tranT
 Type of array holding translation.
typedef T typeT
Public Types inherited from madness::WorldObject< FunctionImpl< T, NDIM > >
typedef WorldObject< FunctionImpl< T, NDIM > > objT

Public Member Functions

 FunctionImpl (const FunctionFactory< T, NDIM > &factory)
 Initialize function impl from data in factory.
template<typename Q>
 FunctionImpl (const FunctionImpl< Q, NDIM > &other, const std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > &pmap, bool dozero)
 Copy constructor.
template<typename Q>
 FunctionImpl (World &world, const FunctionImpl< Q, NDIM > &other, const std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > &pmap, bool dozero)
 Copy constructor.
virtual ~FunctionImpl ()
void abs_inplace (bool fence)
void abs_square_inplace (bool fence)
void accumulate_timer (const double time) const
template<typename Q, typename R>
void accumulate_trees (FunctionImpl< Q, NDIM > &result, const R alpha, const bool fence=true) const
 merge the trees of this and other, while multiplying them with the alpha or beta, resp
void add_keys_to_map (mapT *map, int index) const
 Adds keys to union of local keys with specified index.
void add_scalar_inplace (T t, bool fence)
 Adds a constant to the function. Local operation, optional fence.
template<typename opT, typename R>
void apply (opT &op, const FunctionImpl< R, NDIM > &f, bool fence)
 apply an operator on f to return this
template<typename opT, typename R>
void apply_1d_realspace_push (const opT &op, const FunctionImpl< R, NDIM > *f, int axis, bool fence)
template<typename opT, typename R>
void apply_1d_realspace_push_op (const archive::archive_ptr< const opT > &pop, int axis, const keyT &key, const Tensor< R > &c)
template<typename opT, typename R>
void apply_source_driven (opT &op, const FunctionImpl< R, NDIM > &f, bool fence)
 similar to apply, but for low rank coeffs
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
bool autorefine_square_test (const keyT &key, const nodeT &t) const
 Returns true if this block of coeffs needs autorefining.
void average (const implT &rhs)
 take the average of two functions, similar to: this=0.5*(this+rhs)
template<typename L, typename R, typename opT>
void binaryXX (const FunctionImpl< L, NDIM > *left, const FunctionImpl< R, NDIM > *right, const opT &op, bool fence)
template<typename L, typename R, typename opT>
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)
void broaden (const array_of_bools< NDIM > &is_periodic, bool fence)
void broaden_op (const keyT &key, const std::vector< Future< bool > > &v)
void change_tensor_type1 (const TensorArgs &targs, bool fence)
 change the tensor type of the coefficients in the FunctionNode
void change_tree_state (const TreeState finalstate, bool fence=true)
 change the tree state of this function, might or might not respect fence!
double check_symmetry_local () const
 Returns some asymmetry measure ... no comms.
std::vector< Slice > child_patch (const keyT &child) const
 Returns patch referring to coeffs of child in parent box.
void chop_at_level (const int n, const bool fence=true)
 remove all nodes with level higher than n
template<typename Q>
GenTensor< Q > coeffs2values (const keyT &key, const GenTensor< Q > &coeff) const
template<typename Q>
Tensor< Q > coeffs2values (const keyT &key, const Tensor< Q > &coeff) const
void compress (const TreeState newstate, bool fence)
 compress the wave function
compressT compress_op (const keyT &key, const std::vector< Future< compressT > > &v, bool nonstandard)
 calculate the wavelet coefficients using the sum coefficients of all child nodes
Future< compressT > compress_spawn (const keyT &key, bool nonstandard, bool keepleaves, bool redundant1)
 Invoked on node where key is local.
void compute_snorm_and_dnorm (bool fence=true)
 compute norm of s and d coefficients for all nodes
template<typename Q>
void copy_coeffs (const FunctionImpl< Q, NDIM > &other, bool fence)
 Copy coeffs from other into self.
template<typename Q>
void copy_coeffs_different_world (const FunctionImpl< Q, NDIM > &other)
 Copy coefficients from other funcimpl with possibly different world and on a different node.
template<typename Q>
void copy_coeffs_same_world (const FunctionImpl< Q, NDIM > &other, bool fence)
 Copy coeffs from other into self.
template<typename Q>
void copy_remote_coeffs_from_pid (const ProcessID pid, const FunctionImpl< Q, NDIM > &other)
void diff (const DerivativeBase< T, NDIM > *D, const implT *f, bool fence)
template<std::size_t LDIM>
void dirac_convolution_op (const keyT &key, const nodeT &node, FunctionImpl< T, LDIM > *f) const
 The operator.
void distribute (std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > newmap) const
template<typename opT, typename R>
void do_apply (const opT *op, const keyT &key, const Tensor< R > &c)
 apply an operator on the coeffs c (at node key)
template<typename opT, typename R>
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)
template<typename opT, typename R, size_t OPDIM>
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
template<typename opT, typename R, size_t OPDIM>
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
template<typename opT, typename R, size_t OPDIM>
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
template<typename L, typename R, typename opT>
void do_binary_op (const keyT &key, const Tensor< L > &left, const std::pair< keyT, Tensor< R > > &arg, const opT &op)
 Functor for the binary_op method.
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 > &center, const std::pair< keyT, coeffT > &right)
template<std::size_t LDIM>
void do_dirac_convolution (FunctionImpl< T, LDIM > *f, bool fence) const
template<typename L, typename R>
void do_mul (const keyT &key, const Tensor< L > &left, const std::pair< keyT, Tensor< R > > &arg)
 Functor for the mul method.
void do_print_grid (const std::string filename, const std::vector< keyT > &keys) const
 print the grid in xyz format
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
void do_print_tree (const keyT &key, std::ostream &os, Level maxlevel) const
 Functor for the do_print_tree method.
void do_print_tree_graphviz (const keyT &key, std::ostream &os, Level maxlevel) const
 Functor for the do_print_tree method (using GraphViz).
void do_print_tree_json (const keyT &key, std::multimap< Level, std::tuple< tranT, std::string > > &data, Level maxlevel) const
 Functor for the do_print_tree_json method.
template<size_t LDIM>
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
void do_square_inplace (const keyT &key)
void do_square_inplace2 (const keyT &parent, const keyT &child, const tensorT &parent_coeff)
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
void erase (const Level &max_level)
 truncate tree at a certain level
template<typename opT>
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.
template<typename opT>
double errsq_local (const opT &func) const
 Returns the sum of squares of errors from local info ... no comms.
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.
T eval_cube (Level n, coordT &x, const tensorT &c) const
std::vector< std::pair< bool, T > > eval_local_only (const std::vector< Vector< double, NDIM > > &xin, Level maxlevel)
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,0.0).
void eval_local_only (const Vector< double, NDIM > *xin, std::size_t npt, Level maxlevel, std::pair< bool, T > *results)
Tensor< T > eval_plot_cube (const coordT &plotlo, const coordT &plothi, const std::vector< long > &npt, const bool eval_refine=false) const
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.
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.
bool exists_and_has_children (const keyT &key) const
bool exists_and_is_leaf (const keyT &key) const
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.
void fcube (const keyT &key, T(*f)(const coordT &), const Tensor< double > &qx, tensorT &fval) const
 Evaluate function at quadrature points in the specified box.
template<typename Q>
GenTensor< Q > fcube_for_mul (const keyT &child, const keyT &parent, const GenTensor< Q > &coeff) const
 Compute the function values for multiplication.
template<typename Q>
Tensor< Q > fcube_for_mul (const keyT &child, const keyT &parent, const Tensor< Q > &coeff) const
 Compute the function values for multiplication.
coeffT filter (const coeffT &s) const
tensorT filter (const tensorT &s) const
 Transform sum coefficients at level n to sums+differences at level n-1.
double finalize_apply ()
 after apply we need to do some cleanup;
void finalize_sum ()
 after summing up we need to do some cleanup;
std::pair< Key< NDIM >, ShallowNode< T, NDIM > > find_datum (keyT key) const
 return the a std::pair<key, node>, which MUST exist
Future< std::pair< keyT, coeffT > > find_me (const keyT &key) const
 find_me. Called by diff_bdry to get coefficients of boundary function
template<typename opT>
void flo_unary_op_node_inplace (const opT &op, bool fence)
template<typename opT>
void flo_unary_op_node_inplace (const opT &op, bool fence) const
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 > &center, const std::pair< keyT, coeffT > &right)
template<typename coeff_opT, typename apply_opT>
void forward_traverse (const coeff_opT &coeff_op, const apply_opT &apply_op, const keyT &key) const
 traverse a non-existing tree
template<typename L, typename R>
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.
template<typename L>
void gaxpy_ext (const FunctionImpl< L, NDIM > *left, T(*f)(const coordT &), T alpha, T beta, double tol, bool fence)
template<typename L>
tensorT gaxpy_ext_node (keyT key, Tensor< L > lc, T(*f)(const coordT &), T alpha, T beta) const
template<typename L>
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)
template<typename Q, typename R>
void gaxpy_inplace (const T &alpha, const FunctionImpl< Q, NDIM > &other, const R &beta, bool fence)
 Inplace general bilinear operation.
template<typename Q, typename R>
void gaxpy_inplace_reconstructed (const T &alpha, const FunctionImpl< Q, NDIM > &g, const R &beta, const bool fence)
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
bool get_autorefine () const
const FunctionCommonData< T, NDIM > & get_cdata () const
const Tensor< double > & get_cell () const
 return the simulation cell
dcT & get_coeffs ()
const dcT & get_coeffs () const
template<std::size_t CDIM>
std::tuple< std::set< Key< NDIM > >, std::map< Key< CDIM >, double > > get_contraction_node_lists (const std::size_t n, const std::array< int, CDIM > &v) const
 for contraction two functions f(x,z) = \int g(x,y) h(y,z) dy
std::shared_ptr< FunctionFunctorInterface< T, NDIM > > get_functor ()
std::shared_ptr< FunctionFunctorInterface< T, NDIM > > get_functor () const
int get_initial_level () const
 getter
int get_k () const
Future< double > get_norm_tree_recursive (const keyT &key) const
const std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > & get_pmap () const
int get_special_level () const
const std::vector< Vector< double, NDIM > > & get_special_points () const
TensorArgs get_tensor_args () const
TensorType get_tensor_type () const
double get_thresh () const
TreeState get_tree_state () const
int get_truncate_mode () const
void halo_clear () const
 Discard the neighbor halo, freeing the staged coefficients.
bool halo_enabled () const
 Is a neighbor halo staged on this function?
bool halo_probe (const keyT &key, coeffT &out) const
 Look up a staged neighbor; on a hit copy its coefficients, which are empty for an interior node.
std::size_t halo_size () const
 How many neighbor nodes are staged on this rank; zero if no halo.
template<std::size_t LDIM, typename leaf_opT>
void hartree_product (const std::vector< std::shared_ptr< FunctionImpl< T, LDIM > > > p1, const std::vector< std::shared_ptr< FunctionImpl< T, LDIM > > > p2, const leaf_opT &leaf_op, bool fence)
 given two functions of LDIM, perform the Hartree/Kronecker/outer product
bool has_coefficients_on_leaves_only () const
 Returns true if only the leaves of this tree carry its coefficients.
bool has_leaves () const
bool has_summable_coefficients () const
 Returns true if summing over the local nodes yields the function.
T inner_adaptive_local (const std::shared_ptr< FunctionFunctorInterface< T, NDIM > > f, const bool leaf_refine) const
T inner_adaptive_recursive (keyT key, const tensorT &c, const std::shared_ptr< FunctionFunctorInterface< T, NDIM > > f, const bool leaf_refine, T old_inner=T(0)) const
T inner_ext_local (const std::shared_ptr< FunctionFunctorInterface< T, NDIM > > f, const bool leaf_refine) const
T inner_ext_node (keyT key, tensorT c, const std::shared_ptr< FunctionFunctorInterface< T, NDIM > > f) const
 Return the inner product with an external function on a specified function node.
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
template<typename opT, size_t LDIM>
T inner_ij_u_eri (const opT &leaf_op, const FunctionImpl< T, NDIM > *u, const FunctionImpl< T, LDIM > *i_func, const FunctionImpl< T, LDIM > *j_func, const FunctionImpl< T, NDIM > *eri, double target_precision=0.0, int oversampling=1) const
 compute <eri(1,2) | u(1,2) * [i(1)] * [j(2)]> adaptively using Vphi_ij_u_op_NS
void insert_serialized_coeffs (std::vector< unsigned char > &v)
 insert coeffs from vector archive into this
void insert_zero_down_to_initial_level (const keyT &key)
 Initialize nodes to zero function at initial_level of refinement.
bool is_compressed () const
 Returns true if the function is compressed.
bool is_nonstandard () const
bool is_nonstandard_with_leaves () const
bool is_on_demand () const
bool is_reconstructed () const
 Returns true if the function is compressed.
bool is_redundant () const
 Returns true if the function is redundant.
bool is_redundant_after_merge () const
 Returns true if the function is redundant_after_merge.
const keyT & key0 () const
 Returns cdata.key0.
template<typename Archive>
void load (Archive &ar)
std::vector< keyT > local_leaf_keys () const
 return the keys of the local leaf boxes
 MADNESS_ASSERT (this->is_redundant()==g.is_redundant())
 MADNESS_ASSERT (this->is_redundant()==g.is_redundant())
 MADNESS_CHECK (this->is_reconstructed())
compressT make_redundant_op (const keyT &key, const std::vector< Future< compressT > > &v)
 similar to compress_op, but insert only the sum coefficients in the tree
template<typename opT>
void make_Vphi (const opT &leaf_op, const bool fence=true)
 assemble the function V*phi using V and phi given from the functor
template<typename opT, size_t LDIM>
void make_Vphi_ij_u (const opT &leaf_op, const FunctionImpl< T, NDIM > *u, const FunctionImpl< T, LDIM > *i_func=nullptr, const FunctionImpl< T, LDIM > *j_func=nullptr, bool fence=true, double target_precision=0.0, int oversampling=1)
 build this = u * [i(1)] * [j(2)] adaptively using Vphi_ij_u_op_NS
template<typename opT, std::size_t LDIM>
void make_Vphi_only (const opT &leaf_op, FunctionImpl< T, NDIM > *ket, FunctionImpl< T, LDIM > *v1, FunctionImpl< T, LDIM > *v2, FunctionImpl< T, LDIM > *p1, FunctionImpl< T, LDIM > *p2, FunctionImpl< T, NDIM > *eri, const bool fence=true)
 assemble the function V*phi using V and phi given from the functor
void map_and_mirror (const implT &f, const std::vector< long > &map, const std::vector< long > &mirror, bool fence)
 map and mirror the translation index and the coefficients, result on this
void mapdim (const implT &f, const std::vector< long > &map, bool fence)
 Permute the dimensions of f according to map, result on this.
std::size_t max_depth () const
 Returns the maximum depth of the tree ... collective ... global sum/broadcast.
std::size_t max_local_depth () const
 Returns the maximum local depth of the tree ... no communications.
std::size_t max_nodes () const
 Returns the max number of nodes on a processor.
std::size_t min_nodes () const
 Returns the min number of nodes on a processor.
void mirror (const implT &f, const std::vector< long > &mirror, bool fence)
 mirror the dimensions of f according to map, result on this
template<typename R>
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
template<typename opT>
void multi_to_multi_op_values (const opT &op, const std::vector< implT * > &vin, std::vector< implT * > &vout, const bool fence=true)
 Inplace operate on many functions (impl's) with an operator within a certain box.
template<typename opT>
void multi_to_multi_op_values_doit (const keyT &key, const opT &op, const std::vector< implT * > &vin, std::vector< implT * > &vout)
 Inplace operate on many functions (impl's) with an operator within a certain box.
template<typename opT>
void multiop_values (const opT &op, const std::vector< implT * > &v)
template<typename opT>
void multiop_values_doit (const keyT &key, const opT &op, const std::vector< implT * > &v)
coeffT multiply (const coeffT &val_ket, const coeffT &val_pot, int particle) const
 multiply the ket with a one-electron potential rr(1,2)= f(1,2)*g(1)
template<size_t LDIM>
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)
template<typename L, typename R>
void mulXX (const FunctionImpl< L, NDIM > *left, const FunctionImpl< R, NDIM > *right, double tol, bool fence)
template<typename L, typename R>
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)
template<typename L, typename R>
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)
template<typename L, typename R>
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)
std::size_t nCoeff () const
 Returns the number of coefficients in the function ... collective global sum.
std::size_t nCoeff_local () const
 Returns the number of coefficients in the function for this MPI rank.
keyT neighbor (const keyT &key, const keyT &disp, const array_of_bools< NDIM > &is_periodic) const
 Returns key of general neighbor enforcing BC.
keyT neighbor_in_volume (const keyT &key, const keyT &disp) const
 Returns key of general neighbor that resides in-volume.
bool noautorefine (const keyT &key, const tensorT &t) const
 Always returns false (for when autorefine is not wanted).
double norm2sq_local () const
 Returns the square of the local norm ... no comms.
void norm_tree (bool fence)
 compute for each FunctionNode the norm of the function inside that node
double norm_tree_op (const keyT &key, const std::vector< Future< double > > &v)
Future< double > norm_tree_spawn (const keyT &key)
template<typename Q>
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.
template<typename Q>
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
const coeffT parent_to_child (const coeffT &s, const keyT &parent, const keyT &child) const
 Directly project parent coeffs to child coeffs.
coeffT parent_to_child_NS (const keyT &child, const keyT &parent, const coeffT &coeff) const
 Directly project parent NS coeffs to child NS coeffs.
template<typename Q, std::size_t LDIM, typename R, std::size_t KDIM, std::size_t CDIM = (KDIM + LDIM - NDIM) / 2>
void partial_inner (const FunctionImpl< Q, LDIM > &g, const FunctionImpl< R, KDIM > &h, const std::array< int, CDIM > v1, const std::array< int, CDIM > v2)
 invoked by result
template<typename Q, std::size_t LDIM, typename R, std::size_t KDIM, std::size_t CDIM = (KDIM + LDIM - NDIM) / 2>
void partial_inner_contract (const FunctionImpl< Q, LDIM > *g, const FunctionImpl< R, KDIM > *h, const std::array< int, CDIM > v1, const std::array< int, CDIM > v2, const Key< NDIM > &key, const std::list< Key< CDIM > > &j_key_list)
 tensor contraction part of partial_inner
void phi_for_mul (Level np, Translation lp, Level nc, Translation lc, Tensor< double > &phi) const
 Compute the Legendre scaling functions for multiplication.
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
void print_grid (const std::string filename) const
void print_info () const
 Prints summary of data distribution.
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.
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
void print_size (const std::string name) const
 print tree size and size
void print_stats () const
 print the number of configurations per node
void print_timer () const
void print_tree (std::ostream &os=std::cout, Level maxlevel=10000) const
void print_tree_graphviz (std::ostream &os=std::cout, Level maxlevel=10000) const
void print_tree_json (std::ostream &os=std::cout, Level maxlevel=10000) const
template<typename R>
void print_type_in_compilation_error (R &&)
void project (const implT &old, bool fence)
 Projects old function into new basis (only in reconstructed form).
tensorT project (const keyT &key) const
template<size_t LDIM>
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) = <this(x,y) | g(y)>
template<size_t LDIM>
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) = <f(x,y) | g(y)>
void project_refine_op (const keyT &key, bool do_refine, const std::vector< Vector< double, NDIM > > &specialpts)
void put_in_box (ProcessID from, long nl, long ni) const
rangeT range (coeffs.begin(), coeffs.end())
template<size_t FDIM>
std::enable_if< 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
template<size_t FDIM>
std::enable_if< NDIM==FDIM >::type read_grid2 (const std::string gridfile, std::shared_ptr< FunctionFunctorInterface< double, NDIM > > vnuc_functor)
 read data from a grid
std::size_t real_size () const
 Returns the number of coefficients in the function ... collective global sum.
void receive_halo (const std::vector< std::pair< keyT, coeffT > > &buf) const
 Insert pushed neighbor nodes into the halo; runs as a task, concurrently with other pushes.
void reconstruct (bool fence)
 reconstruct this tree – respects fence
void reconstruct_op (const keyT &key, const coeffT &s, const bool accumulate_NS=true)
template<std::size_t CDIM, std::size_t ODIM, std::size_t FDIM = NDIM+ODIM-2*CDIM>
std::multimap< Key< FDIM >, std::list< Key< CDIM > > > recur_down_for_contraction_map (const keyT &key, const nodeT &node, const std::array< int, CDIM > &v_this, const std::array< int, CDIM > &v_other, const std::set< Key< ODIM > > &ij_other_list, const std::map< Key< CDIM >, double > &j_other_list, bool this_first, const double thresh)
 make a map of all nodes that will contribute to a partial inner product
template<typename opT, std::size_t LDIM>
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
template<typename opT>
void recursive_apply (opT &apply_op, const implT *fimpl, implT *rimpl, const bool fence)
 traverse an existing tree and apply an operator
template<typename opT, std::size_t LDIM>
void recursive_apply (opT &apply_op, const std::vector< const FunctionImpl< T, LDIM > * > &fimpls, const std::vector< const FunctionImpl< T, LDIM > * > &gimpls, const bool fence)
 traverse a non-existing tree for a sum of hartree products and apply an operator
return world taskq reduce (range, do_inner_local_on_demand< R >(this, &gimpl))
return world taskq reduce (rangeT(coeffs.begin(), coeffs.end()), do_dot_local< R >(&g, leaves_only))
return world taskq reduce (rangeT(coeffs.begin(), coeffs.end()), do_inner_local< R >(&g, leaves_only))
void reduce_rank (const double thresh, bool fence)
 reduce the rank of the coefficients tensors
template<typename opT>
void refine (const opT &op, bool fence)
template<typename opT>
void refine_op (const opT &op, const keyT &key)
template<typename opT>
void refine_spawn (const opT &op, const keyT &key)
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.
void remove_internal_coefficients (const bool fence)
void remove_leaf_coefficients (const bool fence)
void replicate (bool fence=true)
void replicate_on_hosts (bool fence=true)
void reset_timer ()
void scale_inplace (const T q, bool fence)
 In-place scale by a constant.
template<typename Q, typename F>
void scale_oop (const Q q, const FunctionImpl< F, NDIM > &f, bool fence)
 Out-of-place scale by a constant.
std::vector< unsigned char > serialize_remote_coeffs ()
 invoked by copy_remote_coeffs_from_pid to serialize local coeffs
void set_autorefine (bool value)
void set_functor (const std::shared_ptr< FunctionFunctorInterface< T, NDIM > > functor1)
void set_tensor_args (const TensorArgs &t)
void set_thresh (double value)
void set_tree_state (const TreeState &state)
void set_truncate_mode (int mode)
std::size_t size () const
 Returns the number of coefficients in the function ... collective global sum.
std::size_t size_local () const
 Returns the number of coefficients in the function for each rank.
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.
void sock_it_to_me_too (const keyT &key, const RemoteReference< FutureImpl< std::pair< keyT, coeffT > > > &ref) const
void square_inplace (bool fence)
 Pointwise squaring of function with optional global fence.
void standard (bool fence)
 Changes non-standard compressed form to standard compressed form.
template<typename Archive>
void store (Archive &ar)
void sum_down (bool fence)
 After 1d push operator must sum coeffs down the tree to restore correct scaling function coefficients.
void sum_down_spawn (const keyT &key, const coeffT &s)
 is this the same as trickle_down() ?
template<typename R>
 TENSOR_RESULT_TYPE (T, R) dot_local(const FunctionImpl< R
 Returns the dot product ASSUMING same distribution.
template<typename R>
 TENSOR_RESULT_TYPE (T, R) inner_local(const FunctionImpl< R
 Returns the inner product ASSUMING same distribution.
template<typename R>
 TENSOR_RESULT_TYPE (T, R) inner_local_on_demand(const FunctionImpl< R
 Returns the inner product of this with function g constructed on-the-fly.
typedef TENSOR_RESULT_TYPE (T, R) resultT
typedef TENSOR_RESULT_TYPE (T, R) resultT
T trace_local () const
 Returns int(f(x),x) in local volume.
template<typename coeff_opT, typename apply_opT>
void traverse_tree (const coeff_opT &coeff_op, const apply_opT &apply_op, const keyT &key) const
 traverse a non-existing tree
std::size_t tree_size () const
 Returns the size of the tree structure of the function ... collective global sum.
void trickle_down (bool fence)
 sum all the contributions from all scales after applying an operator in mod-NS form
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
void truncate (double tol, bool fence)
 Truncate according to the threshold with optional global fence.
bool truncate_op (const keyT &key, double tol, const std::vector< Future< bool > > &v)
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
Future< coeffT > truncate_reconstructed_spawn (const keyT &key, const double tol)
 truncate using a tree in reconstructed form
Future< bool > truncate_spawn (const keyT &key, double tol)
 Returns true if after truncation this node has coefficients.
double truncate_tol (double tol, const keyT &key) const
 Returns the truncation threshold according to truncate_method.
template<typename opT>
void unary_op_coeff_inplace (const opT &op, bool fence)
template<typename opT>
void unary_op_node_inplace (const opT &op, bool fence)
template<typename opT>
void unary_op_value_inplace (const opT &op, bool fence)
template<typename Q, typename opT>
void unaryXX (const FunctionImpl< Q, NDIM > *func, const opT &op, bool fence)
template<typename Q, typename opT>
void unaryXXa (const keyT &key, const FunctionImpl< Q, NDIM > *func, const opT &op)
template<typename Q, typename opT>
void unaryXXvalues (const FunctionImpl< Q, NDIM > *func, const opT &op, bool fence)
void undo_redundant (const bool fence)
 convert this from redundant to standard reconstructed form
void undo_replicate (bool fence=true)
coeffT unfilter (const coeffT &s) const
tensorT unfilter (const tensorT &s) const
 Transform sums+differences at level n to sum coefficients at level n+1.
void unset_functor ()
coeffT upsample (const keyT &key, const coeffT &coeff) const
 upsample the sum coefficients of level 1 to sum coeffs on level n+1
template<typename Q>
GenTensor< Q > values2coeffs (const keyT &key, const GenTensor< Q > &values) const
template<typename Q>
Tensor< Q > values2coeffs (const keyT &key, const Tensor< Q > &values) const
template<typename Q>
GenTensor< Q > values2NScoeffs (const keyT &key, const GenTensor< Q > &values) const
 convert function values of the a child generation directly to NS coeffs
bool verify_parents_and_children () const
 check that parents and children are consistent
void verify_tree () const
 Verify tree is properly constructed ... global synchronization involved.
bool verify_tree_state_local () const
 check that the tree state and the coeffs are consistent
double vol_nsphere (int n, double R)
template<typename Q, typename R>
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)
template<typename Q, typename R>
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)
void zero_norm_tree ()
Public Member Functions inherited from madness::WorldObject< FunctionImpl< T, NDIM > >
 WorldObject (const WorldObject &other)
 WorldObject (World &world)
 Constructor that associates an object (via the derived class) with a globally unique ID.
virtual ~WorldObject ()
WorldObject & operator= (const WorldObject &)=delete
detail::task_result_type< memfnT >::futureT send (ProcessID dest, memfnT memfn) const
detail::task_result_type< memfnT >::futureT send (ProcessID dest, memfnT memfn, const a1T &a1) const
detail::task_result_type< memfnT >::futureT send (ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2) const
detail::task_result_type< memfnT >::futureT send (ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3) const
detail::task_result_type< memfnT >::futureT send (ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4) const
detail::task_result_type< memfnT >::futureT send (ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const a5T &a5) const
detail::task_result_type< memfnT >::futureT send (ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const a5T &a5, const a6T &a6) const
detail::task_result_type< memfnT >::futureT send (ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const a5T &a5, const a6T &a6, const a7T &a7) const
detail::task_result_type< memfnT >::futureT send (ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const a5T &a5, const a6T &a6, const a7T &a7, const a8T &a8) const
detail::task_result_type< memfnT >::futureT send (ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const a5T &a5, const a6T &a6, const a7T &a7, const a8T &a8, const a9T &a9) const
detail::task_result_type< memfnT >::futureT task (ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const a5T &a5, const a6T &a6, const a7T &a7, const a8T &a8, const a9T &a9, const TaskAttributes &attr=TaskAttributes()) const
 Sends task to derived class method returnT (this->*memfn)(a1,a2,a3,a4,a5,a6,a7,a8,a9).
detail::task_result_type< memfnT >::futureT task (ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const a5T &a5, const a6T &a6, const a7T &a7, const a8T &a8, const TaskAttributes &attr=TaskAttributes()) const
 Sends task to derived class method returnT (this->*memfn)(a1,a2,a3,a4,a5,a6,a7,a8).
detail::task_result_type< memfnT >::futureT task (ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const a5T &a5, const a6T &a6, const a7T &a7, const TaskAttributes &attr=TaskAttributes()) const
 Sends task to derived class method returnT (this->*memfn)(a1,a2,a3,a4,a5,a6,a7).
detail::task_result_type< memfnT >::futureT task (ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const a5T &a5, const a6T &a6, const TaskAttributes &attr=TaskAttributes()) const
 Sends task to derived class method returnT (this->*memfn)(a1,a2,a3,a4,a5,a6).
detail::task_result_type< memfnT >::futureT task (ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const a5T &a5, const TaskAttributes &attr=TaskAttributes()) const
 Sends task to derived class method returnT (this->*memfn)(a1,a2,a3,a4,a5).
detail::task_result_type< memfnT >::futureT task (ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const a4T &a4, const TaskAttributes &attr=TaskAttributes()) const
 Sends task to derived class method returnT (this->*memfn)(a1,a2,a3,a4).
detail::task_result_type< memfnT >::futureT task (ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const a3T &a3, const TaskAttributes &attr=TaskAttributes()) const
 Sends task to derived class method returnT (this->*memfn)(a1,a2,a3).
detail::task_result_type< memfnT >::futureT task (ProcessID dest, memfnT memfn, const a1T &a1, const a2T &a2, const TaskAttributes &attr=TaskAttributes()) const
 Sends task to derived class method returnT (this->*memfn)(a1,a2).
detail::task_result_type< memfnT >::futureT task (ProcessID dest, memfnT memfn, const a1T &a1, const TaskAttributes &attr=TaskAttributes()) const
 Sends task to derived class method returnT (this->*memfn)(a1).
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)().
Public Member Functions inherited from madness::WorldObjectBase
virtual ~WorldObjectBase ()
World & get_world () const
World & get_world_noexcept () const noexcept
 Get the world to which this object belongs, without risking a throw.
const uniqueidT & id () const
 Returns the globally unique object ID.
bool world_is_alive () const noexcept
 Reports whether the world to which this object belongs still exists.

Static Public Member Functions

template<typename Real>
static std::enable_if_t< std::is_floating_point_v< Real >, Real > conj (const Real x)
template<typename Real>
static std::complex< Real > conj (const std::complex< Real > &x)
template<typename R>
static void do_dot_localX (const typename mapT::iterator lstart, const typename mapT::iterator lend, typename FunctionImpl< R, NDIM >::mapT *rmap_ptr, const bool sym, Tensor< TENSOR_RESULT_TYPE(T, R)> *result_ptr, Mutex *mutex)
template<typename R>
static void do_inner_localX (const typename mapT::iterator lstart, const typename mapT::iterator lend, typename FunctionImpl< R, NDIM >::mapT *rmap_ptr, const bool sym, Tensor< TENSOR_RESULT_TYPE(T, R) > *result_ptr, Mutex *mutex)
template<typename R>
static Tensor< TENSOR_RESULT_TYPE(T, R)> dot_local (const std::vector< const FunctionImpl< T, NDIM > * > &left, const std::vector< const FunctionImpl< R, NDIM > * > &right, bool sym)
template<typename R>
static Tensor< TENSOR_RESULT_TYPE(T, R) > inner_local (const std::vector< const FunctionImpl< T, NDIM > * > &left, const std::vector< const FunctionImpl< R, NDIM > * > &right, bool sym)
static mapT make_key_vec_map (const std::vector< const FunctionImpl< T, NDIM > * > &v)
 Returns map of union of local keys to vector of indexes of functions containing that key.
static void tnorm (const GenTensor< T > &t, double *lo, double *hi)
static void tnorm (const SVDTensor< T > &t, double *lo, double *hi, const int particle)
static void tnorm (const tensorT &t, double *lo, double *hi)
 Computes norm of low/high-order polyn. coeffs for autorefinement test.

Public Attributes

long box_interior [1000]
long box_leaf [1000]
NDIM &gimpl const
NDIM &g const
AtomicInt large
bool leaves_only =(this->is_redundant())
AtomicInt small
Timer timer_accumulate
Timer timer_change_tensor_type
Timer timer_compress_svd
Timer timer_filter
Timer timer_lr_result
Timer timer_target_driven
World & world

Private Types

typedef WorldObject< FunctionImpl< T, NDIM > > woT
 Base class world object type.

Private Member Functions

 FunctionImpl (const FunctionImpl< T, NDIM > &p)
void make_redundant (const bool fence)
 convert this to redundant, i.e. have sum coefficients on all levels

Private Attributes

bool autorefine
 If true, autorefine where appropriate.
const FunctionCommonData< T, NDIM > & cdata
const Tensor< double > cell
 the size of the root cell in each dimension, unchangeable
dcT coeffs
 The coefficients.
std::shared_ptr< FunctionFunctorInterface< T, NDIM > > functor
int initial_level
 Initial level for refinement.
int k
 Wavelet order.
int max_refine_level
 Do not refine below this level.
std::atomic< ConcurrentHashMap< keyT, coeffT > * > neighbor_halo_ {nullptr}
 Neighbor coefficients pushed here by whoever owns them; null until something stages.
int special_level
 Minimium level for refinement on special points.
std::vector< Vector< double, NDIM > > special_points
 special points for further refinement (needed for composite functions or multiplication)
TensorArgs targs
 type of tensor to be used in the FunctionNodes
double thresh
 Screening threshold.
TreeState tree_state
int truncate_mode
 0=default=(|d|<thresh), 1=(|d|<thresh/2^n), 2=(|d|<thresh/4^n);
bool truncate_on_project
 If true projection inserts at level n-1 not n.

Friends

template<typename Q, std::size_t D>
class FunctionImpl
hashT hash_value (const FunctionImpl< T, NDIM > *pimpl)
 Hash a pointer to FunctionImpl.
hashT hash_value (const std::shared_ptr< FunctionImpl< T, NDIM > > impl)
 Hash a shared_ptr to FunctionImpl.

Additional Inherited Members

Protected Member Functions inherited from madness::WorldObject< FunctionImpl< T, NDIM > >
void process_pending ()
 To be called from derived constructor to process pending messages.
Protected Member Functions inherited from madness::WorldObjectBase
 WorldObjectBase (const WorldObjectBase &other)
 Copy constructor; produces an unregistered object.
 WorldObjectBase (World &w)
 Construct a new WorldObjectBase.
World & get_world_unchecked () const noexcept
 Unchecked access to the memoized world reference.
template<typename DerivedT>
void register_self (DerivedT *this_ptr)
 Registers this object with its world, making it globally addressable.

Detailed Description

template<typename T, std::size_t NDIM>
class madness::FunctionImpl< T, NDIM >

FunctionImpl holds all Function state to facilitate shallow copy semantics.

Since Function assignment and copy constructors are shallow it greatly simplifies maintaining consistent state to have all (permanent) state encapsulated in a single class. The state is shared between instances using a shared_ptr<FunctionImpl>.

The FunctionImpl inherits all of the functionality of WorldContainer (to store the coefficients) and WorldObject<WorldContainer> (used for RMI and for its unqiue id).

The class methods are public to avoid painful multiple friend template declarations for Function and FunctionImpl ... but this trust should not be abused ... NOTHING except FunctionImpl methods should mess with FunctionImplData. The LB stuff might have to be an exception.

Member Typedef Documentation

◆ coeffT

template<typename T, std::size_t NDIM>
typedef GenTensor<T> madness::FunctionImpl< T, NDIM >::coeffT

Type of tensor used to hold coeffs.

◆ compressT

template<typename T, std::size_t NDIM>
typedef std::pair<coeffT, std::pair<double,double> > madness::FunctionImpl< T, NDIM >::compressT

s coefficients plus the (snorm_tree, dnorm_tree) pair propagated up by compress

◆ coordT

template<typename T, std::size_t NDIM>
typedef Vector<double,NDIM> madness::FunctionImpl< T, NDIM >::coordT

Type of vector holding coordinates.

◆ datumT

template<typename T, std::size_t NDIM>
typedef std::pair<const keyT,nodeT> madness::FunctionImpl< T, NDIM >::datumT

Type of entry in container.

◆ dcT

template<typename T, std::size_t NDIM>
typedef WorldContainer<keyT,nodeT> madness::FunctionImpl< T, NDIM >::dcT

Type of container holding the coefficients.

◆ implT

template<typename T, std::size_t NDIM>
typedef FunctionImpl<T,NDIM> madness::FunctionImpl< T, NDIM >::implT

Type of this class (implementation).

◆ keyT

template<typename T, std::size_t NDIM>
typedef Key<NDIM> madness::FunctionImpl< T, NDIM >::keyT

Type of key.

◆ mapT

template<typename T, std::size_t NDIM>
typedef ConcurrentHashMap< keyT, mapvecT > madness::FunctionImpl< T, NDIM >::mapT

Type of the map returned by make_key_vec_map.

◆ mapvecT

template<typename T, std::size_t NDIM>
typedef std::vector< std::pair<int,const coeffT*> > madness::FunctionImpl< T, NDIM >::mapvecT

Type of the entry in the map returned by make_key_vec_map.

◆ nodeT

template<typename T, std::size_t NDIM>
typedef FunctionNode<T,NDIM> madness::FunctionImpl< T, NDIM >::nodeT

Type of node.

◆ pimplT

template<typename T, std::size_t NDIM>
typedef std::shared_ptr< FunctionImpl<T,NDIM> > madness::FunctionImpl< T, NDIM >::pimplT

pointer to this class

◆ rangeT [1/3]

template<typename T, std::size_t NDIM>
typedef Range<typename dcT::const_iterator> madness::FunctionImpl< T, NDIM >::rangeT

◆ rangeT [2/3]

template<typename T, std::size_t NDIM>
typedef Range<typename dcT::const_iterator> madness::FunctionImpl< T, NDIM >::rangeT

◆ rangeT [3/3]

template<typename T, std::size_t NDIM>
typedef Range<typename dcT::const_iterator> madness::FunctionImpl< T, NDIM >::rangeT

◆ tensorT

template<typename T, std::size_t NDIM>
typedef Tensor<T> madness::FunctionImpl< T, NDIM >::tensorT

Type of tensor for anything but to hold coeffs.

◆ tranT

template<typename T, std::size_t NDIM>
typedef Vector<Translation,NDIM> madness::FunctionImpl< T, NDIM >::tranT

Type of array holding translation.

◆ typeT

template<typename T, std::size_t NDIM>
typedef T madness::FunctionImpl< T, NDIM >::typeT

◆ woT

template<typename T, std::size_t NDIM>
typedef WorldObject< FunctionImpl<T,NDIM> > madness::FunctionImpl< T, NDIM >::woT
private

Base class world object type.

Constructor & Destructor Documentation

◆ FunctionImpl() [1/4]

template<typename T, std::size_t NDIM>
madness::FunctionImpl< T, NDIM >::FunctionImpl ( const FunctionImpl< T, NDIM > & p)
private

◆ FunctionImpl() [2/4]

template<typename T, std::size_t NDIM>
madness::FunctionImpl< T, NDIM >::FunctionImpl ( const FunctionFactory< T, NDIM > & factory)
inline

Initialize function impl from data in factory.

◆ FunctionImpl() [3/4]

template<typename T, std::size_t NDIM>
template<typename Q>
madness::FunctionImpl< T, NDIM >::FunctionImpl ( const FunctionImpl< Q, NDIM > & other,
const std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > & pmap,
bool dozero )
inline

Copy constructor.

Allocates a new function in preparation for a deep copy

By default takes pmap from other but can also specify a different pmap. Does not copy the coefficients ... creates an empty container.

◆ FunctionImpl() [4/4]

template<typename T, std::size_t NDIM>
template<typename Q>
madness::FunctionImpl< T, NDIM >::FunctionImpl ( World & world,
const FunctionImpl< Q, NDIM > & other,
const std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > & pmap,
bool dozero )
inline

Copy constructor.

Allocates a new function in preparation for a deep copy

By default takes pmap from other but can also specify a different pmap. Does not copy the coefficients ... creates an empty container.

uses a different world for the new function

◆ ~FunctionImpl()

template<typename T, std::size_t NDIM>
virtual madness::FunctionImpl< T, NDIM >::~FunctionImpl ( )
inlinevirtual

Member Function Documentation

◆ abs_inplace()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::abs_inplace ( bool fence)

References abs_inplace(), and unary_op_value_inplace().

Referenced by abs_inplace().

◆ abs_square_inplace()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::abs_square_inplace ( bool fence)

◆ accumulate_timer()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::accumulate_timer ( const double time) const

References accumulate_timer(), and timer_accumulate.

Referenced by accumulate_timer().

◆ accumulate_trees()

template<typename T, std::size_t NDIM>
template<typename Q, typename R>
void madness::FunctionImpl< T, NDIM >::accumulate_trees ( FunctionImpl< Q, NDIM > & result,
const R alpha,
const bool fence = true ) const
inline

merge the trees of this and other, while multiplying them with the alpha or beta, resp

result and rhs do not have to have the same distribution or live in the same world result+=alpha* this

Parameters
[in]alphaprefactor for this

◆ add_keys_to_map()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::add_keys_to_map ( mapT * map,
int index ) const
inline

Adds keys to union of local keys with specified index.

Referenced by madness::FunctionImpl< T, LDIM >::make_key_vec_map().

◆ add_scalar_inplace()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::add_scalar_inplace ( T t,
bool fence )

Adds a constant to the function. Local operation, optional fence.

In scaling function basis must add value to first polyn in each box with appropriate scaling for level. In wavelet basis need only add at level zero.

Parameters
[in]tthe scalar to be added

References add_scalar_inplace(), cdata, madness::change_tensor_type(), madness::FunctionNode< T, NDIM >::coeff(), coeffs, madness::GenTensor< T >::full_tensor(), madness::FunctionDefaults< NDIM >::tt, madness::FunctionDefaults< NDIM >::get_cell_volume(), get_tensor_args(), madness::FunctionNode< T, NDIM >::has_coeff(), is_compressed(), L, MADNESS_ASSERT, NDIM, pow(), targs, madness::TT_FULL, madness::ttt, ttt, and world.

Referenced by add_scalar_inplace().

◆ apply()

template<typename T, std::size_t NDIM>
template<typename opT, typename R>
void madness::FunctionImpl< T, NDIM >::apply ( opT & op,
const FunctionImpl< R, NDIM > & f,
bool fence )
inline

apply an operator on f to return this

◆ apply_1d_realspace_push()

template<typename T, std::size_t NDIM>
template<typename opT, typename R>
void madness::FunctionImpl< T, NDIM >::apply_1d_realspace_push ( const opT & op,
const FunctionImpl< R, NDIM > * f,
int axis,
bool fence )
inline

◆ apply_1d_realspace_push_op()

template<typename T, std::size_t NDIM>
template<typename opT, typename R>
void madness::FunctionImpl< T, NDIM >::apply_1d_realspace_push_op ( const archive::archive_ptr< const opT > & pop,
int axis,
const keyT & key,
const Tensor< R > & c )
inline

◆ apply_source_driven()

template<typename T, std::size_t NDIM>
template<typename opT, typename R>
void madness::FunctionImpl< T, NDIM >::apply_source_driven ( opT & op,
const FunctionImpl< R, NDIM > & f,
bool fence )
inline

similar to apply, but for low rank coeffs

◆ assemble_coefficients()

template<typename T, std::size_t NDIM>
FunctionImpl< T, NDIM >::coeffT madness::FunctionImpl< T, NDIM >::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

the result looks like: (v(1,2) + v(1) + v(2)) |ket(1,2)> or (v(1,2) + v(1) + v(2)) |p(1) p(2)> i.e. coefficients for the ket and coefficients for the two particles are mutually exclusive. All potential terms are optional, just pass in empty coeffs.

Parameters
[in]keythe key of the FunctionNode to which these coeffs belong
[in]coeff_ketcoefficients of the ket
[in]vpotential1function values of the potential for particle 1
[in]vpotential2function values of the potential for particle 2
[in]verifunction values for the 2-particle potential

the result looks like: (v(1,2) + v(1) + v(2)) |ket(1,2)> or (v(1,2) + v(1) + v(2)) |p(1) p(2)> i.e. coefficients for the ket and coefficients for the two particles are mutually exclusive. All potential terms are optional, just pass in empty coeffs.

Parameters
[in]keythe key of the FunctionNode to which these coeffs belong
[in]cketcoefficients of the ket
[in]vpotential1function values of the potential for particle 1
[in]vpotential2function values of the potential for particle 2
[in]verifunction values for the 2-particle potential

References assemble_coefficients(), coeffs2values(), madness::GenTensor< T >::convert(), madness::GenTensor< T >::dims(), madness::GenTensor< T >::full_tensor(), madness::GenTensor< T >::full_tensor_copy(), get_tensor_args(), madness::GenTensor< T >::has_data(), madness::Tensor< T >::has_data(), MADNESS_ASSERT, multiply(), madness::GenTensor< T >::ndim(), madness::GenTensor< T >::reduce_rank(), thresh, madness::TT_2D, and values2coeffs().

Referenced by assemble_coefficients().

◆ autorefine_square_test()

template<typename T, std::size_t NDIM>
bool madness::FunctionImpl< T, NDIM >::autorefine_square_test ( const keyT & key,
const nodeT & t ) const

◆ average()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::average ( const implT & rhs)

take the average of two functions, similar to: this=0.5*(this+rhs)

works in either basis and also in nonstandard form

References average(), flo_unary_op_node_inplace(), scale_inplace(), and targs.

Referenced by average().

◆ binaryXX()

template<typename T, std::size_t NDIM>
template<typename L, typename R, typename opT>
void madness::FunctionImpl< T, NDIM >::binaryXX ( const FunctionImpl< L, NDIM > * left,
const FunctionImpl< R, NDIM > * right,
const opT & op,
bool fence )
inline

Performs binary operation on two functions (impl's). Delegates to the binaryXXa() method

Parameters
[in]leftpointer to the left function impl
[in]rightpointer to the right function impl
[in]opthe binary operator

◆ binaryXXa()

template<typename T, std::size_t NDIM>
template<typename L, typename R, typename opT>
void madness::FunctionImpl< T, NDIM >::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 )
inline

Both left and right functions are in the scaling function basis

Parameters
[in]keythe key to the current function node (box)
[in]leftthe function impl associated with the left function
[in]lcinthe scaling function coefficients associated with the current box in the left function
[in]rightthe function impl associated with the right function
[in]rcinthe scaling function coefficients associated with the current box in the right function
[in]opthe binary operator

Referenced by madness::FunctionImpl< T, LDIM >::binaryXX().

◆ broaden()

◆ broaden_op()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::broaden_op ( const keyT & key,
const std::vector< Future< bool > > & v )

References broaden_op(), refine_op(), and v.

Referenced by broaden_op().

◆ change_tensor_type1()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::change_tensor_type1 ( const TensorArgs & targs,
bool fence )

change the tensor type of the coefficients in the FunctionNode

Parameters
[in]targstarget tensor arguments (threshold and full/low rank)

References change_tensor_type1(), flo_unary_op_node_inplace(), and targs.

Referenced by change_tensor_type1().

◆ change_tree_state()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::change_tree_state ( const TreeState finalstate,
bool fence = true )

change the tree state of this function, might or might not respect fence!

References change_tree_state(), and get_tree_state().

Referenced by change_tree_state(), and madness::partial_mul().

◆ check_symmetry_local()

template<typename T, std::size_t NDIM>
double madness::FunctionImpl< T, NDIM >::check_symmetry_local ( ) const

Returns some asymmetry measure ... no comms.

References FunctionImpl, check_symmetry_local(), coeffs, PROFILE_MEMBER_FUNC, and world.

Referenced by check_symmetry_local().

◆ child_patch()

◆ chop_at_level()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::chop_at_level ( const int n,
const bool fence = true )

remove all nodes with level higher than n

reduce the rank of the coefficients tensors

Parameters
[in]targstarget tensor arguments (threshold and full/low rank)

References chop_at_level(), coeffs, madness::Key< NDIM >::level(), and madness::FunctionNode< T, NDIM >::set_is_leaf().

Referenced by chop_at_level().

◆ coeffs2values() [1/2]

template<typename T, std::size_t NDIM>
template<typename Q>
GenTensor< Q > madness::FunctionImpl< T, NDIM >::coeffs2values ( const keyT & key,
const GenTensor< Q > & coeff ) const
inline

Return the values when given the coeffs in scaling function basis

Parameters
[in]keythe key of the function node (box)
[in]coeffthe tensor of scaling function coefficients for function node (box)
Returns
function values for function node (box)

Referenced by assemble_coefficients(), madness::FunctionImpl< T, LDIM >::fcube_for_mul(), madness::FunctionImpl< T, LDIM >::fcube_for_mul(), madness::FunctionImpl< T, LDIM >::multi_to_multi_op_values_doit(), and madness::FunctionImpl< T, LDIM >::multiop_values_doit().

◆ coeffs2values() [2/2]

template<typename T, std::size_t NDIM>
template<typename Q>
Tensor< Q > madness::FunctionImpl< T, NDIM >::coeffs2values ( const keyT & key,
const Tensor< Q > & coeff ) const
inline

Return the scaling function coeffs when given the function values at the quadrature points

Parameters
[in]keythe key of the function node (box)
Returns
function values for function node (box)

◆ compress()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::compress ( const TreeState newstate,
bool fence )

compress the wave function

after application there will be sum coefficients at the root level, and difference coefficients at all other levels; furthermore:

Parameters
[in]nonstandardkeep sum coeffs at all other levels, except leaves
[in]keepleaveskeep sum coeffs (but no diff coeffs) at leaves
[in]redundantkeep only sum coeffs at all levels, discard difference coeffs

References compress(), is_reconstructed(), MADNESS_CHECK_THROW, madness::nonstandard, madness::nonstandard_with_leaves, madness::redundant, set_tree_state(), and tree_state.

Referenced by compress().

◆ compress_op()

template<typename T, std::size_t NDIM>
FunctionImpl< T, NDIM >::compressT madness::FunctionImpl< T, NDIM >::compress_op ( const keyT & key,
const std::vector< Future< compressT > > & v,
bool nonstandard1 )

calculate the wavelet coefficients using the sum coefficients of all child nodes

also propagates norm_tree and dnorm_tree for all nodes

Parameters
[in]keythis's key
[in]vsum coefficients and propagated norms of the child nodes
[in]nonstandardkeep the sum coefficients with the wavelet coefficients
Returns
the sum coefficients and propagated norms
Parameters
[in]keythis's key
[in]vsum coefficients and propagated norms of the child nodes
[in]nonstandardkeep the sum coefficients with the wavelet coefficients
Returns
the sum coefficients and propagated norms

References cdata, child_patch(), coeffs, compress_op(), copy(), cpu_time(), d, filter(), madness::Key< NDIM >::level(), MADNESS_CHECK, MADNESS_CHECK_THROW, norm_tree(), madness::GenTensor< T >::normf(), targs, madness::TensorArgs::thresh, timer_compress_svd, timer_filter, and v.

Referenced by compress_op(), and compress_spawn().

◆ compress_spawn()

template<typename T, std::size_t NDIM>
Future< typename FunctionImpl< T, NDIM >::compressT > madness::FunctionImpl< T, NDIM >::compress_spawn ( const keyT & key,
bool nonstandard1,
bool keepleaves,
bool redundant1 )

◆ compute_snorm_and_dnorm()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::compute_snorm_and_dnorm ( bool fence = true)

compute norm of s and d coefficients for all nodes

Parameters
[in]targstarget tensor arguments (threshold and full/low rank)

References cdata, compute_snorm_and_dnorm(), and flo_unary_op_node_inplace().

Referenced by compute_snorm_and_dnorm().

◆ conj() [1/2]

template<typename T, std::size_t NDIM>
template<typename Real>
std::enable_if_t< std::is_floating_point_v< Real >, Real > madness::FunctionImpl< T, NDIM >::conj ( const Real x)
inlinestatic

◆ conj() [2/2]

template<typename T, std::size_t NDIM>
template<typename Real>
std::complex< Real > madness::FunctionImpl< T, NDIM >::conj ( const std::complex< Real > & x)
inlinestatic

◆ copy_coeffs()

template<typename T, std::size_t NDIM>
template<typename Q>
void madness::FunctionImpl< T, NDIM >::copy_coeffs ( const FunctionImpl< Q, NDIM > & other,
bool fence )
inline

Copy coeffs from other into self.

this and other might live in different worlds

◆ copy_coeffs_different_world()

template<typename T, std::size_t NDIM>
template<typename Q>
void madness::FunctionImpl< T, NDIM >::copy_coeffs_different_world ( const FunctionImpl< Q, NDIM > & other)
inline

Copy coefficients from other funcimpl with possibly different world and on a different node.

Referenced by madness::FunctionImpl< T, LDIM >::copy_coeffs().

◆ copy_coeffs_same_world()

template<typename T, std::size_t NDIM>
template<typename Q>
void madness::FunctionImpl< T, NDIM >::copy_coeffs_same_world ( const FunctionImpl< Q, NDIM > & other,
bool fence )
inline

◆ copy_remote_coeffs_from_pid()

template<typename T, std::size_t NDIM>
template<typename Q>
void madness::FunctionImpl< T, NDIM >::copy_remote_coeffs_from_pid ( const ProcessID pid,
const FunctionImpl< Q, NDIM > & other )
inline

Copy coefficients from other funcimpl with possibly different world and on a different node to this

< Type of this class (implementation)

Referenced by madness::FunctionImpl< T, LDIM >::copy_coeffs_different_world().

◆ diff()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::diff ( const DerivativeBase< T, NDIM > * D,
const implT * f,
bool fence )

◆ dirac_convolution_op()

template<typename T, std::size_t NDIM>
template<std::size_t LDIM>
void madness::FunctionImpl< T, NDIM >::dirac_convolution_op ( const keyT & key,
const nodeT & node,
FunctionImpl< T, LDIM > * f ) const
inline

The operator.

Integrate over one particle of a two particle function and get a one particle function bsp \int g(1,2) \delta(2-1) d2 = f(1) The overall dimension of g should be even

◆ distribute()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::distribute ( std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > newmap) const
inline

◆ do_apply()

template<typename T, std::size_t NDIM>
template<typename opT, typename R>
void madness::FunctionImpl< T, NDIM >::do_apply ( const opT * op,
const keyT & key,
const Tensor< R > & c )
inline

apply an operator on the coeffs c (at node key)

the result is accumulated inplace to this's tree at various FunctionNodes

Parameters
[in]opthe operator to act on the source function
[in]keykey of the source FunctionNode of f which is processed
[in]ccoeffs of the FunctionNode of f which is processed

◆ do_apply_directed_screening()

template<typename T, std::size_t NDIM>
template<typename opT, typename R>
double madness::FunctionImpl< T, NDIM >::do_apply_directed_screening ( const opT * op,
const keyT & key,
const coeffT & coeff,
const bool & do_kernel )
inline

apply an operator on the coeffs c (at node key)

invoked by result; the result is accumulated inplace to this's tree at various FunctionNodes

Parameters
[in]opthe operator to act on the source function
[in]keykey of the source FunctionNode of f which is processed (see "source")
[in]coeffcoeffs of FunctionNode being processed
[in]do_kerneltrue: do the 0-disp only; false: do everything but the kernel
Returns
max norm, and will modify or include new nodes in this' tree

Referenced by madness::FunctionImpl< T, NDIM >::recursive_apply_op2< opT >::operator()(), madness::FunctionImpl< T, NDIM >::recursive_apply_op< opT, LDIM >::operator()(), and madness::FunctionImpl< T, NDIM >::recursive_apply_op_vec< opT, LDIM >::operator()().

◆ do_apply_kernel()

template<typename T, std::size_t NDIM>
template<typename opT, typename R, size_t OPDIM>
void madness::FunctionImpl< T, NDIM >::do_apply_kernel ( const opT * op,
const Tensor< R > & c,
const do_op_args< OPDIM > & args )
inline

for fine-grain parallelism: call the apply method of an operator in a separate task

Parameters
[in]opthe operator working on our function
[in]cfull rank tensor holding the NS coefficients
[in]argslaziness holding norm of the coefficients, displacement, destination, ..

◆ do_apply_kernel2()

template<typename T, std::size_t NDIM>
template<typename opT, typename R, size_t OPDIM>
double madness::FunctionImpl< T, NDIM >::do_apply_kernel2 ( const opT * op,
const Tensor< R > & c,
const do_op_args< OPDIM > & args,
const TensorArgs & apply_targs )
inline

same as do_apply_kernel, but use full rank tensors as input and low rank tensors as output

Parameters
[in]opthe operator working on our function
[in]cfull rank tensor holding the NS coefficients
[in]argslaziness holding norm of the coefficients, displacement, destination, ..
[in]apply_targsTensorArgs with tightened threshold for accumulation
Returns
nothing, but accumulate the result tensor into the destination node

Referenced by madness::FunctionImpl< T, LDIM >::do_apply_directed_screening().

◆ do_apply_kernel3()

template<typename T, std::size_t NDIM>
template<typename opT, typename R, size_t OPDIM>
double madness::FunctionImpl< T, NDIM >::do_apply_kernel3 ( const opT * op,
const GenTensor< R > & coeff,
const do_op_args< OPDIM > & args,
const TensorArgs & apply_targs )
inline

same as do_apply_kernel2, but use low rank tensors as input and low rank tensors as output

Parameters
[in]opthe operator working on our function
[in]coefffull rank tensor holding the NS coefficients
[in]argslaziness holding norm of the coefficients, displacement, destination, ..
[in]apply_targsTensorArgs with tightened threshold for accumulation
Returns
nothing, but accumulate the result tensor into the destination node

Referenced by madness::FunctionImpl< T, LDIM >::do_apply_directed_screening().

◆ do_binary_op()

template<typename T, std::size_t NDIM>
template<typename L, typename R, typename opT>
void madness::FunctionImpl< T, NDIM >::do_binary_op ( const keyT & key,
const Tensor< L > & left,
const std::pair< keyT, Tensor< R > > & arg,
const opT & op )
inline

Functor for the binary_op method.

Referenced by madness::FunctionImpl< T, LDIM >::binaryXXa().

◆ do_diff1()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::do_diff1 ( const DerivativeBase< T, NDIM > * D,
const implT * f,
const keyT & key,
const std::pair< keyT, coeffT > & left,
const std::pair< keyT, coeffT > & center,
const std::pair< keyT, coeffT > & right )

◆ do_dirac_convolution()

template<typename T, std::size_t NDIM>
template<std::size_t LDIM>
void madness::FunctionImpl< T, NDIM >::do_dirac_convolution ( FunctionImpl< T, LDIM > * f,
bool fence ) const
inline

◆ do_dot_localX()

template<typename T, std::size_t NDIM>
template<typename R>
void madness::FunctionImpl< T, NDIM >::do_dot_localX ( const typename mapT::iterator lstart,
const typename mapT::iterator lend,
typename FunctionImpl< R, NDIM >::mapT * rmap_ptr,
const bool sym,
Tensor< TENSOR_RESULT_TYPE(T, R)> * result_ptr,
Mutex * mutex )
inlinestatic

◆ do_inner_localX()

template<typename T, std::size_t NDIM>
template<typename R>
void madness::FunctionImpl< T, NDIM >::do_inner_localX ( const typename mapT::iterator lstart,
const typename mapT::iterator lend,
typename FunctionImpl< R, NDIM >::mapT * rmap_ptr,
const bool sym,
Tensor< TENSOR_RESULT_TYPE(T, R) > * result_ptr,
Mutex * mutex )
inlinestatic

◆ do_mul()

template<typename T, std::size_t NDIM>
template<typename L, typename R>
void madness::FunctionImpl< T, NDIM >::do_mul ( const keyT & key,
const Tensor< L > & left,
const std::pair< keyT, Tensor< R > > & arg )
inline

Functor for the mul method.

Referenced by madness::FunctionImpl< T, LDIM >::mulXXa().

◆ do_print_grid()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::do_print_grid ( const std::string filename,
const std::vector< keyT > & keys ) const

print the grid in xyz format

the quadrature points and the key information will be written to file,

Parameters
[in]filenamewhere the quadrature points will be written to
[in]keysall leaf keys

References c, cdata, cell, d, madness::BaseTensor::dim(), do_print_grid(), madness::filename, madness::FunctionDefaults< NDIM >::cell_width, madness::FunctionDefaults< NDIM >::get_cell(), madness::FunctionDefaults< NDIM >::get_cell_width(), h(), k, madness::Key< NDIM >::level(), MADNESS_ASSERT, MADNESS_EXCEPTION, NDIM, madness::power(), madness::Key< NDIM >::translation(), and world.

Referenced by do_print_grid(), and print_grid().

◆ do_print_plane()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::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

Functor for the print_plane method

Parameters
[in]filenamethe filename for the output
[in]plotinfoplotting parameters
[in]xaxisthe x-axis in the plot (can be any axis of the MRA box)
[in]yaxisthe y-axis in the plot (can be any axis of the MRA box)

References cell, madness::BaseTensor::dim(), do_print_plane(), madness::Tensor< T >::end(), madness::filename, madness::FunctionDefaults< NDIM >::get_cell(), madness::Tensor< T >::has_data(), MADNESS_ASSERT, and world.

Referenced by do_print_plane(), and print_plane().

◆ do_print_tree()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::do_print_tree ( const keyT & key,
std::ostream & os,
Level maxlevel ) const

Functor for the do_print_tree method.

References coeffs, do_print_tree(), madness::FunctionNode< T, NDIM >::has_children(), and madness::Key< NDIM >::level().

Referenced by do_print_tree(), and print_tree().

◆ do_print_tree_graphviz()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::do_print_tree_graphviz ( const keyT & key,
std::ostream & os,
Level maxlevel ) const

◆ do_print_tree_json()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::do_print_tree_json ( const keyT & key,
std::multimap< Level, std::tuple< tranT, std::string > > & data,
Level maxlevel ) const

◆ do_project_out()

template<typename T, std::size_t NDIM>
template<size_t LDIM>
void madness::FunctionImpl< T, NDIM >::do_project_out ( const coeffT & fcoeff,
const std::pair< keyT, coeffT > gpair,
const keyT & gkey,
const Key< NDIM > & dest,
const int dim ) const
inline

compute the inner product of two nodes of only some dimensions and accumulate on result

invoked by result

Parameters
[in]fcoeffcoefficients of high dimension LDIM+NDIM
[in]gpairkey and coeffs of low dimension LDIM (possibly a parent node)
[in]gkeykey of actual low dim node (possibly the same as gpair.first, iff gnode exists)
[in]destdestination node for the result
[in]dimwhich dimensions should be contracted: 0..LDIM-1 or LDIM..NDIM+LDIM-1

◆ do_square_inplace()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::do_square_inplace ( const keyT & key)

◆ do_square_inplace2()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::do_square_inplace2 ( const keyT & parent,
const keyT & child,
const tensorT & parent_coeff )

◆ dot_local()

template<typename T, std::size_t NDIM>
template<typename R>
Tensor< TENSOR_RESULT_TYPE(T, R)> madness::FunctionImpl< T, NDIM >::dot_local ( const std::vector< const FunctionImpl< T, NDIM > * > & left,
const std::vector< const FunctionImpl< R, NDIM > * > & right,
bool sym )
inlinestatic

Referenced by madness::matrix_dot().

◆ downsample()

template<typename T, std::size_t NDIM>
FunctionImpl< T, NDIM >::tensorT madness::FunctionImpl< T, NDIM >::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

specialization of the filter method, will yield only the sum coefficients

Parameters
[in]keykey of level n
[in]vvector of sum coefficients of level n+1
Returns
sum coefficients on level n in full tensor format

specialization of the filter method, will yield only the sum coefficients

Parameters
[in]keykey of level n
[in]vvector of sum coefficients of level n+1
[in]argsTensorArguments for possible low rank approximations
Returns
sum coefficients on level n in full tensor format

References cdata, downsample(), madness::general_transform(), h(), NDIM, and v.

Referenced by downsample().

◆ erase()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::erase ( const Level & max_level)

truncate tree at a certain level

truncate tree at a certain level

Parameters
[in]max_leveltruncate tree below this level

References coeffs, erase(), madness::Key< NDIM >::level(), make_redundant(), madness::FunctionNode< T, NDIM >::set_has_children(), and undo_redundant().

Referenced by erase().

◆ err_box()

template<typename T, std::size_t NDIM>
template<typename opT>
double madness::FunctionImpl< T, NDIM >::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
inline

Returns the square of the error norm in the box labeled by key.

Assumed to be invoked locally but it would be easy to eliminate this assumption

◆ errsq_local()

template<typename T, std::size_t NDIM>
template<typename opT>
double madness::FunctionImpl< T, NDIM >::errsq_local ( const opT & func) const
inline

Returns the sum of squares of errors from local info ... no comms.

◆ eval()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::eval ( const Vector< double, NDIM > & xin,
const keyT & keyin,
const typename Future< T >::remote_refT & ref )

◆ eval_cube()

◆ eval_local_only() [1/3]

template<typename T, std::size_t NDIM>
std::vector< std::pair< bool, T > > madness::FunctionImpl< T, NDIM >::eval_local_only ( const std::vector< Vector< double, NDIM > > & xin,
Level maxlevel )

Batched eval_local_only returning a fresh vector (see the pointer core above for semantics). maxlevel is the maximum depth to search down to — the max local depth can be computed with max_local_depth();

References eval_local_only().

◆ eval_local_only() [2/3]

template<typename T, std::size_t NDIM>
std::pair< bool, T > madness::FunctionImpl< T, NDIM >::eval_local_only ( const Vector< double, NDIM > & xin,
Level maxlevel )

Evaluate function only if point is local returning (true,value); otherwise return (false,0.0).

maxlevel is the maximum depth to search down to — the max local depth can be computed with max_local_depth();

References madness::FunctionNode< T, NDIM >::coeff(), coeffs, eval_cube(), eval_local_only(), madness::GenTensor< T >::full_tensor(), madness::Future< T >::get(), madness::FunctionNode< T, NDIM >::has_coeff(), madness::Key< NDIM >::level(), madness::WorldObject< FunctionImpl< T, NDIM > >::me, NDIM, madness::Key< NDIM >::translation(), world, and xi.

Referenced by eval_local_only(), eval_local_only(), and eval_local_only().

◆ eval_local_only() [3/3]

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::eval_local_only ( const Vector< double, NDIM > * xin,
std::size_t npt,
Level maxlevel,
std::pair< bool, T > * results )

Allocation-free core of the batched eval_local_only: writes one (local?,value) pair per point, in input order, into results[0..npt). Consecutive points in the same leaf box share that box's descent and coefficient fetch (last-box memoization); each point is evaluated by the same eval_cube on the same tensor as the single-point path, so results are bit-for-bit identical. No communications.

References madness::FunctionNode< T, NDIM >::coeff(), coeffs, eval_cube(), eval_local_only(), madness::GenTensor< T >::full_tensor(), madness::Future< T >::get(), madness::FunctionNode< T, NDIM >::has_coeff(), madness::Key< NDIM >::level(), madness::WorldObject< FunctionImpl< T, NDIM > >::me, NDIM, madness::same, madness::Key< NDIM >::translation(), world, and xi.

◆ eval_plot_cube()

template<typename T, std::size_t NDIM>
Tensor< T > madness::FunctionImpl< T, NDIM >::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 No communications

Parameters
[in]plotlothe coordinate of the starting point
[in]plothithe coordinate of the ending point
[in]nptthe number of points in each dimension

Set plot_refine=true to get a plot of the refinment levels of the given function (defaulted to false in prototype).

References FunctionImpl, coeffs, eval_plot_cube(), is_reconstructed(), MADNESS_ASSERT, NDIM, and PROFILE_MEMBER_FUNC.

Referenced by eval_plot_cube().

◆ evaldepthpt()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::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.

Only the invoking process will get the result via the remote reference to a future. Active messages may be sent to other nodes.

This function is a minimally-modified version of eval()

References FunctionImpl, coeffs, evaldepthpt(), madness::Future< T >::get(), madness::FunctionNode< T, NDIM >::has_coeff(), madness::TaskAttributes::hipri(), madness::Key< NDIM >::level(), madness::WorldObject< FunctionImpl< T, NDIM > >::me, NDIM, PROFILE_MEMBER_FUNC, madness::Future< T >::set(), madness::WorldObject< FunctionImpl< T, NDIM > >::task(), madness::Key< NDIM >::translation(), world, and xi.

Referenced by evaldepthpt().

◆ evalR()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::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.

Only the invoking process will get the result via the remote reference to a future. Active messages may be sent to other nodes.

This function is a minimally-modified version of eval()

References FunctionImpl, madness::FunctionNode< T, NDIM >::coeff(), coeffs, evalR(), madness::Future< T >::get(), madness::FunctionNode< T, NDIM >::has_coeff(), madness::TaskAttributes::hipri(), madness::Key< NDIM >::level(), madness::WorldObject< FunctionImpl< T, NDIM > >::me, NDIM, PROFILE_MEMBER_FUNC, madness::GenTensor< T >::rank(), madness::Future< T >::set(), madness::WorldObject< FunctionImpl< T, NDIM > >::task(), madness::Key< NDIM >::translation(), world, and xi.

Referenced by eval_cube(), and evalR().

◆ exists_and_has_children()

template<typename T, std::size_t NDIM>
bool madness::FunctionImpl< T, NDIM >::exists_and_has_children ( const keyT & key) const

◆ exists_and_is_leaf()

template<typename T, std::size_t NDIM>
bool madness::FunctionImpl< T, NDIM >::exists_and_is_leaf ( const keyT & key) const

References coeffs, and exists_and_is_leaf().

Referenced by exists_and_is_leaf().

◆ fcube() [1/2]

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::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.

Parameters
[in]keythe key indicating where the quadrature points are located
[in]fthe interface to the elementary function
[in]qxquadrature points on a level=0 box
[out]fvalvalues

References madness::f, madness::fcube(), and fcube().

Referenced by madness::composite_product_op_NS< T, NDIM, opT, LDIM >::eri_coeffs(), madness::FunctionImpl< T, LDIM >::err_box(), fcube(), fcube(), and madness::FunctionImpl< T, LDIM >::inner_ext_node().

◆ fcube() [2/2]

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::fcube ( const keyT & key,
T(* f )(const coordT &),
const Tensor< double > & qx,
tensorT & fval ) const

Evaluate function at quadrature points in the specified box.

Parameters
[in]keythe key indicating where the quadrature points are located
[in]fthe interface to the elementary function
[in]qxquadrature points on a level=0 box
[out]fvalvalues

References madness::f, madness::fcube(), and fcube().

◆ fcube_for_mul() [1/2]

template<typename T, std::size_t NDIM>
template<typename Q>
GenTensor< Q > madness::FunctionImpl< T, NDIM >::fcube_for_mul ( const keyT & child,
const keyT & parent,
const GenTensor< Q > & coeff ) const
inline

Compute the function values for multiplication.

Given coefficients from a parent cell, compute the value of the functions at the quadrature points of a child

Parameters
[in]childthe key for the child function node (box)
[in]parentthe key for the parent function node (box)
[in]coeffthe coefficients of scaling function basis of the parent box

◆ fcube_for_mul() [2/2]

template<typename T, std::size_t NDIM>
template<typename Q>
Tensor< Q > madness::FunctionImpl< T, NDIM >::fcube_for_mul ( const keyT & child,
const keyT & parent,
const Tensor< Q > & coeff ) const
inline

Compute the function values for multiplication.

Given coefficients from a parent cell, compute the value of the functions at the quadrature points of a child

Parameters
[in]childthe key for the child function node (box)
[in]parentthe key for the parent function node (box)
[in]coeffthe coefficients of scaling function basis of the parent box

Referenced by madness::FunctionImpl< T, LDIM >::do_binary_op(), madness::FunctionImpl< T, LDIM >::do_mul(), and parent_to_child().

◆ filter() [1/2]

template<typename T, std::size_t NDIM>
FunctionImpl< T, NDIM >::coeffT madness::FunctionImpl< T, NDIM >::filter ( const coeffT & s) const

References cdata, filter(), and transform().

◆ filter() [2/2]

template<typename T, std::size_t NDIM>
FunctionImpl< T, NDIM >::tensorT madness::FunctionImpl< T, NDIM >::filter ( const tensorT & s) const

Transform sum coefficients at level n to sums+differences at level n-1.

Given scaling function coefficients s[n][l][i] and s[n][l+1][i] return the scaling function and wavelet coefficients at the coarser level. I.e., decompose Vn using Vn = Vn-1 + Wn-1.

s_i = sum(j) h0_ij*s0_j + h1_ij*s1_j
d_i = sum(j) g0_ij*s0_j + g1_ij*s1_j
//
AtomicInt sum
Definition test_atomicint.cc:46

Returns a new tensor and has no side effects. Works for any number of dimensions.

No communication involved.

References cdata, madness::fast_transform(), filter(), and w().

Referenced by compress_op(), filter(), filter(), madness::FunctionImpl< T, LDIM >::gaxpy_ext_recursive(), make_redundant_op(), project_refine_op(), and truncate_reconstructed_op().

◆ finalize_apply()

template<typename T, std::size_t NDIM>
double madness::FunctionImpl< T, NDIM >::finalize_apply ( )

after apply we need to do some cleanup;

forces fence

References finalize_apply(), flo_unary_op_node_inplace(), madness::print_timings, targs, madness::TensorArgs::thresh, madness::wall_time(), and world.

Referenced by finalize_apply().

◆ finalize_sum()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::finalize_sum ( )

after summing up we need to do some cleanup;

forces fence

References finalize_sum().

Referenced by finalize_sum().

◆ find_datum()

template<typename T, std::size_t NDIM>
std::pair< Key< NDIM >, ShallowNode< T, NDIM > > madness::FunctionImpl< T, NDIM >::find_datum ( keyT key) const

return the a std::pair<key, node>, which MUST exist

References coeffs, find_datum(), and MADNESS_ASSERT.

Referenced by madness::CoeffTracker< T, LDIM >::activate(), and find_datum().

◆ find_me()

template<typename T, std::size_t NDIM>
Future< std::pair< Key< NDIM >, GenTensor< T > > > madness::FunctionImpl< T, NDIM >::find_me ( const keyT & key) const

find_me. Called by diff_bdry to get coefficients of boundary function

References coeffs, find_me(), madness::TaskAttributes::hipri(), madness::Future< T >::remote_ref(), sock_it_to_me_too(), madness::WorldObject< FunctionImpl< T, NDIM > >::task(), and world.

Referenced by find_me().

◆ flo_unary_op_node_inplace() [1/2]

template<typename T, std::size_t NDIM>
template<typename opT>
void madness::FunctionImpl< T, NDIM >::flo_unary_op_node_inplace ( const opT & op,
bool fence )
inline

◆ flo_unary_op_node_inplace() [2/2]

template<typename T, std::size_t NDIM>
template<typename opT>
void madness::FunctionImpl< T, NDIM >::flo_unary_op_node_inplace ( const opT & op,
bool fence ) const
inline

Unary operation applied inplace to the coefficients WITHOUT refinement, optional fence

Parameters
[in]opthe unary operator for the coefficients

◆ forward_do_diff1()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::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 > & center,
const std::pair< keyT, coeffT > & right )

◆ forward_traverse()

template<typename T, std::size_t NDIM>
template<typename coeff_opT, typename apply_opT>
void madness::FunctionImpl< T, NDIM >::forward_traverse ( const coeff_opT & coeff_op,
const apply_opT & apply_op,
const keyT & key ) const
inline

traverse a non-existing tree

part II: activate coeff_op, i.e. retrieve all the necessary remote boxes (communication)

Parameters
[in]coeff_opoperator making the coefficients that needs activation
[in]apply_opjust passing thru
[in]keythe key we are working on

Referenced by madness::FunctionImpl< T, NDIM >::Vphi_ij_u_op_NS< opT, LDIM >::continue_recursion(), madness::FunctionImpl< T, NDIM >::Vphi_op_NS< opT, LDIM >::continue_recursion(), gaxpy_oop_reconstructed(), and madness::FunctionImpl< T, LDIM >::traverse_tree().

◆ gaxpy()

template<typename T, std::size_t NDIM>
template<typename L, typename R>
void madness::FunctionImpl< T, NDIM >::gaxpy ( T alpha,
const FunctionImpl< L, NDIM > & left,
T beta,
const FunctionImpl< R, NDIM > & right,
bool fence )
inline

Invoked by result to perform result += alpha*left+beta*right in wavelet basis.

Does not assume that any of result, left, right have the same distribution. For most purposes result will start as an empty so actually are implementing out of place gaxpy. If all functions have the same distribution there is no communication except for the optional fence.

◆ gaxpy_ext()

template<typename T, std::size_t NDIM>
template<typename L>
void madness::FunctionImpl< T, NDIM >::gaxpy_ext ( const FunctionImpl< L, NDIM > * left,
T(* f )(const coordT &),
T alpha,
T beta,
double tol,
bool fence )
inline

◆ gaxpy_ext_node()

template<typename T, std::size_t NDIM>
template<typename L>
tensorT madness::FunctionImpl< T, NDIM >::gaxpy_ext_node ( keyT key,
Tensor< L > lc,
T(* f )(const coordT &),
T alpha,
T beta ) const
inline

Return the gaxpy product with an external function on a specified function node.

Parameters
[in]keyKey of the function node on which to compute gaxpy
[in]lcTensor of coefficients for the function at the function node given by key
[in]fPointer to function of type T that takes coordT arguments. This is the externally provided function and the right argument of gaxpy.
[in]alphaprefactor of c Tensor for gaxpy
[in]betaprefactor of fcoeffs for gaxpy
Returns
Returns coefficient tensor of the gaxpy product at specified key, no guarantee of accuracy.

Referenced by madness::FunctionImpl< T, LDIM >::gaxpy_ext_recursive().

◆ gaxpy_ext_recursive()

template<typename T, std::size_t NDIM>
template<typename L>
void madness::FunctionImpl< T, NDIM >::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 )
inline

Return out of place gaxpy using recursive descent.

Parameters
[in]keyKey of the function node on which to compute gaxpy
[in]leftFunctionImpl, left argument of gaxpy
[in]lcincoefficients of left at this node
[in]ccoefficients of gaxpy product at this node
[in]fpointer to function of type T that takes coordT arguments. This is the externally provided function and the right argument of gaxpy.
[in]alphaprefactor of left argument for gaxpy
[in]betaprefactor of right argument for gaxpy
[in]tolconvergence tolerance...when the norm of the gaxpy's difference coefficients is less than tol, we are done.

Referenced by madness::FunctionImpl< T, LDIM >::gaxpy_ext().

◆ gaxpy_inplace()

template<typename T, std::size_t NDIM>
template<typename Q, typename R>
void madness::FunctionImpl< T, NDIM >::gaxpy_inplace ( const T & alpha,
const FunctionImpl< Q, NDIM > & other,
const R & beta,
bool fence )
inline

Inplace general bilinear operation.

this's world can differ from other's world this = alpha * this + beta * other

Parameters
[in]alphaprefactor for the current function impl
[in]otherthe other function impl
[in]betaprefactor for other

Referenced by madness::FunctionImpl< T, LDIM >::gaxpy_inplace_reconstructed(), and madness::FunctionImpl< T, NDIM >::do_gaxpy_inplace< Q, R >::operator()().

◆ gaxpy_inplace_reconstructed()

template<typename T, std::size_t NDIM>
template<typename Q, typename R>
void madness::FunctionImpl< T, NDIM >::gaxpy_inplace_reconstructed ( const T & alpha,
const FunctionImpl< Q, NDIM > & g,
const R & beta,
const bool fence )
inline

perform inplace gaxpy: this = alpha*this + beta*other

Parameters
[in]alphaprefactor for this
[in]betaprefactor for other
[in]gthe other function, reconstructed
Returns
*this = alpha*this + beta*other, in either reconstructed or redundant_after_merge state

◆ gaxpy_oop_reconstructed()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::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

f and g are reconstructed, so we can save on the compress operation, walk down the joint tree, and add leaf coefficients; effectively refines to common finest level. nothing returned, but leaves this's tree reconstructed and as sum of f and g

Parameters
[in]alphaprefactor for f
[in]ffirst addend
[in]betaprefactor for g
[in]gsecond addend

f and g are reconstructed, so we can save on the compress operation, walk down the joint tree, and add leaf coefficients; effectively refines to common finest level.

Parameters
[in]alphaprefactor for f
[in]ffirst addend
[in]betaprefactor for g
[in]gsecond addend
Returns
nothing, but leaves this's tree reconstructed and as sum of f and g

References alpha, beta, cdata, coeffs, madness::f, forward_traverse(), madness::g, gaxpy_oop_reconstructed(), MADNESS_CHECK_THROW, madness::reconstructed, set_tree_state(), madness::WorldObject< FunctionImpl< T, NDIM > >::task(), and world.

Referenced by gaxpy_oop_reconstructed().

◆ get_autorefine()

template<typename T, std::size_t NDIM>
bool madness::FunctionImpl< T, NDIM >::get_autorefine ( ) const

References autorefine, and get_autorefine().

Referenced by get_autorefine().

◆ get_cdata()

◆ get_cell()

template<typename T, std::size_t NDIM>
const Tensor< double > & madness::FunctionImpl< T, NDIM >::get_cell ( ) const
inline

return the simulation cell

◆ get_coeffs() [1/2]

template<typename T, std::size_t NDIM>
FunctionImpl< T, NDIM >::dcT & madness::FunctionImpl< T, NDIM >::get_coeffs ( )

References coeffs, and get_coeffs().

◆ get_coeffs() [2/2]

◆ get_contraction_node_lists()

template<typename T, std::size_t NDIM>
template<std::size_t CDIM>
std::tuple< std::set< Key< NDIM > >, std::map< Key< CDIM >, double > > madness::FunctionImpl< T, NDIM >::get_contraction_node_lists ( const std::size_t n,
const std::array< int, CDIM > & v ) const
inline

for contraction two functions f(x,z) = \int g(x,y) h(y,z) dy

find all nodes with d coefficients and return a list of complete keys and of keys holding only the y dimension, also the maximum norm of all d for the j dimension

Parameters
[in]nthe scale
[in]varray holding the indices of the integration variable
Returns
ijlist: list of all nodes with d coeffs; jlist: j-part of ij list only, with max d norm

◆ get_functor() [1/2]

template<typename T, std::size_t NDIM>
std::shared_ptr< FunctionFunctorInterface< T, NDIM > > madness::FunctionImpl< T, NDIM >::get_functor ( )

◆ get_functor() [2/2]

template<typename T, std::size_t NDIM>
std::shared_ptr< FunctionFunctorInterface< T, NDIM > > madness::FunctionImpl< T, NDIM >::get_functor ( ) const

◆ get_initial_level()

template<typename T, std::size_t NDIM>
int madness::FunctionImpl< T, NDIM >::get_initial_level ( ) const
inline

getter

◆ get_k()

template<typename T, std::size_t NDIM>
int madness::FunctionImpl< T, NDIM >::get_k ( ) const

References get_k(), and k.

Referenced by get_k(), reconstruct_op(), and verify_tree_state_local().

◆ get_norm_tree_recursive()

◆ get_pmap()

template<typename T, std::size_t NDIM>
const std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > & madness::FunctionImpl< T, NDIM >::get_pmap ( ) const

◆ get_special_level()

template<typename T, std::size_t NDIM>
int madness::FunctionImpl< T, NDIM >::get_special_level ( ) const
inline

◆ get_special_points()

template<typename T, std::size_t NDIM>
const std::vector< Vector< double, NDIM > > & madness::FunctionImpl< T, NDIM >::get_special_points ( ) const
inline

◆ get_tensor_args()

◆ get_tensor_type()

template<typename T, std::size_t NDIM>
TensorType madness::FunctionImpl< T, NDIM >::get_tensor_type ( ) const

◆ get_thresh()

◆ get_tree_state()

template<typename T, std::size_t NDIM>
TreeState madness::FunctionImpl< T, NDIM >::get_tree_state ( ) const
inline

◆ get_truncate_mode()

template<typename T, std::size_t NDIM>
int madness::FunctionImpl< T, NDIM >::get_truncate_mode ( ) const
inline

◆ halo_clear()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::halo_clear ( ) const
inline

Discard the neighbor halo, freeing the staged coefficients.

Requires a quiescent window: it frees a table that halo_probe may be reading.

Referenced by madness::FunctionImpl< T, LDIM >::~FunctionImpl().

◆ halo_enabled()

template<typename T, std::size_t NDIM>
bool madness::FunctionImpl< T, NDIM >::halo_enabled ( ) const
inline

Is a neighbor halo staged on this function?

◆ halo_probe()

template<typename T, std::size_t NDIM>
bool madness::FunctionImpl< T, NDIM >::halo_probe ( const keyT & key,
coeffT & out ) const
inline

Look up a staged neighbor; on a hit copy its coefficients, which are empty for an interior node.

◆ halo_size()

template<typename T, std::size_t NDIM>
std::size_t madness::FunctionImpl< T, NDIM >::halo_size ( ) const
inline

How many neighbor nodes are staged on this rank; zero if no halo.

◆ hartree_product()

template<typename T, std::size_t NDIM>
template<std::size_t LDIM, typename leaf_opT>
void madness::FunctionImpl< T, NDIM >::hartree_product ( const std::vector< std::shared_ptr< FunctionImpl< T, LDIM > > > p1,
const std::vector< std::shared_ptr< FunctionImpl< T, LDIM > > > p2,
const leaf_opT & leaf_op,
bool fence )
inline

given two functions of LDIM, perform the Hartree/Kronecker/outer product

|Phi(1,2)> = |phi(1)> x |phi(2)>

Parameters
[in]p1FunctionImpl of particle 1
[in]p2FunctionImpl of particle 2
[in]leaf_opoperator determining of a given box will be a leaf

◆ has_coefficients_on_leaves_only()

template<typename T, std::size_t NDIM>
bool madness::FunctionImpl< T, NDIM >::has_coefficients_on_leaves_only ( ) const

Returns true if only the leaves of this tree carry its coefficients.

redundant and nonstandard_with_leaves keep s coefficients on the internal nodes as well, so a sum over all nodes counts the function more than once; the leaves alone are exactly the reconstructed tree, which is why change_tree_state(reconstructed) is nothing but remove_internal_coefficients() for these two states.

References has_coefficients_on_leaves_only(), madness::nonstandard_with_leaves, madness::redundant, and tree_state.

Referenced by has_coefficients_on_leaves_only(), has_summable_coefficients(), and trace_local().

◆ has_leaves()

template<typename T, std::size_t NDIM>
bool madness::FunctionImpl< T, NDIM >::has_leaves ( ) const

◆ has_summable_coefficients()

template<typename T, std::size_t NDIM>
bool madness::FunctionImpl< T, NDIM >::has_summable_coefficients ( ) const

Returns true if summing over the local nodes yields the function.

The precondition of norm2sq_local() and trace_local(): the tree holds its coefficients exactly once. reconstructed and compressed do so outright, the two states above once the internal nodes are skipped. redundant_after_merge is a sum that has not been collapsed yet, and nonstandard / nonstandard_after_apply have no leaf coefficients to single out, so neither qualifies.

References has_coefficients_on_leaves_only(), has_summable_coefficients(), is_compressed(), and is_reconstructed().

Referenced by has_summable_coefficients(), norm2sq_local(), print_size(), and trace_local().

◆ inner_adaptive_local()

template<typename T, std::size_t NDIM>
T madness::FunctionImpl< T, NDIM >::inner_adaptive_local ( const std::shared_ptr< FunctionFunctorInterface< T, NDIM > > f,
const bool leaf_refine ) const
inline

Return the local part of inner product with external function ... no communication.

Parameters
[in]fReference to FunctionFunctorInterface. This is the externally provided function
[in]leaf_refineboolean switch to turn on/off refinement past leaf nodes
Returns
Returns local part of the inner product, i.e. over the domain of all function nodes on this compute node.

◆ inner_adaptive_recursive()

template<typename T, std::size_t NDIM>
T madness::FunctionImpl< T, NDIM >::inner_adaptive_recursive ( keyT key,
const tensorT & c,
const std::shared_ptr< FunctionFunctorInterface< T, NDIM > > f,
const bool leaf_refine,
T old_inner = T(0) ) const
inline

Call inner_ext_node recursively until convergence.

Parameters
[in]keyKey of the function node on which to compute inner product (the domain of integration)
[in]ccoeffs for the function at the node given by key
[in]fReference to FunctionFunctorInterface. This is the externally provided function
[in]leaf_refineboolean switch to turn on/off refinement past leaf nodes
[in]old_innerthe inner product on the parent function node
Returns
Returns the inner product over the domain of a single function, checks for convergence.

Referenced by madness::FunctionImpl< T, LDIM >::inner_adaptive_recursive().

◆ inner_ext_local()

template<typename T, std::size_t NDIM>
T madness::FunctionImpl< T, NDIM >::inner_ext_local ( const std::shared_ptr< FunctionFunctorInterface< T, NDIM > > f,
const bool leaf_refine ) const
inline

Return the local part of inner product with external function ... no communication.

Parameters
[in]fReference to FunctionFunctorInterface. This is the externally provided function
[in]leaf_refineboolean switch to turn on/off refinement past leaf nodes
Returns
Returns local part of the inner product, i.e. over the domain of all function nodes on this compute node.

◆ inner_ext_node()

template<typename T, std::size_t NDIM>
T madness::FunctionImpl< T, NDIM >::inner_ext_node ( keyT key,
tensorT c,
const std::shared_ptr< FunctionFunctorInterface< T, NDIM > > f ) const
inline

Return the inner product with an external function on a specified function node.

Parameters
[in]keyKey of the function node to compute the inner product on. (the domain of integration)
[in]cTensor of coefficients for the function at the function node given by key
[in]fReference to FunctionFunctorInterface. This is the externally provided function
Returns
Returns the inner product over the domain of a single function node, no guarantee of accuracy.

Referenced by madness::FunctionImpl< T, LDIM >::inner_adaptive_recursive(), and madness::FunctionImpl< T, LDIM >::inner_ext_recursive().

◆ inner_ext_recursive()

template<typename T, std::size_t NDIM>
T madness::FunctionImpl< T, NDIM >::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
inline

Call inner_ext_node recursively until convergence.

Parameters
[in]keyKey of the function node on which to compute inner product (the domain of integration)
[in]ccoeffs for the function at the node given by key
[in]fReference to FunctionFunctorInterface. This is the externally provided function
[in]leaf_refineboolean switch to turn on/off refinement past leaf nodes
[in]old_innerthe inner product on the parent function node
Returns
Returns the inner product over the domain of a single function, checks for convergence.

Referenced by madness::FunctionImpl< T, LDIM >::inner_ext_recursive().

◆ inner_ij_u_eri()

template<typename T, std::size_t NDIM>
template<typename opT, size_t LDIM>
T madness::FunctionImpl< T, NDIM >::inner_ij_u_eri ( const opT & leaf_op,
const FunctionImpl< T, NDIM > * u,
const FunctionImpl< T, LDIM > * i_func,
const FunctionImpl< T, LDIM > * j_func,
const FunctionImpl< T, NDIM > * eri,
double target_precision = 0.0,
int oversampling = 1 ) const
inline

compute <eri(1,2) | u(1,2) * [i(1)] * [j(2)]> adaptively using Vphi_ij_u_op_NS

Must be called collectively on all MPI ranks. All of u, i_func, j_func must be in NS form; i_func, j_func must be replicated. eri must be on-demand (provides_coeff() or evaluatable via fcube).

Parameters
[in]leaf_opoperator deciding leaf status
[in]upair function u(1,2), NS form
[in]i_funcorbital i(1), NS form, replicated; may be null
[in]j_funcorbital j(2), NS form, replicated; may be null
[in]eriexact on-demand 2-particle operator g(1,2)
Returns
scalar inner product <eri | u * [i] * [j]>

◆ inner_local()

template<typename T, std::size_t NDIM>
template<typename R>
Tensor< TENSOR_RESULT_TYPE(T, R) > madness::FunctionImpl< T, NDIM >::inner_local ( const std::vector< const FunctionImpl< T, NDIM > * > & left,
const std::vector< const FunctionImpl< R, NDIM > * > & right,
bool sym )
inlinestatic

Referenced by madness::matrix_inner().

◆ insert_serialized_coeffs()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::insert_serialized_coeffs ( std::vector< unsigned char > & v)
inline

insert coeffs from vector archive into this

Referenced by madness::FunctionImpl< T, LDIM >::copy_remote_coeffs_from_pid().

◆ insert_zero_down_to_initial_level()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::insert_zero_down_to_initial_level ( const keyT & key)

◆ is_compressed()

template<typename T, std::size_t NDIM>
bool madness::FunctionImpl< T, NDIM >::is_compressed ( ) const

◆ is_nonstandard()

template<typename T, std::size_t NDIM>
bool madness::FunctionImpl< T, NDIM >::is_nonstandard ( ) const

◆ is_nonstandard_with_leaves()

template<typename T, std::size_t NDIM>
bool madness::FunctionImpl< T, NDIM >::is_nonstandard_with_leaves ( ) const

◆ is_on_demand()

◆ is_reconstructed()

template<typename T, std::size_t NDIM>
bool madness::FunctionImpl< T, NDIM >::is_reconstructed ( ) const

Returns true if the function is compressed.

Returns true if the function is reconstructed.

References is_reconstructed(), madness::reconstructed, and tree_state.

Referenced by compress(), eval_plot_cube(), has_summable_coefficients(), is_reconstructed(), and reconstruct().

◆ is_redundant()

template<typename T, std::size_t NDIM>
bool madness::FunctionImpl< T, NDIM >::is_redundant ( ) const

Returns true if the function is redundant.

References is_redundant(), madness::redundant, and tree_state.

Referenced by is_redundant(), and reconstruct().

◆ is_redundant_after_merge()

template<typename T, std::size_t NDIM>
bool madness::FunctionImpl< T, NDIM >::is_redundant_after_merge ( ) const

Returns true if the function is redundant_after_merge.

References is_redundant_after_merge(), madness::redundant_after_merge, and tree_state.

Referenced by is_redundant_after_merge().

◆ key0()

template<typename T, std::size_t NDIM>
const FunctionImpl< T, NDIM >::keyT & madness::FunctionImpl< T, NDIM >::key0 ( ) const

Returns cdata.key0.

References cdata, and key0().

Referenced by key0(), and madness::FunctionImpl< T, LDIM >::partial_inner().

◆ load()

template<typename T, std::size_t NDIM>
template<typename Archive>
void madness::FunctionImpl< T, NDIM >::load ( Archive & ar)
inline

◆ local_leaf_keys()

template<typename T, std::size_t NDIM>
std::vector< typename FunctionImpl< T, NDIM >::keyT > madness::FunctionImpl< T, NDIM >::local_leaf_keys ( ) const

return the keys of the local leaf boxes

References coeffs, madness::FunctionNode< T, NDIM >::is_leaf(), and local_leaf_keys().

Referenced by local_leaf_keys(), and print_grid().

◆ MADNESS_ASSERT() [1/2]

template<typename T, std::size_t NDIM>
madness::FunctionImpl< T, NDIM >::MADNESS_ASSERT ( this-> is_redundant() = =g.is_redundant())

◆ MADNESS_ASSERT() [2/2]

template<typename T, std::size_t NDIM>
madness::FunctionImpl< T, NDIM >::MADNESS_ASSERT ( this-> is_redundant() = =g.is_redundant())

◆ MADNESS_CHECK()

template<typename T, std::size_t NDIM>
madness::FunctionImpl< T, NDIM >::MADNESS_CHECK ( this-> is_reconstructed())

◆ make_key_vec_map()

template<typename T, std::size_t NDIM>
mapT madness::FunctionImpl< T, NDIM >::make_key_vec_map ( const std::vector< const FunctionImpl< T, NDIM > * > & v)
inlinestatic

Returns map of union of local keys to vector of indexes of functions containing that key.

Local concurrency and synchronization only; no communication

Referenced by madness::FunctionImpl< T, LDIM >::dot_local(), and madness::FunctionImpl< T, LDIM >::inner_local().

◆ make_redundant()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::make_redundant ( const bool fence)
private

convert this to redundant, i.e. have sum coefficients on all levels

References make_redundant().

Referenced by erase(), and make_redundant().

◆ make_redundant_op()

template<typename T, std::size_t NDIM>
FunctionImpl< T, NDIM >::compressT madness::FunctionImpl< T, NDIM >::make_redundant_op ( const keyT & key,
const std::vector< Future< compressT > > & v )

similar to compress_op, but insert only the sum coefficients in the tree

also propagates norm_tree and dnorm_tree for all nodes

Parameters
[in]keythis's key
[in]vsum coefficients and propagated norms of the child nodes
Returns
the sum coefficients and propagated norms

also sets snorm, dnorm, norm_tree and dnorm_tree for all nodes

Parameters
[in]keythis's key
[in]vsum coefficients and propagated norms of the child nodes
Returns
the sum coefficients and propagated norms

References cdata, child_patch(), coeffs, copy(), d, filter(), MADNESS_CHECK, make_redundant_op(), norm_tree(), targs, madness::TensorArgs::thresh, and v.

Referenced by compress_spawn(), and make_redundant_op().

◆ make_Vphi()

template<typename T, std::size_t NDIM>
template<typename opT>
void madness::FunctionImpl< T, NDIM >::make_Vphi ( const opT & leaf_op,
const bool fence = true )
inline

assemble the function V*phi using V and phi given from the functor

this function must have been constructed using the CompositeFunctorInterface. The interface provides one- and two-electron potentials, and the ket, which are assembled to give V*phi.

Parameters
[in]leaf_opoperator to decide if a given node is a leaf node
[in]fenceglobal fence

◆ make_Vphi_ij_u()

template<typename T, std::size_t NDIM>
template<typename opT, size_t LDIM>
void madness::FunctionImpl< T, NDIM >::make_Vphi_ij_u ( const opT & leaf_op,
const FunctionImpl< T, NDIM > * u,
const FunctionImpl< T, LDIM > * i_func = nullptr,
const FunctionImpl< T, LDIM > * j_func = nullptr,
bool fence = true,
double target_precision = 0.0,
int oversampling = 1 )
inline

build this = u * [i(1)] * [j(2)] adaptively using Vphi_ij_u_op_NS

All of u, i_func, j_func must be in redundant form. i_func and j_func must be replicated to all ranks (make_redundant). On return (after fence) this is in redundant_after_merge state; caller must call flo_unary_op_node_inplace(do_consolidate_buffer(...)) then sum_down(true) and set_tree_state(reconstructed) to finalise.

Parameters
[in]leaf_opoperator deciding leaf status (e.g. Leaf_op_other mirroring u)
[in]upair function u(1,2), NS form
[in]i_funcorbital i(1), NS form, replicated; may be null
[in]j_funcorbital j(2), NS form, replicated; may be null
[in]fenceglobal fence after completion

◆ make_Vphi_only()

template<typename T, std::size_t NDIM>
template<typename opT, std::size_t LDIM>
void madness::FunctionImpl< T, NDIM >::make_Vphi_only ( const opT & leaf_op,
FunctionImpl< T, NDIM > * ket,
FunctionImpl< T, LDIM > * v1,
FunctionImpl< T, LDIM > * v2,
FunctionImpl< T, LDIM > * p1,
FunctionImpl< T, LDIM > * p2,
FunctionImpl< T, NDIM > * eri,
const bool fence = true )
inline

assemble the function V*phi using V and phi given from the functor

this function must have been constructed using the CompositeFunctorInterface. The interface provides one- and two-electron potentials, and the ket, which are assembled to give V*phi.

Parameters
[in]leaf_opoperator to decide if a given node is a leaf node
[in]fenceglobal fence

Referenced by madness::FunctionImpl< T, LDIM >::make_Vphi().

◆ map_and_mirror()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::map_and_mirror ( const implT & f,
const std::vector< long > & map,
const std::vector< long > & mirror,
bool fence )

map and mirror the translation index and the coefficients, result on this

first map the dimensions, the mirror! this = mirror(map(f))

References FunctionImpl, madness::f, flo_unary_op_node_inplace(), madness::GaussianConvolution1DCache< double >::map, map_and_mirror(), mirror(), and PROFILE_MEMBER_FUNC.

Referenced by map_and_mirror().

◆ mapdim()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::mapdim ( const implT & f,
const std::vector< long > & map,
bool fence )

Permute the dimensions of f according to map, result on this.

References FunctionImpl, madness::f, flo_unary_op_node_inplace(), madness::GaussianConvolution1DCache< double >::map, mapdim(), and PROFILE_MEMBER_FUNC.

Referenced by mapdim().

◆ max_depth()

template<typename T, std::size_t NDIM>
std::size_t madness::FunctionImpl< T, NDIM >::max_depth ( ) const

Returns the maximum depth of the tree ... collective ... global sum/broadcast.

References max_depth(), max_local_depth(), and world.

Referenced by max_depth().

◆ max_local_depth()

template<typename T, std::size_t NDIM>
std::size_t madness::FunctionImpl< T, NDIM >::max_local_depth ( ) const

Returns the maximum local depth of the tree ... no communications.

References coeffs, and max_local_depth().

Referenced by max_depth(), and max_local_depth().

◆ max_nodes()

template<typename T, std::size_t NDIM>
std::size_t madness::FunctionImpl< T, NDIM >::max_nodes ( ) const

Returns the max number of nodes on a processor.

References coeffs, max_nodes(), and world.

Referenced by max_nodes().

◆ min_nodes()

template<typename T, std::size_t NDIM>
std::size_t madness::FunctionImpl< T, NDIM >::min_nodes ( ) const

Returns the min number of nodes on a processor.

References coeffs, min_nodes(), and world.

Referenced by min_nodes().

◆ mirror()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::mirror ( const implT & f,
const std::vector< long > & mirror,
bool fence )

mirror the dimensions of f according to map, result on this

mirror the dimensions of f according to mirror, result on this

References FunctionImpl, madness::f, flo_unary_op_node_inplace(), mirror(), and PROFILE_MEMBER_FUNC.

Referenced by map_and_mirror(), and mirror().

◆ mul()

template<typename T, std::size_t NDIM>
template<typename R>
Tensor< TENSOR_RESULT_TYPE(T, R)> madness::FunctionImpl< T, NDIM >::mul ( const Tensor< T > & c1,
const Tensor< R > & c2,
const int npt,
const keyT & key ) const
inline

multiply the values of two coefficient tensors using a custom number of grid points

note both coefficient tensors have to refer to the same key!

Parameters
[in]c1a tensor holding coefficients
[in]c2another tensor holding coeffs
[in]nptnumber of grid points (optional, default is cdata.npt)
Returns
coefficient tensor holding the product of the values of c1 and c2

◆ multi_to_multi_op_values()

template<typename T, std::size_t NDIM>
template<typename opT>
void madness::FunctionImpl< T, NDIM >::multi_to_multi_op_values ( const opT & op,
const std::vector< implT * > & vin,
std::vector< implT * > & vout,
const bool fence = true )
inline

Inplace operate on many functions (impl's) with an operator within a certain box.

Assumes all functions have been refined down to the same level

Parameters
[in]opthe operator
[in]vinthe vector of function impl's on which to be operated
[out]voutthe resulting vector of function impl's

◆ multi_to_multi_op_values_doit()

template<typename T, std::size_t NDIM>
template<typename opT>
void madness::FunctionImpl< T, NDIM >::multi_to_multi_op_values_doit ( const keyT & key,
const opT & op,
const std::vector< implT * > & vin,
std::vector< implT * > & vout )
inline

Inplace operate on many functions (impl's) with an operator within a certain box.

Parameters
[in]keythe key of the current function node (box)
[in]opthe operator
[in]vinthe vector of function impl's on which to be operated
[out]voutthe resulting vector of function impl's

◆ multiop_values()

template<typename T, std::size_t NDIM>
template<typename opT>
void madness::FunctionImpl< T, NDIM >::multiop_values ( const opT & op,
const std::vector< implT * > & v )
inline

Inplace operate on many functions (impl's) with an operator within a certain box Assumes all functions have been refined down to the same level

Parameters
[in]opthe operator
[in]vthe vector of function impl's on which to be operated

◆ multiop_values_doit()

template<typename T, std::size_t NDIM>
template<typename opT>
void madness::FunctionImpl< T, NDIM >::multiop_values_doit ( const keyT & key,
const opT & op,
const std::vector< implT * > & v )
inline

Inplace operate on many functions (impl's) with an operator within a certain box

Parameters
[in]keythe key of the current function node (box)
[in]opthe operator
[in]vthe vector of function impl's on which to be operated

◆ multiply() [1/2]

template<typename T, std::size_t NDIM>
FunctionImpl< T, NDIM >::coeffT madness::FunctionImpl< T, NDIM >::multiply ( const coeffT & val_ket,
const coeffT & val_pot,
int particle ) const

multiply the ket with a one-electron potential rr(1,2)= f(1,2)*g(1)

Parameters
[in]val_ketfunction values of f(1,2)
[in]val_potfunction values of g(1)
[in]particleif 0 then g(1), if 1 then g(2)
Returns
the resulting function values

References cdata, copy(), madness::GenTensor< T >::emul(), madness::GenTensor< T >::full_tensor(), madness::GenTensor< T >::is_full_tensor(), madness::GenTensor< T >::is_svd_tensor(), MADNESS_ASSERT, multiply(), NDIM, madness::outer(), targs, and madness::GenTensor< T >::tensor_type().

◆ multiply() [2/2]

template<typename T, std::size_t NDIM>
template<size_t LDIM>
void madness::FunctionImpl< T, NDIM >::multiply ( const implT * f,
const FunctionImpl< T, LDIM > * g,
const int particle )
inline

multiply f (a pair function of NDIM) with an orbital g (LDIM=NDIM/2)

as in (with h(1,2)=*this) : h(1,2) = g(1) * f(1,2) use tnorm as a measure to determine if f (=*this) must be refined

Parameters
[in]fthe NDIM function f=f(1,2)
[in]gthe LDIM function g(1) (or g(2))
[in]particle1 or 2, as in g(1) or g(2)

Referenced by assemble_coefficients(), and multiply().

◆ mulXX()

template<typename T, std::size_t NDIM>
template<typename L, typename R>
void madness::FunctionImpl< T, NDIM >::mulXX ( const FunctionImpl< L, NDIM > * left,
const FunctionImpl< R, NDIM > * right,
double tol,
bool fence )
inline

Multiplies two functions (impl's) together. Delegates to the mulXXa() method

Parameters
[in]leftpointer to the left function impl
[in]rightpointer to the right function impl
[in]tolnumerical tolerance

◆ mulXXa()

template<typename T, std::size_t NDIM>
template<typename L, typename R>
void madness::FunctionImpl< T, NDIM >::mulXXa ( const keyT & key,
const FunctionImpl< L, NDIM > * left,
const Tensor< L > & lcin,
const FunctionImpl< R, NDIM > * right,
const Tensor< R > & rcin,
double tol )
inline

Multiplication using recursive descent and assuming same distribution Both left and right functions are in the scaling function basis

Parameters
[in]keythe key to the current function node (box)
[in]leftthe function impl associated with the left function
[in]lcinthe scaling function coefficients associated with the current box in the left function
[in]rightthe function impl associated with the right function
[in]rcinthe scaling function coefficients associated with the current box in the right function

Referenced by madness::FunctionImpl< T, LDIM >::mulXX().

◆ mulXXvec()

template<typename T, std::size_t NDIM>
template<typename L, typename R>
void madness::FunctionImpl< T, NDIM >::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 )
inline

Multiplies a function (impl) with a vector of functions (impl's). Delegates to the mulXXveca() method.

Parameters
[in]leftpointer to the left function impl
[in]vrightvector of pointers to the right function impl's
[in]tolnumerical tolerance
[out]vresultvector of pointers to the resulting function impl's

◆ mulXXveca()

template<typename T, std::size_t NDIM>
template<typename L, typename R>
void madness::FunctionImpl< T, NDIM >::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 )
inline

Both left and right functions are in the scaling function basis

Parameters
[in]keythe key to the current function node (box)
[in]leftthe function impl associated with the left function
[in]lcinthe scaling function coefficients associated with the current box in the left function
[in]vrightinthe vector of function impl's associated with the vector of right functions
[in]vrcinthe vector scaling function coefficients associated with the current box in the right functions
[out]vresultinthe vector of resulting functions (impl's)

Referenced by madness::FunctionImpl< T, LDIM >::mulXXvec().

◆ nCoeff()

template<typename T, std::size_t NDIM>
std::size_t madness::FunctionImpl< T, NDIM >::nCoeff ( ) const

Returns the number of coefficients in the function ... collective global sum.

References nCoeff(), nCoeff_local(), madness::sum(), and world.

Referenced by nCoeff(), and print_size().

◆ nCoeff_local()

template<typename T, std::size_t NDIM>
std::size_t madness::FunctionImpl< T, NDIM >::nCoeff_local ( ) const

Returns the number of coefficients in the function for this MPI rank.

Returns the number of coefficients in the function on this MPI rank.

References madness::FunctionNode< T, NDIM >::coeff(), coeffs, madness::FunctionNode< T, NDIM >::has_coeff(), madness::GenTensor< T >::nCoeff(), nCoeff_local(), and madness::sum().

Referenced by nCoeff(), and nCoeff_local().

◆ neighbor()

template<typename T, std::size_t NDIM>
Key< NDIM > madness::FunctionImpl< T, NDIM >::neighbor ( const keyT & key,
const keyT & disp,
const array_of_bools< NDIM > & is_periodic ) const

Returns key of general neighbor enforcing BC.

Out of volume keys are mapped to enforce the BC as follows.

  • Periodic BC map back into the volume and return the correct key
  • non-periodic BC - returns invalid() to indicate out of volume

References axis, madness::enforce_bc(), madness::Key< NDIM >::invalid(), madness::Key< NDIM >::level(), NDIM, neighbor(), and madness::Key< NDIM >::translation().

Referenced by madness::FunctionImpl< T, LDIM >::do_apply(), and neighbor().

◆ neighbor_in_volume()

template<typename T, std::size_t NDIM>
Key< NDIM > madness::FunctionImpl< T, NDIM >::neighbor_in_volume ( const keyT & key,
const keyT & disp ) const

◆ noautorefine()

template<typename T, std::size_t NDIM>
bool madness::FunctionImpl< T, NDIM >::noautorefine ( const keyT & key,
const tensorT & t ) const

Always returns false (for when autorefine is not wanted).

References noautorefine().

Referenced by noautorefine().

◆ norm2sq_local()

template<typename T, std::size_t NDIM>
double madness::FunctionImpl< T, NDIM >::norm2sq_local ( ) const

Returns the square of the local norm ... no comms.

Requires has_summable_coefficients(); throws otherwise, because on a tree that carries its coefficients on more than one level the sum is not the norm. Internal nodes are skipped where they are the duplicates, so no state change is needed to ask for the norm.

References FunctionImpl, coeffs, has_summable_coefficients(), MADNESS_CHECK_THROW, norm2sq_local(), PROFILE_MEMBER_FUNC, and world.

Referenced by norm2sq_local(), and print_size().

◆ norm_tree()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::norm_tree ( bool fence)

compute for each FunctionNode the norm of the function inside that node

References cdata, coeffs, norm_tree(), norm_tree_spawn(), and world.

Referenced by compress_op(), make_redundant_op(), and norm_tree().

◆ norm_tree_op()

template<typename T, std::size_t NDIM>
double madness::FunctionImpl< T, NDIM >::norm_tree_op ( const keyT & key,
const std::vector< Future< double > > & v )

◆ norm_tree_spawn()

template<typename T, std::size_t NDIM>
Future< double > madness::FunctionImpl< T, NDIM >::norm_tree_spawn ( const keyT & key)

◆ NS_fcube_for_mul()

template<typename T, std::size_t NDIM>
template<typename Q>
GenTensor< Q > madness::FunctionImpl< T, NDIM >::NS_fcube_for_mul ( const keyT & child,
const keyT & parent,
const GenTensor< Q > & coeff,
const bool s_only ) const
inline

Compute the function values for multiplication.

Given S or NS coefficients from a parent cell, compute the value of the functions at the quadrature points of a child currently restricted to special cases

Parameters
[in]childkey of the box in which we compute values
[in]parentkey of the parent box holding the coeffs
[in]coeffcoeffs of the parent box
[in]s_onlysanity check to avoid unintended discard of d coeffs
Returns
function values on the quadrature points of the children of child (!)

◆ NScoeffs2values()

template<typename T, std::size_t NDIM>
template<typename Q>
GenTensor< Q > madness::FunctionImpl< T, NDIM >::NScoeffs2values ( const keyT & key,
const GenTensor< Q > & coeff,
const bool s_only ) const
inline

convert S or NS coeffs to values on a 2k grid of the children

equivalent to unfiltering the NS coeffs and then converting all child S-coeffs to values in their respective boxes. If only S coeffs are provided d coeffs are assumed to be zero. Reverse operation to values2NScoeffs().

Parameters
[in]keythe key of the current S or NS coeffs, level n
[in]coeffcoeffs in S or NS form; if S then d coeffs are assumed zero
[in]s_onlysanity check to avoid unintended discard of d coeffs
Returns
function values on the quadrature points of the children of child (!)

◆ parent_to_child()

template<typename T, std::size_t NDIM>
const GenTensor< T > madness::FunctionImpl< T, NDIM >::parent_to_child ( const coeffT & s,
const keyT & parent,
const keyT & child ) const

Directly project parent coeffs to child coeffs.

Currently used by diff, but other uses can be anticipated

Todo
is this documentation correct?
Parameters
[in]childthe key whose coeffs we are requesting
[in]parentthe (leaf) key of our function
[in]sthe (leaf) coeffs belonging to parent
Returns
coeffs

References cdata, fcube_for_mul(), madness::FunctionDefaults< NDIM >::get_cell_volume(), madness::Key< NDIM >::is_invalid(), madness::Key< NDIM >::level(), NDIM, parent_to_child(), pow(), madness::GenTensor< T >::scale(), and transform().

Referenced by madness::Derivative< double, 1 >::do_diff2b(), madness::Derivative< double, 1 >::do_diff2i(), madness::FunctionImpl< T, LDIM >::do_project_out(), and parent_to_child().

◆ parent_to_child_NS()

template<typename T, std::size_t NDIM>
FunctionImpl< T, NDIM >::coeffT madness::FunctionImpl< T, NDIM >::parent_to_child_NS ( const keyT & child,
const keyT & parent,
const coeffT & coeff ) const

Directly project parent NS coeffs to child NS coeffs.

return the NS coefficients if parent and child are the same, or construct sum coeffs from the parents and "add" zero wavelet coeffs

Parameters
[in]childthe key whose coeffs we are requesting
[in]parentthe (leaf) key of our function
[in]coeffthe (leaf) coeffs belonging to parent
Returns
coeffs in NS form

References madness::GenTensor< T >::dim(), madness::f, madness::Key< NDIM >::level(), MADNESS_ASSERT, MADNESS_EXCEPTION, parent_to_child_NS(), and madness::GenTensor< T >::tensor_type().

Referenced by parent_to_child_NS().

◆ partial_inner()

template<typename T, std::size_t NDIM>
template<typename Q, std::size_t LDIM, typename R, std::size_t KDIM, std::size_t CDIM = (KDIM + LDIM - NDIM) / 2>
void madness::FunctionImpl< T, NDIM >::partial_inner ( const FunctionImpl< Q, LDIM > & g,
const FunctionImpl< R, KDIM > & h,
const std::array< int, CDIM > v1,
const std::array< int, CDIM > v2 )
inline

invoked by result

contract 2 functions f(x,z) = \int g(x,y) * h(y,z) dy

Template Parameters
CDIMthe dimension of the contraction variable (y)
NDIMthe dimension of the result (x,z)
LDIMthe dimension of g(x,y)
KDIMthe dimension of h(y,z)

◆ partial_inner_contract()

template<typename T, std::size_t NDIM>
template<typename Q, std::size_t LDIM, typename R, std::size_t KDIM, std::size_t CDIM = (KDIM + LDIM - NDIM) / 2>
void madness::FunctionImpl< T, NDIM >::partial_inner_contract ( const FunctionImpl< Q, LDIM > * g,
const FunctionImpl< R, KDIM > * h,
const std::array< int, CDIM > v1,
const std::array< int, CDIM > v2,
const Key< NDIM > & key,
const std::list< Key< CDIM > > & j_key_list )
inline

tensor contraction part of partial_inner

Parameters
[in]grhs of the inner product
[in]hlhs of the inner product
[in]v1dimensions of g to be contracted
[in]v2dimensions of h to be contracted
[in]keykey of result's (this) FunctionNode
[in]j_key_listlist of contraction index-j keys contributing to this' node

◆ phi_for_mul()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::phi_for_mul ( Level np,
Translation lp,
Level nc,
Translation lc,
Tensor< double > & phi ) const

Compute the Legendre scaling functions for multiplication.

Evaluate parent polyn at quadrature points of a child. The prefactor of 2^n/2 is included. The tensor must be preallocated as phi(k,npt). Refer to the implementation notes for more info.

Todo
Robert please verify this comment. I don't understand this method.
Parameters
[in]nplevel of the parent function node (box)
[in]nclevel of the child function node (box)
[in]lptranslation of the parent function node (box)
[in]lctranslation of the child function node (box)
[out]phitensor of the legendre scaling functions

References cdata, e(), k, madness::legendre_scaling_functions(), MADNESS_ASSERT, mu, np, p(), phi_for_mul(), pow(), madness::scale(), and madness::Tensor< T >::scale().

Referenced by madness::FunctionImpl< T, LDIM >::fcube_for_mul(), madness::FunctionImpl< T, LDIM >::fcube_for_mul(), madness::FunctionImpl< T, LDIM >::NS_fcube_for_mul(), and phi_for_mul().

◆ plot_cube_kernel()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::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
Todo
help!

References plot_cube_kernel().

Referenced by plot_cube_kernel().

◆ print_grid()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::print_grid ( const std::string filename) const

print the grid (the roots of the quadrature of each leaf box) of this function in user xyz coordinates

Parameters
[in]filenamethe filename for the output

print the grid (the roots of the quadrature of each leaf box) of this function in user xyz coordinates

References do_print_grid(), madness::filename, local_leaf_keys(), print_grid(), and world.

Referenced by print_grid().

◆ print_info()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::print_info ( ) const

◆ print_plane()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::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.

works for all dimensions; we walk through the tree, and if a leaf node inside the sub-cell touches the plane we print it in pstricks format

References do_print_plane(), madness::filename, print_plane(), print_plane_local(), and world.

Referenced by print_plane().

◆ print_plane_local()

template<typename T, std::size_t NDIM>
Tensor< double > madness::FunctionImpl< T, NDIM >::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

Parameters
[in]xaxisthe x-axis in the plot (can be any axis of the MRA box)
[in]yaxisthe y-axis in the plot (can be any axis of the MRA box)
[in]el2needs a description
Todo
Provide a description for el2
Parameters
[in]xaxisthe x-axis in the plot (can be any axis of the MRA box)
[in]yaxisthe y-axis in the plot (can be any axis of the MRA box)
[in]el2

References madness::_(), madness::FunctionCommonData< T, NDIM >::_init_quadrature(), cdata, madness::FunctionNode< T, NDIM >::coeff(), coeffs, madness::error(), madness::FunctionDefaults< NDIM >::get_cell(), madness::FunctionDefaults< NDIM >::get_cell_width(), get_functor(), madness::FunctionNode< T, NDIM >::has_coeff(), madness::FunctionNode< T, NDIM >::is_leaf(), k, madness::Key< NDIM >::level(), op(), print_plane_local(), madness::GenTensor< T >::rank(), madness::scale(), madness::Key< NDIM >::thisKeyContains(), madness::Key< NDIM >::translation(), and madness::user_to_sim().

Referenced by print_plane(), and print_plane_local().

◆ print_size()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::print_size ( const std::string name) const

◆ print_stats()

◆ print_timer()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::print_timer ( ) const

◆ print_tree()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::print_tree ( std::ostream & os = std::cout,
Level maxlevel = 10000 ) const

Prints the coeffs tree of the current function impl

Parameters
[in]maxlevelthe maximum level of the tree for printing
[out]osthe ostream to where the output is sent

References cdata, do_print_tree(), print_tree(), and world.

Referenced by print_tree().

◆ print_tree_graphviz()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::print_tree_graphviz ( std::ostream & os = std::cout,
Level maxlevel = 10000 ) const

Prints the coeffs tree of the current function impl (using GraphViz)

Parameters
[in]maxlevelthe maximum level of the tree for printing
[out]osthe ostream to where the output is sent

References cdata, do_print_tree_graphviz(), print_tree_graphviz(), and world.

Referenced by print_tree_graphviz().

◆ print_tree_json()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::print_tree_json ( std::ostream & os = std::cout,
Level maxlevel = 10000 ) const

Same as print_tree() but in JSON format

Parameters
[out]osthe ostream to where the output is sent
[in]maxlevelthe maximum level of the tree for printing

References cdata, do_print_tree_json(), madness::FunctionCommonData< T, NDIM >::data, print_tree_json(), range(), and world.

Referenced by print_tree_json().

◆ print_type_in_compilation_error()

template<typename T, std::size_t NDIM>
template<typename R>
void madness::FunctionImpl< T, NDIM >::print_type_in_compilation_error ( R && )
inline

◆ project() [1/2]

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::project ( const implT & old,
bool fence )

◆ project() [2/2]

template<typename T, std::size_t NDIM>
Tensor< T > madness::FunctionImpl< T, NDIM >::project ( const keyT & key) const

Compute by projection the scaling function coeffs in specified box

Parameters
[in]keythe key to the current function node (box)

References cdata, madness::fast_transform(), madness::fcube(), functor, madness::FunctionDefaults< NDIM >::get_cell_volume(), madness::Key< NDIM >::level(), MADNESS_ASSERT, MADNESS_EXCEPTION, NDIM, pow(), project(), and madness::Tensor< T >::scale().

Referenced by project(), and project().

◆ project_out()

template<typename T, std::size_t NDIM>
template<size_t LDIM>
void madness::FunctionImpl< T, NDIM >::project_out ( FunctionImpl< T, NDIM-LDIM > * result,
const FunctionImpl< T, LDIM > * gimpl,
const int dim,
const bool fence )
inline

project the low-dim function g on the hi-dim function f: result(x) = <this(x,y) | g(y)>

invoked by the hi-dim function, a function of NDIM+LDIM Upon return, result matches this, with contributions on all scales

Parameters
[in]resultlo-dim function of NDIM-LDIM
Todo
Should this be param[out]?
Parameters
[in]gimpllo-dim function of LDIM
[in]dimover which dimensions to be integrated: 0..LDIM or LDIM..LDIM+NDIM-1

◆ project_out2()

template<typename T, std::size_t NDIM>
template<size_t LDIM>
void madness::FunctionImpl< T, NDIM >::project_out2 ( const FunctionImpl< T, LDIM+NDIM > * f,
const FunctionImpl< T, LDIM > * g,
const int dim )
inline

project the low-dim function g on the hi-dim function f: this(x) = <f(x,y) | g(y)>

invoked by result, a function of NDIM

Parameters
[in]fhi-dim function of LDIM+NDIM
[in]glo-dim function of LDIM
[in]dimover which dimensions to be integrated: 0..LDIM or LDIM..LDIM+NDIM-1

◆ project_refine_op()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::project_refine_op ( const keyT & key,
bool do_refine,
const std::vector< Vector< double, NDIM > > & specialpts )

Projection with optional refinement w/ special points

Parameters
[in]keythe key to the current function node (box)
[in]do_refineshould we continue refinement?
[in]specialptsvector of special points in the function where we need to refine at a much finer level

project the functor into this functionimpl, and "return" a tree in reconstructed, rank-reduced form.

Parameters
[in]keycurrent FunctionNode
[in]do_refine
[in]specialptsin case these are very spiky functions – don't undersample

References cdata, child_patch(), coeffs, copy(), d, filter(), madness::FunctionDefaults< NDIM >::bc, madness::FunctionDefaults< NDIM >::get_bc(), madness::FunctionDefaults< NDIM >::get_project_randomize(), madness::FunctionDefaults< NDIM >::get_tensor_type(), madness::Key< NDIM >::is_neighbor_of(), madness::Key< NDIM >::level(), max_refine_level, p(), project(), project_refine_op(), s0, simpt2key(), special_level, targs, madness::WorldObject< FunctionImpl< T, NDIM > >::task(), thresh, truncate_on_project, truncate_tol(), madness::user_to_sim(), and world.

Referenced by madness::FunctionImpl< T, LDIM >::FunctionImpl(), and project_refine_op().

◆ put_in_box()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::put_in_box ( ProcessID from,
long nl,
long ni ) const

References box_interior, box_leaf, put_in_box(), and world.

Referenced by print_info(), and put_in_box().

◆ range()

template<typename T, std::size_t NDIM>
rangeT madness::FunctionImpl< T, NDIM >::range ( coeffs. begin(),
coeffs. end() )

◆ read_grid()

template<typename T, std::size_t NDIM>
template<size_t FDIM>
std::enable_if< NDIM==FDIM >::type madness::FunctionImpl< T, NDIM >::read_grid ( const std::string keyfile,
const std::string gridfile,
std::shared_ptr< FunctionFunctorInterface< double, NDIM > > vnuc_functor )
inline

read data from a grid

Parameters
[in]keyfilefile with keys and grid points for each key
[in]gridfilefile with grid points, w/o key, but with same ordering
[in]vnuc_functorsubtract the values of this functor if regularization is needed

◆ read_grid2()

template<typename T, std::size_t NDIM>
template<size_t FDIM>
std::enable_if< NDIM==FDIM >::type madness::FunctionImpl< T, NDIM >::read_grid2 ( const std::string gridfile,
std::shared_ptr< FunctionFunctorInterface< double, NDIM > > vnuc_functor )
inline

read data from a grid

Parameters
[in]gridfilefile with keys and grid points and values for each key
[in]vnuc_functorsubtract the values of this functor if regularization is needed

◆ real_size()

template<typename T, std::size_t NDIM>
std::size_t madness::FunctionImpl< T, NDIM >::real_size ( ) const

Returns the number of coefficients in the function ... collective global sum.

References madness::FunctionNode< T, NDIM >::coeff(), coeffs, madness::FunctionNode< T, NDIM >::has_coeff(), real_size(), madness::GenTensor< T >::real_size(), madness::sum(), and world.

Referenced by real_size().

◆ receive_halo()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::receive_halo ( const std::vector< std::pair< keyT, coeffT > > & buf) const
inline

Insert pushed neighbor nodes into the halo; runs as a task, concurrently with other pushes.

Allocates the table on the first push, so staging needs no collective set-up.

Referenced by madness::DerivativeBase< T, NDIM >::stage_halo().

◆ reconstruct()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::reconstruct ( bool fence)

◆ reconstruct_op()

◆ recur_down_for_contraction_map()

template<typename T, std::size_t NDIM>
template<std::size_t CDIM, std::size_t ODIM, std::size_t FDIM = NDIM+ODIM-2*CDIM>
std::multimap< Key< FDIM >, std::list< Key< CDIM > > > madness::FunctionImpl< T, NDIM >::recur_down_for_contraction_map ( const keyT & key,
const nodeT & node,
const std::array< int, CDIM > & v_this,
const std::array< int, CDIM > & v_other,
const std::set< Key< ODIM > > & ij_other_list,
const std::map< Key< CDIM >, double > & j_other_list,
bool this_first,
const double thresh )
inline

make a map of all nodes that will contribute to a partial inner product

given the list of d coefficient-holding nodes of the other function: recur down h if snorm * dnorm > tol and key n−jx ∈ other−ij-list. Make s coefficients if necessary. Make list of nodes n − ijk as map(n-ik, list(j)).

!! WILL ADD NEW S NODES TO THIS TREE THAT MUST BE REMOVED TO AVOID INCONSISTENT TREE STRUCTURE !!

Parameters
[in]keyfor recursion
[in]nodecorresponds to key
[in]v_thisthis' dimension that are contracted
[in]v_otherother's dimension that are contracted
[in]ij_other_listlist of nodes of the other function that will be contracted (and their parents)
[in]j_other_listlist of column nodes of the other function that will be contracted (and their parents)
[in]max_d_normmax d coeff norm of the nodes in j_list
[in]this_firstare the remaining coeffs of this functions first or last in the result function
[in]threshthreshold for including nodes in the contraction: snorm*dnorm > thresh
Template Parameters
CDIMdimension to be contracted
ODIMdimensions of the other function
FDIMdimensions of the final function

Referenced by madness::FunctionImpl< T, LDIM >::partial_inner(), and madness::FunctionImpl< T, LDIM >::recur_down_for_contraction_map().

◆ recursive_apply() [1/3]

template<typename T, std::size_t NDIM>
template<typename opT, std::size_t LDIM>
void madness::FunctionImpl< T, NDIM >::recursive_apply ( opT & apply_op,
const FunctionImpl< T, LDIM > * fimpl,
const FunctionImpl< T, LDIM > * gimpl,
const bool fence )
inline

traverse a non-existing tree, make its coeffs and apply an operator

invoked by result here we use the fact that the hi-dim NS coefficients on all scales are exactly the outer product of the underlying low-dim functions (also in NS form), so we don't need to construct the full hi-dim tree and then turn it into NS form.

Parameters
[in]apply_opthe operator acting on the NS tree
[in]fimplthe funcimpl of the function of particle 1
[in]gimplthe funcimpl of the function of particle 2

◆ recursive_apply() [2/3]

template<typename T, std::size_t NDIM>
template<typename opT>
void madness::FunctionImpl< T, NDIM >::recursive_apply ( opT & apply_op,
const implT * fimpl,
implT * rimpl,
const bool fence )
inline

traverse an existing tree and apply an operator

invoked by result

Parameters
[in]apply_opthe operator acting on the NS tree
[in]fimplthe funcimpl of the source function
[in]rimpla dummy function for recursive_op to insert data

◆ recursive_apply() [3/3]

template<typename T, std::size_t NDIM>
template<typename opT, std::size_t LDIM>
void madness::FunctionImpl< T, NDIM >::recursive_apply ( opT & apply_op,
const std::vector< const FunctionImpl< T, LDIM > * > & fimpls,
const std::vector< const FunctionImpl< T, LDIM > * > & gimpls,
const bool fence )
inline

traverse a non-existing tree for a sum of hartree products and apply an operator

invoked by result Fuses the loop over matched pairs into a single tree traversal: result = op( Σ_i f_i(1) * g_i(2) ) The hi-dim NS coefficients are the sum of outer products of the underlying low-dim functions (in NS form), formed on the fly.

Parameters
[in]apply_opthe operator acting on the NS tree
[in]fimplsvector of funcimpls of particle 1
[in]gimplsvector of funcimpls of particle 2

◆ reduce() [1/3]

template<typename T, std::size_t NDIM>
return world taskq madness::FunctionImpl< T, NDIM >::reduce ( range ,
do_inner_local_on_demand< R > this, &gimpl )

◆ reduce() [2/3]

template<typename T, std::size_t NDIM>
return world taskq madness::FunctionImpl< T, NDIM >::reduce ( rangeT(coeffs.begin(), coeffs.end()) ,
do_dot_local< R > &, leaves_only )

◆ reduce() [3/3]

template<typename T, std::size_t NDIM>
return world taskq madness::FunctionImpl< T, NDIM >::reduce ( rangeT(coeffs.begin(), coeffs.end()) ,
do_inner_local< R > &, leaves_only )

◆ reduce_rank()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::reduce_rank ( const double thresh,
bool fence )

reduce the rank of the coefficients tensors

Parameters
[in]targstarget tensor arguments (threshold and full/low rank)

References flo_unary_op_node_inplace(), reduce_rank(), and thresh.

Referenced by reduce_rank().

◆ refine()

template<typename T, std::size_t NDIM>
template<typename opT>
void madness::FunctionImpl< T, NDIM >::refine ( const opT & op,
bool fence )
inline

◆ refine_op()

template<typename T, std::size_t NDIM>
template<typename opT>
void madness::FunctionImpl< T, NDIM >::refine_op ( const opT & op,
const keyT & key )
inline

Referenced by broaden_op().

◆ refine_spawn()

template<typename T, std::size_t NDIM>
template<typename opT>
void madness::FunctionImpl< T, NDIM >::refine_spawn ( const opT & op,
const keyT & key )
inline

◆ refine_to_common_level()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::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.

Parameters
vthe vector of functions we are refining.
keythe current node.
cthe vector of coefficients passed from above.
[v]is the vector of functions we are refining.
[key]is the current node.
[c]is the vector of coefficients passed from above.

References FunctionImpl, c, cdata, child_patch(), coeffs, copy(), d, MADNESS_ASSERT, MADNESS_CHECK, refine_to_common_level(), size(), targs, madness::WorldObject< FunctionImpl< T, NDIM > >::task(), unfilter(), v, and world.

Referenced by refine_to_common_level().

◆ remove_internal_coefficients()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::remove_internal_coefficients ( const bool fence)

◆ remove_leaf_coefficients()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::remove_leaf_coefficients ( const bool fence)

◆ replicate()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::replicate ( bool fence = true)
inline

◆ replicate_on_hosts()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::replicate_on_hosts ( bool fence = true)
inline

◆ reset_timer()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::reset_timer ( )

◆ scale_inplace()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::scale_inplace ( const T q,
bool fence )

In-place scale by a constant.

References q(), scale_inplace(), and unary_op_node_inplace().

Referenced by average(), madness::FunctionImpl< T, LDIM >::gaxpy_inplace(), and scale_inplace().

◆ scale_oop()

template<typename T, std::size_t NDIM>
template<typename Q, typename F>
void madness::FunctionImpl< T, NDIM >::scale_oop ( const Q q,
const FunctionImpl< F, NDIM > & f,
bool fence )
inline

Out-of-place scale by a constant.

◆ serialize_remote_coeffs()

template<typename T, std::size_t NDIM>
std::vector< unsigned char > madness::FunctionImpl< T, NDIM >::serialize_remote_coeffs ( )
inline

invoked by copy_remote_coeffs_from_pid to serialize local coeffs

◆ set_autorefine()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::set_autorefine ( bool value)

◆ set_functor()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::set_functor ( const std::shared_ptr< FunctionFunctorInterface< T, NDIM > > functor1)

◆ set_tensor_args()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::set_tensor_args ( const TensorArgs & t)

References set_tensor_args(), and targs.

Referenced by set_tensor_args().

◆ set_thresh()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::set_thresh ( double value)

◆ set_tree_state()

◆ set_truncate_mode()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::set_truncate_mode ( int mode)
inline

◆ size()

template<typename T, std::size_t NDIM>
std::size_t madness::FunctionImpl< T, NDIM >::size ( ) const

◆ size_local()

template<typename T, std::size_t NDIM>
std::size_t madness::FunctionImpl< T, NDIM >::size_local ( ) const

Returns the number of coefficients in the function for each rank.

References coeffs, madness::FunctionNode< T, NDIM >::has_coeff(), madness::FunctionNode< T, NDIM >::size(), size_local(), and madness::sum().

Referenced by size(), and size_local().

◆ sock_it_to_me()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::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.

Three possibilities.

1) The coeffs are present and returned with the key of the containing node.

2) The coeffs are further up the tree ... the request is forwarded up.

3) The coeffs are futher down the tree ... an empty tensor is returned.

!! This routine is crying out for an optimization to manage the number of messages being sent ... presently each parent is fetched 2^(n*d) times where n is the no. of levels between the level of evaluation and the parent. Alternatively, reimplement multiply as a downward tree walk and just pass the parent down. Slightly less parallelism but much less communication.

Todo
Robert .... help!

References madness::FunctionNode< T, NDIM >::coeff(), coeffs, madness::FunctionNode< T, NDIM >::has_coeff(), madness::Future< T >::set(), and sock_it_to_me().

Referenced by madness::DerivativeBase< T, NDIM >::find_neighbor(), madness::FunctionImpl< T, LDIM >::project_out2(), and sock_it_to_me().

◆ sock_it_to_me_too()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::sock_it_to_me_too ( const keyT & key,
const RemoteReference< FutureImpl< std::pair< keyT, coeffT > > > & ref ) const

◆ square_inplace()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::square_inplace ( bool fence)

Pointwise squaring of function with optional global fence.

If not autorefining, local computation only if not fencing. If autorefining, may result in asynchronous communication.

References square_inplace(), and unary_op_value_inplace().

Referenced by square_inplace().

◆ standard()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::standard ( bool fence)

Changes non-standard compressed form to standard compressed form.

References madness::compressed, flo_unary_op_node_inplace(), is_compressed(), set_tree_state(), and standard().

Referenced by standard().

◆ store()

template<typename T, std::size_t NDIM>
template<typename Archive>
void madness::FunctionImpl< T, NDIM >::store ( Archive & ar)
inline

◆ sum_down()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::sum_down ( bool fence)

After 1d push operator must sum coeffs down the tree to restore correct scaling function coefficients.

References cdata, coeffs, madness::reconstructed, sum_down(), sum_down_spawn(), tree_state, and world.

Referenced by madness::composite_product_apply(), madness::FunctionImpl< T, LDIM >::gaxpy_inplace_reconstructed(), madness::FunctionImpl< T, LDIM >::make_Vphi(), and sum_down().

◆ sum_down_spawn()

◆ TENSOR_RESULT_TYPE() [1/5]

template<typename T, std::size_t NDIM>
template<typename R>
madness::FunctionImpl< T, NDIM >::TENSOR_RESULT_TYPE ( T ,
R  ) const

Returns the dot product ASSUMING same distribution.

handles compressed and redundant form

◆ TENSOR_RESULT_TYPE() [2/5]

template<typename T, std::size_t NDIM>
template<typename R>
madness::FunctionImpl< T, NDIM >::TENSOR_RESULT_TYPE ( T ,
R  ) const

Returns the inner product ASSUMING same distribution.

handles compressed and redundant form

◆ TENSOR_RESULT_TYPE() [3/5]

template<typename T, std::size_t NDIM>
template<typename R>
madness::FunctionImpl< T, NDIM >::TENSOR_RESULT_TYPE ( T ,
R  ) const

Returns the inner product of this with function g constructed on-the-fly.

the leaf boxes of this' MRA tree defines the inner product

◆ TENSOR_RESULT_TYPE() [4/5]

template<typename T, std::size_t NDIM>
typedef madness::FunctionImpl< T, NDIM >::TENSOR_RESULT_TYPE ( T ,
R  )

◆ TENSOR_RESULT_TYPE() [5/5]

template<typename T, std::size_t NDIM>
typedef madness::FunctionImpl< T, NDIM >::TENSOR_RESULT_TYPE ( T ,
R  )

◆ tnorm() [1/3]

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::tnorm ( const GenTensor< T > & t,
double * lo,
double * hi )
static

◆ tnorm() [2/3]

◆ tnorm() [3/3]

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::tnorm ( const tensorT & t,
double * lo,
double * hi )
static

Computes norm of low/high-order polyn. coeffs for autorefinement test.

t is a k^d tensor. In order to screen the autorefinement during multiplication compute the norms of ... lo ... the block of t for all polynomials of order < k/2 ... hi ... the block of t for all polynomials of order >= k/2

k=5 0,1,2,3,4 --> 0,1,2 ... 3,4 k=6 0,1,2,3,4,5 --> 0,1,2 ... 3,4,5

k=number of wavelets, so k=5 means max order is 4, so max exactly representable squarable polynomial is of order 2.

References cdata, copy(), madness::BaseTensor::dim(), madness::Tensor< T >::fill(), madness::FunctionCommonData< T, NDIM >::get(), lo, madness::Tensor< T >::normf(), and tnorm().

Referenced by madness::FunctionImpl< T, NDIM >::pointwise_multiplier< LDIM >::pointwise_multiplier(), autorefine_square_test(), madness::FunctionImpl< T, NDIM >::pointwise_multiplier< LDIM >::operator()(), refop::operator()(), refop::operator()(), tnorm(), tnorm(), and tnorm().

◆ trace_local()

◆ traverse_tree()

template<typename T, std::size_t NDIM>
template<typename coeff_opT, typename apply_opT>
void madness::FunctionImpl< T, NDIM >::traverse_tree ( const coeff_opT & coeff_op,
const apply_opT & apply_op,
const keyT & key ) const
inline

traverse a non-existing tree

part I: make the coefficients, process them and continue the recursion if necessary

Parameters
[in]coeff_opoperator making the coefficients and determining them being leaves
[in]apply_opoperator processing the coefficients
[in]keythe key we are currently working on

◆ tree_size()

template<typename T, std::size_t NDIM>
std::size_t madness::FunctionImpl< T, NDIM >::tree_size ( ) const

Returns the size of the tree structure of the function ... collective global sum.

References coeffs, madness::sum(), tree_size(), and world.

Referenced by print_size(), and tree_size().

◆ trickle_down()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::trickle_down ( bool fence)

sum all the contributions from all scales after applying an operator in mod-NS form

References cdata, coeffs, madness::reconstructed, set_tree_state(), madness::WorldObject< FunctionImpl< T, NDIM > >::task(), trickle_down(), trickle_down_op(), and world.

Referenced by trickle_down().

◆ trickle_down_op()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::trickle_down_op ( const keyT & key,
const coeffT & s )

◆ truncate()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::truncate ( double tol,
bool fence )

Truncate according to the threshold with optional global fence.

If thresh<=0 the default value of this->thresh is used

Parameters
[in]tolthe truncation tolerance

If thresh<=0 the default value of this->thresh is used

References cdata, coeffs, is_compressed(), thresh, truncate(), truncate_reconstructed_spawn(), truncate_spawn(), and world.

Referenced by truncate().

◆ truncate_op()

template<typename T, std::size_t NDIM>
bool madness::FunctionImpl< T, NDIM >::truncate_op ( const keyT & key,
double tol,
const std::vector< Future< bool > > & v )

Actually do the truncate operation

Parameters
[in]keythe key to the current function node being evaluated for truncation
[in]tolthe tolerance for thresholding
[in]vvector of Future<bool>'s that specify whether the current nodes children have coeffs

References cdata, madness::FunctionNode< T, NDIM >::clear_coeff(), madness::FunctionNode< T, NDIM >::coeff(), coeffs, madness::FunctionNode< T, NDIM >::has_children(), madness::FunctionNode< T, NDIM >::has_coeff(), madness::Key< NDIM >::level(), NDIM, madness::GenTensor< T >::normf(), madness::FunctionNode< T, NDIM >::set_coeff(), madness::FunctionNode< T, NDIM >::set_has_children(), targs, truncate_op(), truncate_tol(), and v.

Referenced by truncate_op(), and truncate_spawn().

◆ truncate_reconstructed_op()

template<typename T, std::size_t NDIM>
FunctionImpl< T, NDIM >::coeffT madness::FunctionImpl< T, NDIM >::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

Returns
new sum coefficients (empty if internal, not empty, if new leaf); might delete its children

References cdata, child_patch(), coeffs, copy(), d, madness::error(), filter(), madness::Key< NDIM >::level(), MADNESS_ASSERT, MADNESS_CHECK, madness::FunctionNode< T, NDIM >::set_has_children(), targs, truncate_reconstructed_op(), truncate_tol(), and v.

Referenced by truncate_reconstructed_op().

◆ truncate_reconstructed_spawn()

template<typename T, std::size_t NDIM>
Future< typename FunctionImpl< T, NDIM >::coeffT > madness::FunctionImpl< T, NDIM >::truncate_reconstructed_spawn ( const keyT & key,
const double tol )

truncate using a tree in reconstructed form

must be invoked where key is local

References truncate_reconstructed_spawn().

Referenced by truncate(), and truncate_reconstructed_spawn().

◆ truncate_spawn()

template<typename T, std::size_t NDIM>
Future< bool > madness::FunctionImpl< T, NDIM >::truncate_spawn ( const keyT & key,
double tol )

◆ truncate_tol()

template<typename T, std::size_t NDIM>
double madness::FunctionImpl< T, NDIM >::truncate_tol ( double tol,
const keyT & key ) const

Returns the truncation threshold according to truncate_method.

here is our handwaving argument: this threshold will give each FunctionNode an error of less than tol. The total error can then be as high as sqrt(#nodes) * tol. Therefore in order to account for higher dimensions: divide tol by about the root of number of siblings (2^NDIM) that have a large error when we refine along a deep branch of the tree.

Returns the truncation threshold according to truncate_method

All modes scale tol with the box size h_n = L/2^n at level n (L = cell_min_width). The positive modes tighten the threshold at fine levels so that high-frequency content is kept accurately — appropriate when the function itself or its derivatives must be pointwise accurate. The negative modes loosen the threshold at fine levels — appropriate when the function will immediately be passed to a smoothing integral operator that suppresses high-frequency content anyway.

Design rationale for each mode:

Mode 0: t_n = tol (uniform, level-independent) Simplest choice. No level weighting; each wavelet coefficient is kept if it exceeds tol regardless of its scale.

Mode 1: t_n = tol * min(1, L/2^n) Designed for first-derivative accuracy. A level-n coefficient of magnitude t_n contributes t_n * (2^n/L) to ||∇f||, so this mode makes every level contribute at most tol to the gradient error. Clamped to tol at coarse levels (L/2^n > 1).

Mode 2: t_n = tol * min(1, (L/2^n)^2) Designed for second-derivative (Laplacian) accuracy. Each level contributes at most tol to ||∇²f||. Tighter than mode 1 at fine levels; same tol at coarse levels.

Mode 3: t_n = tol/2^{NDIM/2} * min(1, L/2^n) Like mode 1 but with an extra 1/2^{NDIM/2} prefactor intended to account for the growing number of tree nodes in higher dimensions. See inline comment below for the (disputed) justification.

Mode 4: t_n = tol * min(1, (L/2^n)^{NDIM/2}) Rigorous L2 bound for NDIM dimensions: if each node's L2 error is at most t_n, then the total L2 error is at most tol when the level-n box volume (L/2^n)^NDIM is used to weight the sum. Recovers mode 1 for NDIM=2 and mode 2 for NDIM=4.

Mode -1: t_n = tol * max(1, 2^n/L) [dual of mode 1] Designed for accuracy after applying a first-order smoothing operator S with ||S||_{k} ~ 1/k (e.g. a Poisson-type convolution). If the representation error at level n has L2 norm t_n, the error after S is ~t_n * (L/2^n). Setting t_n = tol * (2^n/L) ensures ||S(f-f̃)||₂ ≤ const*tol while allowing much coarser fine-level representation. CAUTION: the resulting f̃ is only meaningful as input to such an S; derivatives and inner products with non-smooth functions will be wrong.

Mode -2: t_n = tol * max(1, (2^n/L)^2) [dual of mode 2] Designed for accuracy after applying the resolvent G = (T-E)^{-1}, whose Fourier-space symbol is G(k) = 2/(k²+μ²) ~ 2/k² for k >> μ. A level-n error of magnitude t_n survives G as ~t_n*(L/2^n)². Setting t_n = tol*(2^n/L)² guarantees ||G(f-f̃)||â‚‚ ≤ const*tol while aggressively pruning fine levels (factor ~(2^n/L)² looser than mode 0 at level n). The coarse-level floor (where max clamps to 1) is unchanged — coarse-level errors pass through G at amplitude ~1/|E| and are only reduced by tightening tol itself, not by choosing this mode. CAUTION: same as mode -1 — use only for intermediates fed into G. Modes 1, 2 and 3 scale the tolerance by the physical width of the box. The width of an anisotropic cell has to be reduced to one number, and that is the geometric mean, volume^(1/NDIM) – not the smallest dimension, which would tie the tolerance to the cell's aspect ratio rather than to its resolution. Cubic cells are unaffected: there the two agree.

References madness::FunctionDefaults< NDIM >::get_cell_geometric_mean_width(), madness::FunctionDefaults< NDIM >::get_cell_min_width(), L, madness::Key< NDIM >::level(), MADNESS_EXCEPTION, NDIM, pow(), truncate_mode, and truncate_tol().

Referenced by madness::FunctionImpl< T, LDIM >::apply_1d_realspace_push_op(), autorefine_square_test(), broaden(), madness::Leaf_op< T, NDIM, opT, specialboxT >::compare_to_parent(), madness::FunctionImpl< T, LDIM >::do_apply(), madness::FunctionImpl< T, LDIM >::do_apply_directed_screening(), madness::FunctionImpl< T, NDIM >::recursive_apply_op2< opT >::finalize(), madness::FunctionImpl< T, LDIM >::gaxpy_ext_recursive(), madness::FunctionImpl< T, LDIM >::inner_adaptive_recursive(), madness::FunctionImpl< T, LDIM >::mulXXa(), madness::FunctionImpl< T, LDIM >::mulXXveca(), madness::FunctionImpl< T, NDIM >::Vphi_ij_u_op_NS< opT, LDIM >::operator()(), madness::FunctionImpl< T, NDIM >::Vphi_op_NS< opT, LDIM >::operator()(), refop::operator()(), refop::operator()(), madness::Leaf_op< T, NDIM, opT, specialboxT >::post_screening(), project_refine_op(), madness::FunctionImpl< T, LDIM >::recur_down_for_contraction_map(), madness::FunctionImpl< T, NDIM >::multiply_op< LDIM >::screen(), truncate_op(), truncate_reconstructed_op(), truncate_spawn(), truncate_tol(), and madness::FunctionImpl< T, LDIM >::vtransform_doit().

◆ unary_op_coeff_inplace()

template<typename T, std::size_t NDIM>
template<typename opT>
void madness::FunctionImpl< T, NDIM >::unary_op_coeff_inplace ( const opT & op,
bool fence )
inline

Unary operation applied inplace to the coefficients WITHOUT refinement, optional fence

Parameters
[in]opthe unary operator for the coefficients

◆ unary_op_node_inplace()

template<typename T, std::size_t NDIM>
template<typename opT>
void madness::FunctionImpl< T, NDIM >::unary_op_node_inplace ( const opT & op,
bool fence )
inline

Unary operation applied inplace to the coefficients WITHOUT refinement, optional fence

Parameters
[in]opthe unary operator for the coefficients

Referenced by scale_inplace().

◆ unary_op_value_inplace()

template<typename T, std::size_t NDIM>
template<typename opT>
void madness::FunctionImpl< T, NDIM >::unary_op_value_inplace ( const opT & op,
bool fence )
inline

Unary operation applied inplace to the values with optional refinement and fence

Parameters
[in]opthe unary operator for the values

Referenced by abs_inplace(), abs_square_inplace(), and square_inplace().

◆ unaryXX()

template<typename T, std::size_t NDIM>
template<typename Q, typename opT>
void madness::FunctionImpl< T, NDIM >::unaryXX ( const FunctionImpl< Q, NDIM > * func,
const opT & op,
bool fence )
inline

Performs unary operation on function impl. Delegates to the unaryXXa() method

Parameters
[in]funcfunction impl of the operand
[in]opthe unary operator

◆ unaryXXa()

template<typename T, std::size_t NDIM>
template<typename Q, typename opT>
void madness::FunctionImpl< T, NDIM >::unaryXXa ( const keyT & key,
const FunctionImpl< Q, NDIM > * func,
const opT & op )
inline

Out of place unary operation on function impl The skeleton algorithm should resemble something like

*this = op(*func)

Parameters
[in]keythe key of the current function node (box)
[in]functhe function impl on which to be operated
[in]opthe unary operator

Referenced by madness::FunctionImpl< T, LDIM >::unaryXX(), and madness::FunctionImpl< T, LDIM >::unaryXXvalues().

◆ unaryXXvalues()

template<typename T, std::size_t NDIM>
template<typename Q, typename opT>
void madness::FunctionImpl< T, NDIM >::unaryXXvalues ( const FunctionImpl< Q, NDIM > * func,
const opT & op,
bool fence )
inline

Performs unary operation on function impl. Delegates to the unaryXXa() method

Parameters
[in]funcfunction impl of the operand
[in]opthe unary operator

◆ undo_redundant()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::undo_redundant ( const bool fence)

convert this from redundant to standard reconstructed form

Referenced by erase(), madness::partial_mul(), and madness::FunctionImpl< Q, NDIM >::print_tree_json().

◆ undo_replicate()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::undo_replicate ( bool fence = true)
inline

◆ unfilter() [1/2]

template<typename T, std::size_t NDIM>
FunctionImpl< T, NDIM >::coeffT madness::FunctionImpl< T, NDIM >::unfilter ( const coeffT & s) const

References cdata, transform(), and unfilter().

◆ unfilter() [2/2]

template<typename T, std::size_t NDIM>
FunctionImpl< T, NDIM >::tensorT madness::FunctionImpl< T, NDIM >::unfilter ( const tensorT & s) const

Transform sums+differences at level n to sum coefficients at level n+1.

Given scaling function and wavelet coefficients (s and d) returns the scaling function coefficients at the next finer level. I.e., reconstruct Vn using Vn = Vn-1 + Wn-1.

s0 = sum(j) h0_ji*s_j + g0_ji*d_j
s1 = sum(j) h1_ji*s_j + g1_ji*d_j
static const double s0
Definition tdse4.cc:83

Returns a new tensor and has no side effects

If (sonly) ... then ss is only the scaling function coeff (and assume the d are zero). Works for any number of dimensions.

No communication involved.

References cdata, madness::fast_transform(), unfilter(), and w().

Referenced by madness::FunctionImpl< T, LDIM >::binaryXXa(), madness::FunctionImpl< T, LDIM >::gaxpy_ext_recursive(), madness::FunctionImpl< T, LDIM >::inner_adaptive_recursive(), madness::FunctionImpl< T, LDIM >::inner_ext_recursive(), madness::FunctionImpl< T, LDIM >::mulXXa(), madness::FunctionImpl< T, LDIM >::mulXXveca(), reconstruct_op(), madness::FunctionImpl< T, LDIM >::recur_down_for_contraction_map(), madness::FunctionImpl< T, LDIM >::refine_op(), refine_to_common_level(), sum_down_spawn(), unfilter(), and unfilter().

◆ unset_functor()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::unset_functor ( )

◆ upsample()

template<typename T, std::size_t NDIM>
FunctionImpl< T, NDIM >::coeffT madness::FunctionImpl< T, NDIM >::upsample ( const keyT & key,
const coeffT & coeff ) const

upsample the sum coefficients of level 1 to sum coeffs on level n+1

specialization of the unfilter method, will transform only the sum coefficients

Parameters
[in]keykey of level n+1
[in]coeffsum coefficients of level n (does NOT belong to key!!)
Returns
sum coefficients on level n+1

specialization of the unfilter method, will transform only the sum coefficients

Parameters
[in]keykey of level n+1
[in]coeffsum coefficients of level n (does NOT belong to key!!)
[in]argsTensorArguments for possible low rank approximations
Returns
sum coefficients on level n+1

References cdata, madness::general_transform(), h(), NDIM, madness::Key< NDIM >::translation(), and upsample().

Referenced by madness::Leaf_op< T, NDIM, opT, specialboxT >::compare_to_parent(), and upsample().

◆ values2coeffs() [1/2]

◆ values2coeffs() [2/2]

template<typename T, std::size_t NDIM>
template<typename Q>
Tensor< Q > madness::FunctionImpl< T, NDIM >::values2coeffs ( const keyT & key,
const Tensor< Q > & values ) const
inline

◆ values2NScoeffs()

template<typename T, std::size_t NDIM>
template<typename Q>
GenTensor< Q > madness::FunctionImpl< T, NDIM >::values2NScoeffs ( const keyT & key,
const GenTensor< Q > & values ) const
inline

convert function values of the a child generation directly to NS coeffs

equivalent to converting the function values to 2^NDIM S coeffs and then filtering them to NS coeffs. Reverse operation to NScoeffs2values().

Parameters
[in]keykey of the parent of the generation
[in]valuestensor holding function values of the 2^NDIM children of key
Returns
NS coeffs belonging to key

◆ verify_parents_and_children()

template<typename T, std::size_t NDIM>
bool madness::FunctionImpl< T, NDIM >::verify_parents_and_children ( ) const

check that parents and children are consistent

will not check proper size of coefficients global communication

References coeffs, and verify_parents_and_children().

Referenced by verify_parents_and_children(), and verify_tree().

◆ verify_tree()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::verify_tree ( ) const

Verify tree is properly constructed ... global synchronization involved.

If an inconsistency is detected, prints a message describing the error and then throws a madness exception.

This is a reasonably quick and scalable operation that is useful for debugging and paranoia.

References FunctionImpl, MADNESS_CHECK_THROW, PROFILE_MEMBER_FUNC, verify_parents_and_children(), verify_tree(), verify_tree_state_local(), and world.

Referenced by verify_tree().

◆ verify_tree_state_local()

template<typename T, std::size_t NDIM>
bool madness::FunctionImpl< T, NDIM >::verify_tree_state_local ( ) const

◆ vol_nsphere()

template<typename T, std::size_t NDIM>
double madness::FunctionImpl< T, NDIM >::vol_nsphere ( int n,
double R )
inline

◆ vtransform()

template<typename T, std::size_t NDIM>
template<typename Q, typename R>
void madness::FunctionImpl< T, NDIM >::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 )
inline

Transforms a vector of functions left[i] = sum[j] right[j]*c[j,i] using sparsity

Parameters
[in]vrightvector of functions (impl's) on which to be transformed
[in]cthe tensor (matrix) transformer
[in]vleftvector of of the newly transformed functions (impl's)

◆ vtransform_doit()

template<typename T, std::size_t NDIM>
template<typename Q, typename R>
void madness::FunctionImpl< T, NDIM >::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 )
inline
Todo
I don't know what this does other than a trasform

◆ zero_norm_tree()

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::zero_norm_tree ( )

◆ FunctionImpl

◆ hash_value [1/2]

template<typename T, std::size_t NDIM>
hashT hash_value ( const FunctionImpl< T, NDIM > * pimpl)
friend

Hash a pointer to FunctionImpl.

Parameters
[in]implpointer to a FunctionImpl
Returns
The hash.

Referenced by madness::FunctionImpl< T, LDIM >::hash_value, and madness::FunctionImpl< T, LDIM >::hash_value.

◆ hash_value [2/2]

template<typename T, std::size_t NDIM>
hashT hash_value ( const std::shared_ptr< FunctionImpl< T, NDIM > > impl)
friend

Hash a shared_ptr to FunctionImpl.

Parameters
[in]implpointer to a FunctionImpl
Returns
The hash.

Member Data Documentation

◆ autorefine

template<typename T, std::size_t NDIM>
bool madness::FunctionImpl< T, NDIM >::autorefine
private

If true, autorefine where appropriate.

Referenced by get_autorefine(), and set_autorefine().

◆ box_interior

template<typename T, std::size_t NDIM>
long madness::FunctionImpl< T, NDIM >::box_interior[1000]
mutable

Referenced by print_info(), and put_in_box().

◆ box_leaf

template<typename T, std::size_t NDIM>
long madness::FunctionImpl< T, NDIM >::box_leaf[1000]
mutable

Referenced by print_info(), and put_in_box().

◆ cdata

◆ cell

template<typename T, std::size_t NDIM>
const Tensor<double> madness::FunctionImpl< T, NDIM >::cell
private

the size of the root cell in each dimension, unchangeable

Referenced by do_print_grid(), do_print_plane(), madness::FunctionImpl< T, LDIM >::read_grid(), and madness::FunctionImpl< T, LDIM >::read_grid2().

◆ coeffs

template<typename T, std::size_t NDIM>
dcT madness::FunctionImpl< T, NDIM >::coeffs
private

The coefficients.

Referenced by add_scalar_inplace(), madness::FunctionImpl< T, LDIM >::binaryXXa(), broaden(), check_symmetry_local(), chop_at_level(), compress_op(), compress_spawn(), madness::FunctionImpl< T, NDIM >::Vphi_ij_u_op_NS< opT, LDIM >::continue_recursion(), madness::FunctionImpl< T, NDIM >::Vphi_op_NS< opT, LDIM >::continue_recursion(), madness::FunctionImpl< T, LDIM >::copy_coeffs_same_world(), diff(), do_print_tree(), do_print_tree_graphviz(), do_print_tree_json(), erase(), eval(), eval_local_only(), eval_local_only(), eval_plot_cube(), evaldepthpt(), evalR(), exists_and_has_children(), exists_and_is_leaf(), find_datum(), find_me(), madness::FunctionImpl< T, LDIM >::gaxpy(), madness::FunctionImpl< T, LDIM >::gaxpy_ext_recursive(), madness::FunctionImpl< T, LDIM >::gaxpy_inplace(), gaxpy_oop_reconstructed(), get_coeffs(), get_coeffs(), get_norm_tree_recursive(), get_pmap(), insert_zero_down_to_initial_level(), local_leaf_keys(), make_redundant_op(), max_local_depth(), max_nodes(), min_nodes(), madness::FunctionImpl< T, LDIM >::mulXXa(), madness::FunctionImpl< T, LDIM >::mulXXveca(), nCoeff_local(), norm2sq_local(), norm_tree(), norm_tree_op(), norm_tree_spawn(), print_info(), print_plane_local(), print_stats(), project(), project_refine_op(), real_size(), reconstruct_op(), refine_to_common_level(), size_local(), sock_it_to_me(), sock_it_to_me_too(), sum_down(), sum_down_spawn(), trace_local(), tree_size(), trickle_down(), trickle_down_op(), truncate(), truncate_op(), truncate_reconstructed_op(), truncate_spawn(), verify_parents_and_children(), verify_tree_state_local(), madness::FunctionImpl< T, LDIM >::vtransform_doit(), and zero_norm_tree().

◆ const [1/2]

template<typename T, std::size_t NDIM>
NDIM& gimpl madness::FunctionImpl< T, NDIM >::const
Initial value:
{
friend class FunctionImpl
Definition funcimpl.h:1060
#define PROFILE_MEMBER_FUNC(classname)
Definition worldprofile.h:210

◆ const [2/2]

template<typename T, std::size_t NDIM>
NDIM &g madness::FunctionImpl< T, NDIM >::const

◆ functor

template<typename T, std::size_t NDIM>
std::shared_ptr< FunctionFunctorInterface<T,NDIM> > madness::FunctionImpl< T, NDIM >::functor
private

◆ initial_level

template<typename T, std::size_t NDIM>
int madness::FunctionImpl< T, NDIM >::initial_level
private

Initial level for refinement.

Referenced by insert_zero_down_to_initial_level().

◆ k

◆ large

template<typename T, std::size_t NDIM>
AtomicInt madness::FunctionImpl< T, NDIM >::large

◆ leaves_only

template<typename T, std::size_t NDIM>
bool madness::FunctionImpl< T, NDIM >::leaves_only =(this->is_redundant())

Referenced by trace_local().

◆ max_refine_level

template<typename T, std::size_t NDIM>
int madness::FunctionImpl< T, NDIM >::max_refine_level
private

Do not refine below this level.

Referenced by project_refine_op().

◆ neighbor_halo_

template<typename T, std::size_t NDIM>
std::atomic<ConcurrentHashMap<keyT,coeffT>*> madness::FunctionImpl< T, NDIM >::neighbor_halo_ {nullptr}
mutableprivate

Neighbor coefficients pushed here by whoever owns them; null until something stages.

Values mirror what sock_it_to_me returns for the same key: coefficients for a same-level leaf, empty for an interior node, absent when the neighbor is coarser and the consumer must walk up. Which nodes get pushed is the operator's business, not the table's — see DerivativeBase::stage_halo.

Allocated on the first push, so functions that never stage one do not carry it: a ConcurrentHashMap default-constructs 1021 bins, ~32 kB per function.

◆ small

template<typename T, std::size_t NDIM>
AtomicInt madness::FunctionImpl< T, NDIM >::small

◆ special_level

template<typename T, std::size_t NDIM>
int madness::FunctionImpl< T, NDIM >::special_level
private

Minimium level for refinement on special points.

Referenced by project_refine_op().

◆ special_points

template<typename T, std::size_t NDIM>
std::vector<Vector<double,NDIM> > madness::FunctionImpl< T, NDIM >::special_points
private

special points for further refinement (needed for composite functions or multiplication)

◆ targs

◆ thresh

◆ timer_accumulate

template<typename T, std::size_t NDIM>
Timer madness::FunctionImpl< T, NDIM >::timer_accumulate

◆ timer_change_tensor_type

template<typename T, std::size_t NDIM>
Timer madness::FunctionImpl< T, NDIM >::timer_change_tensor_type

◆ timer_compress_svd

template<typename T, std::size_t NDIM>
Timer madness::FunctionImpl< T, NDIM >::timer_compress_svd

Referenced by compress_op().

◆ timer_filter

template<typename T, std::size_t NDIM>
Timer madness::FunctionImpl< T, NDIM >::timer_filter

Referenced by compress_op().

◆ timer_lr_result

template<typename T, std::size_t NDIM>
Timer madness::FunctionImpl< T, NDIM >::timer_lr_result

Referenced by print_timer(), and reset_timer().

◆ timer_target_driven

template<typename T, std::size_t NDIM>
Timer madness::FunctionImpl< T, NDIM >::timer_target_driven

Referenced by print_timer(), and reset_timer().

◆ tree_state

◆ truncate_mode

template<typename T, std::size_t NDIM>
int madness::FunctionImpl< T, NDIM >::truncate_mode
private

0=default=(|d|<thresh), 1=(|d|<thresh/2^n), 2=(|d|<thresh/4^n);

Referenced by truncate_tol().

◆ truncate_on_project

template<typename T, std::size_t NDIM>
bool madness::FunctionImpl< T, NDIM >::truncate_on_project
private

If true projection inserts at level n-1 not n.

Referenced by project_refine_op().

◆ world


The documentation for this class was generated from the following files: