simple_sim

This module contains an example function that evaluates one point of any dimension >=1

simple_sim.norm_eval(H, persis_info, sim_specs, _)

Evaluates the vector norm for a single point x.

simple_sim.py
 1"""
 2This module contains an example function that evaluates one point of any dimension >=1
 3"""
 4
 5__all__ = ["norm_eval"]
 6
 7import numpy as np
 8
 9
10def norm_eval(H, persis_info, sim_specs, _):
11    """
12    Evaluates the vector norm for a single point ``x``.
13
14    .. seealso::
15        `test_2d_sampling.py <https://github.com/Libensemble/libensemble/blob/develop/libensemble/tests/regression_tests/test_2d_sampling.py>`_ # noqa
16    """
17    x = H["x"]
18    H_o = np.zeros(1, dtype=sim_specs["out"])
19    H_o["f"] = np.linalg.norm(x)
20    return H_o, persis_info