10 #ifndef EIGEN_BLASUTIL_H 11 #define EIGEN_BLASUTIL_H 21 template<
typename LhsScalar,
typename RhsScalar,
typename Index,
typename DataMapper,
int mr,
int nr,
bool ConjugateLhs=false,
bool ConjugateRhs=false>
24 template<
typename Scalar,
typename Index,
typename DataMapper,
int nr,
int StorageOrder,
bool Conjugate = false,
bool PanelMode=false>
27 template<
typename Scalar,
typename Index,
typename DataMapper,
int Pack1,
int Pack2,
int StorageOrder,
bool Conjugate = false,
bool PanelMode = false>
32 typename LhsScalar,
int LhsStorageOrder,
bool ConjugateLhs,
33 typename RhsScalar,
int RhsStorageOrder,
bool ConjugateRhs,
37 template<
typename Index,
38 typename LhsScalar,
typename LhsMapper,
int LhsStorageOrder,
bool ConjugateLhs,
39 typename RhsScalar,
typename RhsMapper,
bool ConjugateRhs,
int Version=
Specialized>
54 inline const T&
operator()(
const T& x)
const {
return x; }
56 inline const T&
pconj(
const T& x)
const {
return x; }
60 template<
typename LhsScalar,
typename RhsScalar,
bool ConjLhs,
bool ConjRhs>
72 template<
typename Scalar>
struct conj_helper<Scalar,Scalar,false,false>
78 template<
typename RealScalar>
struct conj_helper<
std::complex<RealScalar>, std::complex<RealScalar>, false,true>
80 typedef std::complex<RealScalar>
Scalar;
82 {
return c +
pmul(x,y); }
88 template<
typename RealScalar>
struct conj_helper<
std::complex<RealScalar>, std::complex<RealScalar>, true,false>
90 typedef std::complex<RealScalar>
Scalar;
92 {
return c +
pmul(x,y); }
98 template<
typename RealScalar>
struct conj_helper<
std::complex<RealScalar>, std::complex<RealScalar>, true,true>
102 {
return c +
pmul(x,y); }
108 template<
typename RealScalar,
bool Conj>
struct conj_helper<
std::complex<RealScalar>, RealScalar, Conj,false>
117 template<
typename RealScalar,
bool Conj>
struct conj_helper<RealScalar,
std::complex<RealScalar>, false,Conj>
136 template<
typename Scalar,
typename Index>
144 template <
typename Packet,
int AlignmentType>
146 return ploadt<Packet, AlignmentType>(m_data + i);
149 template <
typename Packet>
158 template<
typename Scalar,
typename Index,
int AlignmentType>
175 return ploadt<Packet, AlignmentType>(m_data + i);
179 return ploadt<HalfPacket, AlignmentType>(m_data + i);
183 pstoret<Scalar, Packet, AlignmentType>(m_data + i, p);
191 template<
typename Scalar,
typename Index,
int StorageOrder,
int AlignmentType = Unaligned>
208 return LinearMapper(&
operator()(i, j));
212 return VectorMapper(&
operator()(i, j));
218 return m_data[StorageOrder==
RowMajor ? j + i*m_stride : i + j*m_stride];
222 return ploadt<Packet, AlignmentType>(&operator()(i, j));
226 return ploadt<HalfPacket, AlignmentType>(&operator()(i, j));
229 template<
typename SubPacket>
231 pscatter<Scalar, SubPacket>(&operator()(i, j), p, m_stride);
234 template<
typename SubPacket>
236 return pgather<Scalar, SubPacket>(&operator()(i, j), m_stride);
240 EIGEN_DEVICE_FUNC
const Scalar*
data()
const {
return m_data; }
243 if (
UIntPtr(m_data)%
sizeof(Scalar)) {
255 template<
typename Scalar,
typename Index,
int StorageOrder>
276 IsTransposed =
false,
277 NeedToConjugate =
false,
279 && (
bool(XprType::IsVectorAtCompileTime)
283 typedef typename conditional<bool(HasUsableDirectAccess),
285 typename _ExtractType::PlainObject
287 static inline ExtractType
extract(
const XprType& x) {
return x; }
292 template<
typename Scalar,
typename NestedXpr>
302 NeedToConjugate = Base::NeedToConjugate ? 0 : IsComplex
309 template<
typename Scalar,
typename NestedXpr,
typename Plain>
316 static inline ExtractType
extract(
const XprType& x) {
return Base::extract(x.
rhs()); }
318 {
return x.
lhs().functor().m_other * Base::extractScalarFactor(x.
rhs()); }
320 template<
typename Scalar,
typename NestedXpr,
typename Plain>
327 static inline ExtractType
extract(
const XprType& x) {
return Base::extract(x.
lhs()); }
329 {
return Base::extractScalarFactor(x.
lhs()) * x.
rhs().functor().m_other; }
331 template<
typename Scalar,
typename Plain1,
typename Plain2>
334 :
blas_traits<CwiseNullaryOp<scalar_constant_op<Scalar>,Plain1> >
338 template<
typename Scalar,
typename NestedXpr>
351 template<
typename NestedXpr>
355 typedef typename NestedXpr::Scalar
Scalar;
360 typedef typename conditional<bool(Base::HasUsableDirectAccess),
362 typename ExtractType::PlainObject
365 IsTransposed = Base::IsTransposed ? 0 : 1
376 template<typename T, bool HasUsableDirectAccess=blas_traits<T>::HasUsableDirectAccess>
378 static const typename T::Scalar*
run(
const T& m)
386 static typename T::Scalar*
run(
const T&) {
return 0; }
389 template<
typename T>
const typename T::Scalar*
extract_data(
const T& m)
398 #endif // EIGEN_BLASUTIL_H Generic expression of a matrix where all coefficients are defined by a functor.
packet_traits< Scalar >::half HalfPacket
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE SubPacket gatherPacket(Index i, Index j) const
BlasVectorMapper< Scalar, Index > VectorMapper
#define EIGEN_ALWAYS_INLINE
EIGEN_DEVICE_FUNC Index firstAligned(Index size) const
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE BlasVectorMapper(Scalar *data)
EIGEN_STRONG_INLINE Scalar pmul(const Scalar &x, const RealScalar &y) const
#define EIGEN_STRONG_INLINE
Base::ExtractType ExtractType
CwiseUnaryOp< scalar_opposite_op< Scalar >, NestedXpr > XprType
const AutoDiffScalar< DerType > & conj(const AutoDiffScalar< DerType > &x)
blas_traits< NestedXpr > Base
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE HalfPacket loadHalfPacket(Index i, Index j) const
EIGEN_DEVICE_FUNC RealReturnType real() const
blas_traits< NestedXpr > Base
static ExtractType extract(const XprType &x)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const internal::remove_all< XprTypeNested >::type & nestedExpression() const
Base::ExtractType ExtractType
static const Scalar extractScalarFactor(const XprType &)
Expression of the transpose of a matrix.
const unsigned int DirectAccessBit
conditional< bool(HasUsableDirectAccess), ExtractType, typename _ExtractType::PlainObject >::type DirectLinearAccessType
static Scalar extractScalarFactor(const XprType &x)
EIGEN_ALWAYS_INLINE const_blas_data_mapper(const Scalar *data, Index stride)
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE BlasLinearMapper(Scalar *data)
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Scalar & operator()(Index i, Index j) const
T pconj(const T &x) const
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE To run(const From &x)
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Scalar & operator()(Index i) const
blas_traits< NestedXpr > Base
ScalarBinaryOpTraits< LhsScalar, RhsScalar >::ReturnType Scalar
static constexpr size_t size(Tuple< Args... > &)
Provides access to the number of elements in a tuple as a compile-time constant expression.
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void prefetch(int i) const
EIGEN_STRONG_INLINE Scalar pmadd(const RealScalar &x, const Scalar &y, const Scalar &c) const
static ExtractType extract(const XprType &x)
const T & operator()(const T &x) const
static Scalar extractScalarFactor(const XprType &x)
std::complex< RealScalar > Scalar
EIGEN_DEVICE_FUNC bool aligned(Index i) const
EIGEN_STRONG_INLINE Scalar pmul(const Scalar &x, const Scalar &y) const
EIGEN_DEVICE_FUNC const _LhsNested & lhs() const
blas_traits< NestedXpr > Base
packet_traits< Scalar >::type Packet
static ExtractType extract(const XprType &x)
Transpose< const typename Base::_ExtractType > ExtractType
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE NumTraits< Scalar >::Real run(const Scalar &x)
static Index first_default_aligned(const DenseBase< Derived > &m)
packet_traits< Scalar >::half HalfPacket
static Scalar extractScalarFactor(const XprType &x)
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet loadPacket(Index i, Index j) const
EIGEN_DEVICE_FUNC Packet padd(const Packet &a, const Packet &b)
Generic expression where a coefficient-wise binary operator is applied to two expressions.
BlasLinearMapper< Scalar, Index, AlignmentType > LinearMapper
std::complex< RealScalar > Scalar
CwiseBinaryOp< scalar_product_op< Scalar >, NestedXpr, const CwiseNullaryOp< scalar_constant_op< Scalar >, Plain > > XprType
std::complex< RealScalar > Scalar
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Base::ExtractType ExtractType
static ExtractType extract(const XprType &x)
packet_traits< Scalar >::type Packet
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE LinearMapper getLinearMapper(Index i, Index j) const
Scalar *EIGEN_RESTRICT m_data
static Scalar extractScalarFactor(const XprType &x)
CwiseUnaryOp< scalar_conjugate_op< Scalar >, NestedXpr > XprType
Transpose< NestedXpr > XprType
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE VectorMapper getVectorMapper(Index i, Index j) const
EIGEN_STRONG_INLINE Scalar pmadd(const Scalar &x, const Scalar &y, const Scalar &c) const
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void storePacket(Index i, const Packet &p) const
EIGEN_STRONG_INLINE Packet2cf pconj(const Packet2cf &a)
EIGEN_DEVICE_FUNC const internal::remove_all< MatrixTypeNested >::type & nestedExpression() const
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE HalfPacket loadHalfPacket(Index i) const
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void scatterPacket(Index i, Index j, const SubPacket &p) const
EIGEN_STRONG_INLINE Scalar pmadd(const Scalar &x, const Scalar &y, const Scalar &c) const
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE blas_data_mapper(Scalar *data, Index stride)
static ExtractType extract(const XprType &x)
EIGEN_STRONG_INLINE Scalar pmul(const Scalar &x, const Scalar &y) const
blas_traits< NestedXpr > Base
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Scalar operator()(Index i) const
EIGEN_ALWAYS_INLINE const_blas_data_mapper< Scalar, Index, StorageOrder > getSubMapper(Index i, Index j) const
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE blas_data_mapper< Scalar, Index, StorageOrder, AlignmentType > getSubMapper(Index i, Index j) const
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet loadPacket(Index i) const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar pmadd(const Scalar &x, const Scalar &y, const Scalar &c) const
EIGEN_DEVICE_FUNC const Index stride() const
CwiseBinaryOp< scalar_product_op< Scalar >, const CwiseNullaryOp< scalar_constant_op< Scalar >, Plain >, NestedXpr > XprType
EIGEN_STRONG_INLINE Scalar pmadd(const LhsScalar &x, const RhsScalar &y, const Scalar &c) const
EIGEN_STRONG_INLINE Scalar pmul(const Scalar &x, const Scalar &y) const
EIGEN_STRONG_INLINE Scalar pmul(const RealScalar &x, const Scalar &y) const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar pmul(const Scalar &x, const Scalar &y) const
EIGEN_STRONG_INLINE Scalar pmadd(const Scalar &x, const Scalar &y, const Scalar &c) const
EIGEN_STRONG_INLINE Packet4f pmadd(const Packet4f &a, const Packet4f &b, const Packet4f &c)
T operator()(const T &x) const
EIGEN_DEVICE_FUNC const ImagReturnType imag() const
conditional< bool(Base::HasUsableDirectAccess), ExtractType, typename ExtractType::PlainObject >::type DirectLinearAccessType
Determines whether the given binary operation of two numeric types is allowed and what the scalar ret...
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet load(Index i) const
const T::Scalar * extract_data(const T &m)
EIGEN_DEVICE_FUNC void prefetch(const Scalar *addr)
Generic expression where a coefficient-wise unary operator is applied to an expression.
EIGEN_STRONG_INLINE Scalar pmadd(const Scalar &x, const RealScalar &y, const Scalar &c) const
traits< XprType >::Scalar Scalar
static Scalar extractScalarFactor(const XprType &x)
EIGEN_DEVICE_FUNC const _RhsNested & rhs() const
EIGEN_DEVICE_FUNC Packet pmul(const Packet &a, const Packet &b)
EIGEN_DEVICE_FUNC const Scalar * data() const
std::complex< RealScalar > Scalar
EIGEN_STRONG_INLINE Scalar pmul(const LhsScalar &x, const RhsScalar &y) const
static ExtractType extract(const XprType &x)
std::complex< RealScalar > Scalar
Base::ExtractType ExtractType
const T & pconj(const T &x) const
Transpose< const typename Base::_ExtractType > _ExtractType
const XprType & ExtractType