25 SparseDoubleVectorProto result;
26 result.mutable_ids()->Reserve(
static_cast<int>(terms_.size()));
27 result.mutable_values()->Reserve(
static_cast<int>(terms_.size()));
28 for (
const auto [
var, _] : terms_) {
29 result.add_ids(
var.value());
31 absl::c_sort(*result.mutable_ids());
32 for (
const int64_t
id : result.ids()) {
33 result.add_values(terms_.at(VariableId(
id)));