MADNESS  version 0.9
Classes | Public Types | Public Member Functions | Public Attributes | Friends | List of all members
madness::FunctionImpl< T, NDIM > Singleton Reference

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

#include <funcdefaults.h>

Inheritance diagram for madness::FunctionImpl< T, NDIM >:
Inheritance graph
[legend]
Collaboration diagram for madness::FunctionImpl< T, NDIM >:
Collaboration graph
[legend]

Classes

struct  add_op
 add two functions f and g: result=alpha * f + beta * g More...
 
struct  coeff_value_adaptor
 
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_consolidate_buffer
 
struct  do_convert_to_color
 
class  do_err_box
 
struct  do_gaxpy_inplace
 
struct  do_inner_ext_local
 
struct  do_inner_ext_local_ffi
 
struct  do_inner_local
 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_mapdim
 map this on f More...
 
struct  do_merge_trees
 merge the coefficent boxes of this into other's tree 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  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  remove_internal_coeffs
 
struct  true_refine_test
 
struct  Vphi_op_NS
 given a ket and the 1- and 2-electron potentials, construct the function V phi More...
 

Public Types

typedef FunctionImpl< T, NDIMimplT
 Type of this class (implementation) More...
 
typedef std::shared_ptr
< FunctionImpl< T, NDIM > > 
pimplT
 pointer to this class More...
 
typedef Tensor< T > tensorT
 Type of tensor for anything but to hold coeffs. More...
 
typedef Vector< Translation, NDIMtranT
 Type of array holding translation. More...
 
typedef Key< NDIMkeyT
 Type of key. More...
 
typedef FunctionNode< T, NDIMnodeT
 Type of node. More...
 
typedef GenTensor< T > coeffT
 Type of tensor used to hold coeffs. More...
 
typedef WorldContainer< keyT,
nodeT
dcT
 Type of container holding the coefficients. More...
 
typedef std::pair< const keyT,
nodeT
datumT
 Type of entry in container. More...
 
typedef Vector< double, NDIMcoordT
 Type of vector holding coordinates. More...
 
typedef Range< typename
dcT::const_iterator
rangeT
 

Public Member Functions

 FunctionImpl (const FunctionFactory< T, NDIM > &factory)
 Initialize function impl from data in factory. More...
 
template<typename Q >
 FunctionImpl (const FunctionImpl< Q, NDIM > &other, const std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > &pmap, bool dozero)
 Copy constructor. More...
 
virtual ~FunctionImpl ()
 
const std::shared_ptr
< WorldDCPmapInterface< Key
< NDIM > > > & 
get_pmap () const
 
template<typename Q >
void copy_coeffs (const FunctionImpl< Q, NDIM > &other, bool fence)
 Copy coeffs from other into self. More...
 
template<typename Q , typename R >
void gaxpy_inplace_reconstructed (const T &alpha, const FunctionImpl< Q, NDIM > &g, const R &beta, const bool fence)
 perform inplace gaxpy: this = alpha*this + beta*other More...
 
template<typename Q , typename R >
void merge_trees (const T alpha, const FunctionImpl< Q, NDIM > &other, const R beta, const bool fence=true)
 merge the trees of this and other, while multiplying them with the alpha or beta, resp More...
 
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 More...
 
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. More...
 
template<typename Archive >
void load (Archive &ar)
 
template<typename Archive >
void store (Archive &ar)
 
bool is_compressed () const
 Returns true if the function is compressed. More...
 
bool is_redundant () const
 Returns true if the function is redundant. More...
 
bool is_nonstandard () const
 
void set_functor (const std::shared_ptr< FunctionFunctorInterface< T, NDIM > > functor1)
 
std::shared_ptr
< FunctionFunctorInterface< T,
NDIM > > 
get_functor ()
 
std::shared_ptr
< FunctionFunctorInterface< T,
NDIM > > 
get_functor () const
 
void unset_functor ()
 
bool & is_on_demand ()
 
const bool & is_on_demand () const
 
TensorType get_tensor_type () const
 
TensorArgs get_tensor_args () const
 
double get_thresh () const
 
void set_thresh (double value)
 
bool get_autorefine () const
 
void set_autorefine (bool value)
 
int get_k () const
 
const dcTget_coeffs () const
 
dcTget_coeffs ()
 
const FunctionCommonData< T,
NDIM > & 
get_cdata () const
 
Void accumulate_timer (const double time) const
 
void print_timer () const
 
void reset_timer ()
 
void add_scalar_inplace (T t, bool fence)
 Adds a constant to the function. Local operation, optional fence. More...
 
void insert_zero_down_to_initial_level (const keyT &key)
 Initialize nodes to zero function at initial_level of refinement. More...
 
void truncate (double tol, bool fence)
 Truncate according to the threshold with optional global fence. More...
 
Future< bool > truncate_spawn (const keyT &key, double tol)
 Returns true if after truncation this node has coefficients. More...
 
bool truncate_op (const keyT &key, double tol, const std::vector< Future< bool > > &v)
 Actually do the truncate operation. More...
 
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. More...
 
void fcube (const keyT &key, T(*f)(const coordT &), const Tensor< double > &qx, tensorT &fval) const
 
const keyTkey0 () const
 
void print_tree (std::ostream &os=std::cout, Level maxlevel=10000) const
 
void do_print_tree (const keyT &key, std::ostream &os, Level maxlevel) const
 
void print_tree_graphviz (std::ostream &os=std::cout, Level maxlevel=10000) const
 
void do_print_tree_graphviz (const keyT &key, std::ostream &os, Level maxlevel) const
 
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. More...
 
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 More...
 
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 More...
 
void print_grid (const std::string filename) const
 
std::vector< keyTlocal_leaf_keys () const
 return the keys of the local leaf boxes More...
 
void do_print_grid (const std::string filename, const std::vector< keyT > &keys) const
 print the grid in xyz format More...
 
template<size_t FDIM>
enable_if_c< NDIM==FDIM >::type read_grid (const std::string keyfile, const std::string gridfile, std::shared_ptr< FunctionFunctorInterface< double, NDIM > > vnuc_functor)
 read data from a grid More...
 
