|
MADNESS 0.10.1
|
#include <madness/mra/mra.h>#include <madness/mra/vmra.h>#include <madness/world/test_utilities.h>#include <cmath>#include <cstdio>#include <string>#include <vector>
Classes | |
| class | Gauss |
| exp(-a |r-R|^2) More... | |
| struct | operand_pair |
| an operand pair plus the independently projected analytic product More... | |
| class | Slater |
| c * exp(-a |r-R|), cusped at R More... | |
Functions | |
| static std::string | fmt_tol (double tol) |
| static long | interior_nodes_with_coeffs (World &world, const Function< double, D > &f) |
| int | main (int argc, char **argv) |
| static std::vector< operand_pair > | make_pairs (World &world) |
| static long | nodes_with_marker (World &world, const Function< double, D > &f) |
| number of nodes carrying the norm_tree == -1.0 broadened marker | |
| static long | nodes_with_moved_marker (World &world, const Function< double, D > &orig, const Function< double, D > &scaled) |
| static long | nodes_with_unscaled_norms (World &world, const Function< double, D > &orig, const Function< double, D > &scaled, double q) |
| static Function< double, D > | project (World &world, const std::shared_ptr< FunctionFunctorInterface< double, D > > &functor) |
| static double | sparse_product_error (World &world, const Function< double, D > &qf, const Function< double, D > &g, const Function< double, D > &ref, double tol, const std::string &tag) |
| ||mul_sparse(qf, g, tol) - ref||, or 1e300 if the kernel throws | |
| int | test_broaden_resets_norms (World &world, std::vector< operand_pair > &pairs) |
| int | test_compress_clears_snorm (World &world, std::vector< operand_pair > &pairs) |
| int | test_dot_sparse (World &world, std::vector< operand_pair > &pairs) |
| T5: dot_sparse routes through the screened kernel; check it against the analytic sum. | |
| int | test_empty_vector_norms (World &world) |
| int | test_exact (World &world, std::vector< operand_pair > &pairs) |
| T1: the exact path reproduces the analytic product. | |
| int | test_norm_tree_states (World &world, std::vector< operand_pair > &pairs) |
| int | test_norms_preserve_tree_state (World &world, std::vector< operand_pair > &pairs) |
| int | test_operand_state (World &world, std::vector< operand_pair > &pairs) |
| int | test_scale_inplace_norms (World &world, std::vector< operand_pair > &pairs) |
| int | test_scale_preserves_broaden_marker (World &world, std::vector< operand_pair > &pairs) |
| int | test_scaled_redundant_operand (World &world, std::vector< operand_pair > &pairs) |
| int | test_screening_accuracy (World &world, std::vector< operand_pair > &pairs) |
| int | test_self_consistency (World &world, std::vector< operand_pair > &pairs) |
| int | test_tree_state (World &world, std::vector< operand_pair > &pairs) |
| T2: the result is a reconstructed tree, both scalar and vector entry points. | |
Variables | |
| static const double | C_MAX = 100.0 |
| err <= C_MAX*tol; measured max 34 | |
| static const std::size_t | D = 3 |
| static const double | EXACT_FLOOR = 1.e-7 |
| static const double | P_MIN = 0.4 |
| err ~ tol^p; measured p = 0.58 .. 0.75 | |
| static const double | THRESH_REF = 1.e-9 |
| projection threshold of the reference | |
|
static |
Referenced by test_dot_sparse(), test_self_consistency(), and test_tree_state().
number of nodes violating the reconstructed layout: coefficients live on the leaves only
References madness::f, madness::World::gop, and madness::WorldGopInterface::sum().
Referenced by test_tree_state().
| int main | ( | int | argc, |
| char ** | argv | ||
| ) |
References madness::WorldGopInterface::fence(), madness::finalize(), madness::World::gop, madness::initialize(), make_pairs(), madness::FunctionDefaults< NDIM >::set_autorefine(), madness::FunctionDefaults< NDIM >::set_cubic_cell(), madness::FunctionDefaults< NDIM >::set_initial_level(), madness::FunctionDefaults< NDIM >::set_k(), madness::FunctionDefaults< NDIM >::set_refine(), madness::FunctionDefaults< NDIM >::set_thresh(), madness::startup(), test_broaden_resets_norms(), test_compress_clears_snorm(), test_dot_sparse(), test_empty_vector_norms(), test_exact(), test_norm_tree_states(), test_norms_preserve_tree_state(), test_operand_state(), test_scale_inplace_norms(), test_scale_preserves_broaden_marker(), test_scaled_redundant_operand(), test_screening_accuracy(), test_self_consistency(), test_tree_state(), and THRESH_REF.
|
static |
coincident Gaussians, separated Gaussians (where the screening actually fires, as it does for distant localized orbitals), and a Slater cusp
References a, and madness::project().
Referenced by main().
number of nodes carrying the norm_tree == -1.0 broadened marker
References madness::f, madness::World::gop, and madness::WorldGopInterface::sum().
Referenced by test_scale_preserves_broaden_marker().
|
static |
number of nodes where exactly one of orig and scaled carries the norm_tree == -1.0 broadened marker; orig and scaled share a tree
References madness::Function< T, NDIM >::get_impl(), madness::World::gop, and madness::WorldGopInterface::sum().
Referenced by test_scale_preserves_broaden_marker().
|
static |
number of nodes of scaled whose norms are not |q| times those of orig, or whose dnorm_tree is uncomputed; orig and scaled share a tree
References std::abs(), madness::Function< T, NDIM >::get_impl(), madness::World::gop, madness::NORM_TREE_UNCOMPUTED, q(), and madness::WorldGopInterface::sum().
Referenced by test_scale_inplace_norms(), and test_scaled_redundant_operand().
|
static |
|
static |
||mul_sparse(qf, g, tol) - ref||, or 1e300 if the kernel throws
References e(), madness::g, madness::mul_sparse(), madness::norm2(), and madness::World::rank().
Referenced by test_scale_inplace_norms(), and test_scaled_redundant_operand().
| int test_broaden_resets_norms | ( | World & | world, |
| std::vector< operand_pair > & | pairs | ||
| ) |
T8: broaden() resets the per-node norms through zero_norm_tree(). The screening criterion reads norm_tree and dnorm_tree as a pair, so a reset that clears one and leaves the other in place is worse than no reset at all: norm_tree = 0 with a small stale dnorm_tree passes the test in mulXXveca() and multiplies at a level that is too coarse.
References c, madness::test_output::checkpoint(), madness::copy(), madness::test_output::end(), madness::f, madness::WorldGopInterface::fence(), madness::g, madness::World::gop, madness::NORM_TREE_UNCOMPUTED, madness::World::rank(), madness::test_output::set_do_print(), and madness::WorldGopInterface::sum().
Referenced by main().
| int test_compress_clears_snorm | ( | World & | world, |
| std::vector< operand_pair > & | pairs | ||
| ) |
T11: compress() clears the leaf coefficients, and snorm has to go with them. recur_down_for_contraction_map() reads snorm > 0 as "this node holds s coefficients" and then skips building them, so a stale snorm on an emptied node sends the recursion into unfilter() with an empty tensor. The norm the parent filters with is norm_tree, which does keep the leaf norm – reading it after the coefficients are gone is what propagates a zero to the root.
References c, madness::test_output::checkpoint(), madness::copy(), madness::test_output::end(), exact, madness::f, madness::World::gop, madness::World::rank(), madness::test_output::set_do_print(), and madness::WorldGopInterface::sum().
Referenced by main().
| int test_dot_sparse | ( | World & | world, |
| std::vector< operand_pair > & | pairs | ||
| ) |
T5: dot_sparse routes through the screened kernel; check it against the analytic sum.
References a, b, C_MAX, madness::test_output::checkpoint(), madness::copy(), madness::dot_sparse(), madness::test_output::end(), EXACT_FLOOR, madness::f, fmt_tol(), madness::g, madness::norm2(), q(), madness::World::rank(), and madness::test_output::set_do_print().
Referenced by main().
| int test_empty_vector_norms | ( | World & | world | ) |
T9: the vector norms accept an empty vector. norm2s()/norm2s_T() index norms[0] to get the buffer address, which is undefined behaviour on an empty container even with a length of zero.
References madness::test_output::checkpoint(), madness::test_output::end(), madness::norm2(), madness::norm2s(), madness::norm2s_T(), madness::World::rank(), madness::test_output::set_do_print(), and madness::BaseTensor::size().
Referenced by main().
| int test_exact | ( | World & | world, |
| std::vector< operand_pair > & | pairs | ||
| ) |
T1: the exact path reproduces the analytic product.
References madness::test_output::checkpoint(), madness::test_output::end(), EXACT_FLOOR, madness::mul_sparse(), madness::norm2(), p(), q(), madness::World::rank(), and madness::test_output::set_do_print().
Referenced by main().
| int test_norm_tree_states | ( | World & | world, |
| std::vector< operand_pair > & | pairs | ||
| ) |
T7: norm_tree means ||f|| on the box, in every tree state. compress() clears leaf coefficients, and the leaf norm has to be read before that happens or a zero propagates to the root.
References std::abs(), madness::test_output::checkpoint(), madness::copy(), madness::test_output::end(), exact, madness::f, madness::g, madness::World::gop, madness::WorldGopInterface::max(), madness::World::rank(), and madness::test_output::set_do_print().
Referenced by main().
| int test_norms_preserve_tree_state | ( | World & | world, |
| std::vector< operand_pair > & | pairs | ||
| ) |
T10: norm2() and trace() answer from a redundant or nonstandard-with-leaves tree without converting it. Adding up every node overcounts there – the scaling coefficients sit on every level – but the leaves alone are exactly the reconstructed tree, so the answer costs no mutation and no extra fence. mul_sparse() leaves its operands redundant and callers take norms of them in a loop, so converting here would be paid back by the next multiplication.
References std::abs(), madness::test_output::checkpoint(), madness::copy(), madness::test_output::end(), madness::f, madness::nonstandard_with_leaves, madness::norm2(), madness::norm2s(), madness::World::rank(), madness::redundant, madness::test_output::set_do_print(), and v.
Referenced by main().
| int test_operand_state | ( | World & | world, |
| std::vector< operand_pair > & | pairs | ||
| ) |
T6: mul_sparse leaves its operands redundant. The global norm2()/trace() entry points must stay correct across that state.
References madness::test_output::checkpoint(), madness::copy(), madness::test_output::end(), madness::WorldGopInterface::fence(), madness::get_tree_state(), madness::World::gop, madness::mul_sparse(), operand_pair::name, madness::norm2s(), p(), q(), madness::World::rank(), madness::redundant, madness::test_output::set_do_print(), and v.
Referenced by main().
| int test_scale_inplace_norms | ( | World & | world, |
| std::vector< operand_pair > & | pairs | ||
| ) |
T13: f.scale(q) scales in place and keeps the tree state, so the node norms have to follow the coefficients. Left alone they stay computed but wrong by |q|: the kernel's check passes, and the screen silently judges the product against norms |q| times too small or too large.
References C_MAX, madness::test_output::checkpoint(), madness::copy(), madness::test_output::end(), madness::f, madness::g, madness::Function< T, NDIM >::get_impl(), nodes_with_unscaled_norms(), p(), q(), madness::World::rank(), madness::redundant, madness::Function< T, NDIM >::scale(), madness::test_output::set_do_print(), and sparse_product_error().
Referenced by main().
| int test_scale_preserves_broaden_marker | ( | World & | world, |
| std::vector< operand_pair > & | pairs | ||
| ) |
T14: broaden and refine_op mark handled nodes with norm_tree == -1.0, and a later broaden skips those nodes by exact comparison. Scaling must preserve the marker or broadening can repeat before norms are recomputed.
References madness::test_output::checkpoint(), madness::copy(), madness::test_output::end(), madness::f, madness::WorldGopInterface::fence(), madness::World::gop, nodes_with_marker(), nodes_with_moved_marker(), q(), madness::World::rank(), madness::Function< T, NDIM >::scale(), and madness::test_output::set_do_print().
Referenced by main().
| int test_scaled_redundant_operand | ( | World & | world, |
| std::vector< operand_pair > & | pairs | ||
| ) |
T12: q*f copies f's tree state, so a scaled copy of a redundant function is redundant too, and mul_sparse() takes that label at its word and skips make_redundant(). The copy therefore has to carry the norms the screen reads, scaled by |q|; with them left uncomputed the kernel's redundant-form check fires on the scaled operand.
References C_MAX, madness::test_output::checkpoint(), madness::copy(), madness::test_output::end(), madness::f, madness::g, madness::Function< T, NDIM >::get_impl(), nodes_with_unscaled_norms(), p(), q(), madness::World::rank(), madness::redundant, madness::test_output::set_do_print(), and sparse_product_error().
Referenced by main().
| int test_screening_accuracy | ( | World & | world, |
| std::vector< operand_pair > & | pairs | ||
| ) |
T3: the screening error over a tol ladder, against the analytic product.
The bounds are measured, not derived: err ~ tol^p with p short of 1, and tree quantization (adjacent tol yielding the same tree) leaves err flat and inflates err/tol by up to a decade. Hence a loose C_MAX plus two tighter statements – err falls monotonically with tol, and its decay exponent does not collapse.
References C_MAX, madness::test_output::checkpoint(), madness::test_output::end(), madness::mul_sparse(), madness::norm2(), p(), P_MIN, q(), madness::World::rank(), and madness::test_output::set_do_print().
Referenced by main().
| int test_self_consistency | ( | World & | world, |
| std::vector< operand_pair > & | pairs | ||
| ) |
T4: screened and exact multiplication agree to within tol, no analytic reference needed
References C_MAX, madness::test_output::checkpoint(), madness::test_output::end(), exact, fmt_tol(), madness::mul_sparse(), madness::norm2(), p(), q(), madness::World::rank(), and madness::test_output::set_do_print().
Referenced by main().
| int test_tree_state | ( | World & | world, |
| std::vector< operand_pair > & | pairs | ||
| ) |
T2: the result is a reconstructed tree, both scalar and vector entry points.
References madness::test_output::checkpoint(), madness::test_output::end(), madness::WorldGopInterface::fence(), fmt_tol(), madness::get_tree_state(), madness::World::gop, interior_nodes_with_coeffs(), L, madness::mul_sparse(), p(), q(), madness::World::rank(), madness::reconstructed, madness::test_output::set_do_print(), and v.
Referenced by main().
|
static |
err <= C_MAX*tol; measured max 34
Bounds on the screening error over the tol ladder, all measured, see the header of test_screening_accuracy.
Referenced by test_dot_sparse(), test_scale_inplace_norms(), test_scaled_redundant_operand(), test_screening_accuracy(), and test_self_consistency().
|
static |
Referenced by Gauss::operator()().
|
static |
Error floor of the exact path (tol=0): the product of two order-k polynomials is not representable at order k, and multiplication does not autorefine. Measured max 2.3e-8 over the pairs below.
Referenced by test_dot_sparse(), and test_exact().
|
static |
err ~ tol^p; measured p = 0.58 .. 0.75
Referenced by test_screening_accuracy().