Add OrderedGroups::MinNonZeroGroup.

Change-Id: If571c2435a7c884b472c33421722208cb2d036ff
This commit is contained in:
Sameer Agarwal
2014-06-09 12:03:17 -07:00
parent ec6bfa5b12
commit e9fcf3decb
3 changed files with 30 additions and 1 deletions
+9
View File
@@ -35,6 +35,7 @@
#include <set>
#include <vector>
#include "ceres/internal/port.h"
#include "glog/logging.h"
namespace ceres {
@@ -171,6 +172,14 @@ class OrderedGroups {
return group_to_elements_.size();
}
// The first group with one or more elements. Calling this when
// there are no groups with non-zero elements will result in a
// crash.
int MinNonZeroGroup() const {
CHECK_NE(NumGroups(), 0);
return group_to_elements_.begin()->first;
}
const map<int, set<T> >& group_to_elements() const {
return group_to_elements_;
}