template<size_t FDIM>
enable_if_c< NDIM==FDIM >::type read_grid2 (const std::string gridfile, std::shared_ptr< FunctionFunctorInterface< double, NDIM > > vnuc_functor)
 read data from a grid More...
 
tensorT project (const keyT &key) const
 Compute by projection the scaling function coeffs in specified box. More...
 
double truncate_tol (double tol, const keyT &key) const
 Returns the truncation threshold according to truncate_method. More...
 
std::vector< Slicechild_patch (const keyT &child) const
 Returns patch referring to coeffs of child in parent box. More...
 
Void project_refine_op (const keyT &key, bool do_refine, const std::vector< Vector< double, NDIM > > &specialpts)
 Projection with optional refinement. More...
 
void phi_for_mul (Level np, Translation lp, Level nc, Translation lc, Tensor< double > &phi) const
 Compute the Legendre scaling functions for multiplication. More...
 
const coeffT parent_to_child (const coeffT &s, const keyT &parent, const keyT &child) const
 Directly project parent coeffs to child coeffs. More...
 
coeffT parent_to_child_NS (const keyT &child, const keyT &parent, const coeffT &coeff) const
 Directly project parent NS coeffs to child NS coeffs. More...
 
Key< NDIMsimpt2key (const coordT &pt, Level n) const
 Returns the box at level n that contains the given point in simulation coordinates. More...
 
tensorT coeffs_for_jun (Level n, long q=0)
 Get the scaling function coeffs at level n starting from NS form. More...
 
template<typename Q >
GenTensor< Q > coeffs2values (const keyT &key, const GenTensor< Q > &coeff) const
 
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 More...
 
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. More...
 
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 More...
 
template<typename Q >
Tensor< Q > coeffs2values (const keyT &key, const Tensor< Q > &coeff) const
 
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 >
Tensor< Q > fcube_for_mul (const keyT &child, const keyT &parent, const Tensor< Q > &coeff) const
 Compute the function values for multiplication. More...
 
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. More...
 
template<typename L , typename R >
Void do_mul (const keyT &key, const Tensor< L > &left, const std::pair< keyT, Tensor< R > > &arg)
 Invoked as a task by mul with the actual coefficients. More...
 
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 More...
 
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)
 Invoked as a task by do_binary_op with the actual coefficients. More...
 
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. More...
 
template<typename opT >
void unary_op_coeff_inplace (const opT &op, bool fence)
 Unary operation applied inplace to the coefficients WITHOUT refinement, optional fence. More...
 
template<typename opT >
void unary_op_node_inplace (const opT &op, bool fence)
 Unary operation applied inplace to the coefficients WITHOUT refinement, optional fence. More...
 
template<typename opT >
void flo_unary_op_node_inplace (const opT &op, bool fence)
 Unary operation applied inplace to the coefficients WITHOUT refinement, optional fence. More...
 
template<typename opT >
void flo_unary_op_node_inplace (const opT &op, bool fence) const
 Unary operation applied inplace to the coefficients WITHOUT refinement, optional fence. More...
 
Void erase (const Level &max_level)
 truncate tree at a certain level More...
 
double check_symmetry_local () const
 Returns some asymmetry measure ... no comms. More...
 
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 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. More...
 
template<typename opT >
Void multiop_values_doit (const keyT &key, const opT &op, const std::vector< implT * > &v)
 
template<typename opT >
void multiop_values (const opT &op, const std::vector< implT * > &v)
 
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)
 Transforms a vector of functions left[i] = sum[j] right[j]*c[j,i] using sparsity. More...
 
template<typename opT >
void unary_op_value_inplace (const opT &op, bool fence)
 Unary operation applied inplace to the values with optional refinement and fence. More...
 
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)
 
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 , 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)
 
template<typename Q , typename opT >
Void unaryXXa (const keyT &key, const FunctionImpl< Q, NDIM > *func, const opT &op)
 
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 , typename opT >
void binaryXX (const FunctionImpl< L, NDIM > *left, const FunctionImpl< R, NDIM > *right, 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 unaryXXvalues (const FunctionImpl< Q, NDIM > *func, const opT &op, bool fence)
 
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)
 
Future< double > get_norm_tree_recursive (const keyT &key) const
 
Void put_in_box (ProcessID from, long nl, long ni) const
 
void print_info () const
 Prints summary of data distribution. More...
 
void verify_tree () const
 Verify tree is properly constructed ... global synchronization involved. More...
 
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. More...
 
Void sock_it_to_me_too (const keyT &key, const RemoteReference< FutureImpl< std::pair< keyT, coeffT > > > &ref) const
 
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
 
Tensor< T > eval_plot_cube (const coordT &plotlo, const coordT &plothi, const std::vector< long > &npt, const bool eval_refine=false) const
 Evaluate a cube/slice of points ... plotlo and plothi are already in simulation coordinates. More...
 
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) More...
 
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. More...
 
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. More...
 
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. More...
 
void tnorm (const tensorT &t, double *lo, double *hi) const
 Computes norm of low/high-order polyn. coeffs for autorefinement test. More...
 
Void do_square_inplace (const keyT &key)
 
Void do_square_inplace2 (const keyT &parent, const keyT &child, const tensorT &parent_coeff)
 
bool noautorefine (const keyT &key, const tensorT &t) const
 Always returns false (for when autorefine is not wanted) More...
 
bool autorefine_square_test (const keyT &key, const nodeT &t) const
 Returns true if this block of coeffs needs autorefining. More...
 
void square_inplace (bool fence)
 Pointwise squaring of function with optional global fence. More...
 
void abs_inplace (bool fence)
 
void abs_square_inplace (bool fence)
 
Void sum_down_spawn (const keyT &key, const coeffT &s)
 is this the same as trickle_down() ? More...
 
void sum_down (bool fence)
 After 1d push operator must sum coeffs down the tree to restore correct scaling function coefficients. More...
 
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) More...
 
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 More...
 
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 More...
 
template<std::size_t LDIM, typename leaf_opT >
Void hartree_product (const FunctionImpl< T, LDIM > *p1, const FunctionImpl< T, LDIM > *p2, const leaf_opT &leaf_op, bool fence)
 given two functions of LDIM, perform the Hartree/Kronecker/outer product More...
 
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_1d_realspace_push (const opT &op, const FunctionImpl< R, NDIM > *f, int axis, bool fence)
 
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)
 
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)
 
