Skip to content

Commit

Permalink
[LinearAlgebra] Rename class MatrixSubstraction to MatrixSubtraction (#…
Browse files Browse the repository at this point in the history
…5016)

* [LinearAlgebra] Rename class MatrixSubstraction to MatrixSubtraction

* fix compilation
alxbilger authored Sep 26, 2024
1 parent ebc215c commit 55f303f
Showing 2 changed files with 21 additions and 8 deletions.
19 changes: 11 additions & 8 deletions Sofa/framework/LinearAlgebra/src/sofa/linearalgebra/MatrixExpr.h
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ template<class M1, class M2>
class MatrixAddition;

template<class M1, class M2>
class MatrixSubstraction;
class MatrixSubtraction;

template<class M1>
class MatrixTranspose;
@@ -66,9 +66,9 @@ class MatrixExpr : public T
return MatrixExpr { MatrixAddition< Expr, typename M2::Expr >(*this, m) };
}
template<class M2>
MatrixExpr< MatrixSubstraction< Expr, typename M2::Expr > > operator-(const M2& m) const
MatrixExpr< MatrixSubtraction< Expr, typename M2::Expr > > operator-(const M2& m) const
{
return MatrixExpr { MatrixSubstraction< Expr, typename M2::Expr >(*this, m) };
return MatrixExpr { MatrixSubtraction< Expr, typename M2::Expr >(*this, m) };
}
MatrixExpr< MatrixNegative< Expr > > operator-() const
{
@@ -98,9 +98,9 @@ class MatrixExpr : public T
return MatrixExpr { MatrixAddition< typename M1::Expr, Expr >(m1,m2) };
}
template<class M1>
friend MatrixExpr< MatrixSubstraction< typename M1::Expr, Expr > > operator-(const M1& m1, const MatrixExpr<Expr>& m2)
friend MatrixExpr< MatrixSubtraction< typename M1::Expr, Expr > > operator-(const M1& m1, const MatrixExpr<Expr>& m2)
{
return MatrixExpr { MatrixSubstraction< typename M1::Expr, Expr >(m1,m2) };
return MatrixExpr { MatrixSubtraction< typename M1::Expr, Expr >(m1,m2) };
}
};

@@ -442,18 +442,18 @@ class MatrixAddition
};

template<class M1, class M2>
class MatrixSubstraction
class MatrixSubtraction
{
public:
typedef MatrixSubstraction<M1, M2> Expr;
typedef MatrixSubtraction<M1, M2> Expr;
enum { operand = 0 };
enum { category = ((int)M1::category>(int)M2::category) ? (int)M1::category : (int)M2::category };
enum { m_index = (((int)M1::category>(int)M2::category)?0:1) };
typedef typename type_selector<m_index,typename M1::matrix_type,typename M2::matrix_type>::T matrix_type;

const M1& m1;
const M2& m2;
MatrixSubstraction(const M1& m1, const M2& m2) : m1(m1), m2(m2)
MatrixSubtraction(const M1& m1, const M2& m2) : m1(m1), m2(m2)
{}

bool valid() const
@@ -502,6 +502,9 @@ class MatrixSubstraction
}
};

template<class M1, class M2>
using MatrixSubstraction SOFA_ATTRIBUTE_DEPRECATED__MATRIXSUBTRACTION() = MatrixSubtraction<M1, M2>;

template<class M1, class M2>
class MatrixProduct
{
10 changes: 10 additions & 0 deletions Sofa/framework/LinearAlgebra/src/sofa/linearalgebra/config.h.in
Original file line number Diff line number Diff line change
@@ -59,3 +59,13 @@
"v23.06", "v23.12", \
"bloc has been renamed to block. ")
#endif // SOFA_BUILD_SOFA_LINEARALGEBRA


#ifdef SOFA_BUILD_SOFA_LINEARALGEBRA
#define SOFA_ATTRIBUTE_DEPRECATED__MATRIXSUBTRACTION()
#else
#define SOFA_ATTRIBUTE_DEPRECATED__MATRIXSUBTRACTION() \
SOFA_ATTRIBUTE_DEPRECATED( \
"v24.12", "v25.06", \
"Use MatrixSubtraction instead (typo in the deprecated name).")
#endif // SOFA_BUILD_SOFA_LINEARALGEBRA

0 comments on commit 55f303f

Please sign in to comment.