MADNESS  version 0.9
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
madness::Function< T, NDIM > Class Template Reference

A multiresolution adaptive numerical function. More...

#include <derivative.h>

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

Classes

struct  autorefine_square_op
 
struct  SimpleUnaryOpWrapper
 

Public Types

typedef FunctionImpl< T, NDIMimplT
 
typedef FunctionNode< T, NDIMnodeT
 
typedef FunctionFactory< T, NDIMfactoryT
 
typedef Vector< double, NDIMcoordT
 Type of vector holding coordinates. More...
 

Public Member Functions

void verify () const
 Asserts that the function is initialized. More...
 
bool is_initialized () const
 Returns true if the function is initialized. More...
 
 Function ()
 Default constructor makes uninitialized function. No communication. More...
 
 Function (const factoryT &factory)
 Constructor from FunctionFactory provides named parameter idiom. Possible non-blocking communication. More...
 
 Function (const Function< T, NDIM > &f)
 Copy constructor is shallow. No communication, works in either basis. More...
 
Function< T, NDIM > & operator= (const Function< T, NDIM > &f)
 Assignment is shallow. No communication, works in either basis. More...
 
 ~Function ()
 Destruction of any underlying implementation is deferred to next global fence. More...
 
Future< T > eval (const coordT &xuser) const
 Evaluates the function at a point in user coordinates. Possible non-blocking comm. More...
 
std::pair< bool, T > eval_local_only (const Vector< double, NDIM > &xuser, Level maxlevel) const
 Evaluate function only if point is local returning (true,value); otherwise return (false,0.0) More...
 
Future< Levelevaldepthpt (const coordT &xuser) const
 
Future< long > evalR (const coordT &xuser) const
 Evaluates the function rank at a point in user coordinates. Possible non-blocking comm. More...
 
Tensor< T > eval_cube (const Tensor< double > &cell, const std::vector< long > &npt, bool eval_refine=false) const
 Evaluates a cube/slice of points (probably for plotting) ... collective but no fence necessary. More...
 
operator() (const coordT &xuser) const
 Evaluates the function at a point in user coordinates. Collective operation. More...
 
operator() (double x, double y=0, double z=0, double xx=0, double yy=0, double zz=0) const
 Evaluates the function at a point in user coordinates. Collective operation. More...
 
Level depthpt (const coordT &xuser) const
 
template<typename funcT >
double errsq_local (const funcT &func) const
 Returns an estimate of the difference ||this-func||^2 from local data. More...
 
template<typename funcT >
double err (const funcT &func) const
 Returns an estimate of the difference ||this-func|| ... global sum performed. More...
 
void verify_tree () const
 Verifies the tree data structure ... global sync implied. More...
 
bool is_compressed () const
 Returns true if compressed, false otherwise. No communication. More...
 
std::size_t tree_size () const
 Returns the number of nodes in the function tree ... collective global sum. More...
 
void print_size (const std::string name) const
 print some info about this More...
 
std::size_t max_depth () const
 Returns the maximum depth of the function tree ... collective global sum. More...
 
std::size_t max_local_depth () const
 Returns the maximum local depth of the function tree ... no communications. 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 size () const
 Returns the number of coefficients in the function ... collective global sum. More...
 
bool autorefine () const
 Returns value of autorefine flag. No communication. More...
 
void set_autorefine (bool value, bool fence=true)
 Sets the value of the autorefine flag. Optional global fence. More...
 
double thresh () const
 Returns value of truncation threshold. No communication. More...
 
void set_thresh (double value, bool fence=true)
 Sets the vaule of the truncation threshold. Optional global fence. More...
 
int k () const
 Returns the number of multiwavelets (k). No communication. More...
 
Function< T, NDIM > & truncate (double tol=0.0, bool fence=true)
 Truncate the function with optional fence. Compresses with fence if not compressed. More...
 
const std::shared_ptr
< FunctionImpl< T, NDIM > > & 
get_impl () const
 Returns a shared-pointer to the implementation. More...
 
void set_impl (const std::shared_ptr< FunctionImpl< T, NDIM > > &impl)
 Replace current FunctionImpl with provided new one. More...
 
void set_functor (const std::shared_ptr< FunctionFunctorInterface< T, NDIM > > functor)
 Replace the current functor with the provided new one. More...
 
bool is_on_demand () const
 
template<typename R >
void set_impl (const Function< R, NDIM > &f, bool zero=true)
 Replace current FunctionImpl with a new one using the same parameters & map as f. More...
 
Worldworld () const
 Returns the world. More...
 
const std::shared_ptr
< WorldDCPmapInterface< Key
< NDIM > > > & 
get_pmap () const
 Returns a shared pointer to the process map. More...
 
double norm2sq_local () const
 Returns the square of the norm of the local function ... no communication. More...
 
double norm2 () const
 Returns the 2-norm of the function ... global sum ... works in either basis. More...
 
void norm_tree (bool fence=true) const
 Initializes information about the function norm at all length scales. More...
 
const Function< T, NDIM > & compress (bool fence=true) const
 Compresses the function, transforming into wavelet basis. Possible non-blocking comm. More...
 
void nonstandard (bool keepleaves, bool fence=true)
 Compresses the function retaining scaling function coeffs. Possible non-blocking comm. More...
 
void standard (bool fence=true)
 Converts the function from nonstandard form to standard form. Possible non-blocking comm. More...
 
void reconstruct (bool fence=true) const
 Reconstructs the function, transforming into scaling function basis. Possible non-blocking comm. More...
 
void sum_down (bool fence=true) const
 Sums scaling coeffs down tree restoring state with coeffs only at leaves. Optional fence. Possible non-blocking comm. More...
 
template<typename opT >
void refine_general (const opT &op, bool fence=true) const
 Inplace autorefines the function. Optional fence. Possible non-blocking comm. More...
 
void refine (bool fence=true)
 Inplace autorefines the function using same test as for squaring. More...
 
void broaden (const BoundaryConditions< NDIM > &bc=FunctionDefaults< NDIM >::get_bc(), bool fence=true) const
 Inplace broadens support in scaling function basis. More...
 
Tensor< T > coeffs_for_jun (Level n, long mode=0)
 Get the scaling function coeffs at level n starting from NS form. More...
 
void clear (bool fence=true)
 Clears the function as if constructed uninitialized. Optional fence. More...
 
void print_tree (std::ostream &os=std::cout) const
 Process 0 prints a summary of all nodes in the tree (collective) More...
 
void print_tree_graphviz (std::ostream &os=std::cout) const
 Process 0 prints a graphviz-formatted output of all nodes in the tree (collective) More...
 
void print_info () const
 Print a summary of the load balancing info. More...
 
void unaryop (T(*f)(T))
 Inplace unary operation on function values. More...
 
template<typename opT >
void unaryop (const opT &op, bool fence=true)
 Inplace unary operation on function values. More...
 
template<typename opT >
void unaryop_coeff (const opT &op, bool fence=true)
 Unary operation applied inplace to the coefficients. More...
 
template<typename opT >
void unaryop_node (const opT &op, bool fence=true)
 Unary operation applied inplace to the nodes. More...
 
Function< T, NDIMconj (bool fence=true)
 Inplace complex conjugate. No communication except for optional fence. More...
 
