#[cfg(feature = "bench-internals")]
use faer::{MatMut, MatRef};
#[cfg(feature = "bench-internals")]
pub fn fill_pairwise_sq_euclidean(x: MatRef<'_, f64>, dist: MatMut<'_, f64>) {
crate::kernel::fill_squared_euclidean(x, dist, &mut []);
}
#[cfg(feature = "bench-internals")]
pub struct ArdCache(crate::kernel::ArdSqDiffBuf<f64>);
#[cfg(feature = "bench-internals")]
pub fn fill_ard_squared_diff(x: MatRef<'_, f64>) -> Result<ArdCache, crate::GprError> {
crate::kernel::ArdSqDiffBuf::new(x).map(ArdCache)
}
#[cfg(feature = "bench-internals")]
pub fn apply_from_ard_cache<M: crate::KernelMath>(
kernel: &crate::kernel::CompiledKernel,
cache: &ArdCache,
x: MatRef<'_, f64>,
out: MatMut<'_, f64>,
uplo: crate::kernel::Triangle,
scratch: MatMut<'_, f64>,
) -> Result<(), crate::GprError> {
let mut nested = kernel.nested_buffers(out.nrows(), out.ncols());
kernel.apply_from_ard_cache::<M>(cache.0.view(), x, out, uplo, scratch, &mut nested)
}
#[cfg(feature = "bench-internals")]
pub fn grad_from_ard_cache<M: crate::KernelMath>(
kernel: &crate::kernel::CompiledKernel,
cache: &ArdCache,
x: MatRef<'_, f64>,
d_k: MatMut<'_, f64>,
param_idx: usize,
uplo: crate::kernel::Triangle,
scratch: MatMut<'_, f64>,
) -> Result<(), crate::GprError> {
let mut nested = kernel.nested_buffers(d_k.nrows(), d_k.ncols());
kernel.grad_from_ard_cache::<M>(
cache.0.view(),
x,
d_k,
param_idx,
uplo,
scratch,
&mut nested,
)
}
#[cfg(feature = "insert-stages")]
pub use crate::gpr::take_insert_stages;
#[cfg(feature = "bench-internals")]
pub fn reset_objective_call_counts() {
crate::objective::call_counts::reset();
}
#[cfg(feature = "bench-internals")]
pub fn objective_call_counts() -> (u64, u64) {
crate::objective::call_counts::read()
}