void diff (const DerivativeBase< T, NDIM > *D, const implT *f, bool fence)
 
keyT neighbor (const keyT &key, const keyT &disp, const std::vector< bool > &is_periodic) const
 Returns key of general neighbor enforcing BC. More...
 
Future< std::pair< keyT, coeffT > > find_me (const keyT &key) const
 find_me. Called by diff_bdry to get coefficients of boundary function More...
 
std::pair< Key< NDIM >
, ShallowNode< T, NDIM > > 
find_datum (keyT key) const
 return the a std::pair<key, node>, which MUST exist More...
 
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) More...
 
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 More...
 
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 More...
 
void mapdim (const implT &f, const std::vector< long > &map, bool fence)
 Permute the dimensions of f according to map, result on this. More...
 
void average (const implT &rhs)
 take the average of two functions, similar to: this=0.5*(this+rhs) More...
 
void change_tensor_type1 (const TensorArgs &targs, bool fence)
 change the tensor type of the coefficients in the FunctionNode More...
 
void reduce_rank (const TensorArgs &targs, bool fence)
 reduce the rank of the coefficients tensors More...
 
eval_cube (Level n, coordT &x, const tensorT &c) const
 
tensorT filter (const tensorT &s) const
 Transform sum coefficients at level n to sums+differences at level n-1. More...
 
coeffT filter (const coeffT &s) const
 
tensorT unfilter (const tensorT &s) const
 Transform sums+differences at level n to sum coefficients at level n+1. More...
 
coeffT unfilter (const coeffT &s) const
 
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 More...
 
coeffT upsample (const keyT &key, const coeffT &coeff) const
 upsample the sum coefficients of level 1 to sum coeffs on level n+1 More...
 
void project (const implT &old, bool fence)
 Projects old function into new basis (only in reconstructed form) More...
 
template<typename opT >
Void refine_op (const opT &op, const keyT &key)
 
template<typename opT >
Void refine_spawn (const opT &op, const keyT &key)
 
template<typename opT >
void refine (const opT &op, bool fence)
 
bool exists_and_has_children (const keyT &key) const
 
bool exists_and_is_leaf (const keyT &key) const
 
Void broaden_op (const keyT &key, const std::vector< Future< bool > > &v)
 
void zero_norm_tree ()
 
void broaden (std::vector< bool > is_periodic, bool fence)
 
void trickle_down (bool fence)
 sum all the contributions from all scales after applying an operator in mod-NS form More...
 
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 More...
 
void reconstruct (bool fence)
 
Void reconstruct_op (const keyT &key, const coeffT &s)
 
void compress (bool nonstandard, bool keepleaves, bool redundant, bool fence)
 compress the wave function More...
 
Future< coeffTcompress_spawn (const keyT &key, bool nonstandard, bool keepleaves, bool redundant)
 
void make_redundant (const bool fence)
 convert this to redundant, i.e. have sum coefficients on all levels More...
 
void undo_redundant (const bool fence)
 convert this from redundant to standard reconstructed form More...
 
void norm_tree (bool fence)
 compute for each FunctionNode the norm of the function inside that node More...
 
double norm_tree_op (const keyT &key, const std::vector< Future< double > > &v)
 
Future< double > norm_tree_spawn (const keyT &key)
 
Future< coeffTtruncate_reconstructed_spawn (const keyT &key, const double tol)
 truncate using a tree in reconstructed form More...
 
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 More...
 
coeffT compress_op (const keyT &key, const std::vector< Future< coeffT > > &v, bool nonstandard, bool redundant)
 calculate the wavelet coefficients using the sum coefficients of all child nodes More...
 
coeffT make_redundant_op (const keyT &key, const std::vector< Future< coeffT > > &v)
 similar to compress_op, but insert only the sum coefficients in the tree More...
 
void standard (bool fence)
 Changes non-standard compressed form to standard compressed form. More...
 
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 More...
 
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 More...
 
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 More...
 
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) More...
 
template<typename opT , typename R >
void apply (opT &op, const FunctionImpl< R, NDIM > &f, bool fence)
 apply an operator on f to return this More...
 
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) More...
 
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 More...
 
double finalize_apply (const bool fence=true)
 after apply we need to do some cleanup; More...
 
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 More...
 
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 More...
 
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. More...
 
template<typename opT >
double errsq_local (const opT &func) const
 Returns the sum of squares of errors from local info ... no comms. More...
 
trace_local () const
 Returns int(f(x),x) in local volume. More...
 
double norm2sq_local () const
 Returns the square of the local norm ... no comms. More...
 
template<typename R >
 TENSOR_RESULT_TYPE (T, R) inner_local(const FunctionImpl<R
 Returns the inner product ASSUMING same distribution. More...
 
typedef TENSOR_RESULT_TYPE (T, R) resultT
 
 MADNESS_ASSERT (this->is_redundant()==g.is_redundant())
 
return world taskq reduce (rangeT(coeffs.begin(), coeffs.end()), do_inner_local< R >(&g, leaves_only))
 
inner_ext_node (keyT key, tensorT c, T(*f)(const coordT &)) const
 
inner_ext_node (keyT key, tensorT c, const std::shared_ptr< FunctionFunctorInterface< T, NDIM > > f) const
 
inner_ext_recursive (keyT key, tensorT c, T(*f)(const coordT &), const bool leaf_refine, T old_inner=T(0)) const
 
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
 
inner_ext_local (T(*f)(const coordT &), const bool leaf_refine) const
 
inner_ext_local (const std::shared_ptr< FunctionFunctorInterface< T, NDIM > > f, const bool leaf_refine) const
 
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 L >
void gaxpy_ext (const FunctionImpl< L, NDIM > *left, T(*f)(const coordT &), T alpha, T beta, double tol, bool fence)
 
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)> More...
 
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)> More...
 
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 More...
 
std::size_t max_local_depth () const
 Returns the maximum local depth of the tree ... no communications. More...
 
std::size_t max_depth () const
 Returns the maximum depth of the tree ... collective ... global sum/broadcast. More...
 
std::size_t max_nodes () const
 Returns the max number of nodes on a processor. More...
 
std::size_t min_nodes () const
 Returns the min number of nodes on a processor. More...
 
