Skip to content

Commit

Permalink
[PDLP] sync
Browse files Browse the repository at this point in the history
  • Loading branch information
lperron committed Jan 27, 2025
1 parent ad6ccd0 commit d04d379
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion ortools/pdlp/sharded_optimization_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ enum class ScalingNorm { kL2, kLInf };
// `vector` in-place. If a component of `divisor` is equal to zero, leaves the
// component of `vector` unchanged. `sharder` should have the same size as
// `vector`. For best performance `sharder` should have been created with the
// `Sharder(int64_t, int, ThreadPool*)` constructor.
// `Sharder(int64_t, int, Scheduler*)` constructor.
void DivideBySquareRootOfDivisor(const VectorXd& divisor,
const Sharder& sharder, VectorXd& vector) {
sharder.ParallelForEachShard([&](const Sharder::Shard& shard) {
Expand Down
14 changes: 7 additions & 7 deletions ortools/pdlp/sharded_optimization_utils_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ using ::testing::IsNan;

TEST(ShardedWeightedAverageTest, SimpleAverage) {
Sharder sharder(/*num_elements=*/2, /*num_shards=*/2,
/*thread_pool=*/nullptr);
/*scheduler=*/nullptr);
Eigen::VectorXd vec1{{4, 1}};
Eigen::VectorXd vec2{{1, 7}};

Expand All @@ -61,7 +61,7 @@ TEST(ShardedWeightedAverageTest, SimpleAverage) {

TEST(ShardedWeightedAverageTest, MoveConstruction) {
Sharder sharder(/*num_elements=*/2, /*num_shards=*/2,
/*thread_pool=*/nullptr);
/*scheduler=*/nullptr);
const Eigen::VectorXd vec{{4, 1}};

ShardedWeightedAverage average(&sharder);
Expand All @@ -73,9 +73,9 @@ TEST(ShardedWeightedAverageTest, MoveConstruction) {

TEST(ShardedWeightedAverageTest, MoveAssignment) {
Sharder sharder1(/*num_elements=*/2, /*num_shards=*/2,
/*thread_pool=*/nullptr);
/*scheduler=*/nullptr);
Sharder sharder2(/*num_elements=*/3, /*num_shards=*/2,
/*thread_pool=*/nullptr);
/*scheduler=*/nullptr);
Eigen::VectorXd vec1{{4, 1}};
Eigen::VectorXd vec2{{0, 3}};

Expand All @@ -91,7 +91,7 @@ TEST(ShardedWeightedAverageTest, MoveAssignment) {

TEST(ShardedWeightedAverageTest, ZeroAverage) {
Sharder sharder(/*num_elements=*/1, /*num_shards=*/1,
/*thread_pool=*/nullptr);
/*scheduler=*/nullptr);

ShardedWeightedAverage average(&sharder);
ASSERT_FALSE(average.HasNonzeroWeight());
Expand All @@ -103,7 +103,7 @@ TEST(ShardedWeightedAverageTest, ZeroAverage) {
// average is exactly that vector, with no roundoff.
TEST(ShardedWeightedAverageTest, AveragesEqualWithoutRoundoff) {
Sharder sharder(/*num_elements=*/4, /*num_shards=*/1,
/*thread_pool=*/nullptr);
/*scheduler=*/nullptr);
ShardedWeightedAverage average(&sharder);
EXPECT_THAT(average.ComputeAverage(), ElementsAre(0, 0, 0, 0));
Eigen::VectorXd data{{1.0, 1.0 / 3, 3.0 / 7, 3.14159}};
Expand All @@ -117,7 +117,7 @@ TEST(ShardedWeightedAverageTest, AveragesEqualWithoutRoundoff) {

TEST(ShardedWeightedAverageTest, AddsZeroWeight) {
Sharder sharder(/*num_elements=*/1, /*num_shards=*/1,
/*thread_pool=*/nullptr);
/*scheduler=*/nullptr);

ShardedWeightedAverage average(&sharder);
ASSERT_FALSE(average.HasNonzeroWeight());
Expand Down
4 changes: 2 additions & 2 deletions ortools/pdlp/sharder.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class Sharder {
return 1 + 1 * matrix.col(col).nonZeros();
}) {}

// Constructs a `Sharder` with the same thread pool as `other_sharder`, for
// Constructs a `Sharder` with the same scheduler as `other_sharder`, for
// problems with `num_elements` elements and unit mass. The number of shards
// will be approximately the same as that of `other_sharder`. Also see the
// comments on the first constructor.
Expand Down Expand Up @@ -242,7 +242,7 @@ Eigen::VectorXd TransposedMatrixVectorProduct(
// The following functions use `sharder` to compute a vector operation in
// parallel. `sharder` should have the same size as the vector(s). For best
// performance `sharder` should have been created with the `Sharder(int64_t,
// int, ThreadPool*)` constructor.
// int, Scheduler*)` constructor.
////////////////////////////////////////////////////////////////////////////////

// Like `dest.setZero(sharder.NumElements())`. Note that if `dest.size() !=
Expand Down

0 comments on commit d04d379

Please sign in to comment.