Merge pull request #110 from borglab/fix/subgraphbuilder

Several fixes in legacy code
release/4.3a0
Frank Dellaert 2019-09-08 14:21:40 -04:00 committed by GitHub
commit 675f27b075
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -107,7 +107,7 @@ static vector<size_t> UniqueSampler(const vector<double> &weight,
const size_t m = weight.size(); const size_t m = weight.size();
if (n > m) throw std::invalid_argument("UniqueSampler: invalid input size"); if (n > m) throw std::invalid_argument("UniqueSampler: invalid input size");
vector<size_t> samples; vector<size_t> results;
size_t count = 0; size_t count = 0;
vector<bool> touched(m, false); vector<bool> touched(m, false);
@ -130,12 +130,12 @@ static vector<size_t> UniqueSampler(const vector<double> &weight,
for (const size_t &index : samples) { for (const size_t &index : samples) {
if (touched[index] == false) { if (touched[index] == false) {
touched[index] = true; touched[index] = true;
samples.push_back(index); results.push_back(index);
if (++count >= n) break; if (++count >= n) break;
} }
} }
} }
return samples; return results;
} }
/****************************************************************************/ /****************************************************************************/

View File

@ -121,7 +121,7 @@ namespace gtsam {
// access // access
const Vector& prior() const { return prior_; } const Vector& prior() const { return prior_; }
const std::vector<bool>& mask() const { return mask_; } const std::vector<size_t>& mask() const { return mask_; }
const Matrix& H() const { return H_; } const Matrix& H() const { return H_; }
protected: protected: