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, _)
Input Fields:
['x']Output Datatypes:
[('f', <class 'float'>)]Evaluates the vector norm for a single point
x.See also
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
9from libensemble.specs import input_fields, output_data
10
11
12@input_fields(["x"])
13@output_data([("f", float)])
14def norm_eval(H, persis_info, sim_specs, _):
15 """
16 Evaluates the vector norm for a single point ``x``.
17
18 .. seealso::
19 `test_2d_sampling.py <https://github.com/Libensemble/libensemble/blob/develop/libensemble/tests/regression_tests/test_2d_sampling.py>`_ # noqa
20 """
21 x = H["x"]
22 H_o = np.zeros(1, dtype=sim_specs["out"])
23 H_o["f"] = np.linalg.norm(x)
24 return H_o, persis_info