template<typename Q >
Function< T, NDIM > & scale (const Q q, bool fence=true)
 Inplace, scale the function by a constant. No communication except for optional fence. More...
 
Function< T, NDIM > & add_scalar (T t, bool fence=true)
 Inplace add scalar. No communication except for optional fence. More...
 
template<typename Q , typename R >
Function< T, NDIM > & gaxpy (const T &alpha, const Function< Q, NDIM > &other, const R &beta, bool fence=true)
 Inplace, general bi-linear operation in wavelet basis. No communication except for optional fence. More...
 
template<typename Q >
Function< T, NDIM > & operator+= (const Function< Q, NDIM > &other)
 Inplace addition of functions in the wavelet basis. More...
 
template<typename Q >
Function< T, NDIM > & operator-= (const Function< Q, NDIM > &other)
 Inplace subtraction of functions in the wavelet basis. More...
 
template<typename Q >
IsSupported< TensorTypeData< Q >
, Function< T, NDIM > >::type & 
operator*= (const Q q)
 Inplace scaling by a constant. More...
 
Function< T, NDIM > & square (bool fence=true)
 Inplace squaring of function ... global comm only if not reconstructed. More...
 
Function< T, NDIM > & abs (bool fence=true)
 Returns *this for chaining. More...
 
Function< T, NDIM > & abs_square (bool fence=true)
 Returns *this for chaining. More...
 
trace_local () const
 Returns local contribution to int(f(x),x) ... no communication. More...
 
trace () const
 Returns global value of int(f(x),x) ... global comm required. More...
 
template<typename R >
 TENSOR_RESULT_TYPE (T, R) inner_local(const Function<R
 Returns local part of inner product ... throws if both not compressed. More...
 
 MADNESS_ASSERT (is_compressed())
 
 MADNESS_ASSERT (g.is_compressed())
 
 if (VERIFY_TREE) verify_tree()
 
 if (VERIFY_TREE) g.verify_tree()
 
return impl inner_local * g ())
 
template<typename R >
Function< T, NDIM > & fill_tree (const Function< R, NDIM > &g, bool fence=true)
 With this being an on-demand function, fill the MRA tree according to different criteria. More...
 
template<typename opT >
Function< T, NDIM > & fill_tree (const opT &op, bool fence=true)
 With this being an on-demand function, fill the MRA tree according to different criteria. More...
 
Function< T, NDIM > & fill_tree (bool fence=true)
 With this being an on-demand function, fill the MRA tree according to different criteria. More...
 
template<size_t LDIM, size_t KDIM, typename opT >
void do_hartree_product (const FunctionImpl< T, LDIM > *left, const FunctionImpl< T, KDIM > *right, const opT *op)
 perform the hartree product of f*g, invoked by result More...
 
template<size_t LDIM, size_t KDIM>
void do_hartree_product (const FunctionImpl< T, LDIM > *left, const FunctionImpl< T, KDIM > *right)
 perform the hartree product of f*g, invoked by result More...
 
