MADNESS  0.10.1
Public Types | Public Member Functions | Private Attributes | List of all members
madness::FunctionNode< T, NDIM > Class Template Reference

FunctionNode holds the coefficients, etc., at each node of the 2^NDIM-tree. More...

#include <funcimpl.h>

Public Types

typedef GenTensor< TcoeffT
 
typedef WorldContainer< Key< NDIM >, FunctionNode< T, NDIM > > dcT
 
typedef Tensor< TtensorT
 

Public Member Functions

 FunctionNode ()
 Default constructor makes node without coeff or children. More...
 
 FunctionNode (const coeffT &coeff, bool has_children=false)
 Constructor from given coefficients with optional children. More...
 
 FunctionNode (const coeffT &coeff, double norm_tree, bool has_children)
 
 FunctionNode (const coeffT &coeff, double norm_tree, double snorm, double dnorm, bool has_children)
 
 FunctionNode (const FunctionNode< T, NDIM > &other)
 
void accumulate (const coeffT &t, const typename FunctionNode< T, NDIM >::dcT &c, const Key< NDIM > &key, const TensorArgs &args)
 Accumulate inplace and if necessary connect node to parent. More...
 
void accumulate2 (const tensorT &t, const typename FunctionNode< T, NDIM >::dcT &c, const Key< NDIM > &key)
 Accumulate inplace and if necessary connect node to parent. More...
 
void clear_coeff ()
 Clears the coefficients (has_coeff() will subsequently return false) More...
 
coeffTcoeff ()
 Returns a non-const reference to the tensor containing the coeffs. More...
 
const coeffTcoeff () const
 Returns a const reference to the tensor containing the coeffs. More...
 
void consolidate_buffer (const TensorArgs &args)
 
template<typename Q >
FunctionNode< Q, NDIMconvert () const
 Copy with possible type conversion of coefficients, copying all other state. More...
 
template<typename Q , typename R >
void gaxpy_inplace (const T &alpha, const FunctionNode< Q, NDIM > &other, const R &beta)
 General bi-linear operation — this = this*alpha + other*beta. More...
 
double get_dnorm () const
 return the precomputed norm of the (virtual) d coefficients More...
 
double get_norm_tree () const
 Gets the value of norm_tree. More...
 
double get_snorm () const
 get the precomputed norm of the (virtual) s coefficients More...
 
bool has_children () const
 Returns true if this node has children. More...
 
bool has_coeff () const
 Returns true if there are coefficients in this node. More...
 
bool is_invalid () const
 Returns true if this node is invalid (no coeffs and no children) More...
 
bool is_leaf () const
 Returns true if this does not have children. More...
 
FunctionNode< T, NDIM > & operator= (const FunctionNode< T, NDIM > &other)
 
void print_json (std::ostream &s) const
 
void recompute_snorm_and_dnorm (const FunctionCommonData< T, NDIM > &cdata)
 
void reduceRank (const double &eps)
 reduces the rank of the coefficients (if applicable) More...
 
template<typename Q >
void scale (Q a)
 Scale the coefficients of this node. More...
 
template<typename Archive >
void serialize (Archive &ar)
 
void set_coeff (const coeffT &coeffs)
 Takes a shallow copy of the coeff — same as this->coeff()=coeff. More...
 
void set_dnorm (const double dn)
 set the precomputed norm of the (virtual) d coefficients More...
 
void set_has_children (bool flag)
 Sets has_children attribute to value of flag. More...
 
void set_has_children_recursive (const typename FunctionNode< T, NDIM >::dcT &c, const Key< NDIM > &key)
 Sets has_children attribute to true recurring up to ensure connected. More...
 
void set_is_leaf (bool flag)
 Sets has_children attribute to value of !flag. More...
 
void set_norm_tree (double norm_tree)
 Sets the value of norm_tree. More...
 
void set_snorm (const double sn)
 set the precomputed norm of the (virtual) s coefficients More...
 
size_t size () const
 Returns the number of coefficients in this node. More...
 
T trace_conj (const FunctionNode< T, NDIM > &rhs) const
 

Private Attributes

coeffT _coeffs
 The coefficients, if any. More...
 
bool _has_children
 True if there are children. More...
 
double _norm_tree
 After norm_tree will contain norm of coefficients summed up tree. More...
 
coeffT buffer
 The coefficients, if any. More...
 
double dnorm =-1.0
 norm of the d coefficients, also defined if there are no d coefficients More...
 