std::size_t tree_size () const
 Returns the size of the tree structure of the function ... collective global sum. More...
 
std::size_t size () const
 Returns the number of coefficients in the function ... collective global sum. More...
 
std::size_t real_size () const
 Returns the number of coefficients in the function ... collective global sum. More...
 
void print_size (const std::string name) const
 print tree size and size More...
 
void print_stats () const
 print the number of configurations per node More...
 
void scale_inplace (const T q, bool fence)
 In-place scale by a constant. More...
 
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. More...
 
- Public Member Functions inherited from madness::WorldObject< FunctionImpl< T, NDIM > >
 WorldObject (World &world)
 Associates object with globally unique ID. More...
 
const uniqueidTid () const
 Returns the globally unique object ID. More...
 
Worldget_world () const
 Returns a reference to the world. More...
 
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 TaskAttributes &attr=TaskAttributes()) const
 Sends task to derived class method "returnT (this->*memfn)(a1,a2,a3,a4,a5,a6,a7,a8,a9)". More...
 
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)". More...
 
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)". More...
 
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)". More...
 
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)". More...
 
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)". More...
 
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)". More...
 
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)". More...
 
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)". More...
 
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)". More...
 
virtual ~WorldObject ()
 

Public Attributes

Worldworld
 
Timer timer_accumulate
 
Timer timer_lr_result
 
Timer timer_filter
 
Timer timer_compress_svd
 
Timer timer_target_driven
 
bool do_new
 
AtomicInt small
 
AtomicInt large
 
long box_leaf [1000]
 
long box_interior [1000]
 
NDIM &g const
 
bool leaves_only =(this->is_redundant())
 
- Public Attributes inherited from madness::WorldObject< FunctionImpl< T, NDIM > >
Worldworld
 Think globally act locally. More...
 

Friends

template<typename Q , std::size_t D>
class 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. More...
 

Detailed Description

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

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

Type of tensor used to hold coeffs.

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

Type of vector holding coordinates.

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

Type of entry in container.

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

Type of container holding the coefficients.

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

Type of this class (implementation)

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

Type of key.

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

Type of node.

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

pointer to this class

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

Type of tensor for anything but to hold coeffs.

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

Type of array holding translation.

Constructor & Destructor Documentation

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.

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.

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

Member Function Documentation

template<typename T , std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::abs_inplace ( bool  fence)
template<typename T , std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::abs_square_inplace ( bool  fence)
template<typename T , std::size_t NDIM>
Void madness::FunctionImpl< T, NDIM >::accumulate_timer ( const double  time) const
template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::add_scalar_inplace ( 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.

References madness::change_tensor_type(), madness::FunctionNode< T, NDIM >::coeff(), madness::FunctionNode< T, NDIM >::has_coeff(), L, NDIM, sqrt(), madness::TT_FULL, and ttt.

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

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
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
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

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]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 madness::GenTensor< T >::full_tensor_copy(), madness::GenTensor< T >::has_data(), madness::multiply(), and thresh.

Referenced by madness::FunctionImpl< T, NDIM >::Vphi_op_NS< opT, LDIM >::make_childrens_sum_coeffs(), and madness::FunctionImpl< T, NDIM >::Vphi_op_NS< opT, LDIM >::make_sum_coeffs().

template<typename T , std::size_t NDIM>
bool madness::FunctionImpl< T, NDIM >::autorefine_square_test ( const keyT key,
const nodeT t 
) const
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 madness::FunctionImpl< T, NDIM >::flo_unary_op_node_inplace().

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
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
template<typename T , std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::broaden ( std::vector< bool >  is_periodic,
bool  fence 
)
template<typename T , std::size_t NDIM>
Void madness::FunctionImpl< T, NDIM >::broaden_op ( const keyT key,
const std::vector< Future< bool > > &  v 
)
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)
template<typename T , std::size_t NDIM>
double madness::FunctionImpl< T, NDIM >::check_symmetry_local ( ) const

Returns some asymmetry measure ... no comms.

References PROFILE_MEMBER_FUNC.

template<typename T , std::size_t NDIM>
std::vector< Slice > madness::FunctionImpl< T, NDIM >::child_patch ( const keyT child) const
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
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
template<typename T , std::size_t NDIM>
FunctionImpl< T, NDIM >::tensorT madness::FunctionImpl< T, NDIM >::coeffs_for_jun ( Level  n,
long  q = 0 
)
template<typename T , std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::compress ( bool  nonstandard,
bool  keepleaves,
bool  redundant,
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 madness::nonstandard().

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

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

Parameters
[in]keythis's key
[in]vsum coefficients of the child nodes
[in]nonstandardkeep the sum coefficients with the wavelet coefficients
[in]redundantkeep only the sum coefficients, discard the wavelet coefficients
Returns
the sum coefficients

References c, madness::copy(), madness::Key< NDIM >::level(), madness::nonstandard(), madness::print(), PROFILE_MEMBER_FUNC, and madness::TensorArgs::thresh.

template<typename T , std::size_t NDIM>
Future< GenTensor< T > > madness::FunctionImpl< T, NDIM >::compress_spawn ( const keyT key,
bool  nonstandard,
bool  keepleaves,
bool  redundant 
)
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.

template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::diff ( const DerivativeBase< T, NDIM > *  D,
const implT f,
bool  fence 
)
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]fthe source function (not used???)
[in]keykey of the source FunctionNode of f which is processed
[in]ccoeffs of the FunctionNode of f which is processed
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_op< opT, LDIM >::operator()(), and madness::FunctionImpl< T, NDIM >::recursive_apply_op2< opT >::operator()().

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, ..
Returns
nothing, but accumulate the result tensor into the destination node
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< Q, NDIM >::do_apply_directed_screening().

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]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< Q, NDIM >::do_apply_directed_screening().

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

Invoked as a task by do_binary_op with the actual coefficients.

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 
)
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

Invoked as a task by mul with the actual coefficients.

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, madness::FunctionDefaults< NDIM >::get_cell(), madness::FunctionDefaults< NDIM >::get_cell_width(), madness::Key< NDIM >::level(), MADNESS_EXCEPTION, NDIM, and madness::Key< NDIM >::translation().

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

References madness::FunctionDefaults< NDIM >::get_cell().

template<typename T , std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::do_print_tree ( const keyT key,
std::ostream &  os,
Level  maxlevel 
) const
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
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
template<typename T, std::size_t NDIM>
Void madness::FunctionImpl< T, NDIM >::do_square_inplace ( const keyT key)
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 
)
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
[in]argsTensorArguments for possible low rank approximations
Returns
sum coefficients on level n in full tensor format

References madness::general_transform(), and NDIM.

template<typename T , std::size_t NDIM>
Void madness::FunctionImpl< T, NDIM >::erase ( const Level max_level)
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

Referenced by madness::FunctionImpl< T, NDIM >::do_err_box< opT >::operator()().

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.

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 
)

Evaluate the function 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.

References madness::FunctionNode< T, NDIM >::coeff(), madness::GenTensor< T >::full_tensor_copy(), madness::Future< T >::get(), madness::FunctionNode< T, NDIM >::has_coeff(), madness::TaskAttributes::hipri(), madness::Key< NDIM >::level(), NDIM, PROFILE_BLOCK, PROFILE_MEMBER_FUNC, madness::ref(), and madness::Key< NDIM >::translation().

template<typename T , std::size_t NDIM>
T madness::FunctionImpl< T, NDIM >::eval_cube ( Level  n,
coordT x,
const tensorT c 
) const
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(), madness::GenTensor< T >::full_tensor_copy(), madness::Future< T >::get(), madness::FunctionNode< T, NDIM >::has_coeff(), madness::Key< NDIM >::level(), NDIM, and madness::Key< NDIM >::translation().

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

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

References madness::FunctionNode< T, NDIM >::has_coeff(), NDIM, and PROFILE_MEMBER_FUNC.

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 madness::Future< T >::get(), madness::FunctionNode< T, NDIM >::has_coeff(), madness::TaskAttributes::hipri(), madness::Key< NDIM >::level(), NDIM, PROFILE_BLOCK, PROFILE_MEMBER_FUNC, madness::ref(), and madness::Key< NDIM >::translation().

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 madness::FunctionNode< T, NDIM >::coeff(), madness::Future< T >::get(), madness::FunctionNode< T, NDIM >::has_coeff(), madness::TaskAttributes::hipri(), madness::Key< NDIM >::level(), NDIM, PROFILE_BLOCK, PROFILE_MEMBER_FUNC, madness::GenTensor< T >::rank(), madness::ref(), and madness::Key< NDIM >::translation().

template<typename T , std::size_t NDIM>
bool madness::FunctionImpl< T, NDIM >::exists_and_has_children ( const keyT key) const
template<typename T , std::size_t NDIM>
bool madness::FunctionImpl< T, NDIM >::exists_and_is_leaf ( const keyT key) const
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
template<typename T, std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::fcube ( const keyT key,
T(*)(const coordT &)  f,
const Tensor< double > &  qx,
tensorT fval 
) const

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

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

Referenced by madness::FunctionImpl< Q, NDIM >::do_binary_op(), madness::FunctionImpl< Q, NDIM >::do_mul(), and madness::FunctionImpl< T, NDIM >::do_unary_op_value_inplace< opT >::operator()().

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

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
//

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

No communication involved.

References madness::fast_transform().

Referenced by madness::FunctionImpl< Q, NDIM >::gaxpy_ext_recursive(), and madness::FunctionImpl< T, NDIM >::Vphi_op_NS< opT, LDIM >::operator()().

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

References madness::transform().

template<typename T , std::size_t NDIM>
double madness::FunctionImpl< T, NDIM >::finalize_apply ( const bool  fence = true)

after apply we need to do some cleanup;

References madness::nonstandard(), madness::TensorArgs::thresh, and madness::wall_time().

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

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

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 madness::TaskAttributes::hipri(), PROFILE_BLOCK, PROFILE_MEMBER_FUNC, and madness::Future< T >::remote_ref().

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

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

Referenced by madness::FunctionImpl< T, NDIM >::average(), and madness::FunctionImpl< Q, NDIM >::merge_trees().

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.

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 
)
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
Returns
nothing, but will forward all input to traverse_tree()

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

