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
//! Indexed (top-K) packing for the senna topic models.
//!
//! Packs each row's top-K features into `[N, K]` host buffers, never an
//! `[N, D]` dense matrix. This is a **bounded** view of a row; what a decoder
//! scores is the consumer's choice over the whole feature axis, so a minibatch
//! carries `row_ids` and stops there.
//!
//! Module layout (split 2026-05-15 from a single 1570-line file):
//! - [`types`] — public data types (`IndexedSample`, `IndexedMinibatchData`).
//! - [`top_k`] — weighted top-K selection (`top_k_indices_weighted`,
//! `csc_columns_to_indexed_samples`, `build_indexed_samples`).
//! - [`pack`] — parallel `[N, K]` pack/gather helpers.
//!
//! The single-track in-memory loader that used to sit here, and the
//! feature-feature graph it fed the encoder's GCN block from, are gone: the
//! masked family reads dense rows ([`crate::candle::data::masked_dense`]) and nothing
//! built either any more. The two-track (spliced / unspliced) gem row/gene
//! map that used to live here (`splice_tracks`) is gone too, with the
//! composite engine that consumed it. What is left are the packing pieces
//! that the old-model windowed evaluation still uses.
use ProgressBar;
pub use gather_per_feature_at_indices;
pub use ;
pub use ;
// Crate-public re-exports.
pub use pack_indices_values;
pub use build_indexed_samples;
///////////////////////////////////////////////////////////////////////////
// Progress bar helper (used here and externally by cell-grouped loader) //
///////////////////////////////////////////////////////////////////////////
/// A bounded progress bar in the **canonical workspace style** (see
/// [`crate::matrix::progress::new_progress_bar`]): `[elapsed] bar pos/len (eta) {msg}`,
/// cyan/blue, and — crucially — registered with the shared `MULTI_PROGRESS` so `-v`
/// log output interleaves cleanly above it. `label` is the initial `{msg}` (e.g.
/// "Epochs", "Null rows"); the epoch trainers overwrite it each step with a live metric
/// (`prog_bar.set_message`), matching `senna bge`. Delegating here keeps every
/// legume_numeric::candle bar on ONE style and ONE bridged `MultiProgress` — a locally-styled
/// `ProgressBar::new` spawns a SECOND, unbridged bar that corrupts log output under
/// `-v` (see the `legume_numeric::matrix::progress` module doc).