Eigen  5.0.1
 
Loading...
Searching...
No Matches
XprHelper.h
1// This file is part of Eigen, a lightweight C++ template library
2// for linear algebra.
3//
4// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
5// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
6//
7// This Source Code Form is subject to the terms of the Mozilla
8// Public License v. 2.0. If a copy of the MPL was not distributed
9// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10// SPDX-License-Identifier: MPL-2.0
11
12#ifndef EIGEN_XPRHELPER_H
13#define EIGEN_XPRHELPER_H
14
15// IWYU pragma: private
16#include "../InternalHeaderCheck.h"
17
18namespace Eigen {
19
20namespace internal {
21
22// useful for unsigned / signed integer comparisons when idx is intended to be non-negative
23template <typename IndexType>
24EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE std::make_unsigned_t<IndexType> returnUnsignedIndexValue(const IndexType& idx) {
25 EIGEN_STATIC_ASSERT((NumTraits<IndexType>::IsInteger), THIS FUNCTION IS FOR INTEGER TYPES)
26 eigen_internal_assert(idx >= 0 && "Index value is negative and target type is unsigned");
27 using UnsignedType = std::make_unsigned_t<IndexType>;
28 return static_cast<UnsignedType>(idx);
29}
30
31template <typename IndexDest, typename IndexSrc, bool IndexDestIsInteger = NumTraits<IndexDest>::IsInteger,
32 bool IndexDestIsSigned = NumTraits<IndexDest>::IsSigned,
33 bool IndexSrcIsInteger = NumTraits<IndexSrc>::IsInteger,
34 bool IndexSrcIsSigned = NumTraits<IndexSrc>::IsSigned>
35struct convert_index_impl {
36 static inline EIGEN_DEVICE_FUNC IndexDest run(const IndexSrc& idx) {
37 eigen_internal_assert(idx <= NumTraits<IndexDest>::highest() && "Index value is too big for target type");
38 return static_cast<IndexDest>(idx);
39 }
40};
41template <typename IndexDest, typename IndexSrc>
42struct convert_index_impl<IndexDest, IndexSrc, true, true, true, false> {
43 // IndexDest is a signed integer
44 // IndexSrc is an unsigned integer
45 static inline EIGEN_DEVICE_FUNC IndexDest run(const IndexSrc& idx) {
46 eigen_internal_assert(idx <= returnUnsignedIndexValue(NumTraits<IndexDest>::highest()) &&
47 "Index value is too big for target type");
48 return static_cast<IndexDest>(idx);
49 }
50};
51template <typename IndexDest, typename IndexSrc>
52struct convert_index_impl<IndexDest, IndexSrc, true, false, true, true> {
53 // IndexDest is an unsigned integer
54 // IndexSrc is a signed integer
55 static inline EIGEN_DEVICE_FUNC IndexDest run(const IndexSrc& idx) {
56 eigen_internal_assert(returnUnsignedIndexValue(idx) <= NumTraits<IndexDest>::highest() &&
57 "Index value is too big for target type");
58 return static_cast<IndexDest>(idx);
59 }
60};
61
62template <typename IndexDest, typename IndexSrc>
63EIGEN_DEVICE_FUNC inline IndexDest convert_index(const IndexSrc& idx) {
64 return convert_index_impl<IndexDest, IndexSrc>::run(idx);
65}
66
67// true if both types are not valid index types
68template <typename RowIndices, typename ColIndices>
69struct valid_indexed_view_overload : bool_constant<!(internal::is_valid_index_type<RowIndices>::value &&
70 internal::is_valid_index_type<ColIndices>::value)> {};
71
72// promote_scalar_arg is an helper used in operation between an expression and a scalar, like:
73// expression * scalar
74// Its role is to determine how the type T of the scalar operand should be promoted given the scalar type ExprScalar of
75// the given expression. The IsSupported template parameter must be provided by the caller as:
76// internal::has_ReturnType<ScalarBinaryOpTraits<ExprScalar,T,op> >::value using the proper order for ExprScalar and T.
77// Then the logic is as follows:
78// - if the operation is natively supported as defined by IsSupported, then the scalar type is not promoted, and T is
79// returned.
80// - otherwise, NumTraits<ExprScalar>::Literal is returned if T is implicitly convertible to
81// NumTraits<ExprScalar>::Literal AND that this does not imply a float to integer conversion.
82// - otherwise, ExprScalar is returned if T is implicitly convertible to ExprScalar AND that this does not imply a
83// float to integer conversion.
84// - In all other cases, the promoted type is not defined, and the respective operation is thus invalid and not
85// available (SFINAE).
86template <typename ExprScalar, typename T, bool IsSupported>
87struct promote_scalar_arg;
88
89template <typename S, typename T>
90struct promote_scalar_arg<S, T, true> {
91 using type = T;
92};
93
94// Recursively check safe conversion to PromotedType, and then ExprScalar if they are different.
95template <typename ExprScalar, typename T, typename PromotedType,
96 bool ConvertibleToLiteral = std::is_convertible<T, PromotedType>::value,
97 bool IsSafe = NumTraits<T>::IsInteger || !NumTraits<PromotedType>::IsInteger>
98struct promote_scalar_arg_unsupported;
99
100// Start recursion with NumTraits<ExprScalar>::Literal
101template <typename S, typename T>
102struct promote_scalar_arg<S, T, false> : promote_scalar_arg_unsupported<S, T, typename NumTraits<S>::Literal> {};
103
104// We found a match!
105template <typename S, typename T, typename PromotedType>
106struct promote_scalar_arg_unsupported<S, T, PromotedType, true, true> {
107 using type = PromotedType;
108};
109
110// No match, but no real-to-integer issues, and ExprScalar and current PromotedType are different,
111// so let's try to promote to ExprScalar
112template <typename ExprScalar, typename T, typename PromotedType>
113struct promote_scalar_arg_unsupported<ExprScalar, T, PromotedType, false, true>
114 : promote_scalar_arg_unsupported<ExprScalar, T, ExprScalar> {};
115
116// Unsafe real-to-integer, let's stop.
117template <typename S, typename T, typename PromotedType, bool ConvertibleToLiteral>
118struct promote_scalar_arg_unsupported<S, T, PromotedType, ConvertibleToLiteral, false> {};
119
120// T is not even convertible to ExprScalar, let's stop.
121template <typename S, typename T>
122struct promote_scalar_arg_unsupported<S, T, S, false, true> {};
123
124// classes inheriting no_assignment_operator don't generate a default operator=.
125class no_assignment_operator {
126 no_assignment_operator& operator=(const no_assignment_operator&) = delete;
127
128 protected:
129 EIGEN_DEFAULT_COPY_CONSTRUCTOR(no_assignment_operator)
130 EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(no_assignment_operator)
131};
132
134template <typename I1, typename I2>
135struct promote_index_type {
136 using type = std::conditional_t<(sizeof(I1) < sizeof(I2)), I2, I1>;
137};
138
143template <typename T, int Value>
144class variable_if_dynamic {
145 public:
146 EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE explicit variable_if_dynamic(T v) noexcept {
147 EIGEN_ONLY_USED_FOR_DEBUG(v);
148 eigen_plain_assert(v == T(Value));
149 }
150 EIGEN_DEVICE_FUNC static constexpr T value() { return T(Value); }
151 EIGEN_DEVICE_FUNC constexpr operator T() const { return T(Value); }
152 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void setValue(T v) const {
153 EIGEN_ONLY_USED_FOR_DEBUG(v);
154 eigen_assert(v == T(Value));
155 }
156};
157
158template <typename T>
159class variable_if_dynamic<T, Dynamic> {
160 T m_value;
161
162 public:
163 EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE explicit variable_if_dynamic(T value = 0) noexcept : m_value(value) {}
164 EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE T value() const { return m_value; }
165 EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE operator T() const { return m_value; }
166 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void setValue(T value) { m_value = value; }
167};
168
171template <typename T, int Value>
172class variable_if_dynamicindex {
173 public:
174 EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE explicit variable_if_dynamicindex(T v) {
175 EIGEN_ONLY_USED_FOR_DEBUG(v);
176 eigen_assert(v == T(Value));
177 }
178 EIGEN_DEVICE_FUNC static constexpr T value() { return T(Value); }
179 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void setValue(T) {}
180};
181
182template <typename T>
183class variable_if_dynamicindex<T, DynamicIndex> {
184 T m_value;
185 EIGEN_DEVICE_FUNC variable_if_dynamicindex() { eigen_assert(false); }
186
187 public:
188 EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE explicit variable_if_dynamicindex(T value) : m_value(value) {}
189 EIGEN_DEVICE_FUNC constexpr T EIGEN_STRONG_INLINE value() const { return m_value; }
190 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void setValue(T value) { m_value = value; }
191};
192
193template <typename T>
194struct functor_traits {
195 enum { Cost = 10, PacketAccess = false, IsRepeatable = false };
196};
197
198// Marks a binary functor as commutative: f(a, b) == f(b, a). Reductions may then reorder
199// operands, not merely re-associate them, which enables faster accumulation. Deliberately a
200// separate trait rather than a functor_traits member: user code specializes functor_traits
201// wholesale, so a new member there would break every existing specialization. The default is
202// conservative; operand order is preserved unless a functor opts in.
203template <typename Func>
204struct functor_is_commutative : std::false_type {};
205
206// estimates the cost of lazily evaluating a generic functor by unwinding the expression
207template <typename Xpr>
208struct nested_functor_cost {
209 static constexpr Index Cost = static_cast<Index>(functor_traits<Xpr>::Cost);
210};
211
212template <typename Scalar, int Rows, int Cols, int Options, int MaxRows, int MaxCols>
213struct nested_functor_cost<Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols>> {
214 static constexpr Index Cost = 1;
215};
216
217template <typename Scalar, int Rows, int Cols, int Options, int MaxRows, int MaxCols>
218struct nested_functor_cost<Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols>> {
219 static constexpr Index Cost = 1;
220};
221
222// TODO: assign a cost to the stride type?
223template <typename PlainObjectType, int MapOptions, typename StrideType>
224struct nested_functor_cost<Map<PlainObjectType, MapOptions, StrideType>> : nested_functor_cost<PlainObjectType> {};
225
226template <typename Func, typename Xpr>
227struct nested_functor_cost<CwiseUnaryOp<Func, Xpr>> {
228 using XprCleaned = remove_all_t<Xpr>;
229 using FuncCleaned = remove_all_t<Func>;
230 static constexpr Index Cost = nested_functor_cost<FuncCleaned>::Cost + nested_functor_cost<XprCleaned>::Cost;
231};
232
233template <typename Func, typename Xpr>
234struct nested_functor_cost<CwiseNullaryOp<Func, Xpr>> {
235 using XprCleaned = remove_all_t<Xpr>;
236 using FuncCleaned = remove_all_t<Func>;
237 static constexpr Index Cost = nested_functor_cost<FuncCleaned>::Cost + nested_functor_cost<XprCleaned>::Cost;
238};
239
240template <typename Func, typename LhsXpr, typename RhsXpr>
241struct nested_functor_cost<CwiseBinaryOp<Func, LhsXpr, RhsXpr>> {
242 using LhsXprCleaned = remove_all_t<LhsXpr>;
243 using RhsXprCleaned = remove_all_t<RhsXpr>;
244 using FuncCleaned = remove_all_t<Func>;
245 static constexpr Index Cost = nested_functor_cost<FuncCleaned>::Cost + nested_functor_cost<LhsXprCleaned>::Cost +
246 nested_functor_cost<RhsXprCleaned>::Cost;
247};
248
249template <typename Func, typename LhsXpr, typename MidXpr, typename RhsXpr>
250struct nested_functor_cost<CwiseTernaryOp<Func, LhsXpr, MidXpr, RhsXpr>> {
251 using LhsXprCleaned = remove_all_t<LhsXpr>;
252 using MidXprCleaned = remove_all_t<MidXpr>;
253 using RhsXprCleaned = remove_all_t<RhsXpr>;
254 using FuncCleaned = remove_all_t<Func>;
255 static constexpr Index Cost = nested_functor_cost<FuncCleaned>::Cost + nested_functor_cost<LhsXprCleaned>::Cost +
256 nested_functor_cost<MidXprCleaned>::Cost + nested_functor_cost<RhsXprCleaned>::Cost;
257};
258
259template <typename Xpr>
260struct functor_cost {
261 static constexpr Index Cost = plain_enum_max(nested_functor_cost<Xpr>::Cost, 1);
262};
263
264template <typename T>
265struct packet_traits;
266
267template <typename T>
268struct unpacket_traits;
269
270template <int Size, typename PacketType,
271 bool Stop = Size == Dynamic || (Size % unpacket_traits<PacketType>::size) == 0 ||
272 std::is_same<PacketType, typename unpacket_traits<PacketType>::half>::value>
273struct find_best_packet_helper;
274
275template <int Size, typename PacketType>
276struct find_best_packet_helper<Size, PacketType, true> {
277 using type = PacketType;
278};
279
280template <int Size, typename PacketType>
281struct find_best_packet_helper<Size, PacketType, false> {
282 using type = typename find_best_packet_helper<Size, typename unpacket_traits<PacketType>::half>::type;
283};
284
285template <typename T, int Size>
286struct find_best_packet {
287 using type = typename find_best_packet_helper<Size, typename packet_traits<T>::type>::type;
288};
289
290// Like find_best_packet, but picks the widest packet whose size is <= Size
291// rather than the widest that exactly divides Size. The caller handles any tail.
292template <int Size, typename PacketType,
293 bool Stop = Size == Dynamic || Size >= unpacket_traits<PacketType>::size ||
294 std::is_same<PacketType, typename unpacket_traits<PacketType>::half>::value>
295struct find_largest_packet_helper;
296
297template <int Size, typename PacketType>
298struct find_largest_packet_helper<Size, PacketType, true> {
299 using type = PacketType;
300};
301
302template <int Size, typename PacketType>
303struct find_largest_packet_helper<Size, PacketType, false> {
304 using type = typename find_largest_packet_helper<Size, typename unpacket_traits<PacketType>::half>::type;
305};
306
307template <typename T, int Size>
308struct find_largest_packet {
309 using type = typename find_largest_packet_helper<Size, typename packet_traits<T>::type>::type;
310};
311
312// Pick the packet type for a linear-traversal assignment: the widest packet
313// whose <full-packet count + scalar-tail count> is minimal.
314//
315// find_best_packet picks the widest exact divisor (no scalar tail). That
316// overshoots when no exact divisor exists -- it falls through to the smallest
317// packet, e.g. Packet4f at N=9 float on AVX2 emits 2*SSE + 1 scalar where
318// 1*Packet8f + 1 scalar would do. We prefer find_largest_packet whenever it
319// strictly cuts the op count; otherwise we keep find_best_packet so kernels
320// like LLT/LDLT that rely on exact-fit narrow packets are not disturbed
321// (e.g. 3*Packet2d == 1*Packet4d + 2 scalars at N=6 double on AVX-512, both
322// 3 ops -- keep Packet2d).
323//
324// Only used in LinearVectorizedTraversal, whose tail handling already accepts
325// a partial-packet remainder. InnerVectorized / SliceVectorized still require
326// exact divisibility, so they continue to use find_best_packet.
327template <typename T, int Size>
328struct find_assign_linear_packet {
329 private:
330 using best_type = typename find_best_packet<T, Size>::type;
331 using largest_type = typename find_largest_packet<T, Size>::type;
332 // Op count = full packets + scalar-tail elements (one scalar emit per tail
333 // element under CompleteUnrolling). Both helpers return the max packet for
334 // Dynamic, so the op-count tie there harmlessly resolves to find_best.
335 template <typename P>
336 static constexpr int ops() {
337 constexpr int sz = unpacket_traits<P>::size;
338 return Size == Dynamic ? 0 : Size / sz + Size % sz;
339 }
340
341 public:
342 using type = std::conditional_t<(ops<largest_type>() < ops<best_type>()), largest_type, best_type>;
343};
344
345template <int Size, typename PacketType,
346 bool Stop = (Size == unpacket_traits<PacketType>::size) ||
347 std::is_same<PacketType, typename unpacket_traits<PacketType>::half>::value>
348struct find_packet_by_size_helper;
349template <int Size, typename PacketType>
350struct find_packet_by_size_helper<Size, PacketType, true> {
351 using type = PacketType;
352};
353template <int Size, typename PacketType>
354struct find_packet_by_size_helper<Size, PacketType, false> {
355 using type = typename find_packet_by_size_helper<Size, typename unpacket_traits<PacketType>::half>::type;
356};
357
358template <typename T, int Size>
359struct find_packet_by_size {
360 using type = typename find_packet_by_size_helper<Size, typename packet_traits<T>::type>::type;
361 static constexpr bool value = (Size == unpacket_traits<type>::size);
362};
363template <typename T>
364struct find_packet_by_size<T, 1> {
365 using type = typename unpacket_traits<T>::type;
366 static constexpr bool value = (unpacket_traits<type>::size == 1);
367};
368
369#if EIGEN_MAX_STATIC_ALIGN_BYTES > 0
370constexpr int compute_default_alignment_helper(int ArrayBytes, int AlignmentBytes) {
371 if ((ArrayBytes % AlignmentBytes) == 0) {
372 return AlignmentBytes;
373 } else if (EIGEN_MIN_ALIGN_BYTES < AlignmentBytes) {
374 return compute_default_alignment_helper(ArrayBytes, AlignmentBytes / 2);
375 } else {
376 return 0;
377 }
378}
379#else
380// If static alignment is disabled, no need to bother.
381// This also avoids a division by zero
382constexpr int compute_default_alignment_helper(int ArrayBytes, int AlignmentBytes) {
383 EIGEN_UNUSED_VARIABLE(ArrayBytes);
384 EIGEN_UNUSED_VARIABLE(AlignmentBytes);
385 return 0;
386}
387#endif
388
389template <typename T, int Size>
390struct compute_default_alignment
391 : std::integral_constant<int, compute_default_alignment_helper(Size * sizeof(T), EIGEN_MAX_STATIC_ALIGN_BYTES)> {};
392
393template <typename T>
394struct compute_default_alignment<T, Dynamic> : std::integral_constant<int, EIGEN_MAX_ALIGN_BYTES> {};
395
396template <typename Scalar_, int Rows_, int Cols_,
397 int Options_ = AutoAlign | ((Rows_ == 1 && Cols_ != 1) ? RowMajor
398 : (Cols_ == 1 && Rows_ != 1) ? ColMajor
399 : EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION),
400 int MaxRows_ = Rows_, int MaxCols_ = Cols_>
401struct make_proper_matrix_type {
402 private:
403 static constexpr bool IsColVector = Cols_ == 1 && Rows_ != 1;
404 static constexpr bool IsRowVector = Rows_ == 1 && Cols_ != 1;
405 static constexpr int Options = IsColVector ? (Options_ | ColMajor) & ~RowMajor
406 : IsRowVector ? (Options_ | RowMajor) & ~ColMajor
407 : Options_;
408
409 public:
410 using type = Matrix<Scalar_, Rows_, Cols_, Options, MaxRows_, MaxCols_>;
411};
412
413constexpr unsigned compute_matrix_flags(int Options) {
414 unsigned row_major_bit = Options & RowMajor ? RowMajorBit : 0;
415 // FIXME currently we still have to handle DirectAccessBit at the expression level to handle DenseCoeffsBase<>
416 // and then propagate this information to the evaluator's flags.
417 // However, I (Gael) think that DirectAccessBit should only matter at the evaluation stage.
418 return DirectAccessBit | LvalueBit | NestByRefBit | row_major_bit;
419}
420
424constexpr int size_at_compile_time(int rows, int cols) {
425 if (rows == 0 || cols == 0) return 0;
426 if (rows == Dynamic || cols == Dynamic) return Dynamic;
427 if (rows > (std::numeric_limits<int>::max)() / cols) return Dynamic;
428 return rows * cols;
429}
430
431template <typename XprType>
432struct size_of_xpr_at_compile_time
433 : std::integral_constant<int, size_at_compile_time(traits<XprType>::RowsAtCompileTime,
434 traits<XprType>::ColsAtCompileTime)> {};
435
436/* plain_matrix_type : the difference from eval is that plain_matrix_type is always a plain matrix type,
437 * whereas eval is a const reference in the case of a matrix
438 */
439
440template <typename T, typename StorageKind = typename traits<T>::StorageKind>
441struct plain_matrix_type;
442
443/* plain_object_options : the Options template argument (storage order and alignment) of the plain object that a
444 * decomposition's MatrixType stores: the type's own for a Matrix or Array, the referenced type's for a Ref, whose own
445 * Options is a pointer-alignment requirement instead.
446 */
447template <typename T>
448struct plain_object_options {
449 static constexpr int value = int(traits<T>::Options);
450};
451template <typename PlainObjectType, int Options, typename StrideType>
452struct plain_object_options<Ref<PlainObjectType, Options, StrideType>> : plain_object_options<PlainObjectType> {};
453
454/* is_ref : whether T is a Ref<>, i.e. a decomposition instantiated on it works in the referenced memory. */
455template <typename T>
456struct is_ref : std::false_type {};
457template <typename PlainObjectType, int Options, typename StrideType>
458struct is_ref<Ref<PlainObjectType, Options, StrideType>> : std::true_type {};
459
460template <typename T, typename BaseClassType, int Flags>
461struct plain_matrix_type_dense;
462template <typename T>
463struct plain_matrix_type<T, Dense> {
464 using type = typename plain_matrix_type_dense<T, typename traits<T>::XprKind, traits<T>::Flags>::type;
465};
466template <typename T>
467struct plain_matrix_type<T, DiagonalShape> {
468 using type = typename T::PlainObject;
469};
470
471template <typename T>
472struct plain_matrix_type<T, SkewSymmetricShape> {
473 using type = typename T::PlainObject;
474};
475
476template <typename T, int Flags>
477struct plain_matrix_type_dense<T, MatrixXpr, Flags> {
478 using type = Matrix<typename traits<T>::Scalar, traits<T>::RowsAtCompileTime, traits<T>::ColsAtCompileTime,
479 AutoAlign | (Flags & RowMajorBit ? RowMajor : ColMajor), traits<T>::MaxRowsAtCompileTime,
480 traits<T>::MaxColsAtCompileTime>;
481};
482
483template <typename T, int Flags>
484struct plain_matrix_type_dense<T, ArrayXpr, Flags> {
485 using type = Array<typename traits<T>::Scalar, traits<T>::RowsAtCompileTime, traits<T>::ColsAtCompileTime,
486 AutoAlign | (Flags & RowMajorBit ? RowMajor : ColMajor), traits<T>::MaxRowsAtCompileTime,
487 traits<T>::MaxColsAtCompileTime>;
488};
489
490/* eval : the return type of eval(). For matrices, this is just a const reference
491 * in order to avoid a useless copy
492 */
493
494template <typename T, typename StorageKind = typename traits<T>::StorageKind>
495struct eval;
496
497template <typename T>
498struct eval<T, Dense> {
499 using type = typename plain_matrix_type<T>::type;
500};
501
502template <typename T>
503struct eval<T, DiagonalShape> {
504 using type = typename plain_matrix_type<T>::type;
505};
506
507template <typename T>
508struct eval<T, SkewSymmetricShape> {
509 using type = typename plain_matrix_type<T>::type;
510};
511
512// for matrices, no need to evaluate, just use a const reference to avoid a useless copy
513template <typename Scalar_, int Rows_, int Cols_, int Options_, int MaxRows_, int MaxCols_>
514struct eval<Matrix<Scalar_, Rows_, Cols_, Options_, MaxRows_, MaxCols_>, Dense> {
515 using type = const Matrix<Scalar_, Rows_, Cols_, Options_, MaxRows_, MaxCols_>&;
516};
517
518template <typename Scalar_, int Rows_, int Cols_, int Options_, int MaxRows_, int MaxCols_>
519struct eval<Array<Scalar_, Rows_, Cols_, Options_, MaxRows_, MaxCols_>, Dense> {
520 using type = const Array<Scalar_, Rows_, Cols_, Options_, MaxRows_, MaxCols_>&;
521};
522
523/* similar to plain_matrix_type, but using the evaluator's Flags */
524template <typename T, typename StorageKind = typename traits<T>::StorageKind>
525struct plain_object_eval;
526
527template <typename T>
528struct plain_object_eval<T, Dense> {
529 using type = typename plain_matrix_type_dense<T, typename traits<T>::XprKind, evaluator<T>::Flags>::type;
530};
531
532/* plain_matrix_type_column_major : same as plain_matrix_type but guaranteed to be column-major
533 */
534template <typename T>
535struct plain_matrix_type_column_major {
536 static constexpr int Rows = traits<T>::RowsAtCompileTime;
537 static constexpr int Cols = traits<T>::ColsAtCompileTime;
538 static constexpr int MaxRows = traits<T>::MaxRowsAtCompileTime;
539 static constexpr int MaxCols = traits<T>::MaxColsAtCompileTime;
540 using type = Matrix<typename traits<T>::Scalar, Rows, Cols, (MaxRows == 1 && MaxCols != 1) ? RowMajor : ColMajor,
541 MaxRows, MaxCols>;
542};
543
544/* plain_matrix_type_row_major : same as plain_matrix_type but guaranteed to be row-major
545 */
546template <typename T>
547struct plain_matrix_type_row_major {
548 static constexpr int Rows = traits<T>::RowsAtCompileTime;
549 static constexpr int Cols = traits<T>::ColsAtCompileTime;
550 static constexpr int MaxRows = traits<T>::MaxRowsAtCompileTime;
551 static constexpr int MaxCols = traits<T>::MaxColsAtCompileTime;
552 using type = Matrix<typename traits<T>::Scalar, Rows, Cols, (MaxCols == 1 && MaxRows != 1) ? ColMajor : RowMajor,
553 MaxRows, MaxCols>;
554};
555
559template <typename T>
560struct ref_selector {
561 using type = std::conditional_t<bool(traits<T>::Flags& NestByRefBit), T const&, const T>;
562
563 using non_const_type = std::conditional_t<bool(traits<T>::Flags& NestByRefBit), T&, T>;
564};
565
566// However, we still need a mechanism to detect whether an expression which is evaluated multiple time
567// has to be evaluated into a temporary.
568// That's the purpose of this new nested_eval helper:
580template <typename T, int n, typename PlainObject = typename plain_object_eval<T>::type>
581struct nested_eval {
582 enum {
583 ScalarReadCost = NumTraits<typename traits<T>::Scalar>::ReadCost,
584 CoeffReadCost =
585 evaluator<T>::CoeffReadCost, // NOTE What if an evaluator evaluate itself into a temporary?
586 // Then CoeffReadCost will be small (e.g., 1) but we still have to evaluate,
587 // especially if n>1. This situation is already taken care by the
588 // EvalBeforeNestingBit flag, which is turned ON for all evaluator creating a
589 // temporary. This flag is then propagated by the parent evaluators. Another
590 // solution could be to count the number of temps?
591 NAsInteger = n == Dynamic ? HugeCost : n,
592 CostEval = (NAsInteger + 1) * ScalarReadCost + CoeffReadCost,
593 CostNoEval = int(NAsInteger) * int(CoeffReadCost),
594 Evaluate = (int(evaluator<T>::Flags) & EvalBeforeNestingBit) || (int(CostEval) < int(CostNoEval))
595 };
596
597 using type = std::conditional_t<Evaluate, PlainObject, typename ref_selector<T>::type>;
598};
599
600template <typename Derived, typename XprKind = typename traits<Derived>::XprKind>
601struct dense_xpr_base {
602 /* dense_xpr_base should only ever be used on dense expressions, thus falling either into the MatrixXpr or into the
603 * ArrayXpr cases */
604};
605
606template <typename Derived>
607struct dense_xpr_base<Derived, MatrixXpr> {
608 using type = MatrixBase<Derived>;
609};
610
611template <typename Derived>
612struct dense_xpr_base<Derived, ArrayXpr> {
613 using type = ArrayBase<Derived>;
614};
615
616template <typename Derived, typename XprKind = typename traits<Derived>::XprKind,
617 typename StorageKind = typename traits<Derived>::StorageKind>
618struct generic_xpr_base;
619
620template <typename Derived, typename XprKind>
621struct generic_xpr_base<Derived, XprKind, Dense> {
622 using type = typename dense_xpr_base<Derived, XprKind>::type;
623};
624
625template <typename XprType, typename CastType>
626struct cast_return_type {
627 using CurrentScalarType = typename XprType::Scalar;
628 using CastType_ = remove_all_t<CastType>;
629 using NewScalarType = typename CastType_::Scalar;
630 using type = std::conditional_t<std::is_same<CurrentScalarType, NewScalarType>::value, const XprType&, CastType>;
631};
632
633template <typename A, typename B>
634struct promote_storage_type;
635
636template <typename A>
637struct promote_storage_type<A, A> {
638 using ret = A;
639};
640template <typename A>
641struct promote_storage_type<A, const A> {
642 using ret = A;
643};
644template <typename A>
645struct promote_storage_type<const A, A> {
646 using ret = A;
647};
648
662template <typename A, typename B, typename Functor>
663struct cwise_promote_storage_type;
664
665template <typename A, typename Functor>
666struct cwise_promote_storage_type<A, A, Functor> {
667 using ret = A;
668};
669template <typename Functor>
670struct cwise_promote_storage_type<Dense, Dense, Functor> {
671 using ret = Dense;
672};
673template <typename A, typename Functor>
674struct cwise_promote_storage_type<A, Dense, Functor> {
675 using ret = Dense;
676};
677template <typename B, typename Functor>
678struct cwise_promote_storage_type<Dense, B, Functor> {
679 using ret = Dense;
680};
681template <typename Functor>
682struct cwise_promote_storage_type<Sparse, Dense, Functor> {
683 using ret = Sparse;
684};
685template <typename Functor>
686struct cwise_promote_storage_type<Dense, Sparse, Functor> {
687 using ret = Sparse;
688};
689
690template <typename LhsKind, typename RhsKind, int LhsOrder, int RhsOrder>
691struct cwise_promote_storage_order : std::integral_constant<int, LhsOrder> {};
692
693template <typename LhsKind, int LhsOrder, int RhsOrder>
694struct cwise_promote_storage_order<LhsKind, Sparse, LhsOrder, RhsOrder> : std::integral_constant<int, RhsOrder> {};
695template <typename RhsKind, int LhsOrder, int RhsOrder>
696struct cwise_promote_storage_order<Sparse, RhsKind, LhsOrder, RhsOrder> : std::integral_constant<int, LhsOrder> {};
697template <int Order>
698struct cwise_promote_storage_order<Sparse, Sparse, Order, Order> : std::integral_constant<int, Order> {};
699
714template <typename A, typename B, int ProductTag>
715struct product_promote_storage_type;
716
717template <typename A, int ProductTag>
718struct product_promote_storage_type<A, A, ProductTag> {
719 using ret = A;
720};
721template <int ProductTag>
722struct product_promote_storage_type<Dense, Dense, ProductTag> {
723 using ret = Dense;
724};
725template <typename A, int ProductTag>
726struct product_promote_storage_type<A, Dense, ProductTag> {
727 using ret = Dense;
728};
729template <typename B, int ProductTag>
730struct product_promote_storage_type<Dense, B, ProductTag> {
731 using ret = Dense;
732};
733
734template <typename A, int ProductTag>
735struct product_promote_storage_type<A, DiagonalShape, ProductTag> {
736 using ret = A;
737};
738template <typename B, int ProductTag>
739struct product_promote_storage_type<DiagonalShape, B, ProductTag> {
740 using ret = B;
741};
742template <int ProductTag>
743struct product_promote_storage_type<Dense, DiagonalShape, ProductTag> {
744 using ret = Dense;
745};
746template <int ProductTag>
747struct product_promote_storage_type<DiagonalShape, Dense, ProductTag> {
748 using ret = Dense;
749};
750
751template <typename A, int ProductTag>
752struct product_promote_storage_type<A, SkewSymmetricShape, ProductTag> {
753 using ret = A;
754};
755template <typename B, int ProductTag>
756struct product_promote_storage_type<SkewSymmetricShape, B, ProductTag> {
757 using ret = B;
758};
759template <int ProductTag>
760struct product_promote_storage_type<Dense, SkewSymmetricShape, ProductTag> {
761 using ret = Dense;
762};
763template <int ProductTag>
764struct product_promote_storage_type<SkewSymmetricShape, Dense, ProductTag> {
765 using ret = Dense;
766};
767template <int ProductTag>
768struct product_promote_storage_type<SkewSymmetricShape, SkewSymmetricShape, ProductTag> {
769 using ret = Dense;
770};
771// A skew-symmetric matrix scaled by a diagonal is neither, and without these the <A, DiagonalShape> and
772// <SkewSymmetricShape, B> rules are ambiguous.
773template <int ProductTag>
774struct product_promote_storage_type<SkewSymmetricShape, DiagonalShape, ProductTag> {
775 using ret = Dense;
776};
777template <int ProductTag>
778struct product_promote_storage_type<DiagonalShape, SkewSymmetricShape, ProductTag> {
779 using ret = Dense;
780};
781
782template <typename A, int ProductTag>
783struct product_promote_storage_type<A, PermutationStorage, ProductTag> {
784 using ret = A;
785};
786template <typename B, int ProductTag>
787struct product_promote_storage_type<PermutationStorage, B, ProductTag> {
788 using ret = B;
789};
790template <int ProductTag>
791struct product_promote_storage_type<Dense, PermutationStorage, ProductTag> {
792 using ret = Dense;
793};
794template <int ProductTag>
795struct product_promote_storage_type<PermutationStorage, Dense, ProductTag> {
796 using ret = Dense;
797};
798
802template <typename ExpressionType, typename Scalar = typename ExpressionType::Scalar>
803struct plain_row_type {
804 using MatrixRowType =
805 Matrix<Scalar, 1, ExpressionType::ColsAtCompileTime, int(ExpressionType::PlainObject::Options) | int(RowMajor), 1,
806 ExpressionType::MaxColsAtCompileTime>;
807 using ArrayRowType =
808 Array<Scalar, 1, ExpressionType::ColsAtCompileTime, int(ExpressionType::PlainObject::Options) | int(RowMajor), 1,
809 ExpressionType::MaxColsAtCompileTime>;
810
811 using type = std::conditional_t<std::is_same<typename traits<ExpressionType>::XprKind, MatrixXpr>::value,
812 MatrixRowType, ArrayRowType>;
813};
814
815template <typename ExpressionType, typename Scalar = typename ExpressionType::Scalar>
816struct plain_col_type {
817 using MatrixColType =
818 Matrix<Scalar, ExpressionType::RowsAtCompileTime, 1, ExpressionType::PlainObject::Options & ~RowMajor,
819 ExpressionType::MaxRowsAtCompileTime, 1>;
820 using ArrayColType = Array<Scalar, ExpressionType::RowsAtCompileTime, 1,
821 ExpressionType::PlainObject::Options & ~RowMajor, ExpressionType::MaxRowsAtCompileTime, 1>;
822
823 using type = std::conditional_t<std::is_same<typename traits<ExpressionType>::XprKind, MatrixXpr>::value,
824 MatrixColType, ArrayColType>;
825};
826
827template <typename ExpressionType, typename Scalar = typename ExpressionType::Scalar>
828struct plain_diag_type {
829 static constexpr int diag_size =
830 internal::min_size_prefer_dynamic(ExpressionType::RowsAtCompileTime, ExpressionType::ColsAtCompileTime);
831 static constexpr int max_diag_size =
832 min_size_prefer_fixed(ExpressionType::MaxRowsAtCompileTime, ExpressionType::MaxColsAtCompileTime);
833 using MatrixDiagType =
834 Matrix<Scalar, diag_size, 1, ExpressionType::PlainObject::Options & ~RowMajor, max_diag_size, 1>;
835 using ArrayDiagType = Array<Scalar, diag_size, 1, ExpressionType::PlainObject::Options & ~RowMajor, max_diag_size, 1>;
836
837 using type = std::conditional_t<std::is_same<typename traits<ExpressionType>::XprKind, MatrixXpr>::value,
838 MatrixDiagType, ArrayDiagType>;
839};
840
841template <typename Expr, typename Scalar = typename Expr::Scalar>
842struct plain_constant_type {
843 static constexpr int Options = (traits<Expr>::Flags & RowMajorBit) ? RowMajor : 0;
844
845 using array_type = Array<Scalar, traits<Expr>::RowsAtCompileTime, traits<Expr>::ColsAtCompileTime, Options,
846 traits<Expr>::MaxRowsAtCompileTime, traits<Expr>::MaxColsAtCompileTime>;
847
848 using matrix_type = Matrix<Scalar, traits<Expr>::RowsAtCompileTime, traits<Expr>::ColsAtCompileTime, Options,
849 traits<Expr>::MaxRowsAtCompileTime, traits<Expr>::MaxColsAtCompileTime>;
850
851 using type = CwiseNullaryOp<scalar_constant_op<Scalar>,
852 const std::conditional_t<std::is_same<typename traits<Expr>::XprKind, MatrixXpr>::value,
853 matrix_type, array_type>>;
854};
855
856template <typename ExpressionType>
857struct is_lvalue : bool_constant<(!bool(std::is_const<ExpressionType>::value)) &&
858 bool((traits<ExpressionType>::Flags & LvalueBit))> {};
859
860template <typename T>
861struct is_diagonal : std::false_type {};
862
863template <typename T>
864struct is_diagonal<DiagonalBase<T>> : std::true_type {};
865
866template <typename T>
867struct is_diagonal<DiagonalWrapper<T>> : std::true_type {};
868
869template <typename T, int S>
870struct is_diagonal<DiagonalMatrix<T, S>> : std::true_type {};
871
872template <typename T>
873struct is_identity : std::false_type {};
874
875template <typename T>
876struct is_identity<CwiseNullaryOp<internal::scalar_identity_op<typename T::Scalar>, T>> : std::true_type {};
877
878template <typename S1, typename S2>
879struct glue_shapes;
880template <>
881struct glue_shapes<DenseShape, TriangularShape> {
882 using type = TriangularShape;
883};
884
885template <typename T1, typename T2>
886struct possibly_same_dense : bool_constant<has_direct_access<T1>::value && has_direct_access<T2>::value &&
887 std::is_same<typename T1::Scalar, typename T2::Scalar>::value> {};
888
889template <typename T1, typename T2, std::enable_if_t<possibly_same_dense<T1, T2>::value, int> = 0>
890EIGEN_DEVICE_FUNC bool is_same_dense(const T1& mat1, const T2& mat2) {
891 return (mat1.data() == mat2.data()) && (mat1.innerStride() == mat2.innerStride()) &&
892 (mat1.outerStride() == mat2.outerStride());
893}
894
895template <typename T1, typename T2, std::enable_if_t<!possibly_same_dense<T1, T2>::value, int> = 0>
896EIGEN_DEVICE_FUNC bool is_same_dense(const T1&, const T2&) {
897 return false;
898}
899
900// Internal helper defining the cost of a scalar division for the type T.
901// The default heuristic can be specialized for each scalar type and architecture.
902template <typename T, bool Vectorized = false, typename EnableIf = void>
903struct scalar_div_cost : std::integral_constant<int, 8 * NumTraits<T>::MulCost> {};
904
905template <typename T, bool Vectorized>
906struct scalar_div_cost<T, Vectorized, std::enable_if_t<NumTraits<T>::IsComplex>>
907 : std::integral_constant<int, 2 * scalar_div_cost<typename NumTraits<T>::Real>::value +
908 6 * NumTraits<typename NumTraits<T>::Real>::MulCost +
909 3 * NumTraits<typename NumTraits<T>::Real>::AddCost> {};
910
911template <bool Vectorized>
912struct scalar_div_cost<signed long, Vectorized, std::conditional_t<sizeof(long) == 8, void, std::false_type>>
913 : std::integral_constant<int, 24> {};
914template <bool Vectorized>
915struct scalar_div_cost<unsigned long, Vectorized, std::conditional_t<sizeof(long) == 8, void, std::false_type>>
916 : std::integral_constant<int, 21> {};
917
918#ifdef EIGEN_DEBUG_ASSIGN
919std::string demangle_traversal(int t) {
920 if (t == DefaultTraversal) return "DefaultTraversal";
921 if (t == LinearTraversal) return "LinearTraversal";
922 if (t == InnerVectorizedTraversal) return "InnerVectorizedTraversal";
923 if (t == LinearVectorizedTraversal) return "LinearVectorizedTraversal";
924 if (t == SliceVectorizedTraversal) return "SliceVectorizedTraversal";
925 return "?";
926}
927std::string demangle_unrolling(int t) {
928 if (t == NoUnrolling) return "NoUnrolling";
929 if (t == InnerUnrolling) return "InnerUnrolling";
930 if (t == CompleteUnrolling) return "CompleteUnrolling";
931 return "?";
932}
933std::string demangle_flags(int f) {
934 std::string res;
935 if (f & RowMajorBit) res += " | RowMajor";
936 if (f & PacketAccessBit) res += " | Packet";
937 if (f & LinearAccessBit) res += " | Linear";
938 if (f & LvalueBit) res += " | Lvalue";
939 if (f & DirectAccessBit) res += " | Direct";
940 if (f & NestByRefBit) res += " | NestByRef";
941 if (f & NoPreferredStorageOrderBit) res += " | NoPreferredStorageOrderBit";
942
943 return res;
944}
945#endif
946
947template <typename XprType>
948struct is_block_xpr : std::false_type {};
949
950template <typename XprType, int BlockRows, int BlockCols, bool InnerPanel>
951struct is_block_xpr<Block<XprType, BlockRows, BlockCols, InnerPanel>> : std::true_type {};
952
953template <typename XprType, int BlockRows, int BlockCols, bool InnerPanel>
954struct is_block_xpr<const Block<XprType, BlockRows, BlockCols, InnerPanel>> : std::true_type {};
955
956// Helper utility for constructing non-recursive block expressions.
957template <typename XprType>
958struct block_xpr_helper {
959 using BaseType = XprType;
960
961 // For regular block expressions, simply forward along the InnerPanel argument,
962 // which is set when calling row/column expressions.
963 static constexpr bool is_inner_panel(bool inner_panel) { return inner_panel; }
964
965 // Only enable non-const base function if XprType is not const (otherwise we get a duplicate definition).
966 template <typename T = XprType, typename EnableIf = std::enable_if_t<!std::is_const<T>::value>>
967 static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE BaseType& base(XprType& xpr) {
968 return xpr;
969 }
970 static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE const BaseType& base(const XprType& xpr) { return xpr; }
971 static constexpr EIGEN_ALWAYS_INLINE Index row(const XprType& /*xpr*/, Index r) { return r; }
972 static constexpr EIGEN_ALWAYS_INLINE Index col(const XprType& /*xpr*/, Index c) { return c; }
973};
974
975template <typename XprType, int BlockRows, int BlockCols, bool InnerPanel>
976struct block_xpr_helper<Block<XprType, BlockRows, BlockCols, InnerPanel>> {
977 using BlockXprType = Block<XprType, BlockRows, BlockCols, InnerPanel>;
978 // Recursive helper in case of explicit block-of-block expression.
979 using NestedXprHelper = block_xpr_helper<XprType>;
980 using BaseType = typename NestedXprHelper::BaseType;
981
982 // For block-of-block expressions, we need to combine the InnerPannel trait
983 // with that of the block subexpression.
984 static constexpr bool is_inner_panel(bool inner_panel) {
985 return NestedXprHelper::is_inner_panel(InnerPanel && inner_panel);
986 }
987
988 // Only enable non-const base function if XprType is not const (otherwise we get a duplicates definition).
989 template <typename T = XprType, typename EnableIf = std::enable_if_t<!std::is_const<T>::value>>
990 static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE BaseType& base(BlockXprType& xpr) {
991 return NestedXprHelper::base(xpr.nestedExpression());
992 }
993 static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE const BaseType& base(const BlockXprType& xpr) {
994 return NestedXprHelper::base(xpr.nestedExpression());
995 }
996 static constexpr EIGEN_ALWAYS_INLINE Index row(const BlockXprType& xpr, Index r) {
997 return xpr.startRow() + NestedXprHelper::row(xpr.nestedExpression(), r);
998 }
999 static constexpr EIGEN_ALWAYS_INLINE Index col(const BlockXprType& xpr, Index c) {
1000 return xpr.startCol() + NestedXprHelper::col(xpr.nestedExpression(), c);
1001 }
1002};
1003
1004template <typename XprType, int BlockRows, int BlockCols, bool InnerPanel>
1005struct block_xpr_helper<const Block<XprType, BlockRows, BlockCols, InnerPanel>>
1006 : block_xpr_helper<Block<XprType, BlockRows, BlockCols, InnerPanel>> {};
1007
1008template <typename XprType>
1009struct is_matrix_base_xpr : std::is_base_of<MatrixBase<remove_all_t<XprType>>, remove_all_t<XprType>> {};
1010
1011template <typename XprType>
1012struct is_permutation_base_xpr : std::is_base_of<PermutationBase<remove_all_t<XprType>>, remove_all_t<XprType>> {};
1013
1014} // end namespace internal
1015
1056template <typename ScalarA, typename ScalarB, typename BinaryOp = internal::scalar_product_op<ScalarA, ScalarB>>
1058#ifndef EIGEN_PARSED_BY_DOXYGEN
1059 // for backward compatibility, use the hints given by the (deprecated) internal::scalar_product_traits class.
1060 : internal::scalar_product_traits<ScalarA, ScalarB>
1061#endif // EIGEN_PARSED_BY_DOXYGEN
1062{
1063};
1064
1065template <typename T, typename BinaryOp>
1066struct ScalarBinaryOpTraits<T, T, BinaryOp> {
1067 using ReturnType = T;
1068};
1069
1070template <typename T, typename BinaryOp>
1071struct ScalarBinaryOpTraits<T, typename NumTraits<std::enable_if_t<NumTraits<T>::IsComplex, T>>::Real, BinaryOp> {
1072 using ReturnType = T;
1073};
1074template <typename T, typename BinaryOp>
1075struct ScalarBinaryOpTraits<typename NumTraits<std::enable_if_t<NumTraits<T>::IsComplex, T>>::Real, T, BinaryOp> {
1076 using ReturnType = T;
1077};
1078
1079// For Matrix * Permutation
1080template <typename T, typename BinaryOp>
1081struct ScalarBinaryOpTraits<T, void, BinaryOp> {
1082 using ReturnType = T;
1083};
1084
1085// For Permutation * Matrix
1086template <typename T, typename BinaryOp>
1087struct ScalarBinaryOpTraits<void, T, BinaryOp> {
1088 using ReturnType = T;
1089};
1090
1091// for Permutation*Permutation
1092template <typename BinaryOp>
1093struct ScalarBinaryOpTraits<void, void, BinaryOp> {
1094 using ReturnType = void;
1095};
1096
1097// We require Lhs and Rhs to have "compatible" scalar types.
1098// It is tempting to always allow mixing different types but remember that this is often impossible in the vectorized
1099// paths. So allowing mixing different types gives very unexpected errors when enabling vectorization, when the user
1100// tries to add together a float matrix and a double matrix.
1101#define EIGEN_CHECK_BINARY_COMPATIBILITY(BINOP, LHS, RHS) \
1102 EIGEN_STATIC_ASSERT( \
1103 (Eigen::internal::has_ReturnType<ScalarBinaryOpTraits<LHS, RHS, BINOP>>::value), \
1104 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
1105
1106} // end namespace Eigen
1107
1108#endif // EIGEN_XPRHELPER_H
@ ColMajor
Definition Constants.h:319
@ RowMajor
Definition Constants.h:321
@ AutoAlign
Definition Constants.h:323
constexpr unsigned int NoPreferredStorageOrderBit
Definition Constants.h:183
constexpr unsigned int PacketAccessBit
Definition Constants.h:98
constexpr unsigned int DirectAccessBit
Definition Constants.h:160
constexpr unsigned int EvalBeforeNestingBit
Definition Constants.h:75
constexpr unsigned int LinearAccessBit
Definition Constants.h:134
constexpr unsigned int LvalueBit
Definition Constants.h:149
constexpr unsigned int RowMajorBit
Definition Constants.h:71
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition NumTraits.h:233
Determines whether the given binary operation of two numeric types is allowed and what the scalar ret...
Definition XprHelper.h:1062