Replace make_pair with {}
parent
0710091887
commit
6c0cab25a3
|
@ -69,7 +69,7 @@ class WeightedSampler {
|
|||
static const double kexp1 = std::exp(1.0);
|
||||
for (auto it = weights.begin(); it != weights.begin() + numSamples; ++it) {
|
||||
const double k_i = kexp1 / *it;
|
||||
reservoir.push(std::make_pair(k_i, it - weights.begin() + 1));
|
||||
reservoir.push({k_i, it - weights.begin() + 1});
|
||||
}
|
||||
|
||||
// Step 4: Repeat Steps 5–10 until the population is exhausted
|
||||
|
@ -110,7 +110,7 @@ class WeightedSampler {
|
|||
// Step 8: The item in reservoir with the minimum key is replaced by
|
||||
// item v_i
|
||||
reservoir.pop();
|
||||
reservoir.push(std::make_pair(k_i, it - weights.begin() + 1));
|
||||
reservoir.push({k_i, it - weights.begin() + 1});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -424,10 +424,10 @@ namespace gtsam {
|
|||
template <typename L, typename T1, typename T2>
|
||||
std::pair<DecisionTree<L, T1>, DecisionTree<L, T2> > unzip(
|
||||
const DecisionTree<L, std::pair<T1, T2> >& input) {
|
||||
return std::make_pair(
|
||||
return {
|
||||
DecisionTree<L, T1>(input, [](std::pair<T1, T2> i) { return i.first; }),
|
||||
DecisionTree<L, T2>(input,
|
||||
[](std::pair<T1, T2> i) { return i.second; }));
|
||||
DecisionTree<L, T2>(input, [](std::pair<T1, T2> i) { return i.second; })
|
||||
};
|
||||
}
|
||||
|
||||
} // namespace gtsam
|
||||
|
|
|
@ -140,8 +140,7 @@ namespace gtsam {
|
|||
orderedKeys, product);
|
||||
gttoc(lookup);
|
||||
|
||||
return std::make_pair(
|
||||
std::dynamic_pointer_cast<DiscreteConditional>(lookup), max);
|
||||
return {std::dynamic_pointer_cast<DiscreteConditional>(lookup), max};
|
||||
}
|
||||
|
||||
/* ************************************************************************ */
|
||||
|
@ -223,7 +222,7 @@ namespace gtsam {
|
|||
std::make_shared<DiscreteConditional>(product, *sum, orderedKeys);
|
||||
gttoc(divide);
|
||||
|
||||
return std::make_pair(conditional, sum);
|
||||
return {conditional, sum};
|
||||
}
|
||||
|
||||
/* ************************************************************************ */
|
||||
|
|
|
@ -223,7 +223,7 @@ public:
|
|||
* @return a pair of [start, end] indices into the tangent space vector
|
||||
*/
|
||||
inline static std::pair<size_t, size_t> translationInterval() {
|
||||
return std::make_pair(3, 5);
|
||||
return {3, 5};
|
||||
}
|
||||
|
||||
/// @}
|
||||
|
|
|
@ -309,14 +309,14 @@ public:
|
|||
* exponential map parameterization
|
||||
* @return a pair of [start, end] indices into the tangent space vector
|
||||
*/
|
||||
inline static std::pair<size_t, size_t> translationInterval() { return std::make_pair(0, 1); }
|
||||
inline static std::pair<size_t, size_t> translationInterval() { return {0, 1}; }
|
||||
|
||||
/**
|
||||
* Return the start and end indices (inclusive) of the rotation component of the
|
||||
* exponential map parameterization
|
||||
* @return a pair of [start, end] indices into the tangent space vector
|
||||
*/
|
||||
static std::pair<size_t, size_t> rotationInterval() { return std::make_pair(2, 2); }
|
||||
static std::pair<size_t, size_t> rotationInterval() { return {2, 2}; }
|
||||
|
||||
/// Output stream operator
|
||||
GTSAM_EXPORT
|
||||
|
|
|
@ -364,7 +364,7 @@ public:
|
|||
* @return a pair of [start, end] indices into the tangent space vector
|
||||
*/
|
||||
inline static std::pair<size_t, size_t> translationInterval() {
|
||||
return std::make_pair(3, 5);
|
||||
return {3, 5};
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -373,7 +373,7 @@ public:
|
|||
* @return a pair of [start, end] indices into the tangent space vector
|
||||
*/
|
||||
static std::pair<size_t, size_t> rotationInterval() {
|
||||
return std::make_pair(0, 2);
|
||||
return {0, 2};
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -176,7 +176,7 @@ TEST(Point3, mean) {
|
|||
|
||||
TEST(Point3, mean_pair) {
|
||||
Point3 a_mean(2, 2, 2), b_mean(-1, 1, 0);
|
||||
Point3Pair expected = std::make_pair(a_mean, b_mean);
|
||||
Point3Pair expected = {a_mean, b_mean};
|
||||
Point3 a1(0, 0, 0), a2(1, 2, 3), a3(5, 4, 3);
|
||||
Point3 b1(-1, 0, 0), b2(-2, 4, 0), b3(0, -1, 0);
|
||||
std::vector<Point3Pair> point_pairs{{a1, b1}, {a2, b2}, {a3, b3}};
|
||||
|
|
|
@ -137,7 +137,7 @@ std::pair<NonlinearFactorGraph, Values> triangulationGraph(
|
|||
graph.emplace_shared<TriangulationFactor<Camera> > //
|
||||
(camera_i, measurements[i], model, landmarkKey);
|
||||
}
|
||||
return std::make_pair(graph, values);
|
||||
return {graph, values};
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -165,7 +165,7 @@ std::pair<NonlinearFactorGraph, Values> triangulationGraph(
|
|||
graph.emplace_shared<TriangulationFactor<CAMERA> > //
|
||||
(camera_i, measurements[i], model? model : unit, landmarkKey);
|
||||
}
|
||||
return std::make_pair(graph, values);
|
||||
return {graph, values};
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -273,7 +273,7 @@ EliminatableClusterTree<BAYESTREE, GRAPH>::eliminate(const Eliminate& function)
|
|||
}
|
||||
|
||||
// Return result
|
||||
return std::make_pair(result, remaining);
|
||||
return {result, remaining};
|
||||
}
|
||||
|
||||
} // namespace gtsam
|
||||
|
|
|
@ -473,7 +473,7 @@ std::pair<GaussianFactorGraph, GaussianFactorGraph> splitFactorGraph(
|
|||
remaining.remove(e.index);
|
||||
}
|
||||
|
||||
return std::make_pair(subgraphFactors, remaining);
|
||||
return {subgraphFactors, remaining};
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -229,7 +229,7 @@ typename Expression<T>::KeysAndDims Expression<T>::keysAndDims() const {
|
|||
std::map<Key, int> map;
|
||||
dims(map);
|
||||
size_t n = map.size();
|
||||
KeysAndDims pair = std::make_pair(KeyVector(n), FastVector<int>(n));
|
||||
KeysAndDims pair = {KeyVector(n), FastVector<int>(n)};
|
||||
// Copy map into pair of vectors
|
||||
auto key_it = pair.first.begin();
|
||||
auto dim_it = pair.second.begin();
|
||||
|
|
|
@ -116,7 +116,7 @@ MFAS::MFAS(const TranslationEdges& relativeTranslations,
|
|||
// Iterate over edges, obtain weights by projecting
|
||||
// their relativeTranslations along the projection direction
|
||||
for (const auto& measurement : relativeTranslations) {
|
||||
edgeWeights_[std::make_pair(measurement.key1(), measurement.key2())] =
|
||||
edgeWeights_[{measurement.key1(), measurement.key2()}] =
|
||||
measurement.measured().dot(projectionDirection);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -755,7 +755,7 @@ std::pair<double, Vector> ShonanAveraging<d>::computeMinEigenVector(
|
|||
const Values &values) const {
|
||||
Vector minEigenVector;
|
||||
double minEigenValue = computeMinEigenValue(values, &minEigenVector);
|
||||
return std::make_pair(minEigenValue, minEigenVector);
|
||||
return {minEigenValue, minEigenVector};
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
@ -908,7 +908,7 @@ std::pair<Values, double> ShonanAveraging<d>::run(const Values &initialEstimate,
|
|||
"When using robust norm, Shonan only tests a single rank. Set pMin = pMax");
|
||||
}
|
||||
const Values SO3Values = roundSolution(Qstar);
|
||||
return std::make_pair(SO3Values, 0);
|
||||
return {SO3Values, 0};
|
||||
} else {
|
||||
// Check certificate of global optimality
|
||||
Vector minEigenVector;
|
||||
|
@ -916,7 +916,7 @@ std::pair<Values, double> ShonanAveraging<d>::run(const Values &initialEstimate,
|
|||
if (minEigenValue > parameters_.optimalityThreshold) {
|
||||
// If at global optimum, round and return solution
|
||||
const Values SO3Values = roundSolution(Qstar);
|
||||
return std::make_pair(SO3Values, minEigenValue);
|
||||
return {SO3Values, minEigenValue};
|
||||
}
|
||||
|
||||
// Not at global optimimum yet, so check whether we will go to next level
|
||||
|
|
|
@ -148,7 +148,7 @@ public:
|
|||
std::pair<Matrix, Vector> jacobian() const override {
|
||||
throw std::runtime_error(
|
||||
"RegularImplicitSchurFactor::jacobian non implemented");
|
||||
return std::make_pair(Matrix(), Vector());
|
||||
return {Matrix(), Vector()};
|
||||
}
|
||||
|
||||
/// *Compute* full augmented information matrix
|
||||
|
|
|
@ -61,9 +61,10 @@ namespace gtsam
|
|||
std::set_difference(allKeys.begin(), allKeys.end(), frontals.begin(), frontals.end(), orderedKeys.begin() + nFrontals);
|
||||
|
||||
// Return resulting conditional and factor
|
||||
return std::make_pair(
|
||||
return {
|
||||
SymbolicConditional::FromKeysShared(orderedKeys, nFrontals),
|
||||
SymbolicFactor::FromIteratorsShared(orderedKeys.begin() + nFrontals, orderedKeys.end()));
|
||||
SymbolicFactor::FromIteratorsShared(orderedKeys.begin() + nFrontals, orderedKeys.end())
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue