We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a0bb20a commit ec2fb0cCopy full SHA for ec2fb0c
include/pgvector/sparsevec.hpp
@@ -29,16 +29,7 @@ class SparseVector {
29
}
30
31
/// Creates a sparse vector from a dense vector.
32
- explicit SparseVector(const std::vector<float>& value) {
33
- dimensions_ = value.size();
34
- for (size_t i = 0; i < value.size(); i++) {
35
- float v = value[i];
36
- if (v != 0) {
37
- indices_.push_back(i);
38
- values_.push_back(v);
39
- }
40
41
+ explicit SparseVector(const std::vector<float>& value) : SparseVector(std::span<const float>{value}) {}
42
43
/// Creates a sparse vector from a span.
44
explicit SparseVector(std::span<const float> value) {
0 commit comments