template<typename T, std::size_t NDIM>
template<typename L , typename R >
void madness::FunctionImpl< T, NDIM >::gaxpy ( alpha,
const FunctionImpl< L, NDIM > &  left,
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.

template<typename T, std::size_t NDIM>
template<typename L >
void madness::FunctionImpl< T, NDIM >::gaxpy_ext ( const FunctionImpl< L, NDIM > *  left,
T(*)(const coordT &)  f,
alpha,
beta,
double  tol,
bool  fence 
)
inline
template<typename T, std::size_t NDIM>
template<typename L >
tensorT madness::FunctionImpl< T, NDIM >::gaxpy_ext_node ( keyT  key,
Tensor< L lc,
T(*)(const coordT &)  f,
alpha,
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< Q, NDIM >::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(*)(const coordT &)  f,
alpha,
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]lccoefficients 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.
Returns
Return void but populates tree as side-effect
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.

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

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.

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 madness::FunctionImpl< T, NDIM >::is_compressed().

template<typename T , std::size_t NDIM>
bool madness::FunctionImpl< T, NDIM >::get_autorefine ( ) const
template<typename T , std::size_t NDIM>
const FunctionCommonData< T, NDIM > & madness::FunctionImpl< T, NDIM >::get_cdata ( ) const
template<typename T , std::size_t NDIM>
const FunctionImpl< T, NDIM >::dcT & madness::FunctionImpl< T, NDIM >::get_coeffs ( ) const
template<typename T , std::size_t NDIM>
FunctionImpl< T, NDIM >::dcT & madness::FunctionImpl< T, NDIM >::get_coeffs ( )
template<typename T , std::size_t NDIM>
std::shared_ptr< FunctionFunctorInterface< T, NDIM > > madness::FunctionImpl< T, NDIM >::get_functor ( )
template<typename T , std::size_t NDIM>
std::shared_ptr< FunctionFunctorInterface< T, NDIM > > madness::FunctionImpl< T, NDIM >::get_functor ( ) const
template<typename T , std::size_t NDIM>
int madness::FunctionImpl< T, NDIM >::get_k ( ) const
template<typename T , std::size_t NDIM>
Future< double > madness::FunctionImpl< T, NDIM >::get_norm_tree_recursive ( const keyT key) const
template<typename T , std::size_t NDIM>
const std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > & madness::FunctionImpl< T, NDIM >::get_pmap ( ) const
template<typename T , std::size_t NDIM>
TensorArgs madness::FunctionImpl< T, NDIM >::get_tensor_args ( ) const
template<typename T , std::size_t NDIM>
TensorType madness::FunctionImpl< T, NDIM >::get_tensor_type ( ) const
template<typename T , std::size_t NDIM>
double madness::FunctionImpl< T, NDIM >::get_thresh ( ) const
template<typename T, std::size_t NDIM>
template<std::size_t LDIM, typename leaf_opT >
Void madness::FunctionImpl< T, NDIM >::hartree_product ( const FunctionImpl< T, LDIM > *  p1,
const 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
template<typename T, std::size_t NDIM>
T madness::FunctionImpl< T, NDIM >::inner_ext_local ( T(*)(const coordT &)  f,
const bool  leaf_refine 
) const
inline

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

Parameters
[in]fPointer to function of type T that take coordT arguments. 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.
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.
template<typename T, std::size_t NDIM>
T madness::FunctionImpl< T, NDIM >::inner_ext_node ( keyT  key,
tensorT  c,
T(*)(const coordT &)  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]fPointer to function of type T that take coordT arguments. 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< Q, NDIM >::inner_ext_recursive().

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.
template<typename T, std::size_t NDIM>
T madness::FunctionImpl< T, NDIM >::inner_ext_recursive ( keyT  key,
tensorT  c,
T(*)(const coordT &)  f,
const bool  leaf_refine,
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]fPointer to function of type T that take coordT arguments. 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< Q, NDIM >::inner_ext_recursive(), madness::FunctionImpl< T, NDIM >::do_inner_ext_local::operator()(), and madness::FunctionImpl< T, NDIM >::do_inner_ext_local_ffi::operator()().

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,
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.
template<typename T , std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::insert_zero_down_to_initial_level ( const keyT key)

Initialize nodes to zero function at initial_level of refinement.

Works for either basis. No communication.

References madness::Key< NDIM >::level(), max, and PROFILE_MEMBER_FUNC.

Referenced by madness::FunctionImpl< Q, NDIM >::FunctionImpl().

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

Returns true if the function is redundant.

template<typename T , std::size_t NDIM>
const FunctionImpl< T, NDIM >::keyT & madness::FunctionImpl< T, NDIM >::key0 ( ) const
template<typename T, std::size_t NDIM>
template<typename Archive >
void madness::FunctionImpl< T, NDIM >::load ( Archive &  ar)
inline
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 madness::FunctionNode< T, NDIM >::is_leaf().

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

Referenced by madness::FunctionImpl< Q, NDIM >::apply(), madness::FunctionImpl< Q, NDIM >::apply_1d_realspace_push(), madness::FunctionImpl< Q, NDIM >::apply_source_driven(), madness::FunctionImpl< Q, NDIM >::binaryXXa(), madness::FunctionImpl< Q, NDIM >::do_apply_kernel2(), madness::FunctionImpl< Q, NDIM >::do_project_out(), madness::FunctionImpl< Q, NDIM >::forward_traverse(), madness::FunctionImpl< Q, NDIM >::FunctionImpl(), madness::FunctionImpl< Q, NDIM >::gaxpy_ext_recursive(), madness::FunctionImpl< Q, NDIM >::gaxpy_inplace(), madness::FunctionImpl< T, NDIM >::hartree_op< LDIM, leaf_opT >::hartree_op(), madness::FunctionImpl< Q, NDIM >::hartree_product(), madness::FunctionImpl< Q, NDIM >::load(), madness::archive::ArchiveLoadImpl< Archive, const FunctionImpl< T, NDIM > * >::load(), madness::archive::ArchiveLoadImpl< Archive, FunctionImpl< T, NDIM > * >::load(), madness::FunctionImpl< Q, NDIM >::make_Vphi(), madness::FunctionImpl< Q, NDIM >::merge_trees(), madness::FunctionImpl< Q, NDIM >::mulXXa(), madness::FunctionImpl< Q, NDIM >::mulXXveca(), madness::FunctionImpl< Q, NDIM >::NS_fcube_for_mul(), madness::FunctionImpl< Q, NDIM >::NScoeffs2values(), madness::FunctionImpl< T, NDIM >::do_check_symmetry_local::operator()(), madness::FunctionImpl< T, NDIM >::multiply_op< LDIM >::operator()(), madness::FunctionImpl< T, NDIM >::project_out_op< LDIM >::operator()(), madness::FunctionImpl< Q, NDIM >::read_grid(), madness::FunctionImpl< Q, NDIM >::read_grid2(), madness::FunctionImpl< T, NDIM >::recursive_apply_op< opT, LDIM >::recursive_apply_op(), madness::FunctionImpl< Q, NDIM >::refine_op(), madness::FunctionImpl< T, NDIM >::multiply_op< LDIM >::screen(), madness::FunctionImpl< Q, NDIM >::traverse_tree(), madness::FunctionImpl< Q, NDIM >::values2NScoeffs(), and madness::FunctionImpl< T, NDIM >::Vphi_op_NS< opT, LDIM >::Vphi_op_NS().

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

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

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

References madness::TensorArgs::thresh.

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
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 madness::f, and PROFILE_MEMBER_FUNC.

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.

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 N.

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.

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

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

first step in an inplace gaxpy operation for reconstructed functions; assuming the same distribution for this and other

Parameters
[in]alphaprefactor for this
[in]betaprefactor for other
[in]otherthe other function, reconstructed
Returns
this = alpha *this + beta * other

Referenced by madness::FunctionImpl< Q, NDIM >::gaxpy_inplace_reconstructed().

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.

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
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
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
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)
Returns
this the NDIM function h(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 madness::GenTensor< T >::config(), madness::copy(), madness::GenTensor< T >::full_tensor(), madness::GenTensor< T >::rank(), madness::GenTensor< T >::tensor_type(), madness::TT_2D, and madness::TT_FULL.

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
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
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
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
template<typename T , std::size_t NDIM>
Key< NDIM > madness::FunctionImpl< T, NDIM >::neighbor ( const keyT key,
const keyT disp,
const std::vector< bool > &  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
  • Zero BC - returns invalid() to indicate out of volume

References madness::Key< NDIM >::level(), NDIM, and madness::Key< NDIM >::translation().

Referenced by madness::FunctionImpl< Q, NDIM >::do_apply(), and madness::FunctionImpl< Q, NDIM >::do_apply_directed_screening().

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)

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

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

References PROFILE_MEMBER_FUNC.

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

template<typename T , std::size_t NDIM>
double madness::FunctionImpl< T, NDIM >::norm_tree_op ( const keyT key,
const std::vector< Future< double > > &  v 
)
template<typename T , std::size_t NDIM>
Future< double > madness::FunctionImpl< T, NDIM >::norm_tree_spawn ( const keyT key)
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 (!)
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 (!)
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
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::BaseTensor::dim(), madness::f, madness::GenTensor< T >::full_tensor_copy(), madness::FunctionImpl< T, NDIM >::get_k(), madness::FunctionImpl< T, NDIM >::get_tensor_args(), madness::Key< NDIM >::level(), MADNESS_EXCEPTION, and madness::FunctionImpl< T, NDIM >::parent_to_child().

Referenced by madness::CoeffTracker< T, LDIM >::coeff().

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.

References madness::legendre_scaling_functions(), mu, PROFILE_MEMBER_FUNC, and madness::scale().

Referenced by madness::FunctionImpl< Q, NDIM >::fcube_for_mul(), and madness::FunctionImpl< Q, NDIM >::NS_fcube_for_mul().

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
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

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

Prints summary of data distribution.

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

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

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 
)
template<typename T , std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::print_size ( const std::string  name) const

print tree size and size

References madness::norm(), sqrt(), std::tr1::T(), and madness::wall_time().

template<typename T , std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::print_stats ( ) const
template<typename T , std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::print_timer ( ) const
template<typename T , std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::print_tree ( std::ostream &  os = std::cout,
Level  maxlevel = 10000 
) const
template<typename T , std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::print_tree_graphviz ( std::ostream &  os = std::cout,
Level  maxlevel = 10000 
) const
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.

References madness::fast_transform(), madness::fcube(), madness::Key< NDIM >::level(), MADNESS_EXCEPTION, NDIM, PROFILE_MEMBER_FUNC, and sqrt().

template<typename T , std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::project ( const implT old,
bool  fence 
)
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

Parameters
[in]resultlo-dim function of NDIM-LDIM
[in]glo-dim function of LDIM
[in]dimover which dimensions to be integrated: 0..LDIM or LDIM..LDIM+NDIM-1
Returns
this, with contributions on all scales
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
Returns
this, with contributions on all scales
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.

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 madness::copy(), madness::FunctionDefaults< NDIM >::get_bc(), madness::Key< NDIM >::is_neighbor_of(), madness::BoundaryConditions< NDIM >::is_periodic(), madness::Key< NDIM >::level(), PROFILE_BLOCK, PROFILE_MEMBER_FUNC, madness::project(), simpt2key(), std::tr1::T(), and thresh.

Referenced by madness::FunctionImpl< Q, NDIM >::FunctionImpl().

template<typename T , std::size_t NDIM>
Void madness::FunctionImpl< T, NDIM >::put_in_box ( ProcessID  from,
long  nl,
long  ni 
) const
template<typename T, std::size_t NDIM>
template<size_t FDIM>
enable_if_c<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
template<typename T, std::size_t NDIM>
template<size_t FDIM>
enable_if_c<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
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(), madness::FunctionNode< T, NDIM >::has_coeff(), madness::GenTensor< T >::real_size(), and mpfr::sum().

template<typename T , std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::reconstruct ( bool  fence)
template<typename T , std::size_t NDIM>
Void madness::FunctionImpl< T, NDIM >::reconstruct_op ( const keyT key,
const coeffT s 
)
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]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
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]opthe operator acting on the NS tree
[in]fimplthe funcimpl of the source function
[in]rimpla dummy function for recursive_op to insert data
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 
)
template<typename T , std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::reduce_rank ( const TensorArgs targs,
bool  fence 
)

