Metis 2.0.0
High-performance C++20 dual-mode numerical framework
Loading...
Searching...
No Matches
metis::diff_test::detail Namespace Reference

Functions

template<typename F, typename T>
constexpr int detect_arity ()
 Detect the arity of a callable when invoked with arguments of type T.
template<typename Func, typename Scalar>
constexpr int arity_of ()
 Get the detected arity of a callable for a given scalar type.
template<typename Func, typename Scalar>
auto invoke (Func &&f, const std::vector< Scalar > &args)
 Invoke a callable with N arguments unpacked from a vector.
template<typename T>
Eigen::VectorXd to_numeric_vector (const T &val)
 Normalize a scalar or vector return to Eigen::VectorXd.
template<typename T>
std::vector< SymbolicArgto_symbolic_output_args (const T &val)
 Normalize a symbolic scalar or vector return to a vector of SymbolicArg.
std::string format_point (const std::vector< double > &point)
 Format a test point as a string for diagnostics.
std::string format_matrix (const Eigen::MatrixXd &m)
 Format an Eigen matrix as a string for diagnostics.

Function Documentation

◆ arity_of()

template<typename Func, typename Scalar>
int metis::diff_test::detail::arity_of ( )
constexpr

Get the detected arity of a callable for a given scalar type.

◆ detect_arity()

template<typename F, typename T>
int metis::diff_test::detail::detect_arity ( )
constexpr

Detect the arity of a callable when invoked with arguments of type T.

Checks from 1 to 8 arguments and returns the first arity that compiles. For generic lambdas like [](auto x, auto y) { ... }, std::is_invocable_v correctly returns false for wrong arities.

◆ format_matrix()

std::string metis::diff_test::detail::format_matrix ( const Eigen::MatrixXd & m)
inline

Format an Eigen matrix as a string for diagnostics.

◆ format_point()

std::string metis::diff_test::detail::format_point ( const std::vector< double > & point)
inline

Format a test point as a string for diagnostics.

◆ invoke()

template<typename Func, typename Scalar>
auto metis::diff_test::detail::invoke ( Func && f,
const std::vector< Scalar > & args )

Invoke a callable with N arguments unpacked from a vector.

Validates that args.size() matches the callable's detected arity. Mismatched sizes indicate a bug in the test (wrong number of values in a test point).

◆ to_numeric_vector()

template<typename T>
Eigen::VectorXd metis::diff_test::detail::to_numeric_vector ( const T & val)

Normalize a scalar or vector return to Eigen::VectorXd.

◆ to_symbolic_output_args()

template<typename T>
std::vector< SymbolicArg > metis::diff_test::detail::to_symbolic_output_args ( const T & val)

Normalize a symbolic scalar or vector return to a vector of SymbolicArg.