Skip to content

Commit 116d03b

Browse files
committed
Modified arg types for `NumberNode::bound_axis_sums()
Added a `const` to `State& state`. Fixed typo.
1 parent 156481a commit 116d03b

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

dwave/optimization/include/dwave-optimization/nodes/numbers.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ class NumberNode : public ArrayOutputMixin<ArrayNode>, public DecisionNode {
157157
/// Return the state-dependent sum of the values within each slice
158158
/// along each bound axis. The returned vector is indexed by the
159159
/// bound axes in the same ordering that `axis_wise_bounds()` returns.
160-
const std::vector<std::vector<double>>& bound_axis_sums(State& state) const;
160+
const std::vector<std::vector<double>>& bound_axis_sums(const State& state) const;
161161

162162
protected:
163163
explicit NumberNode(std::span<const ssize_t> shape, std::vector<double> lower_bound,

dwave/optimization/src/nodes/numbers.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ const std::vector<NumberNode::AxisBound>& NumberNode::axis_wise_bounds() const {
448448
return bound_axes_info_;
449449
}
450450

451-
const std::vector<std::vector<double>>& NumberNode::bound_axis_sums(State& state) const {
451+
const std::vector<std::vector<double>>& NumberNode::bound_axis_sums(const State& state) const {
452452
return data_ptr<NumberNodeStateData>(state)->bound_axes_sums;
453453
}
454454

@@ -614,7 +614,7 @@ void check_bound_axes_integrality(const std::vector<NumberNode::AxisBound>& boun
614614
const double bound = bound_axis_info.get_bound(i);
615615
if (bound != std::floor(bound)) {
616616
throw std::invalid_argument(
617-
"Axis wise bounds for integral number arrays must be intregral.");
617+
"Axis wise bounds for integral number arrays must be integral.");
618618
}
619619
}
620620
}

tests/cpp/nodes/test_numbers.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ TEST_CASE("BinaryNode") {
581581

582582
REQUIRE_THROWS_WITH(graph.emplace_node<BinaryNode>(std::initializer_list<ssize_t>{2, 3, 4},
583583
std::nullopt, std::nullopt, bound_axes),
584-
"Axis wise bounds for integral number arrays must be intregral.");
584+
"Axis wise bounds for integral number arrays must be integral.");
585585
}
586586

587587
GIVEN("(3x2x2)-BinaryNode with infeasible axis-wise bound on axis: 0") {
@@ -1403,7 +1403,7 @@ TEST_CASE("IntegerNode") {
14031403

14041404
REQUIRE_THROWS_WITH(graph.emplace_node<IntegerNode>(std::initializer_list<ssize_t>{2, 3, 4},
14051405
std::nullopt, std::nullopt, bound_axes),
1406-
"Axis wise bounds for integral number arrays must be intregral.");
1406+
"Axis wise bounds for integral number arrays must be integral.");
14071407
}
14081408

14091409
GIVEN("(2x3x2)-IntegerNode with infeasible axis-wise bound on axis: 0") {

0 commit comments

Comments
 (0)