Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change SetValue() return type to void #587

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading