mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-20 08:39:37 +08:00
Add unittesting plugins to scalar_product_op and scalar_quotient_op to help chaking that types are properly propagated.
This commit is contained in:
parent
f57fd78e30
commit
bcc0f38f98
@ -70,7 +70,13 @@ template<typename LhsScalar,typename RhsScalar>
|
|||||||
struct scalar_product_op : binary_op_base<LhsScalar,RhsScalar>
|
struct scalar_product_op : binary_op_base<LhsScalar,RhsScalar>
|
||||||
{
|
{
|
||||||
typedef typename ScalarBinaryOpTraits<LhsScalar,RhsScalar,scalar_product_op>::ReturnType result_type;
|
typedef typename ScalarBinaryOpTraits<LhsScalar,RhsScalar,scalar_product_op>::ReturnType result_type;
|
||||||
|
#ifndef EIGEN_SCALAR_BINARY_OP_PLUGIN
|
||||||
EIGEN_EMPTY_STRUCT_CTOR(scalar_product_op)
|
EIGEN_EMPTY_STRUCT_CTOR(scalar_product_op)
|
||||||
|
#else
|
||||||
|
scalar_product_op() {
|
||||||
|
EIGEN_SCALAR_BINARY_OP_PLUGIN
|
||||||
|
}
|
||||||
|
#endif
|
||||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const result_type operator() (const LhsScalar& a, const RhsScalar& b) const { return a * b; }
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const result_type operator() (const LhsScalar& a, const RhsScalar& b) const { return a * b; }
|
||||||
template<typename Packet>
|
template<typename Packet>
|
||||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const
|
||||||
@ -332,7 +338,13 @@ template<typename LhsScalar,typename RhsScalar>
|
|||||||
struct scalar_quotient_op : binary_op_base<LhsScalar,RhsScalar>
|
struct scalar_quotient_op : binary_op_base<LhsScalar,RhsScalar>
|
||||||
{
|
{
|
||||||
typedef typename ScalarBinaryOpTraits<LhsScalar,RhsScalar,scalar_quotient_op>::ReturnType result_type;
|
typedef typename ScalarBinaryOpTraits<LhsScalar,RhsScalar,scalar_quotient_op>::ReturnType result_type;
|
||||||
|
#ifndef EIGEN_SCALAR_BINARY_OP_PLUGIN
|
||||||
EIGEN_EMPTY_STRUCT_CTOR(scalar_quotient_op)
|
EIGEN_EMPTY_STRUCT_CTOR(scalar_quotient_op)
|
||||||
|
#else
|
||||||
|
scalar_quotient_op() {
|
||||||
|
EIGEN_SCALAR_BINARY_OP_PLUGIN
|
||||||
|
}
|
||||||
|
#endif
|
||||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const result_type operator() (const LhsScalar& a, const RhsScalar& b) const { return a / b; }
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const result_type operator() (const LhsScalar& a, const RhsScalar& b) const { return a / b; }
|
||||||
template<typename Packet>
|
template<typename Packet>
|
||||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
static bool g_called;
|
static bool g_called;
|
||||||
#define EIGEN_SPECIAL_SCALAR_MULTIPLE_PLUGIN { g_called = true; }
|
#define EIGEN_SCALAR_BINARY_OP_PLUGIN { g_called |= (!internal::is_same<LhsScalar,RhsScalar>::value); }
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user