MADNESS 0.10.1
test_eval.cc File Reference

Targeted unit tests for FunctionImpl::eval_local_only and eval_cube. More...

#include <madness/mra/mra.h>
#include <madness/mra/funcdefaults.h>
#include <madness/world/test_utilities.h>
#include <madness/tensor/tensor.h>
#include <algorithm>
#include <array>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <limits>
#include <random>
#include <string>
#include <vector>
Include dependency graph for test_eval.cc:

Classes

class  Constant< T, NDIM >
class  Gaussian< T, NDIM >
struct  GoldenPoint
class  Oscillatory< NDIM >

Functions

template<std::size_t NDIM>
void bench_cell (World &world, int k)
static double eval_tol (double ref, double k_factor=1.0)
template<std::size_t NDIM>
bool golden_check_ndim (World &world, int k, double thresh, double cx, const double raw_pt[3], double &out_ref, double &out_lo)
static bool is_heavy (std::size_t ndim, int k, double thresh)
int main (int argc, char **argv)
template<std::size_t NDIM>
std::vector< Vector< double, NDIM > > random_sim_points (int n, uint64_t seed)
template<std::size_t NDIM>
int run_batched_cell (World &world, const std::string &label, int k, double thresh, double L, const std::vector< Vector< double, NDIM > > &user_pts)
void run_benchmark (World &world)
template<typename FunctorT, std::size_t NDIM>
int run_correctness_cell (World &world, const std::string &label, FunctorT *raw_functor, int k, double thresh, double L, const std::vector< Vector< double, NDIM > > &user_pts)
template<std::size_t NDIM>
Vector< double, NDIM > sim_to_user (const Vector< double, NDIM > &xsim, const Tensor< double > &cell)
template<std::size_t NDIM>
int test_batched_ndim (World &world)
int test_contraction_micro (World &world)
template<std::size_t NDIM>
int test_correctness_ndim (World &world)
int test_general_fast_transform (World &world)
int test_golden_values (World &world)
int test_output_param_overload (World &world)
int test_scaling_factor (World &world)

Variables

static const GoldenPoint golden_pts []
static const bool print_golden
static const bool run_bench
static const bool run_heavy

Detailed Description

Targeted unit tests for FunctionImpl::eval_local_only and eval_cube.

Covers:

  • correctness matrix: NDIM x k x thresh x functor x point location x ranks
  • golden-value characterization: pins computed values to guard silent drift
  • micro-test #1: contraction correctness (raw loop vs separated form)
  • micro-test #2: scaling factor (exp2 vs pow, cached 1/sqrt(V))

Heavy cells (NDIM==6, k>8, thresh<=1e-8) are compiled but skipped at runtime unless MADNESS_TEST_EVAL_EXHAUSTIVE=1 is set.

Function Documentation

◆ bench_cell()

◆ eval_tol()

double eval_tol ( double ref,
double k_factor = 1.0 )
static

References std::abs(), and e().

Referenced by run_correctness_cell().

◆ golden_check_ndim()

◆ is_heavy()

bool is_heavy ( std::size_t ndim,
int k,
double thresh )
static

References e(), k, and thresh.

Referenced by test_correctness_ndim().

◆ main()

◆ random_sim_points()

template<std::size_t NDIM>
std::vector< Vector< double, NDIM > > random_sim_points ( int n,
uint64_t seed )

References d, dist(), NDIM, and p().

Referenced by test_batched_ndim(), and test_correctness_ndim().

◆ run_batched_cell()

◆ run_benchmark()

void run_benchmark ( World & world)

◆ run_correctness_cell()

◆ sim_to_user()

template<std::size_t NDIM>
Vector< double, NDIM > sim_to_user ( const Vector< double, NDIM > & xsim,
const Tensor< double > & cell )

◆ test_batched_ndim()

template<std::size_t NDIM>
int test_batched_ndim ( World & world)

◆ test_contraction_micro()

int test_contraction_micro ( World & world)

◆ test_correctness_ndim()

template<std::size_t NDIM>
int test_correctness_ndim ( World & world)

◆ test_general_fast_transform()

int test_general_fast_transform ( World & world)

References run_heavy.

Referenced by main().

◆ test_golden_values()

◆ test_output_param_overload()

◆ test_scaling_factor()

Variable Documentation

◆ golden_pts

const GoldenPoint golden_pts[]
static
Initial value:
= {
{1, 7, 1e-5, { 0.3, 0.0, 0.0}},
{1, 7, 1e-5, { 0.0, 0.0, 0.0}},
{1, 7, 1e-5, {-0.5, 0.0, 0.0}},
{2, 7, 1e-5, { 0.3, 0.3, 0.0}},
{2, 7, 1e-5, { 0.1, -0.2, 0.0}},
{3, 7, 1e-5, { 0.3, -0.3, 0.3}},
{3, 7, 1e-5, { 0.0, 0.0, 0.0}},
}
void e()
Definition test_sig.cc:75

Referenced by test_golden_values().

◆ print_golden

const bool print_golden
static
Initial value:
=
(std::getenv("MADNESS_TEST_EVAL_PRINT_GOLDEN") != nullptr)

Referenced by golden_check_ndim().

◆ run_bench

const bool run_bench
static
Initial value:
=
(std::getenv("MADNESS_BENCH_EVAL") != nullptr)

Referenced by main(), and main().

◆ run_heavy

const bool run_heavy
static
Initial value:
=
(std::getenv("MADNESS_TEST_EVAL_EXHAUSTIVE") != nullptr)

Referenced by main(), test_correctness_ndim(), and test_general_fast_transform().