refactor: simplify nonzero_triples and update workspace tooling
Remove the `sorted_slots` parameter from `nonzero_triples` and update callers to always sort slots internally. Introduce `MEMBERS_DIR` to workspace scripts to support scanning subdirectories for Cargo manifests. Bump crate-kit version to 0.1.1. - Remove `sorted_slots` field from `nonzero_triples` in `src/obicompactvec/src/views.rs` and always sort permutation by slot values internally. - Update `nonzero_iter` in `src/obicompactvec/src/intmatrix.rs` and `src/obicompactvec/src/bitmatrix/persistent.rs` to call `nonzero_triples` without the `false` argument, passing column views directly. - Add `MEMBERS_DIR` variable to `Makefile` and export it in `.crate-kit/dev-patch.mk` to define the workspace folder for member scanning. - Update `.crate-kit/scripts/deps-lib.sh` and `.crate-kit/scripts/dev-patch.sh` to check for `Cargo.toml` files relative to `$MEMBERS_DIR`, excluding the root manifest. - Change version in `.crate-kit/VERSION` from 0.3.4 to 0.1.1.
This commit is contained in:
1 parent
f1b4b4ebda
commit
f935fb66c4
8 files changed
+25
-23
No files matched your search
@@ -272,12 +272,9 @@ impl PersistentBitMatrix {
|
||||
Self::Implicit { .. } => {
|
||||
Box::new(slots.iter().enumerate().map(|(i, _)| (i, 0usize, 1u32)))
|
||||
}
|
||||
Self::Columnar(_) | Self::Packed(_) => Box::new(nonzero_triples(
|
||||
slots,
|
||||
self.n_cols(),
|
||||
|c| self.col_view(c),
|
||||
false,
|
||||
)),
|
||||
Self::Columnar(_) | Self::Packed(_) => {
|
||||
Box::new(nonzero_triples(slots, self.n_cols(), |c| self.col_view(c)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -560,12 +560,9 @@ impl PersistentIntMatrix {
|
||||
) -> Box<dyn Iterator<Item = (usize, usize, u32)> + 'a> {
|
||||
match self {
|
||||
Self::Sparse(m) => Box::new(m.nonzero_iter(slots)),
|
||||
Self::Columnar(_) | Self::Packed(_) => Box::new(nonzero_triples(
|
||||
slots,
|
||||
self.n_cols(),
|
||||
|c| self.col_view(c),
|
||||
false,
|
||||
)),
|
||||
Self::Columnar(_) | Self::Packed(_) => {
|
||||
Box::new(nonzero_triples(slots, self.n_cols(), |c| self.col_view(c)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -605,13 +605,10 @@ pub(crate) fn nonzero_triples<V: NonzeroSlotsView>(
|
||||
slots: &[usize],
|
||||
n_cols: usize,
|
||||
col_view: impl Fn(usize) -> V,
|
||||
sorted_slots: bool,
|
||||
) -> impl Iterator<Item = (usize, usize, u32)> {
|
||||
let n = slots.len();
|
||||
let mut perm: Vec<usize> = (0..n).collect();
|
||||
if !sorted_slots {
|
||||
perm.sort_by_key(|&i| slots[i]);
|
||||
}
|
||||
perm.sort_by_key(|&i| slots[i]);
|
||||
let sorted_slots: Vec<usize> = perm.iter().map(|&i| slots[i]).collect();
|
||||
let mut hits: Vec<(usize, usize, u32)> = Vec::new();
|
||||
for c in 0..n_cols {
|
||||
|
||||
Reference in new issue
Block a user