Skip to main content

Module utils

Module utils 

Source
Expand description

Numerical and timing utilities.

Mirrors Common/IpUtils.{hpp,cpp}. The PRNG is a portable reimplementation of POSIX drand48 (48-bit LCG with the glibc-default seed) so output matches a drand48-built upstream Ipopt deterministically. Replace with libc’s drand48 later if a particular platform’s bit-equivalence target requires it.

Functions§

compare_le
Equivalent to Ipopt::Compare_le(lhs, rhs, BasVal) — relaxed <= with a tolerance proportional to |BasVal|. Threshold matches upstream’s (10 * machine_epsilon * Max(1, |BasVal|)).
compute_mem_increase_i64
Equivalent to Ipopt::ComputeMemIncrease. Updates len to a new length consistent with recommended/min while clamping to T::MAX. Returns Err if even the maximum representable size would not be an increase.
cpu_time
CPU time in seconds. Equivalent to Ipopt::CpuTime.
ip_random_01
Equivalent to Ipopt::IpRandom01. 48-bit LCG matching POSIX drand48: X_{n+1} = (0x5DEECE66D · X_n + 0xB) mod 2^48, returning the high-order 48 bits as a f64 in [0, 1).
ip_reset_random_01
Reset the PRNG to glibc’s default seed. Equivalent to Ipopt::IpResetRandom01.
is_finite_number
Equivalent to Ipopt::IsFiniteNumber. Returns false for NaN/±∞.
sys_time
System time in seconds since UNIX epoch. Equivalent to Ipopt::SysTime.
wallclock_time
Wallclock time in seconds since first call. Equivalent to Ipopt::WallclockTime.