double snorm =-1.0
 norm of the s coefficients More...
 

Detailed Description

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

FunctionNode holds the coefficients, etc., at each node of the 2^NDIM-tree.

Member Typedef Documentation

◆ coeffT

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

◆ dcT

template<typename T , std::size_t NDIM>
typedef WorldContainer<Key<NDIM> , FunctionNode<T, NDIM> > madness::FunctionNode< T, NDIM >::dcT

Type of container holding the nodes

◆ tensorT

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

Constructor & Destructor Documentation

◆ FunctionNode() [1/5]

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

Default constructor makes node without coeff or children.

◆ FunctionNode() [2/5]

template<typename T , std::size_t NDIM>
madness::FunctionNode< T, NDIM >::FunctionNode ( const coeffT coeff,
bool  has_children = false 
)
inlineexplicit

Constructor from given coefficients with optional children.

Note that only a shallow copy of the coeff are taken so you should pass in a deep copy if you want the node to take ownership.

◆ FunctionNode() [3/5]

template<typename T , std::size_t NDIM>
madness::FunctionNode< T, NDIM >::FunctionNode ( const coeffT coeff,
double  norm_tree,
bool  has_children 
)
inlineexplicit

◆ FunctionNode() [4/5]

template<typename T , std::size_t NDIM>
madness::FunctionNode< T, NDIM >::FunctionNode ( const coeffT coeff,
double  norm_tree,
double  snorm,
double  dnorm,
bool  has_children 
)
inlineexplicit

◆ FunctionNode() [5/5]

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

Member Function Documentation

◆ accumulate()

template<typename T , std::size_t NDIM>
void madness::FunctionNode< T, NDIM >::accumulate ( const coeffT t,
const typename FunctionNode< T, NDIM >::dcT c,
const Key< NDIM > &  key,
const TensorArgs args 
)
inline

◆ accumulate2()

template<typename T , std::size_t NDIM>
void madness::FunctionNode< T, NDIM >::accumulate2 ( const tensorT t,
const typename FunctionNode< T, NDIM >::dcT c,
const Key< NDIM > &  key 
)
inline

◆ clear_coeff()

template<typename T , std::size_t NDIM>
void madness::FunctionNode< T, NDIM >::clear_coeff ( )
inline

◆ coeff() [1/2]

template<typename T , std::size_t NDIM>
coeffT& madness::FunctionNode< T, NDIM >::coeff ( )
inline

Returns a non-const reference to the tensor containing the coeffs.

Returns an empty tensor if there are no coefficients.

References madness::FunctionNode< T, NDIM >::_coeffs, madness::GenTensor< T >::dim(), MADNESS_ASSERT, madness::MAXK, and madness::GenTensor< T >::ndim().

