Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
Levi-Armstrong committed Jun 30, 2023
1 parent 08f1bfe commit d0739b9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
14 changes: 7 additions & 7 deletions trajopt_sco/include/trajopt_sco/solver_interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,10 @@ struct AffExpr
AffExpr(AffExpr&&) = default;
AffExpr& operator=(AffExpr&&) = default;

explicit AffExpr(double a) : constant(a) {}
explicit AffExpr(const Var& v) : coeffs(1, 1), vars(1, v) {}
explicit AffExpr(double a);
explicit AffExpr(const Var& v);

size_t size() const { return coeffs.size(); }
size_t size() const;
double value(const double* x) const;
double value(const DblVec& x) const;
};
Expand All @@ -210,10 +210,10 @@ struct QuadExpr
VarVector vars1;
VarVector vars2;
QuadExpr() = default;
explicit QuadExpr(double a) : affexpr(a) {}
explicit QuadExpr(const Var& v) : affexpr(v) {}
explicit QuadExpr(AffExpr aff) : affexpr(std::move(aff)) {}
size_t size() const { return coeffs.size(); }
explicit QuadExpr(double a);
explicit QuadExpr(const Var& v);
explicit QuadExpr(AffExpr aff);
size_t size() const;
double value(const double* x) const;
double value(const DblVec& x) const;
};
Expand Down
11 changes: 10 additions & 1 deletion trajopt_sco/src/solver_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ TRAJOPT_IGNORE_WARNINGS_PUSH
TRAJOPT_IGNORE_WARNINGS_POP

#include <trajopt_sco/solver_interface.hpp>
#include <trajopt_utils/macros.h>

namespace sco
{
Expand Down Expand Up @@ -62,6 +61,10 @@ void simplify2(IntVec& inds, DblVec& vals)
}
}

AffExpr::AffExpr(double a) : constant(a) {}
AffExpr::AffExpr(const Var& v) : coeffs(1, 1), vars(1, v) {}
size_t AffExpr::size() const { return coeffs.size(); }

double AffExpr::value(const double* x) const
{
double out = constant;
Expand All @@ -80,6 +83,12 @@ double AffExpr::value(const DblVec& x) const
}
return out;
}

QuadExpr::QuadExpr(double a) : affexpr(a) {}
QuadExpr::QuadExpr(const Var& v) : affexpr(v) {}
QuadExpr::QuadExpr(AffExpr aff) : affexpr(std::move(aff)) {}
size_t QuadExpr::size() const { return coeffs.size(); }

double QuadExpr::value(const DblVec& x) const
{
double out = affexpr.value(x);
Expand Down

0 comments on commit d0739b9

Please sign in to comment.