Use c++17 in examples
parent
ae7c17420d
commit
42be860f73
|
@ -87,9 +87,8 @@ int main(int argc, char* argv[]) {
|
|||
result.print();
|
||||
|
||||
cout << "Detailed results:" << endl;
|
||||
for (auto keyedStatus : result.detail->variableStatus) {
|
||||
const auto& status = keyedStatus.second;
|
||||
PrintKey(keyedStatus.first);
|
||||
for (auto& [key, status] : result.detail->variableStatus) {
|
||||
PrintKey(key);
|
||||
cout << " {" << endl;
|
||||
cout << "reeliminated: " << status.isReeliminated << endl;
|
||||
cout << "relinearized above thresh: " << status.isAboveRelinThreshold
|
||||
|
|
|
@ -74,8 +74,8 @@ int main(const int argc, const char* argv[]) {
|
|||
|
||||
// Calculate and print marginal covariances for all variables
|
||||
Marginals marginals(*graph, result);
|
||||
for (const auto& key_pose : result.extract<Pose3>()) {
|
||||
std::cout << marginals.marginalCovariance(key_pose.first) << endl;
|
||||
for (const auto& [key, pose] : result.extract<Pose3>()) {
|
||||
std::cout << marginals.marginalCovariance(key) << endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -79,9 +79,7 @@ int main(int argc, char* argv[]) {
|
|||
for (const SfmTrack& track : mydata.tracks) {
|
||||
// Leaf expression for j^th point
|
||||
Point3_ point_('p', j);
|
||||
for (const SfmMeasurement& m : track.measurements) {
|
||||
size_t i = m.first;
|
||||
Point2 uv = m.second;
|
||||
for (const auto& [i, uv] : track.measurements) {
|
||||
// Leaf expression for i^th camera
|
||||
Expression<SfmCamera> camera_(C(i));
|
||||
// Below an expression for the prediction of the measurement:
|
||||
|
|
|
@ -57,9 +57,7 @@ int main (int argc, char* argv[]) {
|
|||
// Add measurements to the factor graph
|
||||
size_t j = 0;
|
||||
for(const SfmTrack& track: mydata.tracks) {
|
||||
for(const SfmMeasurement& m: track.measurements) {
|
||||
size_t i = m.first;
|
||||
Point2 uv = m.second;
|
||||
for (const auto& [i, uv] : track.measurements) {
|
||||
graph.emplace_shared<MyFactor>(uv, noise, C(i), P(j)); // note use of shorthand symbols C and P
|
||||
}
|
||||
j += 1;
|
||||
|
|
|
@ -59,9 +59,7 @@ int main(int argc, char* argv[]) {
|
|||
// Add measurements to the factor graph
|
||||
size_t j = 0;
|
||||
for (const SfmTrack& track : mydata.tracks) {
|
||||
for (const SfmMeasurement& m : track.measurements) {
|
||||
size_t i = m.first;
|
||||
Point2 uv = m.second;
|
||||
for (const auto& [i, uv] : track.measurements) {
|
||||
graph.emplace_shared<MyFactor>(
|
||||
uv, noise, C(i), P(j)); // note use of shorthand symbols C and P
|
||||
}
|
||||
|
|
|
@ -557,12 +557,12 @@ void runPerturb()
|
|||
|
||||
// Perturb values
|
||||
VectorValues noise;
|
||||
for(const auto& key_dim: initial.dims())
|
||||
for(const auto& [key, dim]: initial.dims())
|
||||
{
|
||||
Vector noisev(key_dim.second);
|
||||
Vector noisev(dim);
|
||||
for(Vector::Index i = 0; i < noisev.size(); ++i)
|
||||
noisev(i) = normal(rng);
|
||||
noise.insert(key_dim.first, noisev);
|
||||
noise.insert(key, noisev);
|
||||
}
|
||||
Values perturbed = initial.retract(noise);
|
||||
|
||||
|
|
Loading…
Reference in New Issue