Referenced by madness::FunctionNode< T, NDIM >::accumulate(), madness::FunctionNode< T, NDIM >::accumulate2(), madness::FunctionImpl< T, NDIM >::add_keys_to_map(), madness::FunctionImpl< T, NDIM >::add_scalar_inplace(), madness::FunctionImpl< T, NDIM >::apply(), madness::FunctionImpl< T, NDIM >::autorefine_square_test(), madness::FunctionNode< T, NDIM >::clear_coeff(), madness::FunctionNode< T, NDIM >::consolidate_buffer(), madness::FunctionNode< T, NDIM >::convert(), madness::FunctionImpl< T, NDIM >::dirac_convolution_op(), madness::FunctionImpl< T, NDIM >::err_box(), madness::FunctionImpl< T, NDIM >::eval(), madness::FunctionImpl< T, NDIM >::eval_local_only(), madness::FunctionImpl< R, NDIM >::eval_plot_cube(), madness::FunctionImpl< T, NDIM >::evalR(), madness::FunctionNode< T, NDIM >::gaxpy_inplace(), madness::FunctionImpl< T, NDIM >::get_contraction_node_lists(), madness::FunctionImpl< T, NDIM >::nCoeff(), madness::FunctionImpl< T, NDIM >::norm_tree_spawn(), LBCost::operator()(), madness::LBCost::operator()(), madness::FunctionImpl< T, NDIM >::project_out_op< LDIM >::operator()(), madness::detail::scaleinplace< T, NDIM >::operator()(), madness::FunctionImpl< T, NDIM >::do_norm2sq_local::operator()(), madness::FunctionImpl< T, NDIM >::do_inner_local< R >::operator()(), madness::FunctionImpl< T, NDIM >::do_inner_local_on_demand< R >::operator()(), madness::FunctionImpl< T, NDIM >::do_truncate_NS_leafs::operator()(), madness::FunctionImpl< T, NDIM >::do_keep_sum_coeffs::operator()(), madness::FunctionImpl< T, NDIM >::do_check_symmetry_local::operator()(), madness::FunctionImpl< T, NDIM >::do_accumulate_trees< Q, R >::operator()(), madness::FunctionImpl< T, NDIM >::do_mapdim::operator()(), madness::FunctionImpl< T, NDIM >::do_mirror::operator()(), madness::FunctionImpl< T, NDIM >::do_map_and_mirror::operator()(), madness::FunctionImpl< T, NDIM >::do_average::operator()(), madness::FunctionImpl< T, NDIM >::do_change_tensor_type::operator()(), madness::FunctionImpl< T, NDIM >::do_unary_op_value_inplace< opT >::operator()(), madness::FunctionImpl< T, NDIM >::do_standard::operator()(), madness::operator<<(), madness::FunctionNode< T, NDIM >::operator=(), madness::FunctionNode< T, NDIM >::print_json(), madness::FunctionImpl< T, NDIM >::print_plane_local(), madness::FunctionImpl< T, NDIM >::print_stats(), madness::FunctionImpl< T, NDIM >::project(), madness::FunctionImpl< T, NDIM >::project_out2(), madness::FunctionImpl< T, NDIM >::real_size(), madness::FunctionNode< T, NDIM >::recompute_snorm_and_dnorm(), madness::FunctionImpl< T, NDIM >::reconstruct_op(), madness::FunctionImpl< T, NDIM >::recur_down_for_contraction_map(), madness::FunctionImpl< T, NDIM >::refine_op(), madness::FunctionNode< T, NDIM >::serialize(), madness::FunctionNode< T, NDIM >::set_coeff(), madness::FunctionImpl< T, NDIM >::sock_it_to_me(), madness::FunctionImpl< T, NDIM >::sock_it_to_me_too(), madness::FunctionImpl< T, NDIM >::sum_down_spawn(), madness::FunctionImpl< T, NDIM >::trace_local(), madness::FunctionImpl< T, NDIM >::truncate_op(), madness::FunctionImpl< T, NDIM >::truncate_reconstructed_spawn(), madness::FunctionImpl< T, NDIM >::truncate_spawn(), madness::FunctionImpl< T, NDIM >::unary_op_coeff_inplace(), madness::FunctionImpl< T, NDIM >::verify_tree(), and madness::FunctionImpl< T, NDIM >::vtransform_doit().

◆ coeff() [2/2]

template<typename T , std::size_t NDIM>
const coeffT& madness::FunctionNode< T, NDIM >::coeff ( ) const
inline

Returns a const reference to the tensor containing the coeffs.

Returns an empty tensor if there are no coefficeints.

References madness::FunctionNode< T, NDIM >::_coeffs.

◆ consolidate_buffer()

template<typename T , std::size_t NDIM>
void madness::FunctionNode< T, NDIM >::consolidate_buffer ( const TensorArgs args)
inline

◆ convert()

template<typename T , std::size_t NDIM>
template<typename Q >
FunctionNode<Q, NDIM> madness::FunctionNode< T, NDIM >::convert ( ) const
inline

Copy with possible type conversion of coefficients, copying all other state.

Choose to not overload copy and type conversion operators so there are no automatic type conversions.

References madness::FunctionNode< T, NDIM >::_has_children, madness::FunctionNode< T, NDIM >::_norm_tree, madness::FunctionNode< T, NDIM >::coeff(), madness::FunctionNode< T, NDIM >::dnorm, and madness::FunctionNode< T, NDIM >::snorm.

◆ gaxpy_inplace()

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

General bi-linear operation — this = this*alpha + other*beta.

This/other may not have coefficients. Has_children will be true in the result if either this/other have children.

References madness::FunctionNode< T, NDIM >::_has_children, alpha, beta, madness::FunctionNode< T, NDIM >::coeff(), madness::GenTensor< T >::gaxpy(), madness::FunctionNode< T, NDIM >::has_children(), madness::FunctionNode< T, NDIM >::has_coeff(), and madness::GenTensor< T >::scale().

Referenced by madness::FunctionImpl< T, NDIM >::do_merge_trees< Q, R >::operator()().

◆ get_dnorm()

