mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-12 11:49:02 +08:00
bug #1260: remove doubtful specializations of ScalarBinaryOpTraits
This commit is contained in:
parent
d3d7c6245d
commit
0d7039319c
@ -497,31 +497,15 @@ struct make_coherent_impl<Matrix<A_Scalar, A_Rows, A_Cols, A_Options, A_MaxRows,
|
|||||||
|
|
||||||
} // end namespace internal
|
} // end namespace internal
|
||||||
|
|
||||||
template<typename A_Scalar, int A_Rows, int A_Cols, int A_Options, int A_MaxRows, int A_MaxCols, typename BinOp>
|
|
||||||
struct ScalarBinaryOpTraits<Matrix<A_Scalar, A_Rows, A_Cols, A_Options, A_MaxRows, A_MaxCols>,A_Scalar,BinOp>
|
|
||||||
{
|
|
||||||
enum { Defined = 1 };
|
|
||||||
typedef Matrix<A_Scalar, A_Rows, A_Cols, A_Options, A_MaxRows, A_MaxCols> ReturnType;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename A_Scalar, int A_Rows, int A_Cols, int A_Options, int A_MaxRows, int A_MaxCols, typename BinOp>
|
|
||||||
struct ScalarBinaryOpTraits<A_Scalar, Matrix<A_Scalar, A_Rows, A_Cols, A_Options, A_MaxRows, A_MaxCols>, BinOp>
|
|
||||||
{
|
|
||||||
enum { Defined = 1 };
|
|
||||||
typedef Matrix<A_Scalar, A_Rows, A_Cols, A_Options, A_MaxRows, A_MaxCols> ReturnType;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename DerType, typename BinOp>
|
template<typename DerType, typename BinOp>
|
||||||
struct ScalarBinaryOpTraits<AutoDiffScalar<DerType>,typename DerType::Scalar,BinOp>
|
struct ScalarBinaryOpTraits<AutoDiffScalar<DerType>,typename DerType::Scalar,BinOp>
|
||||||
{
|
{
|
||||||
enum { Defined = 1 };
|
|
||||||
typedef AutoDiffScalar<DerType> ReturnType;
|
typedef AutoDiffScalar<DerType> ReturnType;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename DerType, typename BinOp>
|
template<typename DerType, typename BinOp>
|
||||||
struct ScalarBinaryOpTraits<typename DerType::Scalar,AutoDiffScalar<DerType>, BinOp>
|
struct ScalarBinaryOpTraits<typename DerType::Scalar,AutoDiffScalar<DerType>, BinOp>
|
||||||
{
|
{
|
||||||
enum { Defined = 1 };
|
|
||||||
typedef AutoDiffScalar<DerType> ReturnType;
|
typedef AutoDiffScalar<DerType> ReturnType;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -205,6 +205,10 @@ void test_autodiff_hessian()
|
|||||||
VERIFY_IS_APPROX(y.value().derivatives()(1), s4*std::cos(s1*s3+s2*s4));
|
VERIFY_IS_APPROX(y.value().derivatives()(1), s4*std::cos(s1*s3+s2*s4));
|
||||||
VERIFY_IS_APPROX(y.derivatives()(0).derivatives(), -std::sin(s1*s3+s2*s4)*Vector2d(s3*s3,s4*s3));
|
VERIFY_IS_APPROX(y.derivatives()(0).derivatives(), -std::sin(s1*s3+s2*s4)*Vector2d(s3*s3,s4*s3));
|
||||||
VERIFY_IS_APPROX(y.derivatives()(1).derivatives(), -std::sin(s1*s3+s2*s4)*Vector2d(s3*s4,s4*s4));
|
VERIFY_IS_APPROX(y.derivatives()(1).derivatives(), -std::sin(s1*s3+s2*s4)*Vector2d(s3*s4,s4*s4));
|
||||||
|
|
||||||
|
ADD z = x(0)*x(1);
|
||||||
|
VERIFY_IS_APPROX(z.derivatives()(0).derivatives(), Vector2d(0,1));
|
||||||
|
VERIFY_IS_APPROX(z.derivatives()(1).derivatives(), Vector2d(1,0));
|
||||||
}
|
}
|
||||||
|
|
||||||
double bug_1222() {
|
double bug_1222() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user