Push zunrplorkwkt #70
@@ -368,13 +368,8 @@ impl PersistentCompactIntMatrix {
|
||||
/// in the same order as `slots`. Column access is sequential to maximize
|
||||
/// cache efficiency on the underlying mmap.
|
||||
pub fn sub_matrix(&self, slots: &[usize]) -> Vec<Vec<u32>> {
|
||||
let n_cols = self.n_cols();
|
||||
let mut out: Vec<Vec<u32>> = Vec::with_capacity(n_cols);
|
||||
for c in 0..n_cols {
|
||||
let mut col_buf = vec![0u32; slots.len()];
|
||||
self.col_view(c).fill_slots_values(slots, &mut col_buf);
|
||||
out.push(col_buf);
|
||||
}
|
||||
let mut out: Vec<Vec<u32>> = (0..self.n_cols()).map(|_| Vec::new()).collect();
|
||||
self.fill_sub_matrix(slots, &mut out);
|
||||
out
|
||||
}
|
||||
|
||||
@@ -396,10 +391,8 @@ impl PersistentCompactIntMatrix {
|
||||
let sorted_slots: Vec<usize> = perm.iter().map(|&i| slots[i]).collect();
|
||||
for (c, col) in out.iter_mut().enumerate() {
|
||||
col.resize(n, 0);
|
||||
let mut tmp = vec![0u32; n];
|
||||
self.col_view(c).fill_slots_values_sorted(&sorted_slots, &mut tmp);
|
||||
for (i, &orig_idx) in perm.iter().enumerate() {
|
||||
col[orig_idx] = tmp[i];
|
||||
for (i, v) in self.col_view(c).enumerate_slots_values(&sorted_slots) {
|
||||
col[perm[i]] = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user