template<typename T , std::size_t NDIM>
double madness::FunctionNode< T, NDIM >::get_dnorm ( ) const
inline

◆ get_norm_tree()

template<typename T , std::size_t NDIM>
double madness::FunctionNode< T, NDIM >::get_norm_tree ( ) const
inline

◆ get_snorm()

template<typename T , std::size_t NDIM>
double madness::FunctionNode< T, NDIM >::get_snorm ( ) const
inline

◆ has_children()

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

Returns true if this node has children.

References madness::FunctionNode< T, NDIM >::_has_children.

Referenced by madness::FunctionImpl< T, NDIM >::dirac_convolution_op(), madness::FunctionImpl< T, NDIM >::do_print_tree(), madness::FunctionImpl< T, NDIM >::do_print_tree_graphviz(), madness::FunctionImpl< T, NDIM >::do_print_tree_json(), madness::FunctionNode< T, NDIM >::gaxpy_inplace(), madness::FunctionNode< T, NDIM >::is_invalid(), madness::FunctionImpl< T, NDIM >::norm_tree_spawn(), madness::LoadBalanceDeux< NDIM >::add_op< T, costT >::operator()(), madness::FunctionImpl< T, NDIM >::remove_internal_coeffs::operator()(), madness::FunctionImpl< T, NDIM >::remove_leaf_coeffs::operator()(), madness::FunctionImpl< T, NDIM >::do_check_symmetry_local::operator()(), madness::FunctionImpl< T, NDIM >::do_mapdim::operator()(), madness::FunctionImpl< T, NDIM >::do_mirror::operator()(), madness::FunctionImpl< T, NDIM >::do_map_and_mirror::operator()(), madness::FunctionImpl< T, NDIM >::do_standard::operator()(), madness::operator<<(), madness::FunctionNode< T, NDIM >::print_json(), madness::FunctionImpl< T, NDIM >::reconstruct_op(), madness::FunctionImpl< T, NDIM >::recur_down_for_contraction_map(), madness::FunctionImpl< T, NDIM >::refine_spawn(), madness::FunctionNode< T, NDIM >::set_has_children_recursive(), madness::FunctionImpl< T, NDIM >::sum_down_spawn(), madness::FunctionImpl< T, NDIM >::truncate_op(), madness::FunctionImpl< T, NDIM >::truncate_reconstructed_spawn(), madness::FunctionImpl< T, NDIM >::truncate_spawn(), and madness::FunctionImpl< T, NDIM >::verify_tree().

◆ has_coeff()

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

Returns true if there are coefficients in this node.

References madness::FunctionNode< T, NDIM >::_coeffs, and madness::GenTensor< T >::has_data().

Referenced by madness::FunctionNode< T, NDIM >::accumulate(), madness::FunctionNode< T, NDIM >::accumulate2(), madness::FunctionImpl< T, NDIM >::add_keys_to_map(), madness::FunctionImpl< T, NDIM >::add_scalar_inplace(), madness::FunctionImpl< T, NDIM >::apply(), madness::FunctionImpl< T, NDIM >::eval(), madness::FunctionImpl< T, NDIM >::eval_local_only(), madness::FunctionImpl< T, NDIM >::eval_plot_cube(), madness::FunctionImpl< T, NDIM >::evaldepthpt(), madness::FunctionImpl< T, NDIM >::evalR(), madness::FunctionNode< T, NDIM >::gaxpy_inplace(), madness::FunctionNode< T, NDIM >::is_invalid(), madness::FunctionImpl< T, NDIM >::nCoeff(), madness::FunctionImpl< T, NDIM >::do_err_box< opT >::operator()(), madness::FunctionImpl< T, NDIM >::do_norm2sq_local::operator()(), madness::FunctionImpl< T, NDIM >::do_inner_local< R >::operator()(), madness::FunctionImpl< T, NDIM >::do_inner_local_on_demand< R >::operator()(), madness::FunctionImpl< T, NDIM >::do_accumulate_trees< Q, R >::operator()(), madness::FunctionImpl< T, NDIM >::do_average::operator()(), madness::FunctionImpl< T, NDIM >::do_unary_op_value_inplace< opT >::operator()(), madness::FunctionImpl< T, NDIM >::do_standard::operator()(), madness::operator<<(), madness::FunctionNode< T, NDIM >::print_json(), madness::FunctionImpl< T, NDIM >::print_plane_local(), madness::FunctionImpl< T, NDIM >::print_stats(), madness::FunctionImpl< T, NDIM >::project(), madness::FunctionImpl< T, NDIM >::real_size(), madness::FunctionImpl< T, NDIM >::reconstruct_op(), madness::FunctionImpl< T, NDIM >::refine_op(), madness::FunctionNode< T, NDIM >::set_has_children_recursive(), madness::FunctionImpl< T, NDIM >::size(), madness::FunctionImpl< T, NDIM >::sock_it_to_me(), madness::FunctionImpl< T, NDIM >::sock_it_to_me_too(), madness::FunctionImpl< T, NDIM >::trace_local(), madness::FunctionImpl< T, NDIM >::truncate_op(), madness::FunctionImpl< T, NDIM >::truncate_spawn(), madness::FunctionImpl< T, NDIM >::unary_op_coeff_inplace(), and madness::FunctionImpl< T, NDIM >::vtransform_doit().

