1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// SPDX-License-Identifier: AGPL-3.0-or-later
//! Sampling strategies for parameter space exploration
//!
//! Provides space-filling and guided sampling methods used across domains:
//! - **Surrogate learning**: Train RBF models on well-distributed points
//! - **Design of experiments**: Explore parameter spaces efficiently
//! - **Neural architecture search**: Evaluate hyperparameter configurations
//! - **Monte Carlo**: Generate quasi-random initial conditions
//!
//! # Available Samplers
//!
//! - [`latin_hypercube`] — Space-filling design with stratified intervals
//! - [`random_uniform`] — Uniform random sampling within bounds
//! - [`maximin::maximin_lhs`] — Maximin-optimized LHS (maximize min pairwise distance)
//! - [`sparsity::sparsity_sampler`] — Iterative surrogate-directed sampling (Diaw et al. 2024)
//! - [`direct::direct_sampler`] — Round-based direct NM on true objective (hotSpring)
//! - [`metropolis::boltzmann_sampling`] — Metropolis-Hastings MCMC with Boltzmann acceptance
//! - [`sobol::sobol_sequence`] — Low-discrepancy quasi-random sequences
//!
//! # Examples
//!
//! ```
//! use barracuda::sample::{latin_hypercube, random_uniform};
//!
//! let bounds = vec![(-5.0, 5.0), (-5.0, 5.0)];
//!
//! // LHS: one sample per row/column in hypercube
//! let lhs_points = latin_hypercube(100, &bounds, 42)?;
//! assert_eq!(lhs_points.len(), 100);
//! assert_eq!(lhs_points[0].len(), 2);
//!
//! // Random: uniform within bounds
//! let rng_points = random_uniform(100, &bounds, 42);
//! assert_eq!(rng_points.len(), 100);
//! # Ok::<(), barracuda::error::BarracudaError>(())
//! ```
//!
//! ```
//! use barracuda::sample::sobol::sobol_scaled;
//!
//! let bounds = vec![(0.0, 1.0), (0.0, 1.0)];
//! let points = sobol_scaled(100, &bounds).unwrap();
//! // Points are more uniformly distributed than pseudo-random
//! ```
/// Latin hypercube sampling shader.
pub static WGSL_LHS: LazyLock =
new;
/// f64 is the canonical source — math is universal, precision is silicon.
static WGSL_METROPOLIS_F64: &str = include_str!;
/// WGSL shader: parallel Metropolis-Hastings MCMC
/// WGSL kernel for Metropolis-Hastings sampling.
pub static WGSL_METROPOLIS: LazyLock =
new;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;