matmod/
├── crates/
│ ├── kernels/ # traits + algebra
│ ├── ffi/ # FFI bindings
│ ├── runtime/ # scheduler + execution
│ ├── app/ # binary (experiments)
│ ├── data_prep/ # data loading and preparation
│ ├── Cargo.toml # workspace
kernels/
├── lib.rs
├── state.rs # chain state and working buffers
├── density.rs # LogDensity, GradLogDensity, HessianLogDensity
├── kernel.rs # TransitionKernel, GradientKernel, state-space traits
├── buffer.rs # owned buffers + views
├── metric.rs # Identity, diagonal, dense Cholesky geometry
ffi/
├── lib.rs
├── gaussian.rs # Gaussian target backend
├── stan.rs # C++ / Stan-style backend example
└── ddm.rs # future DDM backend
runtime/
├── lib.rs
├── scheduler/
│ ├── mod.rs
│ ├── chain.rs # single-chain state machine
│ ├── multi.rs # multi-chain orchestration
│ └── stage.rs # pipeline stages
├── execution/
│ ├── mod.rs
│ ├── rayon.rs # parallel backend
│ └── sequential.rs
├── adapt/
│ ├── mod.rs
│ └── step_size.rs
├── io/
│ ├── mod.rs
│ └── writer.rs
└── config.rs