reduce the rank of the coefficients tensors

Parameters
[in]targstarget tensor arguments (threshold and full/low rank)
template<typename T, std::size_t NDIM>
template<typename opT >
void madness::FunctionImpl< T, NDIM >::refine ( const opT &  op,
bool  fence 
)
inline
template<typename T, std::size_t NDIM>
template<typename opT >
Void madness::FunctionImpl< T, NDIM >::refine_op ( const opT &  op,
const keyT key 
)
inline
template<typename T, std::size_t NDIM>
template<typename opT >
Void madness::FunctionImpl< T, NDIM >::refine_spawn ( const opT &  op,
const keyT key 
)
inline
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
v]is the vector of functions we are refining.
key]is the current node.
c]is the vector of coefficients passed from above.

References madness::copy().

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

In-place scale by a constant.

Referenced by madness::FunctionImpl< Q, NDIM >::gaxpy_inplace().

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

Out-of-place scale by a constant.

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

References thresh.

template<typename T , std::size_t NDIM>
Key< NDIM > madness::FunctionImpl< T, NDIM >::simpt2key ( const coordT pt,
Level  n 
) const

Returns the box at level n that contains the given point in simulation coordinates.

References NDIM.

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

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

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

Referenced by madness::FunctionImpl< Q, NDIM >::mulXXveca().

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.

References madness::FunctionNode< T, NDIM >::coeff(), madness::FunctionNode< T, NDIM >::has_coeff(), madness::TaskAttributes::hipri(), madness::Key< NDIM >::parent(), PROFILE_BLOCK, PROFILE_MEMBER_FUNC, madness::ref(), and madness::Future< T >::set().

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

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
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.

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::nonstandard().

template<typename T, std::size_t NDIM>
template<typename Archive >
void madness::FunctionImpl< T, NDIM >::store ( Archive &  ar)
inline
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.

