@@ -65,14 +65,14 @@ pub struct SparseVec<T> {
6565 displacement : Vec < usize > , // Displacement vector
6666 row_length : usize , // Row length of the input matrix
6767 empty_val : T , // Value considered "empty"
68- empties : Vob , // Mapping of "empty" cells
69- data : PackedVec < T > , // Compressed matrix
68+ empties : Vob < u64 > , // Mapping of "empty" cells
69+ data : PackedVec < T , u64 > , // Compressed matrix
7070}
7171
7272impl < T : Clone + Copy + PartialEq > SparseVec < T >
7373where
74- T : AsPrimitive < usize > + FromPrimitive + Ord + PrimInt + ToPrimitive + Unsigned ,
75- usize : AsPrimitive < T > ,
74+ T : AsPrimitive < u64 > + FromPrimitive + Ord + PrimInt + ToPrimitive + Unsigned ,
75+ u64 : AsPrimitive < T > ,
7676{
7777 /// Constructs a new SparseVec from a `Vec` of unsigned integers where `empty_val` describes
7878 /// the values to be compressed and `row_length` the element size per row in the original
9191 displacement : Vec :: new ( ) ,
9292 row_length : 0 ,
9393 empty_val,
94- empties : Vob :: new ( ) ,
95- data : PackedVec :: new ( v. to_vec ( ) ) ,
94+ empties : Vob :: < u64 > :: new_with_storage_type ( 0 ) ,
95+ data : PackedVec :: < T , u64 > :: new_with_storaget ( v. to_vec ( ) ) ,
9696 } ;
9797 }
9898
@@ -101,7 +101,7 @@ where
101101 let s = sort ( v, empty_val, row_length) ;
102102 let ( c, d) = compress ( v, & s, empty_val, row_length) ;
103103 let e = calc_empties ( v, empty_val) ;
104- let pv = PackedVec :: new ( c) ;
104+ let pv = PackedVec :: < T , u64 > :: new_with_storaget ( c) ;
105105 SparseVec {
106106 displacement : d,
107107 row_length,
@@ -155,8 +155,8 @@ where
155155 }
156156}
157157
158- fn calc_empties < T : PartialEq > ( vec : & [ T ] , empty_val : T ) -> Vob {
159- let mut vob = Vob :: from_elem ( false , vec. len ( ) ) ;
158+ fn calc_empties < T : PartialEq > ( vec : & [ T ] , empty_val : T ) -> Vob < u64 > {
159+ let mut vob = Vob :: < u64 > :: from_elem_with_storage_type ( false , vec. len ( ) ) ;
160160 for ( i, v) in vec. iter ( ) . enumerate ( ) {
161161 if * v == empty_val {
162162 vob. set ( i, true ) ;
0 commit comments