Small host-side numerical, interpolation, fitting, and I/O utilities. More...
#include "util.hpp"
Public Types | |
| using | HostVectorView = Kokkos::View< Real *, Kokkos::HostSpace > |
| Unmanaged-compatible host view type passed to fit callbacks. | |
Static Public Member Functions | |
| static void | A3deriv (const Kokkos::View< Real * > &y_in, const Kokkos::View< Real * > &x_in, Kokkos::View< Real * > &dydx_out, const Kokkos::View< Real * > &x_out) |
| Evaluate derivatives of local four-point cubic interpolants. | |
| static void | A3interp (const Kokkos::View< Real * > &y_in, const Kokkos::View< Real * > &x_in, Kokkos::View< Real * > &y_out, const Kokkos::View< Real * > &x_out) |
| Evaluate local four-point cubic Lagrange interpolants. | |
| static void | append_stat (const std::string &filename, const std::string &data) |
| Append one newline-terminated record to a statistics file. | |
| static int | choose_int (const Kokkos::View< int * > &arr, int val) |
| Find the first occurrence of an integer in a Kokkos View. | |
| static int | choose_int (const std::vector< int > &arr, int val) |
| Find the first occurrence of an integer in a standard vector. | |
| static void | creatd_stat (const std::string &filename) |
| Create or truncate an empty statistics text file. | |
| static int | execute_command_line_wrapper (const std::string &command) |
| Execute a command through the host C runtime shell. | |
| static void | gaussj (Kokkos::View< Real ** > &a, Kokkos::View< Real ** > &b, int n, int m) |
| Solve dense linear systems by full-pivot Gauss–Jordan elimination. | |
| static Real | interp1 (Real x, const Kokkos::View< Real * > &xp, const Kokkos::View< Real * > &yp) |
| Linearly interpolate a monotone one-dimensional table. | |
| static Real | log2real (bool lin) |
| Convert a logical flag to an exact real indicator. | |
| static void | mrqcof (const Kokkos::View< Real * > &x, const Kokkos::View< Real * > &y, const Kokkos::View< Real * > &sig, Kokkos::View< Real * > &a, const Kokkos::View< int * > &ia, Kokkos::View< Real ** > &alpha, Kokkos::View< Real * > &beta, Real &chisq, std::function< void(Real, const HostVectorView &, Real &, HostVectorView &)> funcs) |
| Assemble Levenberg–Marquardt normal-equation coefficients. | |
| template<typename ViewType > | |
| static void | putarr_attime (const ViewType &arr, Real time, const std::string &name) |
| Compatibility placeholder for time-tagged diagnostic array output. | |
| static Real | zbrent (std::function< Real(Real)> func, Real x1, Real x2, Real tol) |
| Find a bracketed scalar root with Brent's method. | |
Small host-side numerical, interpolation, fitting, and I/O utilities.
Routines accept Kokkos Views for integration with ORB5X storage but currently execute through host mirrors. Coordinate and value units pass through unchanged; derivatives have y/x units, and tolerances use the units of their corresponding independent variable.
| using orb5x::Util::HostVectorView = Kokkos::View<Real*, Kokkos::HostSpace> |
Unmanaged-compatible host view type passed to fit callbacks.
|
static |
Evaluate derivatives of local four-point cubic interpolants.
| [in] | y_in | Tabulated dependent values. |
| [in] | x_in | Increasing, distinct tabulation coordinates. |
| [in,out] | dydx_out | Derivatives in y_in/x_in units; unchanged when fewer than four input points are available. |
| [in] | x_out | Nondecreasing query coordinates. |
|
static |
Evaluate local four-point cubic Lagrange interpolants.
| [in] | y_in | Tabulated dependent values. |
| [in] | x_in | Increasing, distinct tabulation coordinates. |
| [in,out] | y_out | Output values; unchanged if fewer than four inputs. |
| [in] | x_out | Query coordinates, expected in nondecreasing order. |
|
static |
Append one newline-terminated record to a statistics file.
| [in] | filename | Output path. |
| [in] | data | Record text without the added newline. |
|
static |
Find the first occurrence of an integer in a Kokkos View.
| [in] | arr | Values copied to host for the search. |
| [in] | val | Requested value. |
|
static |
Find the first occurrence of an integer in a standard vector.
| [in] | arr | Values to search. |
| [in] | val | Requested value. |
|
static |
Create or truncate an empty statistics text file.
| [in] | filename | Output path. |
|
static |
Execute a command through the host C runtime shell.
| [in] | command | Shell command string. |
std::system status code.
|
static |
Solve dense linear systems by full-pivot Gauss–Jordan elimination.
| [in,out] | a | Leading n x n matrix, replaced by its inverse. |
| [in,out] | b | Leading n x m right-hand sides, replaced by solutions. |
| [in] | n | System dimension. |
| [in] | m | Number of right-hand sides. |
| std::runtime_error | If a pivot is repeated or has magnitude below 1e-15. |
|
static |
Linearly interpolate a monotone one-dimensional table.
| [in] | x | Query coordinate in the units of xp. |
| [in] | xp | Increasing tabulation coordinates. |
| [in] | yp | Values in the same order and with at least xp.extent(0) entries. |
|
static |
Convert a logical flag to an exact real indicator.
| [in] | lin | Logical input. |
|
static |
Assemble Levenberg–Marquardt normal-equation coefficients.
| [in] | x | Independent data coordinates. |
| [in] | y | Observations. |
| [in] | sig | One-standard-deviation uncertainties in y units. |
| [in,out] | a | Model parameters supplied to funcs. |
| [in] | ia | Nonzero entries select parameters to fit. |
| [out] | alpha | Symmetric curvature matrix for selected parameters. |
| [out] | beta | Gradient vector for selected parameters. |
| [out] | chisq | Sum of squared uncertainty-normalized residuals. |
| [in] | funcs | Callback returning model value and derivatives with respect to every parameter for one x coordinate. |
|
static |
Compatibility placeholder for time-tagged diagnostic array output.
| [in] | arr | Array that would be written. |
| [in] | time | Simulation time in ORB5X normalized units. |
| [in] | name | Diagnostic quantity name. |
|
static |
Find a bracketed scalar root with Brent's method.
| [in] | func | Continuous scalar function. |
| [in] | x1 | First bracket endpoint. |
| [in] | x2 | Second bracket endpoint. |
| [in] | tol | Absolute convergence tolerance in x units. |