template<typename T , std::size_t NDIM>
Void madness::FunctionImpl< T, NDIM >::sum_down_spawn ( const keyT key,
const coeffT s 
)
template<typename T, std::size_t NDIM>
template<typename R >
madness::FunctionImpl< T, NDIM >::TENSOR_RESULT_TYPE ( ,
R   
) const

Returns the inner product ASSUMING same distribution.

handles compressed and redundant form

Referenced by madness::FunctionImpl< Q, NDIM >::mul().

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

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 madness::copy(), and PROFILE_MEMBER_FUNC.

Referenced by madness::FunctionImpl< T, NDIM >::multiply_op< LDIM >::screen().

template<typename T , std::size_t NDIM>
T madness::FunctionImpl< T, NDIM >::trace_local ( ) const
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
Returns
nothing, but might continue the recursion, depending on coeff_op
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 mpfr::sum(), and mpfr::mpreal::sum.

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 madness::nonstandard().

template<typename T , std::size_t NDIM>
Void madness::FunctionImpl< T, NDIM >::trickle_down_op ( const keyT key,
const coeffT s 
)
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

References thresh.

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 
)
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 madness::copy(), madness::error(), madness::FunctionNode< T, NDIM >::set_has_children(), and sqrt().

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 madness::TaskAttributes::hipri(), and NDIM.

template<typename T , std::size_t NDIM>
Future< bool > madness::FunctionImpl< T, NDIM >::truncate_spawn ( const keyT key,
double  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.

References madness::FunctionDefaults< NDIM >::get_cell_min_width(), L, madness::Key< NDIM >::level(), MADNESS_EXCEPTION, mpfr::min(), and NDIM.

Referenced by madness::FunctionImpl< Q, NDIM >::apply_1d_realspace_push_op(), madness::FunctionImpl< Q, NDIM >::do_apply(), madness::FunctionImpl< Q, NDIM >::do_apply_directed_screening(), madness::FunctionImpl< T, NDIM >::recursive_apply_op< opT, LDIM >::finalize(), madness::FunctionImpl< T, NDIM >::recursive_apply_op2< opT >::finalize(), madness::FunctionImpl< Q, NDIM >::gaxpy_ext_recursive(), madness::FunctionImpl< Q, NDIM >::mulXXa(), madness::FunctionImpl< Q, NDIM >::mulXXveca(), madness::error_leaf_op< T, NDIM >::operator()(), madness::hartree_leaf_op< T, NDIM >::operator()(), madness::op_leaf_op< T, NDIM, opT >::operator()(), madness::hartree_convolute_leaf_op< T, NDIM, LDIM, opT >::operator()(), madness::FunctionImpl< T, NDIM >::do_truncate_NS_leafs::operator()(), madness::FunctionImpl< T, NDIM >::Vphi_op_NS< opT, LDIM >::operator()(), madness::FunctionImpl< T, NDIM >::multiply_op< LDIM >::screen(), and madness::FunctionImpl< Q, NDIM >::vtransform_doit().

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.

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.

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.

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
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
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
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

References madness::nonstandard().

Referenced by madness::FunctionImpl< Q, NDIM >::make_Vphi(), madness::multiply(), and madness::Function< double, 6 >::project_out().

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

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 madness::fast_transform().

Referenced by madness::FunctionImpl< Q, NDIM >::binaryXXa(), madness::FunctionImpl< Q, NDIM >::gaxpy_ext_recursive(), madness::FunctionImpl< Q, NDIM >::inner_ext_recursive(), madness::FunctionImpl< T, NDIM >::Vphi_op_NS< opT, LDIM >::make_childrens_sum_coeffs(), madness::FunctionImpl< Q, NDIM >::mulXXa(), and madness::FunctionImpl< Q, NDIM >::refine_op().

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

References madness::transform().

template<typename T , std::size_t NDIM>
void madness::FunctionImpl< T, NDIM >::unset_functor ( )
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!!)
[in]argsTensorArguments for possible low rank approximations
Returns
sum coefficients on level n+1

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

Referenced by madness::error_leaf_op< T, NDIM >::operator()().

template<typename T, std::size_t NDIM>
template<typename Q >
GenTensor<Q> madness::FunctionImpl< T, NDIM >::values2coeffs ( const keyT key,
const GenTensor< Q > &  values 
) const
inline
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
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
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 madness::FunctionNode< T, NDIM >::coeff(), madness::BaseTensor::dim(), madness::FunctionNode< T, NDIM >::has_children(), madness::GenTensor< T >::has_data(), madness::Key< NDIM >::level(), MADNESS_EXCEPTION, madness::Key< NDIM >::parent(), madness::print(), and PROFILE_MEMBER_FUNC.

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.

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

Friends And Related Function Documentation

template<typename T, std::size_t NDIM>
template<typename Q , std::size_t D>
friend class FunctionImpl
friend

Member Data Documentation

template<typename T, std::size_t NDIM>
long madness::FunctionImpl< T, NDIM >::box_interior[1000]
mutable
template<typename T, std::size_t NDIM>
long madness::FunctionImpl< T, NDIM >::box_leaf[1000]
mutable
template<typename T, std::size_t NDIM>
NDIM& g madness::FunctionImpl< T, NDIM >::const
template<typename T, std::size_t NDIM>
bool madness::FunctionImpl< T, NDIM >::do_new
template<typename T, std::size_t NDIM>
AtomicInt madness::FunctionImpl< T, NDIM >::large
template<typename T, std::size_t NDIM>
bool madness::FunctionImpl< T, NDIM >::leaves_only =(this->is_redundant())
template<typename T, std::size_t NDIM>
AtomicInt madness::FunctionImpl< T, NDIM >::small
template<typename T, std::size_t NDIM>
Timer madness::FunctionImpl< T, NDIM >::timer_accumulate
template<typename T, std::size_t NDIM>
Timer madness::FunctionImpl< T, NDIM >::timer_compress_svd
template<typename T, std::size_t NDIM>
Timer madness::FunctionImpl< T, NDIM >::timer_filter
template<typename T, std::size_t NDIM>
Timer madness::FunctionImpl< T, NDIM >::timer_lr_result
template<typename T, std::size_t NDIM>
Timer madness::FunctionImpl< T, NDIM >::timer_target_driven
template<typename T, std::size_t NDIM>
World& madness::FunctionImpl< T, NDIM >::world

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