@@ -119,23 +119,23 @@ where
119119
120120 /// Return a [`Strided`] for the raw pivots of the requested chunk.
121121 ///
122- /// Returns `None` if `chunk >= self.nchunks`.
122+ /// Returns `None` if `chunk >= self.nchunks() `.
123123 pub fn pivots_for ( & self , chunk : usize ) -> Option < Strided < ' _ , f32 > > {
124124 let range = self . offsets . get ( chunk) ?;
125125
126126 #[ expect(
127127 clippy:: expect_used,
128128 reason = "the BasicTable's invariants mean this panic should be unreachable"
129129 ) ]
130- Some (
131- Strided :: try_from_data (
132- & self . pivots . as_slice ( ) [ range. start ..] ,
133- self . pivots . nrows ( ) ,
134- range. len ( ) ,
135- self . pivots . ncols ( ) ,
136- )
137- . expect ( "BasicTable asserts that this layout is valid" ) ,
130+ let strided = Strided :: try_from_data (
131+ & self . pivots . as_slice ( ) [ range. start ..] ,
132+ self . pivots . nrows ( ) ,
133+ range. len ( ) ,
134+ self . pivots . ncols ( ) ,
138135 )
136+ . expect ( "BasicTable asserts that this layout is valid" ) ;
137+
138+ Some ( strided)
139139 }
140140}
141141
@@ -329,7 +329,7 @@ mod tests {
329329 let ( pivots, offsets) = create_pivot_tables ( schema. to_owned ( ) , num_centers) ;
330330 let table = BasicTable :: new ( pivots, offsets) . unwrap ( ) ;
331331
332- // Check that `pivots_for` works as expected with repsect to the documented
332+ // Check that `pivots_for` works as expected with respect to the documented
333333 // table configuration for `create_pivot_tables`.
334334 for chunk in 0 ..schema. len ( ) {
335335 let strided = table. pivots_for ( chunk) . unwrap ( ) ;
@@ -340,20 +340,17 @@ mod tests {
340340 let base = ( ( center + chunk) % num_centers) as f32 ;
341341 row. iter ( ) . enumerate ( ) . for_each ( |( dim, b) | {
342342 let offset = if dim. is_multiple_of ( 2 ) { 0.25 } else { -0.25 } ;
343-
344- if dim. is_multiple_of ( 2 ) {
345- assert_eq ! (
346- * b,
347- base + offset,
348- "failed: chunk {} of {}, center {} of {}, dim {} of {}" ,
349- chunk,
350- schema. len( ) ,
351- center,
352- num_centers,
353- dim,
354- row. len( ) ,
355- ) ;
356- }
343+ assert_eq ! (
344+ * b,
345+ base + offset,
346+ "failed: chunk {} of {}, center {} of {}, dim {} of {}" ,
347+ chunk,
348+ schema. len( ) ,
349+ center,
350+ num_centers,
351+ dim,
352+ row. len( ) ,
353+ ) ;
357354 } )
358355 }
359356 }
0 commit comments