Skip to content

Commit

Permalink
Remove redundant double overloads from autodiff (#223)
Browse files Browse the repository at this point in the history
  • Loading branch information
calcmogul authored Dec 11, 2023
1 parent c329e8a commit c9e93f2
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 498 deletions.
81 changes: 0 additions & 81 deletions include/sleipnir/autodiff/Expression.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,24 +191,6 @@ struct SLEIPNIR_DLLEXPORT Expression {
IntrusiveSharedPtr<Expression> lhs,
IntrusiveSharedPtr<Expression> rhs);

/**
* Double-expression multiplication operator.
*
* @param lhs Operator left-hand side.
* @param rhs Operator right-hand side.
*/
friend SLEIPNIR_DLLEXPORT IntrusiveSharedPtr<Expression> operator*(
double lhs, const IntrusiveSharedPtr<Expression>& rhs);

/**
* Expression-double multiplication operator.
*
* @param lhs Operator left-hand side.
* @param rhs Operator right-hand side.
*/
friend SLEIPNIR_DLLEXPORT IntrusiveSharedPtr<Expression> operator*(
const IntrusiveSharedPtr<Expression>& lhs, double rhs);

/**
* Expression-Expression multiplication operator.
*
Expand All @@ -219,24 +201,6 @@ struct SLEIPNIR_DLLEXPORT Expression {
const IntrusiveSharedPtr<Expression>& lhs,
const IntrusiveSharedPtr<Expression>& rhs);

/**
* double-Expression division operator.
*
* @param lhs Operator left-hand side.
* @param rhs Operator right-hand side.
*/
friend SLEIPNIR_DLLEXPORT IntrusiveSharedPtr<Expression> operator/(
double lhs, const IntrusiveSharedPtr<Expression>& rhs);

/**
* Expression-double division operator.
*
* @param lhs Operator left-hand side.
* @param rhs Operator right-hand side.
*/
friend SLEIPNIR_DLLEXPORT IntrusiveSharedPtr<Expression> operator/(
const IntrusiveSharedPtr<Expression>& lhs, double rhs);

/**
* Expression-Expression division operator.
*
Expand All @@ -247,24 +211,6 @@ struct SLEIPNIR_DLLEXPORT Expression {
const IntrusiveSharedPtr<Expression>& lhs,
const IntrusiveSharedPtr<Expression>& rhs);

/**
* double-Expression addition operator.
*
* @param lhs Operator left-hand side.
* @param rhs Operator right-hand side.
*/
friend SLEIPNIR_DLLEXPORT IntrusiveSharedPtr<Expression> operator+(
double lhs, const IntrusiveSharedPtr<Expression>& rhs);

/**
* Expression-double addition operator.
*
* @param lhs Operator left-hand side.
* @param rhs Operator right-hand side.
*/
friend SLEIPNIR_DLLEXPORT IntrusiveSharedPtr<Expression> operator+(
const IntrusiveSharedPtr<Expression>& lhs, double rhs);

/**
* Expression-Expression addition operator.
*
Expand All @@ -275,15 +221,6 @@ struct SLEIPNIR_DLLEXPORT Expression {
const IntrusiveSharedPtr<Expression>& lhs,
const IntrusiveSharedPtr<Expression>& rhs);

/**
* Expression-double compound addition operator.
*
* @param lhs Operator left-hand side.
* @param rhs Operator right-hand side.
*/
friend SLEIPNIR_DLLEXPORT IntrusiveSharedPtr<Expression>& operator+=(
IntrusiveSharedPtr<Expression>& lhs, double rhs);

/**
* Expression-Expression compound addition operator.
*
Expand All @@ -294,24 +231,6 @@ struct SLEIPNIR_DLLEXPORT Expression {
IntrusiveSharedPtr<Expression>& lhs,
const IntrusiveSharedPtr<Expression>& rhs);

/**
* double-Expression subtraction operator.
*
* @param lhs Operator left-hand side.
* @param rhs Operator right-hand side.
*/
friend SLEIPNIR_DLLEXPORT IntrusiveSharedPtr<Expression> operator-(
double lhs, const IntrusiveSharedPtr<Expression>& rhs);

/**
* Expression-double subtraction operator.
*
* @param lhs Operator left-hand side.
* @param rhs Operator right-hand side.
*/
friend SLEIPNIR_DLLEXPORT IntrusiveSharedPtr<Expression> operator-(
const IntrusiveSharedPtr<Expression>& lhs, double rhs);

/**
* Expression-Expression subtraction operator.
*
Expand Down
92 changes: 0 additions & 92 deletions include/sleipnir/autodiff/Variable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,22 +95,6 @@ class SLEIPNIR_DLLEXPORT Variable {
*/
Variable& SetValue(int value);

/**
* double-Variable multiplication operator.
*
* @param lhs Operator left-hand side.
* @param rhs Operator right-hand side.
*/
friend SLEIPNIR_DLLEXPORT Variable operator*(double lhs, const Variable& rhs);

/**
* Variable-double multiplication operator.
*
* @param lhs Operator left-hand side.
* @param rhs Operator right-hand side.
*/
friend SLEIPNIR_DLLEXPORT Variable operator*(const Variable& lhs, double rhs);

/**
* Variable-Variable multiplication operator.
*
Expand All @@ -120,36 +104,13 @@ class SLEIPNIR_DLLEXPORT Variable {
friend SLEIPNIR_DLLEXPORT Variable operator*(const Variable& lhs,
const Variable& rhs);

/**
* Variable-double compound multiplication operator.
*
* @param rhs Operator right-hand side.
*/
Variable& operator*=(double rhs);

/**
* Variable-Variable compound multiplication operator.
*
* @param rhs Operator right-hand side.
*/
Variable& operator*=(const Variable& rhs);

/**
* double-Variable division operator.
*
* @param lhs Operator left-hand side.
* @param rhs Operator right-hand side.
*/
friend SLEIPNIR_DLLEXPORT Variable operator/(double lhs, const Variable& rhs);

/**
* Variable-double division operator.
*
* @param lhs Operator left-hand side.
* @param rhs Operator right-hand side.
*/
friend SLEIPNIR_DLLEXPORT Variable operator/(const Variable& lhs, double rhs);

/**
* Variable-Variable division operator.
*
Expand All @@ -159,36 +120,13 @@ class SLEIPNIR_DLLEXPORT Variable {
friend SLEIPNIR_DLLEXPORT Variable operator/(const Variable& lhs,
const Variable& rhs);

/**
* Variable-double compound division operator.
*
* @param rhs Operator right-hand side.
*/
Variable& operator/=(double rhs);

/**
* Variable-Variable compound division operator.
*
* @param rhs Operator right-hand side.
*/
Variable& operator/=(const Variable& rhs);

/**
* double-Variable addition operator.
*
* @param lhs Operator left-hand side.
* @param rhs Operator right-hand side.
*/
friend SLEIPNIR_DLLEXPORT Variable operator+(double lhs, const Variable& rhs);

/**
* Variable-double addition operator.
*
* @param lhs Operator left-hand side.
* @param rhs Operator right-hand side.
*/
friend SLEIPNIR_DLLEXPORT Variable operator+(const Variable& lhs, double rhs);

/**
* Variable-Variable addition operator.
*
Expand All @@ -198,36 +136,13 @@ class SLEIPNIR_DLLEXPORT Variable {
friend SLEIPNIR_DLLEXPORT Variable operator+(const Variable& lhs,
const Variable& rhs);

/**
* Variable-double compound addition operator.
*
* @param rhs Operator right-hand side.
*/
Variable& operator+=(double rhs);

/**
* Variable-Variable compound addition operator.
*
* @param rhs Operator right-hand side.
*/
Variable& operator+=(const Variable& rhs);

/**
* double-Variable subtraction operator.
*
* @param lhs Operator left-hand side.
* @param rhs Operator right-hand side.
*/
friend SLEIPNIR_DLLEXPORT Variable operator-(double lhs, const Variable& rhs);

/**
* Variable-double subtraction operator.
*
* @param lhs Operator left-hand side.
* @param rhs Operator right-hand side.
*/
friend SLEIPNIR_DLLEXPORT Variable operator-(const Variable& lhs, double rhs);

/**
* Variable-Variable subtraction operator.
*
Expand All @@ -237,13 +152,6 @@ class SLEIPNIR_DLLEXPORT Variable {
friend SLEIPNIR_DLLEXPORT Variable operator-(const Variable& lhs,
const Variable& rhs);

/**
* Variable-double compound subtraction operator.
*
* @param rhs Operator right-hand side.
*/
Variable& operator-=(double rhs);

/**
* Variable-Variable compound subtraction operator.
*
Expand Down
Loading

0 comments on commit c9e93f2

Please sign in to comment.