◆ is_invalid()

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

Returns true if this node is invalid (no coeffs and no children)

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

◆ is_leaf()

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

◆ operator=()

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

◆ print_json()

template<typename T , std::size_t NDIM>
void madness::FunctionNode< T, NDIM >::print_json ( std::ostream &  s) const
inline

◆ recompute_snorm_and_dnorm()

template<typename T , std::size_t NDIM>
void madness::FunctionNode< T, NDIM >::recompute_snorm_and_dnorm ( const FunctionCommonData< T, NDIM > &  cdata)
inline

◆ reduceRank()

template<typename T , std::size_t NDIM>
void madness::FunctionNode< T, NDIM >::reduceRank ( const double &  eps)
inline

◆ scale()

template<typename T , std::size_t NDIM>
template<typename Q >
void madness::FunctionNode< T, NDIM >::scale ( Q  a)
inline

◆ serialize()

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

◆ set_coeff()

template<typename T , std::size_t NDIM>
void madness::FunctionNode< T, NDIM >::set_coeff ( const coeffT coeffs)
inline

◆ set_dnorm()

template<typename T , std::size_t NDIM>
void madness::FunctionNode< T, NDIM >::set_dnorm ( const double  dn)
inline

set the precomputed norm of the (virtual) d coefficients

References madness::FunctionNode< T, NDIM >::dnorm.

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

◆ set_has_children()

template<typename T , std::size_t NDIM>
void madness::FunctionNode< T, NDIM >::set_has_children ( bool  flag)
inline

◆ set_has_children_recursive()

template<typename T , std::size_t NDIM>
void madness::FunctionNode< T, NDIM >::set_has_children_recursive ( const typename FunctionNode< T, NDIM >::dcT c,
const Key< NDIM > &  key 
)
inline

◆ set_is_leaf()

template<typename T , std::size_t NDIM>
void madness::FunctionNode< T, NDIM >::set_is_leaf ( bool  flag)
inline

Sets has_children attribute to value of !flag.

References madness::FunctionNode< T, NDIM >::_has_children.

◆ set_norm_tree()

template<typename T , std::size_t NDIM>
void madness::FunctionNode< T, NDIM >::set_norm_tree ( double  norm_tree)
inline

◆ set_snorm()

template<typename T , std::size_t NDIM>
void madness::FunctionNode< T, NDIM >::set_snorm ( const double  sn)
inline

set the precomputed norm of the (virtual) s coefficients

References madness::FunctionNode< T, NDIM >::snorm.

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

◆ size()

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

◆ trace_conj()

template<typename T , std::size_t NDIM>
T madness::FunctionNode< T, NDIM >::trace_conj ( const FunctionNode< T, NDIM > &  rhs) const
inline

Member Data Documentation

◆ _coeffs

template<typename T , std::size_t NDIM>
coeffT madness::FunctionNode< T, NDIM >::_coeffs
private

◆ _has_children

template<typename T , std::size_t NDIM>
bool madness::FunctionNode< T, NDIM >::_has_children
private

◆ _norm_tree

template<typename T , std::size_t NDIM>
double madness::FunctionNode< T, NDIM >::_norm_tree
private

◆ buffer

template<typename T , std::size_t NDIM>
coeffT madness::FunctionNode< T, NDIM >::buffer
private

◆ dnorm

template<typename T , std::size_t NDIM>
double madness::FunctionNode< T, NDIM >::dnorm =-1.0
private

◆ snorm

template<typename T , std::size_t NDIM>
double madness::FunctionNode< T, NDIM >::snorm =-1.0
private

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