Skip to content

Commit

Permalink
Ensure numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Jun 26, 2024
1 parent 4a9f9ae commit dc42aad
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/utils/sparse-vector.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ class SparseVector {
const values = [];
for (const [i, v] of value.entries()) {
if (v != 0) {
indices.push(i);
values.push(v);
indices.push(Number(i));
values.push(Number(v));
}
}
return new SparseVector(dimensions, indices, values);
Expand All @@ -60,11 +60,11 @@ class SparseVector {
const values = [];
for (const [i, v] of map.entries()) {
if (v != 0) {
indices.push(i);
values.push(v);
indices.push(Number(i));
values.push(Number(v));
}
}
return new SparseVector(dimensions, indices, values);
return new SparseVector(Number(dimensions), indices, values);
}
}

Expand Down

0 comments on commit dc42aad

Please sign in to comment.