template<typename R >
 TENSOR_RESULT_TYPE (T, R) inner(const Function<R
 Returns the inner product. More...
 
 if (not this->is_initialized()) return 0.0
 
 if (not g.is_initialized()) return 0.0
 
 if (this->get_impl()==g.get_impl())
 
 if (this->is_on_demand()) return g.inner_on_demand(*this)
 
 if (g.is_on_demand()) return this-> inner_on_demand(g)
 
 if (VERIFY_TREE) verify_tree()
 
 if (VERIFY_TREE) g.verify_tree()
 
 if (NDIM==3)
 
 if (this->is_compressed() and g.is_compressed())
 
 if (not g.get_impl() ->is_redundant()) g.get_impl() -> make_redundant(false)
 
impl world gop fence ()
 
 TENSOR_RESULT_TYPE (T, R) local
 
impl world gop sum (local)
 
impl world gop fence ()
 
 if (this->get_impl() ->is_redundant()) this-> get_impl() ->undo_redundant(false)
 
 if (g.get_impl() ->is_redundant()) g.get_impl() -> undo_redundant(false)
 
impl world gop fence ()
 
inner_ext_local (T(*f)(const coordT &), const bool leaf_refine=true, const bool keep_redundant=false) const
 
inner_ext (T(*f)(const coordT &), const bool leaf_refine=true, const bool keep_redundant=false) const
 
inner_ext_local (const std::shared_ptr< FunctionFunctorInterface< T, NDIM > > f, const bool leaf_refine=true, const bool keep_redundant=false) const
 
inner_ext (const std::shared_ptr< FunctionFunctorInterface< T, NDIM > > f, const bool leaf_refine=true, const bool keep_redundant=false) const
 
template<typename L >
Void gaxpy_ext (const Function< L, NDIM > &left, T(*f)(const coordT &), T alpha, T beta, double tol, bool fence=true) const
 
template<typename R >
 TENSOR_RESULT_TYPE (T, R) inner_on_demand(const Function<R
 Returns the inner product for one on-demand function. More...
 
this reconstruct ()
 
leaf_op< T, NDIMfnode_is_leaf (this->get_impl().get())
 
g get_impl () -> make_Vphi(fnode_is_leaf, true)
 
 if (VERIFY_TREE) verify_tree()
 
 TENSOR_RESULT_TYPE (T, R) local
 
impl world gop sum (local)
 
impl world gop fence ()
 
g get_impl () -> set_functor(func)
 
g get_impl () -> get_coeffs().clear()
 
g get_impl () -> is_on_demand()=true
 
template<typename R , size_t LDIM>
Function< TENSOR_RESULT_TYPE(T,
R), NDIM-LDIM > 
project_out (const Function< R, LDIM > &g, const int dim) const
 project this on the low-dim function g: h(x) = <f(x,y) | g(y)> More...
 
template<typename Archive >
void load (World &world, Archive &ar)
 Replaces this function with one loaded from an archive using the default processor map. More...
 
template<typename Archive >
void store (Archive &ar) const
 Stores the function to an archive. More...
 
void change_tensor_type (const TensorArgs &targs, bool fence=true)
 change the tensor type of the coefficients in the FunctionNode More...
 
template<typename Q , typename opT >
Function< typename
opT::resultT, NDIM > & 
unary_op_coeffs (const Function< Q, NDIM > &func, const opT &op, bool fence)
 This is replaced with left*right ... private. More...
 
void refine_to_common_level (std::vector< Function< T, NDIM > > &vf, bool fence=true)
 Refine vector of functions down to common finest level (reconstructs as necessary, optional fence) More...
 
template<typename opT >
Function< T, NDIM > & multiop_values (const opT &op, const std::vector< Function< T, NDIM > > &vf)
 This is replaced with op(vector of functions) ... private. More...
 
template<typename L , typename R >
void vmulXX (const Function< L, NDIM > &left, const std::vector< Function< R, NDIM > > &right, std::vector< Function< T, NDIM > > &result, double tol, bool fence)
 Multiplication of function * vector of functions using recursive algorithm of mulxx. More...
 
template<typename L , typename R >
void mul_on_demand (const Function< L, NDIM > &f, const Function< R, NDIM > &g, bool fence=true)
 Same as operator* but with optional fence and no automatic reconstruction. More...
 
template<typename R , typename Q >
void vtransform (const std::vector< Function< R, NDIM > > &v, const Tensor< Q > &c, std::vector< Function< T, NDIM > > &vresult, double tol, bool fence=true)
 sparse transformation of a vector of functions ... private More...
 
template<typename L , typename R >
Function< T, NDIM > & gaxpy_oop (T alpha, const Function< L, NDIM > &left, T beta, const Function< R, NDIM > &right, bool fence)
 This is replaced with alpha*left + beta*right ... private. More...
 
Function< T, NDIM > & mapdim (const Function< T, NDIM > &f, const std::vector< long > &map, bool fence)
 This is replaced with mapdim(f) ... private. More...
 
double check_symmetry () const
 check symmetry of a function by computing the 2nd derivative More...
 
Function< T, NDIM > & reduce_rank (const bool fence=true)
 reduce the rank of the coefficient tensors More...
 

Static Public Member Functions

static void doconj (const Key< NDIM >, Tensor< T > &t)
 
template<typename Q , std::size_t D>
static std::vector
< std::shared_ptr
< FunctionImpl< Q, D > > > 
vimpl (const std::vector< Function< Q, D > > &v)
 Returns vector of FunctionImpl pointers corresponding to vector of functions. More...
 

Public Attributes

NDIM &g const
 
 else
 
return local
 
std::shared_ptr
< FunctionFunctorInterface< T,
NDIM > > 
func =g.get_impl()->get_functor()
 

Detailed Description

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

A multiresolution adaptive numerical function.

Member Typedef Documentation

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

Type of vector holding coordinates.

template<typename T, std::size_t NDIM>
typedef FunctionFactory<T,NDIM> madness::Function< T, NDIM >::factoryT
template<typename T, std::size_t NDIM>
typedef FunctionImpl<T,NDIM> madness::Function< T, NDIM >::implT
template<typename T, std::size_t NDIM>
typedef FunctionNode<T,NDIM> madness::Function< T, NDIM >::nodeT

Constructor & Destructor Documentation

template<typename T, std::size_t NDIM>
madness::Function< T, NDIM >::Function ( )
inline

Default constructor makes uninitialized function. No communication.

An unitialized function can only be assigned to. Any other operation will throw.

template<typename T, std::size_t NDIM>
madness::Function< T, NDIM >::Function ( const factoryT factory)
inline

Constructor from FunctionFactory provides named parameter idiom. Possible non-blocking communication.

template<typename T, std::size_t NDIM>
madness::Function< T, NDIM >::Function ( const Function< T, NDIM > &  f)
inline

Copy constructor is shallow. No communication, works in either basis.

template<typename T, std::size_t NDIM>
madness::Function< T, NDIM >::~Function ( )
inline

Destruction of any underlying implementation is deferred to next global fence.

Member Function Documentation

template<typename T, std::size_t NDIM>
Function<T,NDIM>& madness::Function< T, NDIM >::abs ( bool  fence = true)
inline

Returns *this for chaining.

Referenced by madness::abs(), and madness::detail::abssqop< NDIM >::operator()().

template<typename T, std::size_t NDIM>
Function<T,NDIM>& madness::Function< T, NDIM >::abs_square ( bool  fence = true)
inline

Returns *this for chaining.

Referenced by madness::abs_square().

template<typename T, std::size_t NDIM>
Function<T,NDIM>& madness::Function< T, NDIM >::add_scalar ( t,
bool  fence = true 
)
inline

Inplace add scalar. No communication except for optional fence.

Referenced by calcEpshat(), and propagate().

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

Returns value of autorefine flag. No communication.

template<typename T, std::size_t NDIM>
void madness::Function< T, NDIM >::broaden ( const BoundaryConditions< NDIM > &  bc = FunctionDefaults<NDIM>::get_bc(),
bool  fence = true 
) const
inline

Inplace broadens support in scaling function basis.

Referenced by APPLY(), madness::SCF::APPLY(), madness::APPLY(), and loadbal().

template<typename T, std::size_t NDIM>
void madness::Function< T, NDIM >::change_tensor_type ( const TensorArgs targs,
bool  fence = true 
)
inline

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::Function< T, NDIM >::check_symmetry ( ) const
inline

check symmetry of a function by computing the 2nd derivative

Referenced by madness::MP2::asymmetry().

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

Clears the function as if constructed uninitialized. Optional fence.

Any underlying data will not be freed until the next global fence.

Referenced by EFieldOperator::action(), madness::apply(), calcScatField(), madness::FunctionSpace< T, NDIM >::destroy(), doit(), energy(), madness::SCF::initial_guess(), main(), CoupledPurturbation::make_vpsi(), propagate(), and madness::SCF::solve().

template<typename T, std::size_t NDIM>
Tensor<T> madness::Function< T, NDIM >::coeffs_for_jun ( Level  n,
long  mode = 0 
)
inline

Get the scaling function coeffs at level n starting from NS form.

template<typename T, std::size_t NDIM>
const Function<T,NDIM>& madness::Function< T, NDIM >::compress ( bool  fence = true) const
inline

Compresses the function, transforming into wavelet basis. Possible non-blocking comm.

By default fence=true meaning that this operation completes before returning, otherwise if fence=false it returns without fencing and the user must invoke world.gop.fence() to assure global completion before using the function for other purposes.

Noop if already compressed or if not initialized.

Since reconstruction/compression do not discard information we define them as const ... "logical constness" not "bitwise constness".

Referenced by madness::add(), calcScatField(), madness::Solver< T, NDIM >::compute_rho(), energy(), expV(), madness::Function< double, 6 >::if(), madness::inner(), main(), madness::SCF::make_density(), madness::GTHPseudopotential< double >::make_pseudo_potential(), moments(), madness::Projector< double, 3 >::operator()(), madness::operator+(), madness::Function< double, 6 >::operator+=(), madness::operator-(), madness::Function< double, 6 >::operator-=(), propagate(), q_c(), test_truncation(), and madness::NonlinearSolverND< NDIM >::update().

template<typename T, std::size_t NDIM>
Function<T,NDIM> madness::Function< T, NDIM >::conj ( bool  fence = true)
inline

Inplace complex conjugate. No communication except for optional fence.

Returns this for chaining. Works in either basis.

Referenced by madness::conj().

template<typename T, std::size_t NDIM>
Level madness::Function< T, NDIM >::depthpt ( const coordT xuser) const
inline

Throws if function is not initialized.

This function mimics operator() by going through the tree looking for the depth of the tree at the point. It blocks until the result is available and then broadcasts the result to everyone. Therefore, if you are evaluating many points in parallel it is vastly less efficient than calling evaldepthpt directly, saving the futures, and then forcing all of the results.

template<typename T, std::size_t NDIM>
template<size_t LDIM, size_t KDIM, typename opT >
void madness::Function< T, NDIM >::do_hartree_product ( const FunctionImpl< T, LDIM > *  left,
const FunctionImpl< T, KDIM > *  right,
const opT *  op 
)
inline

perform the hartree product of f*g, invoked by result

Referenced by madness::hartree_product().

template<typename T, std::size_t NDIM>
template<size_t LDIM, size_t KDIM>
void madness::Function< T, NDIM >::do_hartree_product ( const FunctionImpl< T, LDIM > *  left,
const FunctionImpl< T, KDIM > *  right 
)
inline

perform the hartree product of f*g, invoked by result

template<typename T, std::size_t NDIM>
static void madness::Function< T, NDIM >::doconj ( const Key< NDIM ,
Tensor< T > &  t 
)
inlinestatic
template<typename T, std::size_t NDIM>
template<typename funcT >
double madness::Function< T, NDIM >::err ( const funcT &  func) const
inline

Returns an estimate of the difference ||this-func|| ... global sum performed.

If the function is compressed, it is reconstructed first. For efficient use especially with many functions, reconstruct them all first, and use errsq_local instead so you can perform a global sum on all at the same time.

Parameters
[in]funcTemplated interface to the a user specified function

Referenced by main().

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

Returns an estimate of the difference ||this-func||^2 from local data.

No communication is performed. If the function is not reconstructed, it throws an exception. To get the global value either do a global sum of the local values or call errsq

Parameters
[in]funcTemplated interface to the a user specified function
template<typename T, std::size_t NDIM>
Future<T> madness::Function< T, NDIM >::eval ( const coordT xuser) const
inline

Evaluates the function at a point in user coordinates. Possible non-blocking comm.

Only the invoking process will receive the result via the future though other processes may be involved in the evaluation.

Throws if function is not initialized.

Referenced by line_plot(), madness::Function< double, 6 >::operator()(), and madness::plot_line().

template<typename T, std::size_t NDIM>
Tensor<T> madness::Function< T, NDIM >::eval_cube ( const Tensor< double > &  cell,
const std::vector< long > &  npt,
bool  eval_refine = false 
) const
inline

Evaluates a cube/slice of points (probably for plotting) ... collective but no fence necessary.

All processes recieve the entire result (which is a rather severe limit on the size of the cube that is possible). Set eval_refine=true to return the refinment levels of the given function.

Parameters
[in]cellA Tensor describe the cube where the function to be evaluated in
[in]nptHow many points to evaluate in each dimension
[in]eval_refineWether to return the refinment levels of the given function
template<typename T, std::size_t NDIM>
std::pair<bool,T> madness::Function< T, NDIM >::eval_local_only ( const Vector< double, NDIM > &  xuser,
Level  maxlevel 
) const
inline

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

Referenced by projectL().

template<typename T, std::size_t NDIM>
Future<Level> madness::Function< T, NDIM >::evaldepthpt ( const coordT xuser) const
inline

Only the invoking process will receive the result via the future though other processes may be involved in the evaluation.

Throws if function is not initialized.

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

Referenced by madness::Function< double, 6 >::depthpt().

template<typename T, std::size_t NDIM>
Future<long> madness::Function< T, NDIM >::evalR ( const coordT xuser) const
inline

Evaluates the function rank at a point in user coordinates. Possible non-blocking comm.

Only the invoking process will receive the result via the future though other processes may be involved in the evaluation.

Throws if function is not initialized.

template<typename T, std::size_t NDIM>
impl world gop madness::Function< T, NDIM >::fence ( )

Referenced by madness::Function< double, 6 >::abs(), madness::Function< double, 6 >::abs_square(), madness::abssq(), madness::add(), madness::Function< double, 6 >::add_scalar(), madness::apply(), madness::apply_1d_realspace_push(), madness::apply_only(), madness::binary_op(), madness::Function< double, 6 >::broaden(), madness::Function< double, 6 >::change_tensor_type(), madness::Function< double, 6 >::clear(), madness::Function< double, 6 >::compress(), madness::Function< double, 6 >::conj(), madness::conj(), madness::convert(), madness::copy(), madness::PotentialManager::core_projection(), madness::SCF::core_projection(), madness::Function< double, 6 >::fill_tree(), madness::Function< double, 6 >::gaxpy(), madness::Function< double, 6 >::gaxpy_ext(), madness::Function< double, 6 >::gaxpy_oop(), madness::gaxpy_oop(), madness::gaxpy_oop_reconstructed(), madness::imag(), madness::mapdim(), madness::mul(), madness::Function< double, 6 >::mul_on_demand(), madness::mul_sparse(), madness::multiply(), madness::Function< double, 6 >::nonstandard(), madness::Function< double, 6 >::norm_tree(), madness::project(), propagate(), madness::real(), madness::Function< double, 6 >::reconstruct(), madness::Function< double, 6 >::reduce_rank(), madness::Function< double, 6 >::refine(), madness::Function< double, 6 >::refine_general(), madness::Function< double, 6 >::refine_to_common_level(), madness::Function< double, 6 >::scale(), madness::Function< double, 6 >::set_autorefine(), madness::Function< double, 6 >::set_thresh(), madness::Function< double, 6 >::square(), madness::Function< double, 6 >::standard(), madness::sub(), madness::Function< double, 6 >::sum_down(), madness::Function< double, 6 >::truncate(), madness::unary_op(), madness::Function< double, 6 >::unary_op_coeffs(), madness::unary_op_coeffs(), madness::Function< double, 6 >::unaryop(), madness::Function< double, 6 >::unaryop_coeff(), madness::Function< double, 6 >::unaryop_node(), madness::Function< double, 6 >::vmulXX(), madness::vmulXX(), and madness::Function< double, 6 >::vtransform().

template<typename T, std::size_t NDIM>
impl world gop madness::Function< T, NDIM >::fence ( )
template<typename T, std::size_t NDIM>
impl world gop madness::Function< T, NDIM >::fence ( )
template<typename T, std::size_t NDIM>
impl world gop madness::Function< T, NDIM >::fence ( )
template<typename T, std::size_t NDIM>
template<typename R >
Function<T,NDIM>& madness::Function< T, NDIM >::fill_tree ( const Function< R, NDIM > &  g,
bool  fence = true 
)
inline

With this being an on-demand function, fill the MRA tree according to different criteria.

Parameters
[in]gthe function after which the MRA structure is modeled (any basis works)

Referenced by apply_U_mix(), apply_U_ncf(), apply_V(), compute_energy(), compute_R2f2_psi(), reconstruct_psi(), test_adaptive_tree(), test_compress(), test_recursive_application(), and test_U_el().

template<typename T, std::size_t NDIM>
template<typename opT >
Function<T,NDIM>& madness::Function< T, NDIM >::fill_tree ( const opT &  op,
bool  fence = true 
)
inline

With this being an on-demand function, fill the MRA tree according to different criteria.

Parameters
[in]opthe convolution operator for screening
template<typename T, std::size_t NDIM>
Function<T,NDIM>& madness::Function< T, NDIM >::fill_tree ( bool  fence = true)
inline

With this being an on-demand function, fill the MRA tree according to different criteria.

Parameters
[in]opthe convolution operator for screening
template<typename T, std::size_t NDIM>
leaf_op<T,NDIM> madness::Function< T, NDIM >::fnode_is_leaf ( this->  get_impl).get()
template<typename T, std::size_t NDIM>
return impl inner_local* madness::Function< T, NDIM >::g ( )

Referenced by madness::multiply().

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

Inplace, general bi-linear operation in wavelet basis. No communication except for optional fence.

If the functions are not in the wavelet basis an exception is thrown since this routine is intended to be fast and unexpected compression is assumed to be a performance bug.

Returns this for chaining.

this <– this*alpha + other*beta

Referenced by madness::Solver< T, NDIM >::compute_rho(), madness::SCF::derivatives(), expV(), madness::FunctionSpace< T, NDIM >::gaxpy(), madness::SCF::make_density(), madness::GTHPseudopotential< double >::make_pseudo_potential(), moments(), madness::Projector< double, 3 >::operator()(), madness::Function< double, 6 >::operator+=(), madness::Function< double, 6 >::operator-=(), propagate(), q_c(), and madness::NonlinearSolverND< NDIM >::update().

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

Return the local part of gaxpy with external function, this*alpha + f*beta ... no communication.

Parameters
[in]alphaprefactor for this Function
[in]fPointer to function of type T that take coordT arguments. This is the externally provided function
[in]betaprefactor for f
Returns
Returns local part of the gaxpy, i.e. over the domain of all function nodes on this compute node.
template<typename T, std::size_t NDIM>
template<typename L , typename R >
Function<T,NDIM>& madness::Function< T, NDIM >::gaxpy_oop ( alpha,
const Function< L, NDIM > &  left,
beta,
const Function< R, NDIM > &  right,
bool  fence 
)
inline

This is replaced with alpha*left + beta*right ... private.

Referenced by madness::add(), madness::gaxpy_oop(), and madness::sub().

template<typename T, std::size_t NDIM>
const std::shared_ptr< FunctionImpl<T,NDIM> >& madness::Function< T, NDIM >::get_impl ( ) const
inline
template<typename T, std::size_t NDIM>
g madness::Function< T, NDIM >::get_impl ( ) -> make_Vphi(fnode_is_leaf, true)
template<typename T, std::size_t NDIM>
g madness::Function< T, NDIM >::get_impl ( ) -> set_functor(func)
template<typename T, std::size_t NDIM>
g madness::Function< T, NDIM >::get_impl ( ) -> get_coeffs().clear()
template<typename T, std::size_t NDIM>
g madness::Function< T, NDIM >::get_impl ( ) -> is_on_demand()=true
template<typename T, std::size_t NDIM>
const std::shared_ptr< WorldDCPmapInterface< Key<NDIM> > >& madness::Function< T, NDIM >::get_pmap ( ) const
inline
template<typename T, std::size_t NDIM>
madness::Function< T, NDIM >::if ( VERIFY_TREE  )
template<typename T, std::size_t NDIM>
madness::Function< T, NDIM >::if ( VERIFY_TREE  )
template<typename T, std::size_t NDIM>
madness::Function< T, NDIM >::if ( not this->  is_initialized())
template<typename T, std::size_t NDIM>
madness::Function< T, NDIM >::if ( not g.  is_initialized())
template<typename T, std::size_t NDIM>
madness::Function< T, NDIM >::if ( this->  get_impl() = =g.get_impl())
inline
template<typename T, std::size_t NDIM>
madness::Function< T, NDIM >::if ( this->  is_on_demand())
template<typename T, std::size_t NDIM>
madness::Function< T, NDIM >::if ( g.  is_on_demand()) -> inner_on_demand(g)
template<typename T, std::size_t NDIM>
madness::Function< T, NDIM >::if ( VERIFY_TREE  )
template<typename T, std::size_t NDIM>
madness::Function< T, NDIM >::if ( VERIFY_TREE  )
template<typename T, std::size_t NDIM>
madness::Function< T, NDIM >::if ( NDIM  = =3)
inline
template<typename T, std::size_t NDIM>
madness::Function< T, NDIM >::if ( this->  is_compressed) and g.is_compressed()
inline
template<typename T, std::size_t NDIM>
madness::Function< T, NDIM >::if ( not g.  get_impl) ->is_redundant() -> make_redundant(false)
template<typename T, std::size_t NDIM>
madness::Function< T, NDIM >::if ( this->  get_impl) ->is_redundant() -> get_impl() ->undo_redundant(false)
template<typename T, std::size_t NDIM>
madness::Function< T, NDIM >::if ( g.  get_impl) ->is_redundant() -> undo_redundant(false)
template<typename T, std::size_t NDIM>
madness::Function< T, NDIM >::if ( VERIFY_TREE  )
template<typename T, std::size_t NDIM>
T madness::Function< T, NDIM >::inner_ext ( T(*)(const coordT &)  f,
const bool  leaf_refine = true,
const bool  keep_redundant = false 
) const
inline

Return the inner product with external function ... requires communication. If you are going to be doing a bunch of inner_ext calls, set keep_redundant to true and then manually undo_redundant when you are finished.

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
[in]keep_redundantboolean switch to turn on/off undo_redundant
Returns
Returns the inner product
template<typename T, std::size_t NDIM>
T madness::Function< T, NDIM >::inner_ext ( const std::shared_ptr< FunctionFunctorInterface< T, NDIM > >  f,
const bool  leaf_refine = true,
const bool  keep_redundant = false 
) const
inline

Return the inner product with external function ... requires communication. If you are going to be doing a bunch of inner_ext calls, set keep_redundant to true and then manually undo_redundant when you are finished.

Parameters
[in]fReference to FunctionFunctorInterface. This is the externally provided function
[in]leaf_refineboolean switch to turn on/off refinement past leaf nodes
[in]keep_redundantboolean switch to turn on/off undo_redundant
Returns
Returns the inner product
template<typename T, std::size_t NDIM>
T madness::Function< T, NDIM >::inner_ext_local ( T(*)(const coordT &)  f,
const bool  leaf_refine = true,
const bool  keep_redundant = false 
) const
inline

Return the local part of inner product with external function ... no communication. If you are going to be doing a bunch of inner_ext calls, set keep_redundant to true and then manually undo_redundant when you are finished.

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
[in]keep_redundantboolean switch to turn on/off undo_redundant
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::Function< T, NDIM >::inner_ext_local ( const std::shared_ptr< FunctionFunctorInterface< T, NDIM > >  f,
const bool  leaf_refine = true,
const bool  keep_redundant = false 
) const
inline

Return the local part of inner product with external function ... no communication. If you are going to be doing a bunch of inner_ext calls, set keep_redundant to true and then manually undo_redundant when you are finished.

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
[in]keep_redundantboolean switch to turn on/off undo_redundant
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>
bool madness::Function< T, NDIM >::is_compressed ( ) const
inline

Returns true if compressed, false otherwise. No communication.

If the function is not initialized, returns false.

Referenced by madness::Function< double, 6 >::abs(), madness::Function< double, 6 >::abs_square(), madness::binary_op(), madness::Function< double, 6 >::compress(), madness::Function< double, 6 >::depthpt(), madness::Function< double, 6 >::err(), madness::Function< double, 6 >::errsq_local(), madness::Function< double, 6 >::eval(), madness::Function< double, 6 >::eval_local_only(), madness::Function< double, 6 >::evaldepthpt(), madness::Function< double, 6 >::evalR(), madness::Function< double, 6 >::gaxpy(), madness::Function< double, 6 >::gaxpy_ext(), madness::Function< double, 6 >::gaxpy_oop(), madness::gaxpy_oop_reconstructed(), madness::Function< double, 6 >::if(), madness::mul_sparse(), madness::Function< double, 6 >::nonstandard(), madness::Function< double, 6 >::norm_tree(), madness::DerivativeBase< T, NDIM >::operator()(), madness::Function< double, 6 >::operator()(), madness::operator*(), madness::operator+(), madness::Function< double, 6 >::operator+=(), madness::operator-(), madness::Function< double, 6 >::operator-=(), madness::Function< double, 6 >::reconstruct(), madness::Function< double, 6 >::refine_general(), madness::Function< double, 6 >::refine_to_common_level(), madness::Function< double, 6 >::square(), madness::Function< double, 6 >::standard(), madness::Function< double, 6 >::sum_down(), madness::unary_op(), madness::Function< double, 6 >::unary_op_coeffs(), and madness::unary_op_coeffs().

template<typename T, std::size_t NDIM>
bool madness::Function< T, NDIM >::is_initialized ( ) const
inline
template<typename T, std::size_t NDIM>
bool madness::Function< T, NDIM >::is_on_demand ( ) const
inline
template<typename T, std::size_t NDIM>
int madness::Function< T, NDIM >::k ( ) const
inline
template<typename T, std::size_t NDIM>
template<typename Archive >
void madness::Function< T, NDIM >::load ( World world,
Archive &  ar 
)
inline

Replaces this function with one loaded from an archive using the default processor map.

Archive can be sequential or parallel.

The & operator for serializing will only work with parallel archives.

Referenced by madness::archive::ArchiveLoadImpl< ParallelInputArchive, Function< T, NDIM > >::load().

template<typename T, std::size_t NDIM>
madness::Function< T, NDIM >::MADNESS_ASSERT ( is_compressed()  )
template<typename T, std::size_t NDIM>
madness::Function< T, NDIM >::MADNESS_ASSERT ( g.  is_compressed())
template<typename T, std::size_t NDIM>
Function<T,NDIM>& madness::Function< T, NDIM >::mapdim ( const Function< T, NDIM > &  f,
const std::vector< long > &  map,
bool  fence 
)
inline

This is replaced with mapdim(f) ... private.

Referenced by madness::mapdim(), and madness::symmetrize().

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

Returns the maximum depth of the function tree ... collective global sum.

Referenced by print_info(), propagate(), and testNavierStokes().

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

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

Referenced by projectL().

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

Returns the max number of nodes on a processor.

Referenced by test_gaussian_num_coeffs().

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

Returns the min number of nodes on a processor.

template<typename T, std::size_t NDIM>
template<typename L , typename R >
void madness::Function< T, NDIM >::mul_on_demand ( const Function< L, NDIM > &  f,
const Function< R, NDIM > &  g,
bool  fence = true 
)
inline

Same as operator* but with optional fence and no automatic reconstruction.

f or g are on-demand functions

template<typename T, std::size_t NDIM>
template<typename opT >
Function<T,NDIM>& madness::Function< T, NDIM >::multiop_values ( const opT &  op,
const std::vector< Function< T, NDIM > > &  vf 
)
inline

This is replaced with op(vector of functions) ... private.

Referenced by madness::multiop_values().

template<typename T, std::size_t NDIM>
void madness::Function< T, NDIM >::nonstandard ( bool  keepleaves,
bool  fence = true 
)
inline

Compresses the function retaining scaling function coeffs. Possible non-blocking comm.

By default fence=true meaning that this operation completes before returning, otherwise if fence=false it returns without fencing and the user must invoke world.gop.fence() to assure global completion before using the function for other purposes.

Noop if already compressed or if not initialized.

Referenced by madness::apply(), madness::Function< double, 6 >::coeffs_for_jun(), madness::hartree_product(), and madness::multiply().

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

Returns the square of the norm of the local function ... no communication.

Works in either basis

template<typename T, std::size_t NDIM>
void madness::Function< T, NDIM >::norm_tree ( bool  fence = true) const
inline

Initializes information about the function norm at all length scales.

Referenced by madness::mul_sparse().

template<typename T, std::size_t NDIM>
T madness::Function< T, NDIM >::operator() ( const coordT xuser) const
inline

Evaluates the function at a point in user coordinates. Collective operation.

Throws if function is not initialized.

This function calls eval, blocks until the result is available and then broadcasts the result to everyone. Therefore, if you are evaluating many points in parallel it is vastly less efficient than calling eval directly, saving the futures, and then forcing all of the results.

template<typename T, std::size_t NDIM>
T madness::Function< T, NDIM >::operator() ( double  x,
double  y = 0,
double  z = 0,
double  xx = 0,
double  yy = 0,
double  zz = 0 
) const
inline

Evaluates the function at a point in user coordinates. Collective operation.

See "operator()(const coordT& xuser)" for more info

template<typename T, std::size_t NDIM>
template<typename Q >
IsSupported<TensorTypeData<Q>, Function<T,NDIM> >::type& madness::Function< T, NDIM >::operator*= ( const q)
inline

Inplace scaling by a constant.

Using operator notation forces a global fence after every operation

template<typename T, std::size_t NDIM>
template<typename Q >
Function<T,NDIM>& madness::Function< T, NDIM >::operator+= ( const Function< Q, NDIM > &  other)
inline

Inplace addition of functions in the wavelet basis.

Using operator notation forces a global fence after every operation. Functions don't need to be compressed, it's the caller's responsibility to choose an appropriate state with performance, usually compressed for 3d, reconstructed for 6d)

template<typename T, std::size_t NDIM>
template<typename Q >
Function<T,NDIM>& madness::Function< T, NDIM >::operator-= ( const Function< Q, NDIM > &  other)
inline

Inplace subtraction of functions in the wavelet basis.

Using operator notation forces a global fence after every operation

template<typename T, std::size_t NDIM>
Function<T,NDIM>& madness::Function< T, NDIM >::operator= ( const Function< T, NDIM > &  f)
inline

Assignment is shallow. No communication, works in either basis.

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

Print a summary of the load balancing info.

This is serial and VERY expensive

template<typename T, std::size_t NDIM>
void madness::Function< T, NDIM >::print_size ( const std::string  name) const
inline
template<typename T, std::size_t NDIM>
void madness::Function< T, NDIM >::print_tree ( std::ostream &  os = std::cout) const
inline

Process 0 prints a summary of all nodes in the tree (collective)

template<typename T, std::size_t NDIM>
void madness::Function< T, NDIM >::print_tree_graphviz ( std::ostream &  os = std::cout) const
inline

Process 0 prints a graphviz-formatted output of all nodes in the tree (collective)

template<typename T, std::size_t NDIM>
template<typename R , size_t LDIM>
Function<TENSOR_RESULT_TYPE(T,R),NDIM-LDIM> madness::Function< T, NDIM >::project_out ( const Function< R, LDIM > &  g,
const int  dim 
) const
inline

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

Parameters
[in]glow-dim function
[in]dimover which dimensions to be integrated: 0..LDIM-1 or LDIM..NDIM-1
Returns
new function of dimension NDIM-LDIM

Referenced by madness::StrongOrthogonalityProjector< double, 3 >::operator()().

template<typename T, std::size_t NDIM>
void madness::Function< T, NDIM >::reconstruct ( bool  fence = true) const
inline

Reconstructs the function, transforming into scaling function basis. Possible non-blocking comm.

By default fence=true meaning that this operation completes before returning, otherwise if fence=false it returns without fencing and the user must invoke world.gop.fence() to assure global completion before using the function for other purposes.

Noop if already reconstructed or if not initialized.

Since reconstruction/compression do not discard information we define them as const ... "logical constness" not "bitwise constness".

Referenced by APPLY(), madness::SCF::APPLY(), madness::apply(), madness::APPLY(), madness::apply_1d_realspace_push(), apply_potential(), WSTFunctional::apply_xc(), madness::binary_op(), madness::TDA_DFT::convolution_with_kernel(), madness::Derivative< T, NDIM >::Derivative(), madness::SCF::do_plots(), energy(), madness::Function< double, 6 >::gaxpy_ext(), madness::SCF::initial_guess(), madness::Solver< T, NDIM >::initial_guess(), line_plot(), loadbal(), main(), make_exp(), madness::SCF::make_lda_potential(), madness::PotentialManager::make_nuclear_potential(), madness::mul(), madness::mul_sparse(), madness::DerivativeBase< T, NDIM >::operator()(), madness::operator*(), madness::operator+(), madness::Function< double, 6 >::operator+=(), madness::operator-(), madness::Function< double, 6 >::operator-=(), madness::plot_line(), madness::project(), projectL(), propagate(), solve(), madness::SCF::solve(), madness::TDA_DFT::TDA_DFT(), test_truncation(), test_wannier(), madness::unary_op(), and madness::unary_op_coeffs().

template<typename T, std::size_t NDIM>
this madness::Function< T, NDIM >::reconstruct ( )
template<typename T, std::size_t NDIM>
Function<T,NDIM>& madness::Function< T, NDIM >::reduce_rank ( const bool  fence = true)
inline

reduce the rank of the coefficient tensors

Referenced by apply_U_ncf().

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

Inplace autorefines the function using same test as for squaring.

template<typename T, std::size_t NDIM>
template<typename opT >
void madness::Function< T, NDIM >::refine_general ( const opT &  op,
bool  fence = true 
) const
inline

Inplace autorefines the function. Optional fence. Possible non-blocking comm.

Referenced by madness::Function< double, 6 >::refine().

template<typename T, std::size_t NDIM>
void madness::Function< T, NDIM >::refine_to_common_level ( std::vector< Function< T, NDIM > > &  vf,
bool  fence = true 
)
inline

Refine vector of functions down to common finest level (reconstructs as necessary, optional fence)

Referenced by madness::TDA_DFT::apply_kernel(), WSTFunctional::apply_xc(), madness::TDA_DFT::convolution_with_kernel(), main(), and madness::SCF::solve().

template<typename T, std::size_t NDIM>
template<typename Q >
Function<T,NDIM>& madness::Function< T, NDIM >::scale ( const q,
bool  fence = true 
)
inline
template<typename T, std::size_t NDIM>
void madness::Function< T, NDIM >::set_autorefine ( bool  value,
bool  fence = true 
)
inline

Sets the value of the autorefine flag. Optional global fence.

A fence is required to ensure consistent global state.

template<typename T, std::size_t NDIM>
void madness::Function< T, NDIM >::set_functor ( const std::shared_ptr< FunctionFunctorInterface< T, NDIM > >  functor)
inline

Replace the current functor with the provided new one.

presumably the new functor will be a CompositeFunctor, which will change the behavior of the function: multiply the functor with the function

template<typename T, std::size_t NDIM>
void madness::Function< T, NDIM >::set_impl ( const std::shared_ptr< FunctionImpl< T, NDIM > > &  impl)
inline
template<typename T, std::size_t NDIM>
template<typename R >
void madness::Function< T, NDIM >::set_impl ( const Function< R, NDIM > &  f,
bool  zero = true 
)
inline

Replace current FunctionImpl with a new one using the same parameters & map as f.

If zero is true the function is initialized to zero, otherwise it is empty

template<typename T, std::size_t NDIM>
void madness::Function< T, NDIM >::set_thresh ( double  value,
bool  fence = true 
)
inline

Sets the vaule of the truncation threshold. Optional global fence.

A fence is required to ensure consistent global state.

Referenced by main(), madness::PotentialManager::make_nuclear_potential(), and madness::StrongOrthogonalityProjector< double, 3 >::operator()().

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

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

Referenced by energy(), main(), print_info(), projectPsi(), propagate(), solve(), trotter(), and madness::NonlinearSolverND< NDIM >::update().

template<typename T, std::size_t NDIM>
Function<T,NDIM>& madness::Function< T, NDIM >::square ( bool  fence = true)
inline

Inplace squaring of function ... global comm only if not reconstructed.

Returns *this for chaining.

Referenced by madness::square().

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

Converts the function from nonstandard form to standard form. Possible non-blocking comm.

By default fence=true meaning that this operation completes before returning, otherwise if fence=false it returns without fencing and the user must invoke world.gop.fence() to assure global completion before using the function for other purposes.

Must be already compressed.

Referenced by madness::apply(), madness::hartree_product(), and madness::multiply().

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

Stores the function to an archive.

Archive can be sequential or parallel.

The & operator for serializing will only work with parallel archives.

Referenced by madness::archive::ArchiveStoreImpl< ParallelOutputArchive, Function< T, NDIM > >::store().

template<typename T, std::size_t NDIM>
impl world gop madness::Function< T, NDIM >::sum ( local  )
template<typename T, std::size_t NDIM>
impl world gop madness::Function< T, NDIM >::sum ( local  )
template<typename T, std::size_t NDIM>
void madness::Function< T, NDIM >::sum_down ( bool  fence = true) const
inline

Sums scaling coeffs down tree restoring state with coeffs only at leaves. Optional fence. Possible non-blocking comm.

Referenced by APPLY(), madness::SCF::APPLY(), and madness::APPLY().

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

Returns local part of inner product ... throws if both not compressed.

Referenced by madness::add(), madness::apply(), madness::Function< double, 6 >::project_out(), madness::sub(), and madness::vmulXX().

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

Returns the inner product.

Not efficient for computing multiple inner products

Parameters
[in]gFunction, optionally on-demand
template<typename T, std::size_t NDIM>
madness::Function< T, NDIM >::TENSOR_RESULT_TYPE ( ,
R   
)
template<typename T, std::size_t NDIM>
template<typename R >
madness::Function< T, NDIM >::TENSOR_RESULT_TYPE ( ,
R   
) const

Returns the inner product for one on-demand function.

It does work, but it might not give you the precision you expect. The assumption is that the function g returns proper sum coefficients on the MRA tree of this. This might not be the case if g is constructed with an implicit multiplication, e.g. result = <this|g>, with g = 1/r12 | gg>

Parameters
[in]gon-demand function
template<typename T, std::size_t NDIM>
madness::Function< T, NDIM >::TENSOR_RESULT_TYPE ( ,
R   
)
template<typename T, std::size_t NDIM>
double madness::Function< T, NDIM >::thresh ( ) const
inline
template<typename T, std::size_t NDIM>
T madness::Function< T, NDIM >::trace ( ) const
inline
template<typename T, std::size_t NDIM>
T madness::Function< T, NDIM >::trace_local ( ) const
inline

Returns local contribution to int(f(x),x) ... no communication.

In the wavelet basis this is just the coefficient of the first scaling function which is a constant. In the scaling function basis we must add up contributions from each box.

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

Returns the number of nodes in the function tree ... collective global sum.

Referenced by main(), and solve().

template<typename T, std::size_t NDIM>
Function<T,NDIM>& madness::Function< T, NDIM >::truncate ( double  tol = 0.0,
bool  fence = true 
)
inline

Truncate the function with optional fence. Compresses with fence if not compressed.

If the truncation threshold is less than or equal to zero the default value specified when the function was created is used. If the function is not initialized, it just returns.

Returns this for chaining.

Parameters
[in]tolTolerance for truncating the coefficients. Default 0.0 means use the implimentation's member value thresh instead.
[in]fenceDo fence

Referenced by DirichletCondIntOp< NDIM >::action(), madness::Solver< T, NDIM >::apply_hf_exchange3(), madness::Solver< T, NDIM >::apply_hf_exchange4(), madness::SCF::apply_potential(), apply_U_mix(), apply_U_ncf(), WSTFunctional::apply_xc(), madness::HartreeFock< T, NDIM >::calculate_coulomb_energy(), chin_chen(), compareGroundState(), madness::EigSolver< T, NDIM >::compute_rho(), madness::Solver< T, NDIM >::compute_rho(), madness::Solver< T, NDIM >::compute_rho_slow(), converge(), converge2s(), madness::TDA_DFT::convolution_with_kernel(), madness::Function< double, 6 >::do_hartree_product(), madness::SCF::do_plots(), doit(), expV(), madness::MP2::increment(), madness::SCF::initial_guess(), iterate(), iterate_excite(), iterate_ground(), iterate_xy(), loadbal(), main(), madness::SCF::make_density(), SVPEColloidSolver::make_Laplace_surface_charge(), madness::PotentialManager::make_nuclear_potential(), SVPEColloidSolver::make_surface_charge(), CoupledPurturbation::make_vpsi(), madness::HartreeFockExchangeOp< T, NDIM >::op_o(), madness::Projector< double, 3 >::operator()(), propagate(), q_c(), ScreenSolventPotential::ScreenSolventPotential(), madness::EigSolver< T, NDIM >::solve(), madness::SCF::solve(), madness::MP2::solve_residual_equations(), SVPEColloidSolver::SVPEColloidSolver(), sympgrad4(), sympgrad6(), test_modified(), test_truncation(), testbsh(), trotter(), madness::NonlinearSolverND< NDIM >::update(), and WF::WF().

template<typename T, std::size_t NDIM>
template<typename Q , typename opT >
Function<typename opT::resultT,NDIM>& madness::Function< T, NDIM >::unary_op_coeffs ( const Function< Q, NDIM > &  func,
const opT &  op,
bool  fence 
)
inline

This is replaced with left*right ... private.

Referenced by madness::imag(), madness::real(), and madness::unary_op_coeffs().

template<typename T, std::size_t NDIM>
void madness::Function< T, NDIM >::unaryop ( T(*)(T)  f)
inline
template<typename T, std::size_t NDIM>
template<typename opT >
void madness::Function< T, NDIM >::unaryop ( const opT &  op,
bool  fence = true 
)
inline

Inplace unary operation on function values.

template<typename T, std::size_t NDIM>
template<typename opT >
void madness::Function< T, NDIM >::unaryop_coeff ( const opT &  op,
bool  fence = true 
)
inline

Unary operation applied inplace to the coefficients.

Referenced by madness::Function< double, 6 >::conj().

template<typename T, std::size_t NDIM>
template<typename opT >
void madness::Function< T, NDIM >::unaryop_node ( const opT &  op,
bool  fence = true 
)
inline

Unary operation applied inplace to the nodes.

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

Asserts that the function is initialized.

Referenced by madness::Function< double, 6 >::add_scalar(), madness::Function< double, 6 >::broaden(), madness::convert(), madness::copy(), madness::Function< double, 6 >::depthpt(), madness::Function< double, 6 >::err(), madness::Function< double, 6 >::errsq_local(), madness::Function< double, 6 >::eval(), madness::Function< double, 6 >::eval_cube(), madness::Function< double, 6 >::eval_local_only(), madness::Function< double, 6 >::evaldepthpt(), madness::Function< double, 6 >::evalR(), madness::Function< double, 6 >::gaxpy(), madness::Function< double, 6 >::gaxpy_oop(), madness::Function< double, 6 >::get_impl(), madness::Function< double, 6 >::get_pmap(), madness::Function< double, 6 >::k(), madness::Function< double, 6 >::mapdim(), madness::mul(), madness::mul_sparse(), madness::Function< double, 6 >::nonstandard(), madness::Function< double, 6 >::norm2(), madness::Function< double, 6 >::norm2sq_local(), madness::Function< double, 6 >::norm_tree(), madness::Function< double, 6 >::operator()(), madness::Function< double, 6 >::project_out(), madness::Function< double, 6 >::reduce_rank(), madness::Function< double, 6 >::refine_general(), madness::Function< double, 6 >::scale(), madness::Function< double, 6 >::set_autorefine(), madness::Function< double, 6 >::set_thresh(), madness::Function< double, 6 >::standard(), madness::Function< double, 6 >::store(), madness::Function< double, 6 >::sum_down(), madness::Function< double, 6 >::truncate(), madness::Function< double, 6 >::unary_op_coeffs(), madness::Function< double, 6 >::unaryop(), madness::Function< double, 6 >::unaryop_coeff(), madness::Function< double, 6 >::unaryop_node(), and madness::Function< double, 6 >::world().

template<typename T, std::size_t NDIM>
void madness::Function< T, NDIM >::verify_tree ( ) const
inline
template<typename T, std::size_t NDIM>
template<typename Q , std::size_t D>
static std::vector< std::shared_ptr< FunctionImpl<Q,D> > > madness::Function< T, NDIM >::vimpl ( const std::vector< Function< Q, D > > &  v)
inlinestatic

Returns vector of FunctionImpl pointers corresponding to vector of functions.

Referenced by madness::Function< double, 6 >::vtransform().

template<typename T, std::size_t NDIM>
template<typename L , typename R >
void madness::Function< T, NDIM >::vmulXX ( const Function< L, NDIM > &  left,
const std::vector< Function< R, NDIM > > &  right,
std::vector< Function< T, NDIM > > &  result,
double  tol,
bool  fence 
)
inline

Multiplication of function * vector of functions using recursive algorithm of mulxx.

template<typename T, std::size_t NDIM>
template<typename R , typename Q >
void madness::Function< T, NDIM >::vtransform ( const std::vector< Function< R, NDIM > > &  v,
const Tensor< Q > &  c,
std::vector< Function< T, NDIM > > &  vresult,
double  tol,
bool  fence = true 
)
inline

sparse transformation of a vector of functions ... private

template<typename T, std::size_t NDIM>
World& madness::Function< T, NDIM >::world ( ) const
inline

Member Data Documentation

template<typename T, std::size_t NDIM>
NDIM &g madness::Function< T, NDIM >::const
Initial value:
template<typename T, std::size_t NDIM>
madness::Function< T, NDIM >::else
Initial value:
{
if (not this->get_impl()->is_redundant()) this->get_impl()->make_redundant(false)
template<typename T, std::size_t NDIM>
std::shared_ptr< FunctionFunctorInterface<T,NDIM> > madness::Function< T, NDIM >::func =g.get_impl()->get_functor()

Referenced by projectPsi(), and projectZdip().

template<typename T, std::size_t NDIM>
return madness::Function< T, NDIM >::local

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