Skip to content

Commit

Permalink
Change SetValue() return type to void
Browse files Browse the repository at this point in the history
  • Loading branch information
calcmogul committed Jul 3, 2024
1 parent 67dbac2 commit 03faa62
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
3 changes: 1 addition & 2 deletions include/sleipnir/autodiff/Variable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class SLEIPNIR_DLLEXPORT Variable {
*
* @param value The value of the Variable.
*/
Variable& SetValue(double value) {
void SetValue(double value) {
if (expr->IsConstant(0.0)) {
expr = detail::MakeExpressionPtr(value);
} else {
Expand All @@ -76,7 +76,6 @@ class SLEIPNIR_DLLEXPORT Variable {
}
expr->value = value;
}
return *this;
}

/**
Expand Down
8 changes: 2 additions & 6 deletions include/sleipnir/autodiff/VariableBlock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,10 @@ class VariableBlock {
*
* @param value Value to assign.
*/
VariableBlock<Mat>& SetValue(double value) {
void SetValue(double value) {
Assert(Rows() == 1 && Cols() == 1);

(*this)(0, 0).SetValue(value);

return *this;
}

/**
Expand Down Expand Up @@ -165,7 +163,7 @@ class VariableBlock {
*/
template <typename Derived>
requires std::same_as<typename Derived::Scalar, double>
VariableBlock<Mat>& SetValue(const Eigen::MatrixBase<Derived>& values) {
void SetValue(const Eigen::MatrixBase<Derived>& values) {
Assert(Rows() == values.rows());
Assert(Cols() == values.cols());

Expand All @@ -174,8 +172,6 @@ class VariableBlock {
(*this)(row, col).SetValue(values(row, col));
}
}

return *this;
}

/**
Expand Down
4 changes: 1 addition & 3 deletions include/sleipnir/autodiff/VariableMatrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class SLEIPNIR_DLLEXPORT VariableMatrix {
*/
template <typename Derived>
requires std::same_as<typename Derived::Scalar, double>
VariableMatrix& SetValue(const Eigen::MatrixBase<Derived>& values) {
void SetValue(const Eigen::MatrixBase<Derived>& values) {
Assert(Rows() == values.rows());
Assert(Cols() == values.cols());

Expand All @@ -209,8 +209,6 @@ class SLEIPNIR_DLLEXPORT VariableMatrix {
(*this)(row, col).SetValue(values(row, col));
}
}

return *this;
}

/**
Expand Down

0 comments on commit 03faa62

Please sign in to comment.