10#ifndef EIGEN_BLASUTIL_H
11#define EIGEN_BLASUTIL_H
21template<
typename LhsScalar,
typename RhsScalar,
typename Index,
typename DataMapper,
int mr,
int nr,
bool ConjugateLhs=false,
bool ConjugateRhs=false>
24template<
typename Scalar,
typename Index,
typename DataMapper,
int nr,
int StorageOrder,
bool Conjugate = false,
bool PanelMode=false>
27template<
typename Scalar,
typename Index,
typename DataMapper,
int Pack1,
int Pack2,
typename Packet,
int StorageOrder,
bool Conjugate = false,
bool PanelMode = false>
32 typename LhsScalar,
int LhsStorageOrder,
bool ConjugateLhs,
33 typename RhsScalar,
int RhsStorageOrder,
bool ConjugateRhs,
34 int ResStorageOrder,
int ResInnerStride>
35struct general_matrix_matrix_product;
37template<
typename Index,
38 typename LhsScalar,
typename LhsMapper,
int LhsStorageOrder,
bool ConjugateLhs,
39 typename RhsScalar,
typename RhsMapper,
bool ConjugateRhs,
int Version=Specialized>
40struct general_matrix_vector_product;
42template<
typename From,
typename To>
struct get_factor {
43 EIGEN_DEVICE_FUNC
static EIGEN_STRONG_INLINE To run(
const From& x) {
return To(x); }
46template<
typename Scalar>
struct get_factor<Scalar,typename NumTraits<Scalar>::Real> {
48 static EIGEN_STRONG_INLINE
typename NumTraits<Scalar>::Real run(
const Scalar& x) {
return numext::real(x); }
52template<
typename Scalar,
typename Index>
53class BlasVectorMapper {
55 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE BlasVectorMapper(Scalar *data) : m_data(data) {}
57 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Scalar operator()(
Index i)
const {
60 template <
typename Packet,
int AlignmentType>
61 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet load(
Index i)
const {
62 return ploadt<Packet, AlignmentType>(m_data + i);
65 template <
typename Packet>
66 EIGEN_DEVICE_FUNC
bool aligned(
Index i)
const {
67 return (UIntPtr(m_data+i)%
sizeof(Packet))==0;
74template<
typename Scalar,
typename Index,
int AlignmentType,
int Incr=1>
75class BlasLinearMapper;
77template<
typename Scalar,
typename Index,
int AlignmentType>
81 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE BlasLinearMapper(Scalar *data,
Index incr=1)
84 EIGEN_ONLY_USED_FOR_DEBUG(incr);
85 eigen_assert(incr==1);
88 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
void prefetch(
int i)
const {
89 internal::prefetch(&
operator()(i));
92 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Scalar& operator()(
Index i)
const {
96 template<
typename PacketType>
97 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE PacketType loadPacket(
Index i)
const {
98 return ploadt<PacketType, AlignmentType>(m_data + i);
101 template<
typename PacketType>
102 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
void storePacket(
Index i,
const PacketType &p)
const {
103 pstoret<Scalar, PacketType, AlignmentType>(m_data + i, p);
111template<
typename Scalar,
typename Index,
int StorageOrder,
int AlignmentType = Unaligned,
int Incr = 1>
112class blas_data_mapper;
118template<
typename Index,
typename Scalar,
typename Packet,
int n,
int idx,
int StorageOrder>
119struct PacketBlockManagement
121 PacketBlockManagement<
Index, Scalar, Packet, n, idx - 1, StorageOrder> pbm;
122 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
void store(Scalar *to,
const Index stride,
Index i,
Index j,
const PacketBlock<Packet, n> &block)
const {
123 pbm.store(to, stride, i, j, block);
124 pstoreu<Scalar>(to + i + (j + idx)*stride, block.packet[idx]);
129template<
typename Index,
typename Scalar,
typename Packet,
int n,
int idx>
130struct PacketBlockManagement<
Index, Scalar, Packet, n, idx,
RowMajor>
132 PacketBlockManagement<
Index, Scalar, Packet, n, idx - 1,
RowMajor> pbm;
133 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
void store(Scalar *to,
const Index stride,
Index i,
Index j,
const PacketBlock<Packet, n> &block)
const {
134 pbm.store(to, stride, i, j, block);
135 pstoreu<Scalar>(to + j + (i + idx)*stride, block.packet[idx]);
139template<
typename Index,
typename Scalar,
typename Packet,
int n,
int StorageOrder>
140struct PacketBlockManagement<
Index, Scalar, Packet, n, -1, StorageOrder>
142 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
void store(Scalar *to,
const Index stride,
Index i,
Index j,
const PacketBlock<Packet, n> &block)
const {
143 EIGEN_UNUSED_VARIABLE(to);
144 EIGEN_UNUSED_VARIABLE(stride);
145 EIGEN_UNUSED_VARIABLE(i);
146 EIGEN_UNUSED_VARIABLE(j);
147 EIGEN_UNUSED_VARIABLE(block);
151template<
typename Index,
typename Scalar,
typename Packet,
int n>
152struct PacketBlockManagement<
Index, Scalar, Packet, n, -1,
RowMajor>
154 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
void store(Scalar *to,
const Index stride,
Index i,
Index j,
const PacketBlock<Packet, n> &block)
const {
155 EIGEN_UNUSED_VARIABLE(to);
156 EIGEN_UNUSED_VARIABLE(stride);
157 EIGEN_UNUSED_VARIABLE(i);
158 EIGEN_UNUSED_VARIABLE(j);
159 EIGEN_UNUSED_VARIABLE(block);
163template<
typename Scalar,
typename Index,
int StorageOrder,
int AlignmentType>
167 typedef BlasLinearMapper<Scalar, Index, AlignmentType> LinearMapper;
168 typedef BlasVectorMapper<Scalar, Index> VectorMapper;
170 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE blas_data_mapper(Scalar* data,
Index stride,
Index incr=1)
171 : m_data(data), m_stride(stride)
173 EIGEN_ONLY_USED_FOR_DEBUG(incr);
174 eigen_assert(incr==1);
177 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE blas_data_mapper<Scalar, Index, StorageOrder, AlignmentType>
179 return blas_data_mapper<Scalar, Index, StorageOrder, AlignmentType>(&
operator()(i, j), m_stride);
182 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE LinearMapper getLinearMapper(
Index i,
Index j)
const {
183 return LinearMapper(&
operator()(i, j));
186 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE VectorMapper getVectorMapper(
Index i,
Index j)
const {
187 return VectorMapper(&
operator()(i, j));
192 EIGEN_ALWAYS_INLINE Scalar& operator()(
Index i,
Index j)
const {
193 return m_data[StorageOrder==
RowMajor ? j + i*m_stride : i + j*m_stride];
196 template<
typename PacketType>
197 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE PacketType loadPacket(
Index i,
Index j)
const {
198 return ploadt<PacketType, AlignmentType>(&
operator()(i, j));
201 template <
typename PacketT,
int AlignmentT>
202 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE PacketT load(
Index i,
Index j)
const {
203 return ploadt<PacketT, AlignmentT>(&
operator()(i, j));
206 template<
typename SubPacket>
207 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
void scatterPacket(
Index i,
Index j,
const SubPacket &p)
const {
208 pscatter<Scalar, SubPacket>(&
operator()(i, j), p, m_stride);
211 template<
typename SubPacket>
212 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE SubPacket gatherPacket(
Index i,
Index j)
const {
213 return pgather<Scalar, SubPacket>(&
operator()(i, j), m_stride);
216 EIGEN_DEVICE_FUNC
const Index stride()
const {
return m_stride; }
217 EIGEN_DEVICE_FUNC
const Scalar* data()
const {
return m_data; }
219 EIGEN_DEVICE_FUNC
Index firstAligned(
Index size)
const {
220 if (UIntPtr(m_data)%
sizeof(Scalar)) {
223 return internal::first_default_aligned(m_data, size);
226 template<
typename SubPacket,
int n>
227 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
void storePacketBlock(
Index i,
Index j,
const PacketBlock<SubPacket, n> &block)
const {
228 PacketBlockManagement<
Index, Scalar, SubPacket, n, n-1, StorageOrder> pbm;
229 pbm.store(m_data, m_stride, i, j, block);
232 Scalar* EIGEN_RESTRICT m_data;
233 const Index m_stride;
239template<
typename Scalar,
typename Index,
int AlignmentType,
int Incr>
240class BlasLinearMapper
243 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE BlasLinearMapper(Scalar *data,
Index incr) : m_data(data), m_incr(incr) {}
245 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
void prefetch(
int i)
const {
246 internal::prefetch(&
operator()(i));
249 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Scalar& operator()(
Index i)
const {
250 return m_data[i*m_incr.value()];
253 template<
typename PacketType>
254 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE PacketType loadPacket(
Index i)
const {
255 return pgather<Scalar,PacketType>(m_data + i*m_incr.value(), m_incr.value());
258 template<
typename PacketType>
259 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
void storePacket(
Index i,
const PacketType &p)
const {
260 pscatter<Scalar, PacketType>(m_data + i*m_incr.value(), p, m_incr.value());
265 const internal::variable_if_dynamic<Index,Incr> m_incr;
268template<
typename Scalar,
typename Index,
int StorageOrder,
int AlignmentType,
int Incr>
269class blas_data_mapper
272 typedef BlasLinearMapper<Scalar, Index, AlignmentType,Incr> LinearMapper;
274 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE blas_data_mapper(Scalar* data,
Index stride,
Index incr) : m_data(data), m_stride(stride), m_incr(incr) {}
276 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE blas_data_mapper
278 return blas_data_mapper(&
operator()(i, j), m_stride, m_incr.value());
281 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE LinearMapper getLinearMapper(
Index i,
Index j)
const {
282 return LinearMapper(&
operator()(i, j), m_incr.value());
286 EIGEN_ALWAYS_INLINE Scalar& operator()(
Index i,
Index j)
const {
287 return m_data[StorageOrder==
RowMajor ? j*m_incr.value() + i*m_stride : i*m_incr.value() + j*m_stride];
290 template<
typename PacketType>
291 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE PacketType loadPacket(
Index i,
Index j)
const {
292 return pgather<Scalar,PacketType>(&
operator()(i, j),m_incr.value());
295 template <
typename PacketT,
int AlignmentT>
296 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE PacketT load(
Index i,
Index j)
const {
297 return pgather<Scalar,PacketT>(&
operator()(i, j),m_incr.value());
300 template<
typename SubPacket>
301 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
void scatterPacket(
Index i,
Index j,
const SubPacket &p)
const {
302 pscatter<Scalar, SubPacket>(&
operator()(i, j), p, m_stride);
305 template<
typename SubPacket>
306 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE SubPacket gatherPacket(
Index i,
Index j)
const {
307 return pgather<Scalar, SubPacket>(&
operator()(i, j), m_stride);
311 template<
typename SubPacket,
typename ScalarT,
int n,
int idx>
312 struct storePacketBlock_helper
314 storePacketBlock_helper<SubPacket, ScalarT, n, idx-1> spbh;
315 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
void store(
const blas_data_mapper<Scalar, Index, StorageOrder, AlignmentType, Incr>* sup,
Index i,
Index j,
const PacketBlock<SubPacket, n>& block)
const {
316 spbh.store(sup, i,j,block);
317 for(
int l = 0; l < unpacket_traits<SubPacket>::size; l++)
319 ScalarT *v = &sup->operator()(i+l, j+idx);
320 *v = block.packet[idx][l];
325 template<
typename SubPacket,
int n,
int idx>
326 struct storePacketBlock_helper<SubPacket, std::complex<float>, n, idx>
328 storePacketBlock_helper<SubPacket, std::complex<float>, n, idx-1> spbh;
329 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
void store(
const blas_data_mapper<Scalar, Index, StorageOrder, AlignmentType, Incr>* sup,
Index i,
Index j,
const PacketBlock<SubPacket, n>& block)
const {
330 spbh.store(sup,i,j,block);
331 for(
int l = 0; l < unpacket_traits<SubPacket>::size; l++)
333 std::complex<float> *v = &sup->operator()(i+l, j+idx);
334 v->real(block.packet[idx].v[2*l+0]);
335 v->imag(block.packet[idx].v[2*l+1]);
340 template<
typename SubPacket,
int n,
int idx>
341 struct storePacketBlock_helper<SubPacket, std::complex<double>, n, idx>
343 storePacketBlock_helper<SubPacket, std::complex<double>, n, idx-1> spbh;
344 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
void store(
const blas_data_mapper<Scalar, Index, StorageOrder, AlignmentType, Incr>* sup,
Index i,
Index j,
const PacketBlock<SubPacket, n>& block)
const {
345 spbh.store(sup,i,j,block);
346 for(
int l = 0; l < unpacket_traits<SubPacket>::size; l++)
348 std::complex<double> *v = &sup->operator()(i+l, j+idx);
349 v->real(block.packet[idx].v[2*l+0]);
350 v->imag(block.packet[idx].v[2*l+1]);
355 template<
typename SubPacket,
typename ScalarT,
int n>
356 struct storePacketBlock_helper<SubPacket, ScalarT, n, -1>
358 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
void store(
const blas_data_mapper<Scalar, Index, StorageOrder, AlignmentType, Incr>*,
Index,
Index,
const PacketBlock<SubPacket, n>& )
const {
362 template<
typename SubPacket,
int n>
363 struct storePacketBlock_helper<SubPacket, std::complex<float>, n, -1>
365 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
void store(
const blas_data_mapper<Scalar, Index, StorageOrder, AlignmentType, Incr>*,
Index,
Index,
const PacketBlock<SubPacket, n>& )
const {
369 template<
typename SubPacket,
int n>
370 struct storePacketBlock_helper<SubPacket, std::complex<double>, n, -1>
372 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
void store(
const blas_data_mapper<Scalar, Index, StorageOrder, AlignmentType, Incr>*,
Index,
Index,
const PacketBlock<SubPacket, n>& )
const {
376 template<
typename SubPacket,
int n>
377 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
void storePacketBlock(
Index i,
Index j,
const PacketBlock<SubPacket, n>&block)
const {
378 storePacketBlock_helper<SubPacket, Scalar, n, n-1> spb;
379 spb.store(
this, i,j,block);
382 Scalar* EIGEN_RESTRICT m_data;
383 const Index m_stride;
384 const internal::variable_if_dynamic<Index,Incr> m_incr;
388template<
typename Scalar,
typename Index,
int StorageOrder>
389class const_blas_data_mapper :
public blas_data_mapper<const Scalar, Index, StorageOrder> {
391 EIGEN_ALWAYS_INLINE const_blas_data_mapper(
const Scalar *data,
Index stride) : blas_data_mapper<const Scalar,
Index, StorageOrder>(data, stride) {}
393 EIGEN_ALWAYS_INLINE const_blas_data_mapper<Scalar, Index, StorageOrder> getSubMapper(
Index i,
Index j)
const {
394 return const_blas_data_mapper<Scalar, Index, StorageOrder>(&(this->
operator()(i, j)), this->m_stride);
402template<
typename XprType>
struct blas_traits
404 typedef typename traits<XprType>::Scalar Scalar;
405 typedef const XprType& ExtractType;
406 typedef XprType _ExtractType;
408 IsComplex = NumTraits<Scalar>::IsComplex,
409 IsTransposed =
false,
410 NeedToConjugate =
false,
412 && (
bool(XprType::IsVectorAtCompileTime)
413 || int(inner_stride_at_compile_time<XprType>::ret) == 1)
415 HasScalarFactor =
false
417 typedef typename conditional<bool(HasUsableDirectAccess),
419 typename _ExtractType::PlainObject
420 >::type DirectLinearAccessType;
421 static inline EIGEN_DEVICE_FUNC ExtractType extract(
const XprType& x) {
return x; }
422 static inline EIGEN_DEVICE_FUNC
const Scalar extractScalarFactor(
const XprType&) {
return Scalar(1); }
426template<
typename Scalar,
typename NestedXpr>
427struct blas_traits<CwiseUnaryOp<scalar_conjugate_op<Scalar>, NestedXpr> >
428 : blas_traits<NestedXpr>
430 typedef blas_traits<NestedXpr> Base;
431 typedef CwiseUnaryOp<scalar_conjugate_op<Scalar>, NestedXpr> XprType;
432 typedef typename Base::ExtractType ExtractType;
435 IsComplex = NumTraits<Scalar>::IsComplex,
436 NeedToConjugate = Base::NeedToConjugate ? 0 : IsComplex
438 static inline ExtractType extract(
const XprType& x) {
return Base::extract(x.nestedExpression()); }
439 static inline Scalar extractScalarFactor(
const XprType& x) {
return conj(Base::extractScalarFactor(x.nestedExpression())); }
443template<
typename Scalar,
typename NestedXpr,
typename Plain>
444struct blas_traits<CwiseBinaryOp<scalar_product_op<Scalar>, const CwiseNullaryOp<scalar_constant_op<Scalar>,Plain>, NestedXpr> >
445 : blas_traits<NestedXpr>
448 HasScalarFactor =
true
450 typedef blas_traits<NestedXpr> Base;
451 typedef CwiseBinaryOp<scalar_product_op<Scalar>,
const CwiseNullaryOp<scalar_constant_op<Scalar>,Plain>, NestedXpr> XprType;
452 typedef typename Base::ExtractType ExtractType;
453 static inline EIGEN_DEVICE_FUNC ExtractType extract(
const XprType& x) {
return Base::extract(x.rhs()); }
454 static inline EIGEN_DEVICE_FUNC Scalar extractScalarFactor(
const XprType& x)
455 {
return x.lhs().functor().m_other * Base::extractScalarFactor(x.rhs()); }
457template<
typename Scalar,
typename NestedXpr,
typename Plain>
458struct blas_traits<CwiseBinaryOp<scalar_product_op<Scalar>, NestedXpr, const CwiseNullaryOp<scalar_constant_op<Scalar>,Plain> > >
459 : blas_traits<NestedXpr>
462 HasScalarFactor =
true
464 typedef blas_traits<NestedXpr> Base;
465 typedef CwiseBinaryOp<scalar_product_op<Scalar>, NestedXpr,
const CwiseNullaryOp<scalar_constant_op<Scalar>,Plain> > XprType;
466 typedef typename Base::ExtractType ExtractType;
467 static inline ExtractType extract(
const XprType& x) {
return Base::extract(x.lhs()); }
468 static inline Scalar extractScalarFactor(
const XprType& x)
469 {
return Base::extractScalarFactor(x.lhs()) * x.rhs().functor().m_other; }
471template<
typename Scalar,
typename Plain1,
typename Plain2>
472struct blas_traits<CwiseBinaryOp<scalar_product_op<Scalar>, const CwiseNullaryOp<scalar_constant_op<Scalar>,Plain1>,
473 const CwiseNullaryOp<scalar_constant_op<Scalar>,Plain2> > >
474 : blas_traits<CwiseNullaryOp<scalar_constant_op<Scalar>,Plain1> >
478template<
typename Scalar,
typename NestedXpr>
479struct blas_traits<CwiseUnaryOp<scalar_opposite_op<Scalar>, NestedXpr> >
480 : blas_traits<NestedXpr>
483 HasScalarFactor =
true
485 typedef blas_traits<NestedXpr> Base;
486 typedef CwiseUnaryOp<scalar_opposite_op<Scalar>, NestedXpr> XprType;
487 typedef typename Base::ExtractType ExtractType;
488 static inline ExtractType extract(
const XprType& x) {
return Base::extract(x.nestedExpression()); }
489 static inline Scalar extractScalarFactor(
const XprType& x)
490 {
return - Base::extractScalarFactor(x.nestedExpression()); }
494template<
typename NestedXpr>
495struct blas_traits<Transpose<NestedXpr> >
496 : blas_traits<NestedXpr>
498 typedef typename NestedXpr::Scalar Scalar;
499 typedef blas_traits<NestedXpr> Base;
500 typedef Transpose<NestedXpr> XprType;
501 typedef Transpose<const typename Base::_ExtractType> ExtractType;
502 typedef Transpose<const typename Base::_ExtractType> _ExtractType;
503 typedef typename conditional<bool(Base::HasUsableDirectAccess),
505 typename ExtractType::PlainObject
506 >::type DirectLinearAccessType;
508 IsTransposed = Base::IsTransposed ? 0 : 1
510 static inline ExtractType extract(
const XprType& x) {
return ExtractType(Base::extract(x.nestedExpression())); }
511 static inline Scalar extractScalarFactor(
const XprType& x) {
return Base::extractScalarFactor(x.nestedExpression()); }
515struct blas_traits<const T>
519template<typename T, bool HasUsableDirectAccess=blas_traits<T>::HasUsableDirectAccess>
520struct extract_data_selector {
521 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
static const typename T::Scalar* run(
const T& m)
523 return blas_traits<T>::extract(m).data();
528struct extract_data_selector<T,false> {
529 static typename T::Scalar* run(
const T&) {
return 0; }
533EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
const typename T::Scalar* extract_data(
const T& m)
535 return extract_data_selector<T>::run(m);
542template<
typename ResScalar,
typename Lhs,
typename Rhs>
543struct combine_scalar_factors_impl
545 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
static ResScalar run(
const Lhs& lhs,
const Rhs& rhs)
547 return blas_traits<Lhs>::extractScalarFactor(lhs) * blas_traits<Rhs>::extractScalarFactor(rhs);
549 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
static ResScalar run(
const ResScalar& alpha,
const Lhs& lhs,
const Rhs& rhs)
551 return alpha * blas_traits<Lhs>::extractScalarFactor(lhs) * blas_traits<Rhs>::extractScalarFactor(rhs);
554template<
typename Lhs,
typename Rhs>
555struct combine_scalar_factors_impl<bool, Lhs, Rhs>
557 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
static bool run(
const Lhs& lhs,
const Rhs& rhs)
559 return blas_traits<Lhs>::extractScalarFactor(lhs) && blas_traits<Rhs>::extractScalarFactor(rhs);
561 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
static bool run(
const bool& alpha,
const Lhs& lhs,
const Rhs& rhs)
563 return alpha && blas_traits<Lhs>::extractScalarFactor(lhs) && blas_traits<Rhs>::extractScalarFactor(rhs);
567template<
typename ResScalar,
typename Lhs,
typename Rhs>
568EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE ResScalar combine_scalar_factors(
const ResScalar& alpha,
const Lhs& lhs,
const Rhs& rhs)
570 return combine_scalar_factors_impl<ResScalar,Lhs,Rhs>::run(alpha, lhs, rhs);
572template<
typename ResScalar,
typename Lhs,
typename Rhs>
573EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE ResScalar combine_scalar_factors(
const Lhs& lhs,
const Rhs& rhs)
575 return combine_scalar_factors_impl<ResScalar,Lhs,Rhs>::run(lhs, rhs);
AlignmentType
Definition: Constants.h:232
@ RowMajor
Definition: Constants.h:321
const unsigned int DirectAccessBit
Definition: Constants.h:155
Namespace containing all symbols from the Eigen library.
Definition: Core:141
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_conjugate_op< typename Derived::Scalar >, const Derived > conj(const Eigen::ArrayBase< Derived > &x)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74