algorithms: std::vector -> absl::Span
This commit is contained in:
@@ -262,8 +262,8 @@ class FindSymmetriesTest : public ::testing::Test {
|
||||
return dense_perm;
|
||||
}
|
||||
|
||||
std::vector<int> ComposePermutations(const std::vector<int>& p1,
|
||||
const std::vector<int>& p2) {
|
||||
std::vector<int> ComposePermutations(absl::Span<const int> p1,
|
||||
absl::Span<const int> p2) {
|
||||
CHECK_EQ(p1.size(), p2.size());
|
||||
std::vector<int> composed(p1.size(), -1);
|
||||
for (int i = 0; i < p1.size(); ++i) composed[i] = p1[p2[i]];
|
||||
@@ -274,7 +274,7 @@ class FindSymmetriesTest : public ::testing::Test {
|
||||
// with some basic, non-through EXPECT(..) that check that each generator
|
||||
// does make the group grow.
|
||||
int ComputePermutationGroupSizeAndVerifyBasicIrreductibility(
|
||||
const std::vector<std::unique_ptr<SparsePermutation>>& generators) {
|
||||
absl::Span<const std::unique_ptr<SparsePermutation>> generators) {
|
||||
if (generators.empty()) return 1; // The identity.
|
||||
const int num_nodes = generators[0]->Size();
|
||||
// The group only contains the identity at first.
|
||||
@@ -697,8 +697,7 @@ void AddReverseArcsAndFinalize(Graph* graph) {
|
||||
graph->Build();
|
||||
}
|
||||
|
||||
void SetGraphEdges(const std::vector<std::pair<int, int>>& edges,
|
||||
Graph* graph) {
|
||||
void SetGraphEdges(absl::Span<const std::pair<int, int>> edges, Graph* graph) {
|
||||
DCHECK_EQ(graph->num_arcs(), 0);
|
||||
for (const auto [from, to] : edges) graph->AddArc(from, to);
|
||||
AddReverseArcsAndFinalize(graph);
|
||||
|
||||
@@ -653,7 +653,7 @@ bool InputContainsNan(absl::Span<const std::vector<double>> input) {
|
||||
}
|
||||
|
||||
void MinimizeLinearAssignment(
|
||||
const std::vector<std::vector<double>>& cost,
|
||||
absl::Span<const std::vector<double>> cost,
|
||||
absl::flat_hash_map<int, int>* direct_assignment,
|
||||
absl::flat_hash_map<int, int>* reverse_assignment) {
|
||||
if (InputContainsNan(cost)) {
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace operations_research {
|
||||
|
||||
// See IMPORTANT NOTE at the top of the file.
|
||||
void MinimizeLinearAssignment(
|
||||
const std::vector<std::vector<double>>& cost,
|
||||
absl::Span<const std::vector<double>> cost,
|
||||
absl::flat_hash_map<int, int>* direct_assignment,
|
||||
absl::flat_hash_map<int, int>* reverse_assignment);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user