10 #ifndef EIGEN_BLASUTIL_H 11 #define EIGEN_BLASUTIL_H 21 template<
typename LhsScalar,
typename RhsScalar,
typename Index,
int mr,
int nr,
bool ConjugateLhs=false,
bool ConjugateRhs=false>
24 template<
typename Scalar,
typename Index,
int nr,
int StorageOrder,
bool Conjugate = false,
bool PanelMode=false>
27 template<
typename Scalar,
typename Index,
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,
typename LhsScalar,
int LhsStorageOrder,
bool ConjugateLhs,
typename RhsScalar,
bool ConjugateRhs,
int Version=Specialized>
45 inline T operator()(
const T& x) {
return numext::conj(x); }
47 inline T pconj(
const T& x) {
return internal::pconj(x); }
52 inline const T& operator()(
const T& x) {
return x; }
54 inline const T& pconj(
const T& x) {
return x; }
57 template<
typename Scalar>
struct conj_helper<Scalar,Scalar,false,false>
59 EIGEN_STRONG_INLINE Scalar pmadd(
const Scalar& x,
const Scalar& y,
const Scalar& c)
const {
return internal::pmadd(x,y,c); }
60 EIGEN_STRONG_INLINE Scalar pmul(
const Scalar& x,
const Scalar& y)
const {
return internal::pmul(x,y); }
63 template<
typename RealScalar>
struct conj_helper<
std::complex<RealScalar>, std::complex<RealScalar>, false,true>
65 typedef std::complex<RealScalar>
Scalar;
66 EIGEN_STRONG_INLINE Scalar pmadd(
const Scalar& x,
const Scalar& y,
const Scalar& c)
const 67 {
return c + pmul(x,y); }
69 EIGEN_STRONG_INLINE Scalar pmul(
const Scalar& x,
const Scalar& y)
const 70 {
return Scalar(numext::real(x)*numext::real(y) + numext::imag(x)*numext::imag(y), numext::imag(x)*numext::real(y) - numext::real(x)*numext::imag(y)); }
73 template<
typename RealScalar>
struct conj_helper<
std::complex<RealScalar>, std::complex<RealScalar>, true,false>
75 typedef std::complex<RealScalar>
Scalar;
76 EIGEN_STRONG_INLINE Scalar pmadd(
const Scalar& x,
const Scalar& y,
const Scalar& c)
const 77 {
return c + pmul(x,y); }
79 EIGEN_STRONG_INLINE Scalar pmul(
const Scalar& x,
const Scalar& y)
const 80 {
return Scalar(numext::real(x)*numext::real(y) + numext::imag(x)*numext::imag(y), numext::real(x)*numext::imag(y) - numext::imag(x)*numext::real(y)); }
83 template<
typename RealScalar>
struct conj_helper<
std::complex<RealScalar>, std::complex<RealScalar>, true,true>
85 typedef std::complex<RealScalar>
Scalar;
86 EIGEN_STRONG_INLINE Scalar pmadd(
const Scalar& x,
const Scalar& y,
const Scalar& c)
const 87 {
return c + pmul(x,y); }
89 EIGEN_STRONG_INLINE Scalar pmul(
const Scalar& x,
const Scalar& y)
const 90 {
return Scalar(numext::real(x)*numext::real(y) - numext::imag(x)*numext::imag(y), - numext::real(x)*numext::imag(y) - numext::imag(x)*numext::real(y)); }
93 template<
typename RealScalar,
bool Conj>
struct conj_helper<
std::complex<RealScalar>, RealScalar, Conj,false>
95 typedef std::complex<RealScalar>
Scalar;
96 EIGEN_STRONG_INLINE Scalar pmadd(
const Scalar& x,
const RealScalar& y,
const Scalar& c)
const 97 {
return padd(c, pmul(x,y)); }
98 EIGEN_STRONG_INLINE Scalar pmul(
const Scalar& x,
const RealScalar& y)
const 102 template<
typename RealScalar,
bool Conj>
struct conj_helper<RealScalar,
std::complex<RealScalar>, false,Conj>
104 typedef std::complex<RealScalar>
Scalar;
105 EIGEN_STRONG_INLINE Scalar pmadd(
const RealScalar& x,
const Scalar& y,
const Scalar& c)
const 106 {
return padd(c, pmul(x,y)); }
107 EIGEN_STRONG_INLINE Scalar pmul(
const RealScalar& x,
const Scalar& y)
const 112 static EIGEN_STRONG_INLINE To run(
const From& x) {
return x; }
122 template<
typename Scalar,
typename Index,
int StorageOrder>
126 blas_data_mapper(Scalar* data, Index stride) : m_data(data), m_stride(stride) {}
127 EIGEN_STRONG_INLINE Scalar& operator()(Index i, Index j)
128 {
return m_data[StorageOrder==
RowMajor ? j + i*m_stride : i + j*m_stride]; }
130 Scalar* EIGEN_RESTRICT m_data;
135 template<
typename Scalar,
typename Index,
int StorageOrder>
140 EIGEN_STRONG_INLINE
const Scalar& operator()(Index i, Index j)
const 141 {
return m_data[StorageOrder==
RowMajor ? j + i*m_stride : i + j*m_stride]; }
143 const Scalar* EIGEN_RESTRICT m_data;
154 typedef const XprType& ExtractType;
155 typedef XprType _ExtractType;
158 IsTransposed =
false,
159 NeedToConjugate =
false,
161 && (
bool(XprType::IsVectorAtCompileTime)
165 typedef typename conditional<bool(HasUsableDirectAccess),
167 typename _ExtractType::PlainObject
169 static inline ExtractType extract(
const XprType& x) {
return x; }
170 static inline const Scalar extractScalarFactor(
const XprType&) {
return Scalar(1); }
174 template<
typename Scalar,
typename NestedXpr>
180 typedef typename Base::ExtractType ExtractType;
184 NeedToConjugate = Base::NeedToConjugate ? 0 : IsComplex
186 static inline ExtractType extract(
const XprType& x) {
return Base::extract(x.
nestedExpression()); }
187 static inline Scalar extractScalarFactor(
const XprType& x) {
return conj(Base::extractScalarFactor(x.
nestedExpression())); }
191 template<
typename Scalar,
typename NestedXpr>
197 typedef typename Base::ExtractType ExtractType;
198 static inline ExtractType extract(
const XprType& x) {
return Base::extract(x.
nestedExpression()); }
199 static inline Scalar extractScalarFactor(
const XprType& x)
204 template<
typename Scalar,
typename NestedXpr>
210 typedef typename Base::ExtractType ExtractType;
211 static inline ExtractType extract(
const XprType& x) {
return Base::extract(x.
nestedExpression()); }
212 static inline Scalar extractScalarFactor(
const XprType& x)
217 template<
typename NestedXpr>
226 typedef typename conditional<bool(Base::HasUsableDirectAccess),
228 typename ExtractType::PlainObject
231 IsTransposed = Base::IsTransposed ? 0 : 1
233 static inline ExtractType extract(
const XprType& x) {
return Base::extract(x.
nestedExpression()); }
234 static inline Scalar extractScalarFactor(
const XprType& x) {
return Base::extractScalarFactor(x.
nestedExpression()); }
242 template<typename T, bool HasUsableDirectAccess=blas_traits<T>::HasUsableDirectAccess>
244 static const typename T::Scalar* run(
const T& m)
252 static typename T::Scalar* run(
const T&) {
return 0; }
255 template<
typename T>
const typename T::Scalar* extract_data(
const T& m)
264 #endif // EIGEN_BLASUTIL_H const internal::remove_all< typename XprType::Nested >::type & nestedExpression() const
Definition: CwiseUnaryOp.h:78
Definition: DenseCoeffsBase.h:727
Definition: Functors.h:368
Definition: BlasUtil.h:151
Definition: GeneralBlockPanelKernel.h:1118
Definition: ForwardDeclarations.h:151
Expression of the transpose of a matrix.
Definition: Transpose.h:57
const unsigned int DirectAccessBit
Means that the underlying array of coefficients can be directly accessed as a plain strided array...
Definition: Constants.h:142
Definition: BlasUtil.h:111
Definition: Functors.h:310
iterative scaling algorithm to equilibrate rows and column norms in matrices
Definition: TestIMU_Common.h:87
Definition: TypeSafeIdHash.h:44
Holds information about the various numeric (i.e.
Definition: NumTraits.h:88
Definition: BlasUtil.h:35
Definition: BlasUtil.h:41
Definition: BlasUtil.h:136
Definition: BlasUtil.h:38
Definition: BlasUtil.h:123
const UnaryOp & functor() const
Definition: CwiseUnaryOp.h:74
Definition: BandTriangularSolver.h:13
Storage order is row major (see TopicStorageOrders).
Definition: Constants.h:266
Definition: Functors.h:504
Generic expression where a coefficient-wise unary operator is applied to an expression.
Definition: CwiseUnaryOp.h:59
Definition: ForwardDeclarations.h:17
double Scalar
Common scalar type.
Definition: FlexibleKalmanBase.h:48
Definition: BlasUtil.h:25
const internal::remove_all< typename MatrixType::Nested >::type & nestedExpression() const
Definition: Transpose.h:74