Skip to content

Commit 39c1728

Browse files
committed
Removed new method from SparseVector
1 parent e4a4636 commit 39c1728

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed

src/sparsevec.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,6 @@ pub struct SparseVector {
1515
}
1616

1717
impl SparseVector {
18-
/// Creates a sparse vector.
19-
pub fn new(dim: usize, indices: Vec<i32>, values: Vec<f32>) -> SparseVector {
20-
// TODO assert indices sorted
21-
assert_eq!(indices.len(), values.len());
22-
assert!(indices.len() < dim);
23-
24-
SparseVector {
25-
dim,
26-
indices,
27-
values,
28-
}
29-
}
30-
3118
/// Creates a sparse vector from a dense vector.
3219
pub fn from_dense(vec: &[f32]) -> SparseVector {
3320
let dim = vec.len();
@@ -129,10 +116,4 @@ mod tests {
129116
let vec = SparseVector::from_coordinates(elements, 6);
130117
assert_eq!(vec![1.0, 0.0, 2.0, 0.0, 3.0, 0.0], vec.to_vec());
131118
}
132-
133-
#[test]
134-
fn test_to_vec() {
135-
let vec = SparseVector::new(6, vec![0, 2, 4], vec![1.0, 2.0, 3.0]);
136-
assert_eq!(vec![1.0, 0.0, 2.0, 0.0, 3.0, 0.0], vec.to_vec());
137-
}
138119
}

0 commit comments

Comments
 (0)