Compare commits

...

360 Commits

Author SHA1 Message Date
Rasmus Munk Larsen
8346cc3410 Fix three bugs in SelfAdjointEigenSolver and improve test coverage
Bug fixes:

1. computeDirect 3x3: eigenvalues from computeRoots() are theoretically
   sorted via the trigonometric formula, but floating-point rounding
   (especially in float) can break the ordering. Add a 3-element sorting
   network after computeRoots() to guarantee sorted output.

2. compute(): Inf input silently returns Success with garbage results,
   unlike NaN which correctly returns NoConvergence. Add an isfinite()
   check on the scaling factor (which is maxCoeff of the matrix) to
   detect Inf/NaN early and return NoConvergence.

3. computeFromTridiagonal(): lacks the equilibration scaling that
   compute() applies, causing overflow and NoConvergence for tridiagonal
   matrices with large entries. Add the same scale-to-[-1,1] pattern.

New tests:

- Eigenvalue sorting verification (both iterative and direct solvers)
- Repeated/degenerate eigenvalues (all equal, multiplicity n-1, two
  clusters, nearly repeated separated by O(epsilon))
- Extreme eigenvalue ranges (high condition number spanning many orders
  of magnitude, near-underflow, near-overflow, mixed positive/negative,
  rank-deficient with zero eigenvalue)
- computeFromTridiagonal with large and tiny values
- Diagonal matrices (eigenvalues must match sorted diagonal)
- operatorInverseSqrt accuracy (sqrtA*invSqrtA=I, invSqrtA*A*invSqrtA=I,
  symmetry)
- RowMajor storage for computeDirect (2x2, 3x3, float, double) and
  iterative solver (dynamic RowMajor)
- Inf input detection
- Tridiagonal structure verification (off-tridiagonal entries are zero)
- Direct solver stress tests: 3x3 (near-planar covariance, triple
  eigenvalue, double eigenvalue, large off-diagonal, nearly singular)
  and 2x2 (equal eigenvalues, tiny off-diagonal, huge diagonal ratio,
  anti-diagonal dominant, negative entries)
- Tightened unitary tolerance from fixed 32*test_precision to
  4*n*epsilon (scales with matrix size)
- Fixed typo: "expponential" -> "exponential"

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 18:07:55 -07:00
Rasmus Munk Larsen
93e9970964 Run clang-format on bench_small_matrix.cpp
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 15:28:20 -07:00
Rasmus Munk Larsen
3eed3b0ab9 Fix Gram-Schmidt bug in SelfAdjointEigenSolver::computeDirect and add small matrix benchmarks
Fix a bug in the 3x3 direct eigensolver's Gram-Schmidt orthogonalization
for near-degenerate eigenvalues. The code was subtracting the projection
onto eivecs.col(l) (itself) instead of onto eivecs.col(k):

  // Before (bug): subtracts scalar multiple of self — does nothing useful
  eivecs.col(l) -= eivecs.col(k).dot(eivecs.col(l)) * eivecs.col(l);
  // After (fix): removes component along eivecs.col(k)
  eivecs.col(l) -= eivecs.col(k).dot(eivecs.col(l)) * eivecs.col(k);

This path is taken when two of three eigenvalues are nearly equal, which
is common for covariance matrices of near-planar point clouds.

Also add comprehensive small fixed-size matrix benchmarks covering the
operations that dominate robotics/CV inner loops: matmul, matvec,
inverse, determinant, LLT, LDLT, PartialPivLU, ColPivHouseholderQR,
JacobiSVD, SelfAdjointEigenSolver (iterative and direct) for sizes
2x2 through 8x9.

Note: the direct 3x3 eigensolver (computeDirect) is 3x faster than
the iterative solver but has 5-6 orders of magnitude worse residuals
for near-degenerate eigenvalues. This is inherent to the closed-form
algorithm, not a consequence of the Gram-Schmidt bug. Users should
prefer compute() when accuracy matters and computeDirect() only when
speed is critical and eigenvalues are well-separated.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 15:24:42 -07:00
Rasmus Munk Larsen
8ddbe44799 Add small fixed-size matrix benchmarks for robotics/CV workloads
Benchmark the operations that dominate robotics and computer vision
inner loops: fixed-size matrix multiply, matrix-vector, inverse,
determinant, LLT, LDLT, PartialPivLU, ColPivHouseholderQR, JacobiSVD,
and SelfAdjointEigenSolver for sizes 2x2 through 8x9.

Key findings from the baseline measurements:
- MatMul/MatVec: excellent (<1ns for 3x3 float)
- Inverse 3x3: excellent (3.4ns)
- LLT 3x3→4x4: 8x jump (3.9→31.7ns float) due to inlining threshold
- ColPivQR 3x3: 166ns — expensive for such a small matrix
- JacobiSVD 3x3: 498ns double — the main CV bottleneck
- SelfAdjointEig: computeDirect() is 3.2x faster than iterative for 3x3
  (71ns vs 230ns) — many users may not know this API exists

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 15:06:32 -07:00
Rasmus Munk Larsen
fe6ada10be Prevent nightly CI pipelines from being auto-cancelled
libeigen/eigen!2390

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-04-04 11:52:15 -07:00
Alexander Grund
8179474225 CI: Add AVX512-FP16 build tests with GCC 13
libeigen/eigen!1652

Co-authored-by: Alexander Grund <alexander.grund@tu-dresden.de>
2026-04-04 11:32:31 -07:00
Florian Maurin
b57d860f3e Fix GCC maybe-uninitialized warning in InnerProduct
libeigen/eigen!2386

Closes #3015
2026-04-03 19:41:09 -07:00
Rasmus Munk Larsen
a3074053a6 Speed up pexp_double by ~15-17%
libeigen/eigen!2388

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-04-03 17:09:11 -07:00
Rasmus Munk Larsen
a91913e961 Speed up plog_float by 1.6x with improved accuracy
libeigen/eigen!2382

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-04-03 13:45:01 -07:00
Rasmus Munk Larsen
ebae0c7c10 ulp_accuracy: use dynamic work queue for thread load balancing
libeigen/eigen!2383

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-04-02 22:40:03 -07:00
Charles Schlosser
5977635d64 fix singed integer overflow UB in integer_types and other trivial compiler warnings
libeigen/eigen!2380
2026-04-03 03:36:28 +00:00
Rasmus Munk Larsen
60df12437e Fix ulp_accuracy crashes in Release builds
libeigen/eigen!2381

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-04-02 20:12:13 -07:00
Pavel Guzenfeld
e315a8cdd0 Inline IndexedViewMethods.inc into DenseBase.h
libeigen/eigen!2330

Closes #2766
2026-04-02 15:26:56 -07:00
Rasmus Munk Larsen
8ec68856a6 Fix basicstuff_8 casting test failure on loongarch64
libeigen/eigen!2379

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-04-02 14:14:54 -07:00
Rasmus Munk Larsen
61a8662876 Improve log1p accuracy and speed with direct range reduction
libeigen/eigen!2378

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-04-02 11:29:25 -07:00
Rasmus Munk Larsen
d31a73437f Vectorize asinh and acosh for float and double
libeigen/eigen!2376

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-04-01 21:46:36 -07:00
Rasmus Munk Larsen
9513d3878e Vectorize sinh, cosh, and log10
libeigen/eigen!2368

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-04-01 20:41:18 -07:00
Rasmus Munk Larsen
30e669cfe1 Tensor module: const-correctness and constexpr improvements
libeigen/eigen!2239

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-04-01 17:49:56 -07:00
Rasmus Munk Larsen
64885cc6a3 Fix remaining MSVC warnings in Windows CI (C4804, C4244, C4146, C4305)
libeigen/eigen!2374

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-04-01 17:20:31 -07:00
Rasmus Munk Larsen
6a07970d7d CI: split NVHPC build and make fallback parallelism configurable
libeigen/eigen!2372

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-04-01 16:43:33 -07:00
Rasmus Munk Larsen
4be66f2830 CI: fail test jobs when no tests are found (--no-tests=error)
libeigen/eigen!2373

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-04-01 12:50:54 -07:00
Rasmus Munk Larsen
1df89cbc21 Right-size CI runners to reduce waste and shuffle build order to avoid OOM
libeigen/eigen!2367

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-31 19:10:34 -07:00
Rasmus Munk Larsen
b54640df19 Fix NVHPC warnings in Visitor.h and Memory.h
libeigen/eigen!2370

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-31 15:09:37 -07:00
Rasmus Munk Larsen
7fcbed7acb Fill packet math coverage gaps across multiple architectures
libeigen/eigen!2237

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-31 14:52:32 -07:00
Rasmus Munk Larsen
80ab2898e2 CI: install libclang-rt-14-dev for sanitizer smoketest
libeigen/eigen!2369

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-31 00:16:18 -07:00
Rasmus Munk Larsen
798d7f2bec CI: drop Clang-6, bump base image to Ubuntu 24.04 and Clang 12 to 14
libeigen/eigen!2366

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-30 22:00:17 -07:00
Rasmus Munk Larsen
1ade3636b9 Fix BDCSVD bidiagonal hard-case failures on ARM with GCC
libeigen/eigen!2365

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-30 20:17:37 -07:00
Rasmus Munk Larsen
801a9ee690 Fix ~1,460 MSVC warnings from generic code instantiated with bool
libeigen/eigen!2364

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-29 21:05:49 -07:00
Rasmus Munk Larsen
806c7b6590 CI: fix Windows build cache key containing invalid path characters
libeigen/eigen!2362

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-29 19:57:45 -07:00
Rasmus Munk Larsen
2776ba55eb Update slicing tutorial docs to reflect Eigen::placeholders namespace
libeigen/eigen!2360

Closes #3064

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-29 18:51:02 -07:00
Rasmus Munk Larsen
09581fda38 Modernize tensor contraction code: bug fixes, dead code removal, and cleanup
libeigen/eigen!2248

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-29 18:03:06 -07:00
Rasmus Munk Larsen
732ebc8cc2 Modernize evaluator files
libeigen/eigen!2245

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-29 17:40:39 -07:00
Rasmus Munk Larsen
255f522e2e Fix bugs, docs, and structure in unsupported/ public headers
libeigen/eigen!2254

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-29 17:06:40 -07:00
Pavel Guzenfeld
bd276fbb28 Map .inc files to C++ in Doxygen extension mapping
libeigen/eigen!2338
2026-03-29 16:48:13 -07:00
Rasmus Munk Larsen
c8633ceeea Clean up top-level Eigen headers
libeigen/eigen!2252

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-29 16:28:09 -07:00
Rasmus Munk Larsen
409296d91d Add nightly benchmark regression detection pipeline
libeigen/eigen!2349

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-29 16:03:56 -07:00
Pavel Guzenfeld
753a6ac5b3 Fix private shadowing of protected base members in iterative solvers
libeigen/eigen!2357

Closes #1859
2026-03-29 15:40:48 -07:00
Rasmus Munk Larsen
9fe2f03fa4 Revert "Lower BDCSVD crossover threshold from 16 to 8"
This reverts merge request !2358
2026-03-29 15:25:09 -07:00
Rasmus Munk Larsen
12fe90db8b Lower BDCSVD crossover threshold from 16 to 8
libeigen/eigen!2358

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-29 14:33:22 -07:00
Pavel Guzenfeld
b7f6aed1b9 Fix dangling reference in IndexedView with expression indices
libeigen/eigen!2335

Closes #1943
2026-03-29 09:39:13 -07:00
Rasmus Munk Larsen
624ab58e8d Add bidiagonal SVD API to BDCSVD and remove dead debug code
libeigen/eigen!2238

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-28 20:38:31 -07:00
Charles Schlosser
ba9871e46b fix and enable realview unit tests
libeigen/eigen!2356
2026-03-28 20:13:54 -07:00
Rasmus Munk Larsen
b8dab89663 CI: remove broken NVHPC CUDA pipeline
libeigen/eigen!2355

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-28 19:52:01 -07:00
Rasmus Munk Larsen
0fe8cdfa3b Extract RankRevealingBase CRTP mixin to eliminate decomposition code duplication
libeigen/eigen!2272

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-28 19:12:23 -07:00
Rasmus Munk Larsen
5e521f3e45 Revert "add realview test"
This reverts merge request !2352
2026-03-28 17:27:01 -07:00
Charles Schlosser
87ae1dbe7f add realview test
libeigen/eigen!2352
2026-03-28 16:26:51 -07:00
Rasmus Munk Larsen
49a137ca24 CI: limit NVHPC build parallelism to avoid OOM kills
libeigen/eigen!2353

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-28 16:10:04 -07:00
Rasmus Munk Larsen
f928a9f534 Fix static alignment for generic clang vector backend
libeigen/eigen!2351

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-28 15:50:58 -07:00
Rasmus Munk Larsen
9706546a14 Add Householder blocked-right regression test
libeigen/eigen!2348

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-27 20:49:43 -07:00
Pavel Guzenfeld
90ca5bfd9a Strip lapacke.h to only the declarations used by Eigen
libeigen/eigen!2322

Closes #2851
2026-03-27 20:16:46 -07:00
Rasmus Munk Larsen
cf508c096b Add block Householder right-side application for HouseholderSequence
libeigen/eigen!2342

Closes #3057

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-27 19:56:08 -07:00
Rasmus Munk Larsen
79d7d280a5 Fix bugs in evaluator files
libeigen/eigen!2244

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-28 01:25:51 +00:00
Rasmus Munk Larsen
b8baa2c49c Split eigensolver_selfadjoint test to fix NVHPC OOM
libeigen/eigen!2347

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-27 18:09:26 -07:00
Charles Schlosser
eb4b2eeffa UBSAN: use appropriate SSE intrinsics for loading 4 and 8 bytes
libeigen/eigen!2346
2026-03-27 19:54:10 +00:00
Tyler Veness
9939a4c6e3 Fix SparseLU and SparseQR for custom scalar types
libeigen/eigen!2345
2026-03-27 00:13:11 -07:00
Rasmus Munk Larsen
002229ce47 Fix RowMajor gemm_pack_lhs for backends without half/quarter packets
libeigen/eigen!2344

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-23 23:33:42 -07:00
Rasmus Munk Larsen
f574cb9b18 Fix vectorization_logic test for generic clang backend
libeigen/eigen!2333

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-22 22:12:57 -07:00
Rasmus Munk Larsen
843ffcec8b Fix warnings reported by NVHPC 26.1
libeigen/eigen!2324

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-22 11:43:40 -07:00
Florian Maurin
71ef987edb Fixes triangular solves on indexed/sliced dense expressions
libeigen/eigen!2340

Closes #2814
2026-03-22 11:12:21 -07:00
Rasmus Munk Larsen
ac6aedc60a Fix flaky matrix_power test
libeigen/eigen!2325

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-22 09:54:32 -07:00
Rasmus Munk Larsen
6490b17e6f Fix sanitizer regressions in sparse serializer and packet tests
libeigen/eigen!2319

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-22 09:10:16 -07:00
Pavel Guzenfeld
835e5615a9 Prefer SuiteSparse config-mode packages in Find modules
libeigen/eigen!2327
2026-03-22 08:44:01 -07:00
Rasmus Munk Larsen
f5774b014e Fix Doxygen build failure for comparison operator links
libeigen/eigen!2339

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-21 18:48:07 -07:00
Pavel Guzenfeld
a0e30732a7 Remove trailing semicolon from EIGEN_UNUSED_VARIABLE macro
libeigen/eigen!2301

Closes #3007

Co-authored-by: Pavel Guzenfeld <67074795+PavelGuzenfeld@users.noreply.github.com>
2026-03-21 16:54:13 -07:00
Rasmus Munk Larsen
e0b8498eef CI: Add nightly clang C++20 full test pipeline
libeigen/eigen!2328

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
Co-authored-by: Rasmus Munk Larsen <rlarsen@nvidia.com>
2026-03-21 11:10:58 -07:00
Rasmus Munk Larsen
7e8a3040bb Fix Doxygen errors for ArrayBase comparison operators
libeigen/eigen!2334

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-21 10:37:17 -07:00
Rasmus Munk Larsen
54b04fc6b1 Fix mixed-type GEMM packing for backends without half/quarter packets
libeigen/eigen!2297

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-21 09:46:54 -07:00
Pavel Guzenfeld
1d21d62fbc Fix computeInverseAndDetWithCheck for dynamic result matrices
libeigen/eigen!2312

Closes #2917
2026-03-21 08:38:27 -07:00
Rasmus Munk Larsen
cc8c7cf0e6 Fix bugs and clean up SparseCore module
libeigen/eigen!2250

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-21 13:31:12 +00:00
Pavel Guzenfeld
daecd28cd5 Add Array relational operator docs and FetchContent CMake guide
libeigen/eigen!2329

Closes #2801 and #2793
2026-03-20 18:50:58 -07:00
Rasmus Munk Larsen
9d1e5f3915 Remove benchmark::internal::Benchmark* from all benchmarks
libeigen/eigen!2332

Co-authored-by: Rasmus Munk Larsen <rlarsen@nvidia.com>
2026-03-20 17:42:07 -07:00
Rasmus Munk Larsen
8115b45e50 Fix integer sanitizer issues in shifts and test ranges
libeigen/eigen!2320

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-20 17:27:02 -07:00
Rasmus Munk Larsen
89621d1024 CI: Remove GCC 6 pipeline
libeigen/eigen!2323

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-20 17:09:19 -07:00
Rasmus Munk Larsen
6540bf4787 Harden unsupported tensor tests for sanitizers
libeigen/eigen!2321

Co-authored-by: Rasmus Munk Larsen <rlarsen@nvidia.com>
Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-20 15:12:41 -07:00
Yu You
9d161e0c87 Fine-tune gebp_kernel for aarch64
libeigen/eigen!2278
2026-03-20 14:29:03 -07:00
Rasmus Munk Larsen
a0b16a7e1b Fix flaky product and eigensolver_selfadjoint tests
libeigen/eigen!2326

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-20 13:44:03 -07:00
Pavel Guzenfeld
a72172e563 Add blocking and vectorization boundary tests for LU and Cholesky
libeigen/eigen!2317
2026-03-20 13:27:49 -07:00
Pavel Guzenfeld
30128de0e3 Guard eigen_fill_helper on trivially copyable scalars
libeigen/eigen!2313

Closes #2956
2026-03-20 19:03:13 +00:00
Rasmus Munk Larsen
8a47aa334b Replace empirical product test tolerances with principled Higham-Mary bounds
libeigen/eigen!2292

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-20 11:03:58 -07:00
Pavel Guzenfeld
821ab7d3e6 Fix TensorUInt128 division infinite loop on overflow
libeigen/eigen!2300

Closes #3012

Co-authored-by: Pavel Guzenfeld <67074795+PavelGuzenfeld@users.noreply.github.com>
2026-03-20 15:41:00 +00:00
Rasmus Munk Larsen
3578883bb3 CI: Split ASAN/UBSAN build into official/unsupported jobs
libeigen/eigen!2315

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-19 17:56:43 -07:00
Pavel Guzenfeld
3e5a2f9245 Fix vectorized erf returning NaN at ±inf instead of ±1
libeigen/eigen!2306

Closes #3053
2026-03-19 14:12:15 -07:00
Pavel Guzenfeld
36ca36d0de Guard redundant constexpr static member redeclarations for C++17+
libeigen/eigen!2299

Closes #3061

Co-authored-by: Pavel Guzenfeld <67074795+PavelGuzenfeld@users.noreply.github.com>
2026-03-18 20:24:09 -07:00
Pavel Guzenfeld
62e23f79dd Fix GCC 13 array-bounds warning in TensorContraction
libeigen/eigen!2311

Closes #3017
2026-03-18 20:08:21 -07:00
Pavel Guzenfeld
05295a818b Fix undefined behavior in matrix_cwise test for signed integers
libeigen/eigen!2310

Closes #2933
2026-03-18 11:51:01 -07:00
Pavel Guzenfeld
0fd8002b11 Fix most vexing parse in SparseSparseProductWithPruning.h
libeigen/eigen!2298

Closes #3060

Co-authored-by: Pavel Guzenfeld <67074795+PavelGuzenfeld@users.noreply.github.com>
2026-03-18 15:13:22 +00:00
Pavel Guzenfeld
c148dc8fad Include Scaling.h in IterativeSolvers module
libeigen/eigen!2309

Closes #3002
2026-03-17 21:59:57 -07:00
Rasmus Munk Larsen
1726a92900 CI: Reduce artifact size, cache clang-tidy, fix test retry, throttle QEMU
libeigen/eigen!2305

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-17 21:41:29 -07:00
Rasmus Munk Larsen
ea13a98dec Fix imag_ref for real scalar types and clean up svd_fill.h
libeigen/eigen!2303

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-15 19:56:01 -07:00
Antonio Sánchez
929785924c Fix more cache size queries.
libeigen/eigen!2296
2026-03-14 16:07:44 +00:00
Antonio Sánchez
b2f95d3733 Fix more cache size queries.
libeigen/eigen!2295
2026-03-14 15:43:24 +00:00
Antonio Sánchez
9ae0e0f195 Remove include from within Eigen namespace.
libeigen/eigen!2294
2026-03-13 21:03:24 +00:00
Rasmus Munk Larsen
c1faa74738 Add boundary test coverage: stableNorm, LinSpaced, complex GEMV, triangular solve
libeigen/eigen!2291

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-12 18:15:30 -07:00
Rasmus Munk Larsen
6b9275d1a8 Add test coverage for transpose, reverse, bool redux, select, diagonal-of-product at boundaries
libeigen/eigen!2290

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-12 17:02:58 -07:00
Rasmus Munk Larsen
356a9ba1da Add test coverage for matrix lpNorm, RowMajor partial reductions, selfadjoint boundaries
libeigen/eigen!2289

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-12 14:45:51 -07:00
Rasmus Munk Larsen
15cae83485 Add test coverage for strided maps, triangular blocking, and mixed storage orders
libeigen/eigen!2288

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-12 14:07:21 -07:00
Rasmus Munk Larsen
93aa959b8a Add vectorization boundary tests for redux and visitor
libeigen/eigen!2287

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-12 13:47:15 -07:00
Rasmus Munk Larsen
c93116b43d Improve test coverage for inner product, fill, reductions, and IO
libeigen/eigen!2286

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-12 12:48:45 -07:00
Rasmus Munk Larsen
5e478d3285 Improve product test coverage at critical code-path boundaries
libeigen/eigen!2285

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-12 12:32:06 -07:00
onalante-ebay
3a2ba7c434 Optimize predux_any<Packet4f>
libeigen/eigen!2277
2026-03-12 09:15:16 -07:00
Rasmus Munk Larsen
8190c82cb4 Add missing SIMD math function benchmarks
libeigen/eigen!2284

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-11 23:20:11 -07:00
Rasmus Munk Larsen
8368a12f0f Add runtime cache size detection for ARM and improve GEMM blocking
libeigen/eigen!2282

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-11 22:36:33 -07:00
Rasmus Munk Larsen
42c1dbd2c3 Add aarch64 smoke test pipeline for MRs
libeigen/eigen!2283

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-11 22:19:16 -07:00
Charles Schlosser
875fb48f0a fix various irksome compiler warnings
libeigen/eigen!2280
2026-03-11 21:01:20 -07:00
Charles Schlosser
2a2456c873 restore Eigen/src/Core/arch/Altivec/MatrixProduct.h to b1e74b1cc
libeigen/eigen!2279
2026-03-12 03:26:03 +00:00
Charles Schlosser
c4eb3c4f4c fix custom visitors
libeigen/eigen!2275

Closes #2920
2026-03-11 10:52:49 +00:00
Antonio Sánchez
4387e32481 Fix row-skipping bug in general_matrix_vector_product::run_small_cols
libeigen/eigen!2276
2026-03-10 15:16:00 -07:00
Juraj Oršulić
81550faea4 Use Web Archive for dead link for the PDF referenced in Geometry/EulerAngles.h
libeigen/eigen!2274
2026-03-09 20:18:43 -07:00
Rasmus Munk Larsen
42b6c43cfe Revert "Remove random retry loops in tests (batch 2: indices and integer types)"
This reverts merge request !2261
2026-03-09 20:01:53 -07:00
Rasmus Munk Larsen
54458cb39d Remove random retry loops in tests (batch 3: geometry, sparse, umeyama)
libeigen/eigen!2262

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-09 00:35:26 -07:00
Rasmus Munk Larsen
a3cb1c6591 cxx11_tensor_random: use retry loop for low-precision RNG collisions
libeigen/eigen!2269

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-08 16:19:48 -07:00
Rasmus Munk Larsen
f80d7b8254 Fix three more flaky tests: igamma, tensor_random, matrix_power
libeigen/eigen!2268

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-08 16:00:04 -07:00
Rasmus Munk Larsen
8eaa7552fe Fix three flaky tests: packetmath, array_cwise, polynomialsolver
libeigen/eigen!2267

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-08 14:59:23 -07:00
Rasmus Munk Larsen
dd81698aed Fix vectorization_logic test for wide SIMD widths
libeigen/eigen!2266

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-08 12:11:33 -07:00
Rasmus Munk Larsen
ab58784268 Remove random retry loops in tests (batch 5: geometry, mixing types, triangular)
libeigen/eigen!2264

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-08 11:51:35 -07:00
Rasmus Munk Larsen
411422f2dc Remove random retry loop in SVD min-norm test
libeigen/eigen!2263

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-08 11:20:27 -07:00
Rasmus Munk Larsen
7c3a344763 Remove random retry loops in tests (batch 2: indices and integer types)
libeigen/eigen!2261

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-08 11:02:45 -07:00
Rasmus Munk Larsen
be7538ed65 Remove random retry loops in tests (batch 1: simple scalar cases)
libeigen/eigen!2260

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-08 10:44:57 -07:00
Rasmus Munk Larsen
5790d716c3 Simplify and optimize pow/cbrt special case handling
libeigen/eigen!2259

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-08 10:19:51 -07:00
Rasmus Munk Larsen
3041ab44af Fix GEBP asm register constraints for custom scalar types
libeigen/eigen!2258

Closes #3059

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-07 07:49:27 -08:00
Antonio Sánchez
20fce70e5a Fix another complex div edge case.
libeigen/eigen!2257
2026-03-06 13:37:26 -08:00
Antonio Sánchez
5bacb5be9a Fix null pointer dereference in Sparse-Dense products for Sparse vectors.
libeigen/eigen!2256
2026-03-06 10:50:28 -08:00
Tyler Veness
d8c8ee6fb2 Fix crash on construction of SparseMatrix with zero-length diagonal
libeigen/eigen!2249
2026-03-06 01:43:21 +00:00
Rasmus Munk Larsen
265496e862 Fix heap overflow in BM_BatchContraction benchmark
libeigen/eigen!2251

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-04 21:01:34 -08:00
Rasmus Munk Larsen
eea4d31f58 Simplify and modernize XprHelper.h
libeigen/eigen!2243

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-04 10:33:05 -08:00
Rasmus Munk Larsen
dd826edb42 Replace typedef with using in tensor contraction files
libeigen/eigen!2247

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-04 08:59:22 -08:00
Antonio Sánchez
abc3d6014d Fix CUDA+Clang build warnings.
libeigen/eigen!2241
2026-03-04 01:41:01 -08:00
Rasmus Munk Larsen
0269c017aa Revise Tensor module README.md: fix bugs, add missing docs
libeigen/eigen!2240

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-03 23:44:49 -08:00
Charles Schlosser
ca94be70da fix uninitialized variable in constexpr function
libeigen/eigen!2236
2026-03-03 21:01:40 -08:00
Rasmus Munk Larsen
b0ebf966a5 Fix default rank-detection threshold in QR and LU decompositions
libeigen/eigen!2232

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-03 18:44:22 -08:00
Antonio Sánchez
d36a7db7b5 Fix Eigen::array constructors.
libeigen/eigen!2235
2026-03-03 22:15:47 +00:00
Antonio Sánchez
661cdb227f Fix relative paths after move.
libeigen/eigen!2234
2026-03-02 19:50:30 +00:00
Rasmus Munk Larsen
57b1de2330 Fix row-major GEMV dropping rows when n8 heuristic disables main loop
libeigen/eigen!2233

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-01 23:47:35 -08:00
Rasmus Munk Larsen
662d5c21ff Optimize SYMV, SYR, SYR2, and TRMV product kernels
libeigen/eigen!2228

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-01 19:40:11 -08:00
Rasmus Munk Larsen
c66fc52868 Add ULP accuracy measurement tool and documentation for vectorized math functions
libeigen/eigen!2153

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-01 13:22:16 -08:00
Rasmus Munk Larsen
c20b6f5c41 Restore EIGEN_EMPTY_STRUCT_CTOR as a no-op macro for backward compatibility
libeigen/eigen!2231

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-03-01 11:44:38 -08:00
Rasmus Munk Larsen
77d9173596 Add ca-certificates to clang-tidy CI job
libeigen/eigen!2230

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-28 09:12:13 -08:00
Rasmus Munk Larsen
444ae9761d Clamp igamma/igammac output to [0,1] for numerical stability
libeigen/eigen!2229

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-28 08:52:44 -08:00
Rasmus Munk Larsen
eddb470a09 Fix flaky array_cwise and sparse_basic tests
libeigen/eigen!2227

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-27 21:52:46 -08:00
Antonio Sánchez
25dba492e3 Use stack-constructed variable for SVD block sweep.
libeigen/eigen!2225
2026-02-28 05:04:41 +00:00
Rasmus Munk Larsen
f64d1e0acc Improve ConditionEstimator docs and tighten test bounds
libeigen/eigen!2226

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-26 22:08:13 -08:00
Rasmus Munk Larsen
8525491eb1 Add dedicated unit tests and benchmark for ConditionEstimator
libeigen/eigen!2223

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-26 18:26:38 -08:00
Antonio Sánchez
e730b1fe33 Fix mixed products GEMM.
libeigen/eigen!2224
2026-02-26 15:47:39 -08:00
Rasmus Munk Larsen
3adfa9bd37 Add const to non-mutating member functions across remaining modules
libeigen/eigen!2222

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-26 13:58:04 -08:00
Rasmus Munk Larsen
13b61529f4 Add const to non-mutating member functions in products/ and Serializer
libeigen/eigen!2221

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-26 12:35:44 -08:00
Rasmus Munk Larsen
aaca9e5856 Add missing const qualifiers in Eigen/src/Core/
libeigen/eigen!2220

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-26 11:23:53 -08:00
Rasmus Munk Larsen
1b1b7e347d Fix EIGEN_NO_AUTOMATIC_RESIZING not resizing empty destinations
libeigen/eigen!2219

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-26 07:54:27 -08:00
Rasmus Munk Larsen
064d686c57 Remove CXX11/ directory nesting for Tensor modules
libeigen/eigen!2199

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-26 07:03:38 -08:00
Rasmus Munk Larsen
11eb66e1b5 Remove pre-C++14 workarounds from unsupported/ tensor code
libeigen/eigen!2218

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-26 06:17:39 -08:00
Rasmus Munk Larsen
a95440de17 Remove obsolete bench/ and btl/ directories
libeigen/eigen!2217

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-25 20:19:45 -08:00
Rasmus Munk Larsen
6e2aff6b5d Fix ambiguous static_cast in JacobiSVD blocking threshold
libeigen/eigen!2215

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-25 19:48:20 -08:00
Rasmus Munk Larsen
d8ed4f6884 Fix GEBP half/quarter-packet loops for nr>=8 RHS packing on ARM64
libeigen/eigen!2216

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-25 19:26:49 -08:00
Rasmus Munk Larsen
6b6d0d8c8e Revert "Fix ambiguous static_cast in JacobiSVD blocking threshold computation"
This reverts commit e567151ce3.
2026-02-25 19:08:21 -08:00
Rasmus Munk Larsen
ba2fc4e775 Revert "Fix GEBP half/quarter-packet loops for nr>=8 RHS packing on ARM64"
This reverts commit 888d708dcd.
2026-02-25 19:08:21 -08:00
Rasmus Munk Larsen
888d708dcd Fix GEBP half/quarter-packet loops for nr>=8 RHS packing on ARM64
On ARM64 (and LoongArch64), the GEBP kernel uses nr=8, so the RHS is
packed in 8-column blocks. The half-packet and quarter-packet row
processing loops were iterating columns 4 at a time starting from j2=0,
misindexing into the 8-column packed RHS buffer. This produced
completely wrong results for float GEMM when the number of rows was
smaller than the SIMD packet size (e.g. 2x10 * 10x8 float).

Add the missing nr>=8 column iteration blocks to both loops, matching
the pattern already present in the 3x, 2x, 1x, and scalar remainder
sections.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-25 19:03:11 -08:00
Rasmus Munk Larsen
e567151ce3 Fix ambiguous static_cast in JacobiSVD blocking threshold computation
The L2 cache size threshold computation used numext::sqrt with a
static_cast<RealScalar>, which fails to compile when RealScalar is
AnnoyingScalar (a test-only type with multiple conversion constructors).
Since this is a pure cache-size computation unrelated to the matrix
scalar type, use std::sqrt(double) instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-25 19:03:01 -08:00
Rasmus Munk Larsen
a31de4778d Blocked Jacobi SVD sweep with L2-cache-adaptive threshold
libeigen/eigen!2206

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
Co-authored-by: Rasmus Munk Larsen <rmlarsen@google.com>
2026-02-25 10:03:05 -08:00
Rasmus Munk Larsen
647e0009ba Refactor BDCSVD D&C code to reduce compilation time and memory footprint
libeigen/eigen!2211

Closes #3048

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-25 09:11:38 -08:00
Rasmus Munk Larsen
4fab38d798 Make clang generic vector backend support 16, 32, and 64-byte vectors
libeigen/eigen!2213

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-25 08:50:47 -08:00
Rasmus Munk Larsen
ea25ea52bb Revert accidental changes from !2212 squash merge
libeigen/eigen!2214

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-25 08:31:41 -08:00
Rasmus Munk Larsen
38f0f42755 Update rmlarsen email address from @google.com to @gmail.com
libeigen/eigen!2212

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-25 07:45:02 -08:00
Rasmus Munk Larsen
d0d70a9527 Consolidate complex math function boilerplate with shared macros
libeigen/eigen!2201

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-25 07:21:20 -08:00
Rasmus Munk Larsen
c4c704e5dd Install libclang-rt-19-dev for asan-ubsan CI job
libeigen/eigen!2210

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-24 20:19:42 -08:00
Rasmus Munk Larsen
61895c5978 Selectively add constexpr to Core expression template scaffolding
libeigen/eigen!2184

Closes #3041

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-24 19:59:10 -08:00
Rasmus Munk Larsen
34092d2788 Fix flaky tests: add iteration guards, yield in busy-waits, cap thread count
libeigen/eigen!2208

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-24 18:29:07 -08:00
Rasmus Munk Larsen
28d090a49c Refactor GenericPacketMathFunctions.h into smaller focused headers
libeigen/eigen!2200

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-24 17:46:12 -08:00
Rasmus Munk Larsen
16da0279f1 Add benchmarks for unsupported modules and extend supported benchmarks
libeigen/eigen!2179

Closes #3036

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-24 17:12:33 -08:00
Rasmus Munk Larsen
fa567f6bcd Add CUDA CI jobs with NVHPC (nvc++) as host and device compiler
libeigen/eigen!2204

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-24 16:54:08 -08:00
Antonio Sánchez
2cd9bb7380 Fix sparse product with entities that do not have direct access.
libeigen/eigen!2205
2026-02-24 16:27:06 -08:00
Rasmus Munk Larsen
00cc497d32 Add clang-tidy, codespell, and sanitizer checks to CI pipeline
libeigen/eigen!2178

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-23 19:43:45 -08:00
Rasmus Munk Larsen
241af1c0ba Add NVHPC (nvc++) compiler support and CI build/test jobs
libeigen/eigen!2186

Closes #3032

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-23 18:51:15 -08:00
Antonio Sánchez
f3f2c676b5 Fix direct access for sparse blocks.
libeigen/eigen!2202
2026-02-23 12:00:52 -08:00
Rasmus Munk Larsen
d537b51ede Fix ComplexEigenSolver NaN with flush-to-zero arithmetic
libeigen/eigen!2196

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-23 11:15:31 -08:00
Rasmus Munk Larsen
667cabe3aa Clean up comments in unsupported module
libeigen/eigen!2198

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-22 22:04:23 -08:00
Rasmus Munk Larsen
78b76986b7 Comment cleanup v3: trailing ??, informal language, FIXME/TODO colons
libeigen/eigen!2197

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-22 21:20:08 -08:00
Rasmus Munk Larsen
112c2324bd Consolidate BF16/F16 wrapper macros and simplify arch math functions
libeigen/eigen!2195

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-22 20:17:43 -08:00
Rasmus Munk Larsen
d5e67adbe7 Clean up informal language, vague TODOs, and dead code in comments
libeigen/eigen!2191

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-22 18:32:10 -08:00
Rasmus Munk Larsen
7d727d26bc Refactor GenericPacketMathFunctions.h into smaller focused headers
libeigen/eigen!2190

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-22 16:30:57 -08:00
Rasmus Munk Larsen
9810969c0f Suppress false-positive GCC and clang warnings in test builds
libeigen/eigen!2187

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-22 14:54:15 -08:00
Rasmus Munk Larsen
ad7f1fe70e Improve clang vector extension backend
libeigen/eigen!2183

Closes #3042

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-22 13:31:21 -08:00
Rasmus Munk Larsen
1f49bf96cf Add new benchmarks for Core, LU, and QR operations
libeigen/eigen!2177

Closes #3035

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-22 12:19:37 -08:00
Rasmus Munk Larsen
8c35441f18 Fix typos: misspellings, French variable names, and hyphenation
libeigen/eigen!2185

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-22 10:04:40 -08:00
Rasmus Munk Larsen
44c6132163 Fix ~40 typos found by codespell across the codebase
libeigen/eigen!2181

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-21 21:29:50 -08:00
Rasmus Munk Larsen
f52ad04bbb Fix ASAN-detected bugs in Diagonal::data() and array_cwise test
libeigen/eigen!2182

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-21 21:11:36 -08:00
Rasmus Munk Larsen
d4077a6e99 Reorganize benchmarks into subdirectories and clean up Eigen sources
libeigen/eigen!2176

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-21 17:46:55 -08:00
Rasmus Munk Larsen
832b940976 Update COPYING.README to clarify third-party license status
libeigen/eigen!2174

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-21 17:16:07 -08:00
Rasmus Munk Larsen
e6accc73ff Fix comment typos, doubled words, grammar errors, and copy-paste mistakes
libeigen/eigen!2173

Closes #3034

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-21 14:36:21 -08:00
Rasmus Munk Larsen
0e424f4050 Remove dead code, commented-out blocks, and outdated comments
libeigen/eigen!2172

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-21 12:49:56 -08:00
Rasmus Munk Larsen
18791a81b9 Fix MSVC build: disable [[msvc::forceinline]] on generic lambdas
libeigen/eigen!2171

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-21 00:13:58 -08:00
Rasmus Munk Larsen
95e8bc3267 Add EIGEN_LAMBDA_ALWAYS_INLINE macro for MSVC lambda inlining
libeigen/eigen!2170

Closes #3033

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-20 21:28:47 -08:00
Rasmus Munk Larsen
a87ecfb179 Use m_ prefix consistently for private/protected member variables
libeigen/eigen!2168

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-20 20:35:58 -08:00
Rasmus Munk Larsen
270ea539fa Remove redundant EIGEN_STRONG_INLINE from trivial constexpr and = default functions
libeigen/eigen!2161

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-20 19:50:52 -08:00
Antonio Sánchez
e0a8d6c9d8 Fix compile warnings
libeigen/eigen!2167
2026-02-20 23:09:56 +00:00
Rasmus Munk Larsen
1dcea43c49 Fix RowMajor performance for triangular/dense assignment
libeigen/eigen!2165

Closes #3031

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-20 08:02:15 -08:00
Rasmus Munk Larsen
374fe225bf Reduce GEMV and TRSM benchmark sizes for faster routine runs
libeigen/eigen!2163

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-20 00:56:57 -08:00
Rasmus Munk Larsen
2c898e8b95 Remove unused LhsPacketType typedef in gebp_peeled_loop
libeigen/eigen!2162

Closes #3029

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-19 20:15:15 -08:00
Rasmus Munk Larsen
4fdc82d695 Fix mixed-type compilation error in row-major GEMV small-cols path
libeigen/eigen!2160

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-19 19:54:16 -08:00
Rasmus Munk Larsen
4141d1fd2d Fix -Wtautological-overlap-compare warning in row-major GEMV dispatch
libeigen/eigen!2158

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-19 15:56:16 -08:00
Rasmus Munk Larsen
53e3408cb7 Optimize GEMV kernels: row-major small-cols and template deduplication
libeigen/eigen!2151

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-19 15:06:24 -08:00
Rasmus Munk Larsen
9c63d26dec Remove reference to nonexistent spmv.cpp in benchmarks
libeigen/eigen!2157

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-19 04:22:35 -08:00
Rasmus Munk Larsen
5f09b3b63f Fix missing template argument list in trsmKernelR for Clang 20/21
libeigen/eigen!2155

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-18 20:43:17 -08:00
Rasmus Munk Larsen
c9eab40878 Fix unused variable warning for phys_l1 on non-AVX512 builds
libeigen/eigen!2154

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-18 20:26:28 -08:00
Rasmus Munk Larsen
3c86a013b1 Vectorize generic trsmKernelR for non-AVX512 targets
libeigen/eigen!2135

Closes #3027

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-18 17:34:31 -08:00
Steve Bronder
43a01f06ad update AVX and AVX512 to support gcc < 10.1 and clang < 10
libeigen/eigen!2129

Closes #3021
2026-02-18 22:07:24 +00:00
Rasmus Munk Larsen
552ca8f15f Simplify GEBP micro-kernel and improve blocking heuristics
libeigen/eigen!2142

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-18 13:16:14 -08:00
Rasmus Munk Larsen
e953f1e504 Modernize C++14 usage and minor optimizations in Core
libeigen/eigen!2143

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
Co-authored-by: Rasmus Munk Larsen <rmlarsen@google.com>
2026-02-18 12:47:51 -08:00
Rasmus Munk Larsen
f69745b678 Fix real x complex GEMM for backends where half == full packet size
libeigen/eigen!2150

Closes #3028

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-18 12:32:24 -08:00
Rasmus Munk Larsen
073190be04 Fix outdated documentation across multiple .dox files
libeigen/eigen!2148

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-18 12:23:41 -08:00
Rasmus Munk Larsen
bdec88009d Remove const from return-by-value types (issue #1087)
libeigen/eigen!2144

Closes #1087

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-18 03:10:11 -08:00
Rasmus Munk Larsen
3108f6360e Migrate Eigen benchmarks to the Google benchmark framework
libeigen/eigen!2132

Closes #3025

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-17 20:51:36 -08:00
Rasmus Munk Larsen
740cac97b4 Fix AVX double-precision trig and complex exp without AVX2
libeigen/eigen!2147

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-17 19:48:16 -08:00
Rasmus Munk Larsen
50d6d92a70 Optimize sparse-dense product by bypassing InnerIterator for compressed storage
libeigen/eigen!2134

Closes #3026

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-17 19:19:18 -08:00
Rasmus Munk Larsen
b6b2f31ba8 Fix compiler warnings from GCC 13 and Clang 18
libeigen/eigen!2146

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-17 10:09:39 -08:00
Rasmus Munk Larsen
113207a9de Optimize JacobiSVD 2x2 kernel and hoist sweep threshold
libeigen/eigen!2139

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-16 15:39:38 -08:00
Rasmus Munk Larsen
e6e5b5c4c8 Fix pexp_complex for complex<double> (issue #3022)
libeigen/eigen!2140

Closes #3022

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
2026-02-16 15:30:31 -08:00
Rasmus Munk Larsen
2b561f9284 Revert "Specialized enable_borrowed_ranges for VectorwiseOp class range iteration"
This reverts merge request !2127
2026-02-16 02:12:28 -08:00
Blake
d0654a201b Specialized enable_borrowed_ranges for VectorwiseOp class range iteration
libeigen/eigen!2127

Closes #2882
2026-02-15 07:31:33 -08:00
Antonio Sánchez
1a2b80727c Fix pdiv for complex packets involving infinites.
libeigen/eigen!2131
2026-02-14 17:47:32 -08:00
Blake
9b709e8269 Diagonalview example typo
libeigen/eigen!2130
2026-02-12 21:12:11 -08:00
Blake
23fcc1c6c9 MatrixBase::diagonalView issue 604
libeigen/eigen!2126

Closes #604
2026-02-10 02:12:03 +00:00
Antonio Sánchez
004d81a852 Fix cblat3/zblat3 test program with gfortran.
libeigen/eigen!2122
2026-02-09 17:50:57 -08:00
Chip Kerchner
0ac2a2df9f Prevent predux_half for DoublePacket from accidentally catching complex Packets of size >= 16
libeigen/eigen!2125
2026-02-08 10:19:45 -08:00
Antonio Sánchez
4d05fcf8da Fix packetmath tests on M* macs.
libeigen/eigen!2120
2026-02-08 10:07:24 -08:00
Blake
752911927f betainc edge case checks at start of calculation
libeigen/eigen!2123

Closes #2359
2026-02-08 10:05:06 -08:00
Antonio Sánchez
afb4380534 Fix RunQueue race condition on weak memory architectures (ARM64)
libeigen/eigen!2121
2026-02-06 02:27:08 +00:00
YJ Chang
c648296368 Update HVX floating-point reduction to support V79 architecture.
libeigen/eigen!2124
2026-02-04 16:39:51 +00:00
Sean Talts
ddfc68d399 Fix clang vector backend type compatibility issues.
libeigen/eigen!2116
2026-01-29 17:17:03 +00:00
mehmet alper kuyumcu
93ff388841 Fix relative tolerance scaling by multiplying with RHS norm in BiCGSTAB
libeigen/eigen!2118
2026-01-29 16:59:38 +00:00
Blake
26c242ab58 make EIGEN_BLAS macro names consistent and undef at end of file
libeigen/eigen!2119

Closes #2954
2026-01-29 16:50:27 +00:00
Charles Schlosser
3d6f5fe8fe Tests: skip denorms in ARM ieee tests
libeigen/eigen!2115
2026-01-27 17:43:19 +00:00
Charles Schlosser
fdfdd4c96b test suite: emit the function name when an ieee test fails
libeigen/eigen!2114
2026-01-22 02:32:38 +00:00
Charles Schlosser
e246f9cb68 Use memset if !NumTraits<Scalar>::RequireInitialization
libeigen/eigen!2113

Closes #3019
2026-01-22 01:01:26 +00:00
Antonio Sánchez
f46a2c561e Fix bad static access for TensorDeviceGpu.
libeigen/eigen!2111
2026-01-20 19:12:53 +00:00
Simon Merkle
c09151a2c2 Wrote resizing documentation page
libeigen/eigen!2110

Co-authored-by: Simon Merkle <st172506@stud.uni-stuttgart.de>
2026-01-19 08:29:52 -08:00
Charles Schlosser
f7772e3946 Gcc warnings
libeigen/eigen!2109
2026-01-18 23:41:20 +00:00
Antonio Sánchez
918a5f1a6f Fix warnings related to variable_if_dynamic.
libeigen/eigen!2107

Closes #2807
2026-01-16 19:47:14 +00:00
Antonio Sánchez
9a37aca9fc Fix assignment size assertion for EIGEN_NO_AUTOMATIC_RESIZING.
libeigen/eigen!2108

Closes #3018
2026-01-15 19:04:53 +00:00
Yu You
251bff2885 CUDA 13 compatibility update for unit test gpu_basic
libeigen/eigen!2106
2026-01-09 22:42:33 +00:00
Yu You
0315fb319a Change inline hint for general_matrix_vector_product<>::run() to gain performance
libeigen/eigen!2092
2026-01-09 19:46:37 +00:00
Chip Kerchner
7aea350ba1 Fix more packetmath issues for RVV
libeigen/eigen!2105
2026-01-09 12:16:28 -05:00
Chip Kerchner
5d9beb81ab Initial version of reactivating RVV features like GeneralBlockPanelKernel
libeigen/eigen!2096
2026-01-07 13:41:02 -05:00
Charles Schlosser
d90a0534be fix polynomialsolver test failures
libeigen/eigen!2104
2026-01-05 05:19:49 +00:00
Martin Diehl
711118b747 docs does not exists
libeigen/eigen!2103
2026-01-03 00:57:18 +00:00
Charles Schlosser
c30af8f3db fix UB in random implementation and tests
libeigen/eigen!2102
2025-12-31 03:57:04 +00:00
srpgilles
c5aa40675a Fix check_that_free_is_allowed so that it properly checks is_free_allowed and not is_malloc_allowed
libeigen/eigen!2101

Co-authored-by: Sébastien Gilles <sebastien.gilles@inria.fr>
2025-12-30 15:20:19 +00:00
Antonio Sánchez
5793499a55 Fix AVX512FP16 build.
libeigen/eigen!2100

Closes #3013
2025-12-29 18:31:48 +00:00
Charles Schlosser
2ac496ff8a Revert !1953 and !1954
libeigen/eigen!2099

Closes #3011
2025-12-28 21:28:42 +00:00
Antonio Sánchez
9164d3f16a Fix undefined behavior in packetmath.
libeigen/eigen!2098

Closes #3009
2025-12-18 21:08:52 +00:00
Cédric Hubert
748e0a6517 Add missing semicolon
libeigen/eigen!2097
2025-12-18 08:49:11 -05:00
Nicholas Vinson
fe973ab0c5 Force early evaluation of boost expressions.
libeigen/eigen!2094
2025-12-16 19:55:59 +00:00
Guilhem Saurel
976f15ebca fix doc generation with doxygen 1.14 & 1.15
libeigen/eigen!2095

Closes #2976
2025-12-16 19:54:18 +00:00
Chip Kerchner
4f14da11d9 Add basic support for packetmath for BF16 RVV
libeigen/eigen!2093
2025-12-16 14:25:46 -05:00
Chip Kerchner
21e4582d17 Merge remote-tracking branch 'refs/remotes/origin/master' 2025-12-15 15:35:58 +00:00
Yu You
a7209fad70 GemmKernel: Define static constexpr member variables out-of-class for C++14 compatibility
libeigen/eigen!2091
2025-12-14 01:00:12 +00:00
Chip Kerchner
cdc62b84c7 Merge remote-tracking branch 'origin2/master' 2025-12-12 16:15:56 +00:00
Chip Kerchner
26fe567dd2 Fix FP16 for RVV so that it will compile for gcc
libeigen/eigen!2090
2025-12-10 08:42:26 -05:00
Chip Kerchner
afbf8173dd Merge remote-tracking branch 'origin2/master' 2025-12-10 03:22:29 +00:00
Gregory Meyer
9b00db8cb9 Simplify thread-safe initialization of GpuDeviceProperties.
libeigen/eigen!2089
2025-12-09 18:36:45 +00:00
Chip Kerchner
8cdc0fa67d Fix naming of predux_half for RVV when LMUL > 1
libeigen/eigen!2087
2025-12-05 13:50:16 -05:00
Chip Kerchner
f610edadcc Merge remote-tracking branch 'origin2/master' 2025-12-05 17:19:56 +00:00
Rasmus Munk Larsen
75bcd155c4 Vectorize tan(x)
libeigen/eigen!2086

Co-authored-by: Rasmus Munk Larsen <rmlarsen@google.com>
2025-12-02 21:53:10 +00:00
Antonio Sánchez
01a919d13f Fix AOCL cmake issues.
libeigen/eigen!2084
2025-12-01 03:32:22 +00:00
Ulysses Apokin
a73501cc76 Added versioning for shared libraries.
libeigen/eigen!2080

Co-authored-by: Ulysses Apokin <ulysses@altlinux.org>
2025-11-27 22:18:42 +00:00
Rasmus Munk Larsen
db90c4939c Add a ptanh_float implementation that is accurate to 1 ULP
libeigen/eigen!2082

Co-authored-by: Rasmus Munk Larsen <rmlarsen@google.com>
2025-11-26 00:17:12 +00:00
Antonio Sánchez
48eb5227c8 Add BLAS function axpby.
libeigen/eigen!2083
2025-11-25 23:13:02 +00:00
Antonio Sánchez
a1eeb02204 Expand CMake compatibility range for single-version specifications.
libeigen/eigen!2081

Closes #3004
2025-11-25 02:42:03 +00:00
sharad bhaskar
8a1083e9bf Aocl integration updated
libeigen/eigen!1952
2025-11-24 17:20:42 +00:00
Chip Kerchner
5aefbab777 Merge remote-tracking branch 'origin2/master' 2025-11-21 12:56:47 +00:00
Rasmus Munk Larsen
a6630c53c1 Fix bug introduced in !2030
libeigen/eigen!2079

Co-authored-by: Rasmus Munk Larsen <rmlarsen@google.com>
2025-11-20 19:29:19 -05:00
Chip Kerchner
3ff3d03783 Merge remote-tracking branch 'origin2/master' 2025-11-20 17:43:17 +00:00
Chip Kerchner
49623d0c4e This patch adds support for RISCV's vector extension RVV1.0.
libeigen/eigen!2030
2025-11-20 16:28:07 +00:00
Chip Kerchner
196eed3d62 Merge branch 'master' of https://gitlab.com/libeigen/eigen 2025-11-20 15:45:06 +00:00
Rasmus Munk Larsen
8eb6551a8a Add support for complex numbers in the generic clang backend
libeigen/eigen!2078

Co-authored-by: Rasmus Munk Larsen <rmlarsen@google.com>
2025-11-20 00:26:37 +00:00
Chip Kerchner
1242d948dd Merge remote-tracking branch 'origin2/master' 2025-11-18 12:59:58 +00:00
Joseph Prince Mathew
8401a241cb Add summary to lldb pretty printing of Eigen::Matrix
libeigen/eigen!2016

Co-authored-by: Joseph Prince Mathew <jmathew@dbuoy.com>
2025-11-17 17:24:03 +00:00
Eric A. Borisch
e75c29fd9d EigenTesting.cmake: Quote argument to separate_arguments.
libeigen/eigen!2077

Closes #3005 and #2866
2025-11-17 17:22:44 +00:00
Chip Kerchner
38e2b94367 Merge remote-tracking branch 'origin' 2025-11-14 00:00:35 +00:00
Yu You
dcbaf2d608 Switch the inline hint to EIGEN_ALWAYS_INLINE for a few functions
libeigen/eigen!2076

Closes #2993
2025-11-13 03:58:53 +00:00
Rasmus Munk Larsen
a7674b70d3 Improve packet op test coverage for IEEE special values.
libeigen/eigen!2075

Co-authored-by: Rasmus Munk Larsen <rmlarsen@google.com>
2025-11-12 22:19:50 +00:00
Chip Kerchner
26dc851a72 Merge remote-tracking branch 'origin' 2025-11-12 15:08:17 +00:00
Charles Schlosser
72bfca3d82 cxx11_tensor_expr.cpp: delete extraneous semicolon
libeigen/eigen!2074
2025-11-11 01:39:38 +00:00
Rasmus Munk Larsen
9b511fe4fe Fix cxx11_tensor_expr.cpp 2025-11-10 19:11:35 +00:00
Chaofan Qiu
943fdc71c6 Use more FMA in reciprocal iteration for precision
libeigen/eigen!2073
2025-11-10 18:36:11 +00:00
Charles Schlosser
1133aa82c7 fix various compiler warnings
libeigen/eigen!2072
2025-11-10 17:14:35 +00:00
Charles Schlosser
8ae3b1aaa5 Fix loongarch unsigned pabsdiff
libeigen/eigen!2071
2025-11-09 19:19:43 +00:00
Rasmus Munk Larsen
035cf68498 Fix build of realview.cpp 2025-11-08 23:19:54 +00:00
Rasmus Munk Larsen
23a5482fc0 Misc. packet math cleanups.
libeigen/eigen!2070

Co-authored-by: Rasmus Munk Larsen <rmlarsen@google.com>
2025-11-08 21:57:20 +00:00
Antonio Sánchez
4cb0776f8e Add 5.0.1 release notes and a few unreleased features.
libeigen/eigen!2069
2025-11-08 20:51:44 +00:00
Charles Schlosser
8b85f5933a Fix realview
libeigen/eigen!2062
2025-11-08 13:36:43 +00:00
Rasmus Munk Larsen
ffcd7bdbd6 Avoid breaking the build on older compilers.
See merge request libeigen/eigen!2068

Co-authored-by: Rasmus Munk Larsen <rmlarsen@google.com>
2025-11-07 21:25:09 +00:00
Antonio Sánchez
da867c31c9 Fix defines in AVX512 custom TRSM kernel.
<!-- 
Thanks for contributing a merge request!

We recommend that first-time contributors read our [contribution guidelines](https://eigen.tuxfamily.org/index.php?title=Contributing_to_Eigen).

Before submitting the MR, please complete the following checks:
- Create one PR per feature or bugfix,
- Run the test suite to verify your changes.
  See our [test guidelines](https://eigen.tuxfamily.org/index.php?title=Tests).
- Add tests to cover the bug addressed or any new feature.
- Document new features.  If it is a substantial change, add it to the [Changelog](https://gitlab.com/libeigen/eigen/-/blob/master/CHANGELOG.md).
- Leave the following box checked when submitting: `Allow commits from members who can merge to the target branch`.
  This allows us to rebase and merge your change.

Note that we are a team of volunteers; we appreciate your patience during the review process.
-->

### Description
<!--Please explain your changes.-->

Broken at head by !2063.

See merge request libeigen/eigen!2066
2025-11-07 20:14:24 +00:00
Rasmus Munk Larsen
8a9bfb72d7 Rename preduce_half for HVX. 2025-11-07 16:52:07 +00:00
Chip Kerchner
332bfa95c4 Merge remote-tracking branch 'origin/master' 2025-11-07 14:51:14 +00:00
Antonio Sánchez
ed989c7504 Enable generic clang backend tests.
<!-- 
Thanks for contributing a merge request!

We recommend that first-time contributors read our [contribution guidelines](https://eigen.tuxfamily.org/index.php?title=Contributing_to_Eigen).

Before submitting the MR, please complete the following checks:
- Create one PR per feature or bugfix,
- Run the test suite to verify your changes.
  See our [test guidelines](https://eigen.tuxfamily.org/index.php?title=Tests).
- Add tests to cover the bug addressed or any new feature.
- Document new features.  If it is a substantial change, add it to the [Changelog](https://gitlab.com/libeigen/eigen/-/blob/master/CHANGELOG.md).
- Leave the following box checked when submitting: `Allow commits from members who can merge to the target branch`.
  This allows us to rebase and merge your change.

Note that we are a team of volunteers; we appreciate your patience during the review process.
-->

### Description
<!--Please explain your changes.-->

Enable generic clang backend tests.

Added an AVX512 job using the generic clang backend.

Also fixed up some guards in the custom AVX512 gemm/trsm kernels so they don't
start defining things if they aren't used.

See merge request libeigen/eigen!2063
2025-11-07 01:37:12 +00:00
Rasmus Munk Larsen
3368ac6c69 Don't set platform-specific vectorization macros for generic backend.
See merge request libeigen/eigen!2065

Co-authored-by: Rasmus Munk Larsen <rmlarsen@google.com>
2025-11-06 23:12:54 +00:00
Rasmus Munk Larsen
fecfa7f27e Fixes to make generic backend build with AVX512
See merge request libeigen/eigen!2064

Co-authored-by: Rasmus Munk Larsen <rmlarsen@google.com>
2025-11-06 22:50:32 +00:00
Rasmus Munk Larsen
ec93a6d098 Add a generic Eigen backend based on clang vector extensions
The goal of this MR is to implement a generic SIMD backend (packet ops) for Eigen that uses clang vector extensions instead of platform-dependent intrinsics. Ideally, this should make it possible to build Eigen and achieve reasonable speed on any platform that has a recent clang compiler, without having to write any inline assembly or intrinsics.

Caveats:

* The current implementation is a proof of concept and supports vectorization for float, double, int32_t, and int64_t using fixed-size 512-bit vectors (a somewhat arbitrary choice). I have not done much to tune this for speed yet.
* For now, there is no way to enable this other than setting -DEIGEN_VECTORIZE_GENERIC on the command line.
* This only compiles with newer versions of clang. I have tested that it compiles and all tests pass with clang 19.1.7.

https://clang.llvm.org/docs/LanguageExtensions.html#vectors-and-extended-vectors

Closes #2998 and #2997

See merge request libeigen/eigen!2051

Co-authored-by: Rasmus Munk Larsen <rmlarsen@google.com>
Co-authored-by: Antonio Sánchez <cantonios@google.com>
2025-11-06 21:52:19 +00:00
Rasmus Munk Larsen
7c7d84735e Align temporary array in TensorSelectOp packet evaluator. 2025-11-05 19:44:47 +00:00
Antonio Sánchez
142caf889c Fix MKL enum conversion warning.
<!-- 
Thanks for contributing a merge request!

We recommend that first-time contributors read our [contribution guidelines](https://eigen.tuxfamily.org/index.php?title=Contributing_to_Eigen).

Before submitting the MR, please complete the following checks:
- Create one PR per feature or bugfix,
- Run the test suite to verify your changes.
  See our [test guidelines](https://eigen.tuxfamily.org/index.php?title=Tests).
- Add tests to cover the bug addressed or any new feature.
- Document new features.  If it is a substantial change, add it to the [Changelog](https://gitlab.com/libeigen/eigen/-/blob/master/CHANGELOG.md).
- Leave the following box checked when submitting: `Allow commits from members who can merge to the target branch`.
  This allows us to rebase and merge your change.

Note that we are a team of volunteers; we appreciate your patience during the review process.
-->

### Description
<!--Please explain your changes.-->

Fix MKL enum conversion warning.

### Reference issue
<!--
You can link to a specific issue using the gitlab syntax #<issue number>. 
If the MR fixes an issue, write "Fixes #<issue number>" to have the issue automatically closed on merge.
-->
Fixes #2999.

Closes #2999

See merge request libeigen/eigen!2061
2025-11-05 18:03:22 +00:00
Antonio Sánchez
9e5714b93b Remove deprecated CUDA device properties.
<!-- 
Thanks for contributing a merge request!

We recommend that first-time contributors read our [contribution guidelines](https://eigen.tuxfamily.org/index.php?title=Contributing_to_Eigen).

Before submitting the MR, please complete the following checks:
- Create one PR per feature or bugfix,
- Run the test suite to verify your changes.
  See our [test guidelines](https://eigen.tuxfamily.org/index.php?title=Tests).
- Add tests to cover the bug addressed or any new feature.
- Document new features.  If it is a substantial change, add it to the [Changelog](https://gitlab.com/libeigen/eigen/-/blob/master/CHANGELOG.md).
- Leave the following box checked when submitting: `Allow commits from members who can merge to the target branch`.
  This allows us to rebase and merge your change.

Note that we are a team of volunteers; we appreciate your patience during the review process.
-->

### Description
<!--Please explain your changes.-->

Remove deprecated CUDA device properties.

### Reference issue
<!--
You can link to a specific issue using the gitlab syntax #<issue number>. 
If the MR fixes an issue, write "Fixes #<issue number>" to have the issue automatically closed on merge.
-->
Fixes #3000.

Closes #3000

See merge request libeigen/eigen!2060
2025-11-05 17:12:33 +00:00
Tyler Veness
06f5cb4878 Use wrapper macro for multidimensional subscript feature test
See merge request libeigen/eigen!2059
2025-11-04 22:26:27 +00:00
Rasmus Munk Larsen
63fc0bc8c1 Make TernarySelectOp immune to const differences.
See merge request libeigen/eigen!2058

Co-authored-by: Rasmus Munk Larsen <rmlarsen@google.com>
2025-11-04 21:42:32 +00:00
Rasmus Munk Larsen
71703a9816 Make assume_aligned a no-op on ARM & ARM64 when msan is used, to work around a missing linker symbol. 2025-11-04 20:26:36 +00:00
Tyler Veness
f95b4698fc Add support for C++23 multidimensional subscript operator
I'm not sure where to put tests for this, assuming they're needed. They also wouldn't run in CI anyway since CI only exercises the C++17 codepaths.

See merge request libeigen/eigen!2053
2025-11-04 07:03:04 +00:00
Rasmus Munk Larsen
b6fcddccfc Get rid of pblend packet op.
There was only a single code path left in TensorEvaluator using pblend. We can replace that with a call to the more general TernarySelectOp and get rid of pblend entirely from Core.

Closes #2998

See merge request libeigen/eigen!2056

Co-authored-by: Rasmus Munk Larsen <rmlarsen@google.com>
2025-11-03 23:27:50 +00:00
Rasmus Munk Larsen
ed9a0e59ba Fix more bugs in !2052
Fixes #2998

Closes #2998

See merge request libeigen/eigen!2057

Co-authored-by: Rasmus Munk Larsen <rmlarsen@google.com>
2025-11-03 20:26:17 +00:00
Rasmus Munk Larsen
a20fc40e4e Revert "simplify squaredNorm"
This causes some subtle alignment-related bugs, which @chuckyschluz is currently investigating.

See merge request libeigen/eigen!2055
2025-11-03 18:59:51 +00:00
Antonio Sánchez
04eb06b354 Fix doc references for nullary expressions.
<!-- 
Thanks for contributing a merge request!

We recommend that first-time contributors read our [contribution guidelines](https://eigen.tuxfamily.org/index.php?title=Contributing_to_Eigen).

Before submitting the MR, please complete the following checks:
- Create one PR per feature or bugfix,
- Run the test suite to verify your changes.
  See our [test guidelines](https://eigen.tuxfamily.org/index.php?title=Tests).
- Add tests to cover the bug addressed or any new feature.
- Document new features.  If it is a substantial change, add it to the [Changelog](https://gitlab.com/libeigen/eigen/-/blob/master/CHANGELOG.md).
- Leave the following box checked when submitting: `Allow commits from members who can merge to the target branch`.
  This allows us to rebase and merge your change.

Note that we are a team of volunteers; we appreciate your patience during the review process.
-->

### Description
<!--Please explain your changes.-->

Fix doc references for nullary expressions.

### Reference issue
<!--
You can link to a specific issue using the gitlab syntax #<issue number>. 
If the MR fixes an issue, write "Fixes #<issue number>" to have the issue automatically closed on merge.
-->

Fixes #2997.

### Additional information
<!--Any additional information you think is important.-->

Closes #2997

See merge request libeigen/eigen!2054
2025-11-03 18:47:04 +00:00
Rasmus Munk Larsen
bfdbc031c2 Fixes #2998. 2025-11-02 23:58:16 +00:00
Rasmus Munk Larsen
8716f109e4 Implement assume_aligned using the standard API
This implements `Eigen::internal::assume_aligned` to match the API for C++20 standard as best as possible using either `std::assume_aligned` or `__builtin_assume_aligned` if available. If neither is available, the function is a no-op.

The override macro `EIGEN_ASSUME_ALIGNED` was changed to a `EIGEN_DONT_ASSUME_ALIGNED`, which now forces the function to be a no-op.

See merge request libeigen/eigen!2052
2025-11-01 12:04:19 +00:00
Rasmus Munk Larsen
ce70a507c0 Enable more generic packet ops for double.
See merge request libeigen/eigen!2050
2025-10-30 19:14:43 +00:00
Charles Schlosser
fb5bb3e98f simplify squaredNorm
<!-- 
Thanks for contributing a merge request!

We recommend that first-time contributors read our [contribution guidelines](https://eigen.tuxfamily.org/index.php?title=Contributing_to_Eigen).

Before submitting the MR, please complete the following checks:
- Create one PR per feature or bugfix,
- Run the test suite to verify your changes.
  See our [test guidelines](https://eigen.tuxfamily.org/index.php?title=Tests).
- Add tests to cover the bug addressed or any new feature.
- Document new features.  If it is a substantial change, add it to the [Changelog](https://gitlab.com/libeigen/eigen/-/blob/master/CHANGELOG.md).
- Leave the following box checked when submitting: `Allow commits from members who can merge to the target branch`.
  This allows us to rebase and merge your change.

Note that we are a team of volunteers; we appreciate your patience during the review process.
-->

### Description
<!--Please explain your changes.-->
My review of https://gitlab.com/libeigen/eigen/-/merge_requests/2048 reminded me there was a much easier and better way of doing this for complex arrays.


### Reference issue
<!--
You can link to a specific issue using the gitlab syntax #<issue number>. 
If the MR fixes an issue, write "Fixes #<issue number>" to have the issue automatically closed on merge.
-->

### Additional information
<!--Any additional information you think is important.-->

See merge request libeigen/eigen!2049
2025-10-30 02:51:15 +00:00
Rasmus Munk Larsen
ece9a4c0b6 Always vectorize abs2() for non-complex types.
For several packet types, `abs2` was not vectorized even if it only requires `pmul`. Get rid of the confusing and redundant `HasAbs2` enum and instead check `HasMul` in addition to making sure the scalar type is not complex.

See merge request libeigen/eigen!2048
2025-10-30 02:42:56 +00:00
Antonio Sánchez
60122df698 Allow user to configure if free is allowed at runtime.
<!-- 
Thanks for contributing a merge request!

We recommend that first-time contributors read our [contribution guidelines](https://eigen.tuxfamily.org/index.php?title=Contributing_to_Eigen).

Before submitting the MR, please complete the following checks:
- Create one PR per feature or bugfix,
- Run the test suite to verify your changes.
  See our [test guidelines](https://eigen.tuxfamily.org/index.php?title=Tests).
- Add tests to cover the bug addressed or any new feature.
- Document new features.  If it is a substantial change, add it to the [Changelog](https://gitlab.com/libeigen/eigen/-/blob/master/CHANGELOG.md).
- Leave the following box checked when submitting: `Allow commits from members who can merge to the target branch`.
  This allows us to rebase and merge your change.

Note that we are a team of volunteers; we appreciate your patience during the review process.
-->

### Description
<!--Please explain your changes.-->

Allow user to configure if `free` is allowed at runtime.

Reverts to Eigen 3.4 behavior by default, where `free(...)` is allowed if `EIGEN_RUNTIME_NO_MALLOC` is defined but `set_is_malloc_allowed(true)`.  Adds a separate `set_is_free_allowed(...)` to explicitly control use of `std::free`.

### Reference issue
<!--
You can link to a specific issue using the gitlab syntax #<issue number>. 
If the MR fixes an issue, write "Fixes #<issue number>" to have the issue automatically closed on merge.
-->

Fixes #2983.

### Additional information
<!--Any additional information you think is important.-->

Closes #2983

See merge request libeigen/eigen!2047
2025-10-28 22:29:00 +00:00
Chip Kerchner
add5e76204 Merge remote-tracking branch 'origin2/master' 2025-10-28 20:26:26 +00:00
Tyler Veness
9234883914 Fix SparseVector::insert(Index) assigning int to Scalar
Scalar doesn't necessarily support implicit construction from int or
assignment from int.

Here's the error message I got without this fix:
```
/home/tav/git/Sleipnir/build/_deps/eigen3-src/Eigen/src/SparseCore/SparseVector.h:180:25: error: no match for ‘operator=’ (operand types are ‘Eigen::internal::CompressedStorage<ExplicitDouble, int>::Scalar’ {aka ‘ExplicitDouble’} and ‘int’)
  180 |     m_data.value(p + 1) = 0;
      |     ~~~~~~~~~~~~~~~~~~~~^~~
```

See merge request libeigen/eigen!2046
2025-10-27 22:06:59 +00:00
Tyler Veness
be56fff1ff Fix ambiguous sqrt() overload caused by ADL
Here's the compiler error:
```
/home/tav/git/Sleipnir/build/_deps/eigen3-src/Eigen/src/Householder/Householder.h:82:16: error: call of overloaded ‘sqrt(boost::decimal::decimal64_t)’ is ambiguous
   82 |     beta = sqrt(numext::abs2(c0) + tailSqNorm);
      |            ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/tav/git/Sleipnir/build/_deps/eigen3-src/Eigen/src/Householder/Householder.h:82:16: note: there are 2 candidates
In file included from /home/tav/git/Sleipnir/build/_deps/eigen3-src/Eigen/Core:198,
                 from /home/tav/git/Sleipnir/test/src/optimization/cart_pole_problem_test.cpp:8:
/home/tav/git/Sleipnir/build/_deps/eigen3-src/Eigen/src/Core/MathFunctions.h:1384:75: note: candidate 1: ‘typename Eigen::internal::sqrt_retval<typename Eigen::internal::global_math_functions_filtering_base<Scalar>::type>::type Eigen::numext::sqrt(const Scalar&) [with Scalar = boost::decimal::decimal64_t; typename Eigen::internal::sqrt_retval<typename Eigen::internal::global_math_functions_filtering_base<Scalar>::type>::type = boost::decimal::decimal64_t; typename Eigen::internal::global_math_functions_filtering_base<Scalar>::type = boost::decimal::decimal64_t]’
 1384 | EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE EIGEN_MATHFUNC_RETVAL(sqrt, Scalar) sqrt(const Scalar& x) {
      |                                                                           ^~~~
In file included from /home/tav/git/Sleipnir/build/_deps/decimal-src/include/boost/decimal/detail/cmath/ellint_1.hpp:16,
                 from /home/tav/git/Sleipnir/build/_deps/decimal-src/include/boost/decimal/cmath.hpp:18,
                 from /home/tav/git/Sleipnir/build/_deps/decimal-src/include/boost/decimal.hpp:33,
                 from /home/tav/git/Sleipnir/test/include/scalar_types_under_test.hpp:6,
                 from /home/tav/git/Sleipnir/test/src/optimization/cart_pole_problem_test.cpp:19:
/home/tav/git/Sleipnir/build/_deps/decimal-src/include/boost/decimal/detail/cmath/sqrt.hpp:167:16: note: candidate 2: ‘constexpr T boost::decimal::sqrt(T) requires  is_decimal_floating_point_v<T> [with T = decimal64_t]’
  167 | constexpr auto sqrt(const T val) noexcept
      |                ^~~~
```

Calling a function via its unqualified name invokes argument-dependent lookup. In this case, since `using numext::sqrt;` was used, both `numext::sqrt()` and `boost::decimal::sqrt()` participated in overload resolution. Since only `numext::sqrt()` was intended, the fix is to call that overload directly instead.

See merge request libeigen/eigen!2044
2025-10-26 02:03:22 +00:00
Rasmus Munk Larsen
2e91853adf Fix a benign bug in ComplexQZ
ComplexQZ would try to apply a Jacobi rotation to an empty block, which triggers a warning in static analyzers, since the corresponding `Eigen::Map` object will contain a `nullptr`.

See merge request libeigen/eigen!2043
2025-10-24 20:54:54 +00:00
Antonio Sánchez
1a5eecd45e Clarify range spanning major versions only works with 3.4.1.
<!-- 
Thanks for contributing a merge request!

We recommend that first-time contributors read our [contribution guidelines](https://eigen.tuxfamily.org/index.php?title=Contributing_to_Eigen).

Before submitting the MR, please complete the following checks:
- Create one PR per feature or bugfix,
- Run the test suite to verify your changes.
  See our [test guidelines](https://eigen.tuxfamily.org/index.php?title=Tests).
- Add tests to cover the bug addressed or any new feature.
- Document new features.  If it is a substantial change, add it to the [Changelog](https://gitlab.com/libeigen/eigen/-/blob/master/CHANGELOG.md).
- Leave the following box checked when submitting: `Allow commits from members who can merge to the target branch`.
  This allows us to rebase and merge your change.

Note that we are a team of volunteers; we appreciate your patience during the review process.
-->

### Description
<!--Please explain your changes.-->

Clarify range spanning major versions only works with 3.4.1.

### Reference issue
<!--
You can link to a specific issue using the gitlab syntax #<issue number>. 
If the MR fixes an issue, write "Fixes #<issue number>" to have the issue automatically closed on merge.
-->

Fixes #2994.

Closes #2994

See merge request libeigen/eigen!2042
2025-10-24 19:54:27 +00:00
Antonio Sánchez
b4209fe984 Eliminate use of std::cout in ArpackSelfAdjointEigenSolver.
<!-- 
Thanks for contributing a merge request!

We recommend that first-time contributors read our [contribution guidelines](https://eigen.tuxfamily.org/index.php?title=Contributing_to_Eigen).

Before submitting the MR, please complete the following checks:
- Create one PR per feature or bugfix,
- Run the test suite to verify your changes.
  See our [test guidelines](https://eigen.tuxfamily.org/index.php?title=Tests).
- Add tests to cover the bug addressed or any new feature.
- Document new features.  If it is a substantial change, add it to the [Changelog](https://gitlab.com/libeigen/eigen/-/blob/master/CHANGELOG.md).
- Leave the following box checked when submitting: `Allow commits from members who can merge to the target branch`.
  This allows us to rebase and merge your change.

Note that we are a team of volunteers; we appreciate your patience during the review process.
-->

### Description
<!--Please explain your changes.-->

Eliminate use of std::cout in ArpackSelfAdjointEigenSolver.

Instead set the appropriate error status on failure.

### Reference issue
<!--
You can link to a specific issue using the gitlab syntax #<issue number>. 
If the MR fixes an issue, write "Fixes #<issue number>" to have the issue automatically closed on merge.
-->

### Additional information
<!--Any additional information you think is important.-->

See merge request libeigen/eigen!2041
2025-10-24 19:46:57 +00:00
Tyler Veness
ac3ef16f30 Fix SparseVector::insertBack() with custom scalar types
It fixes this compiler error:
```
/home/tav/git/Sleipnir/build/_deps/eigen3-src/Eigen/src/SparseCore/SparseVector.h:143:19: error: cannot convert ‘int’ to ‘const Eigen::internal::CompressedStorage<boost::decimal::decimal64_t, int>::Scalar&’ {aka ‘const boost::decimal::decimal64_t&’}
  143 |     m_data.append(0, i);
      |                   ^
      |                   |
      |                   int
```

This change matches what SparseMatrix does:
https://gitlab.com/libeigen/eigen/-/blob/master/Eigen/src/SparseCore/SparseMatrix.h#L430-L438

See merge request libeigen/eigen!2040
2025-10-23 07:03:37 +00:00
Charles Schlosser
40da5b64ce CI enhancements: visual indication of flaky tests
<!-- 
Thanks for contributing a merge request! Please name and fully describe your MR as you would for a commit message.
If the MR fixes an issue, please include "Fixes #issue" in the commit message and the MR description.

In addition, we recommend that first-time contributors read our [contribution guidelines](https://eigen.tuxfamily.org/index.php?title=Contributing_to_Eigen) and [git page](https://eigen.tuxfamily.org/index.php?title=Git), which will help you submit a more standardized MR.

Before submitting the MR, you also need to complete the following checks:
- Make one PR per feature/bugfix (don't mix multiple changes into one PR). Avoid committing unrelated changes.
- Rebase before committing
- For code changes, run the test suite (at least the tests that are likely affected by the change).
  See our [test guidelines](https://eigen.tuxfamily.org/index.php?title=Tests).
- If possible, add a test (both for bug-fixes as well as new features)
- Make sure new features are documented

Note that we are a team of volunteers; we appreciate your patience during the review process.

Again, thanks for contributing! -->

### Reference issue
<!-- You can link to a specific issue using the gitlab syntax #<issue number>  -->

### What does this implement/fix?
<!--Please explain your changes.-->

Currently, we run each test 3 times to account for flaky tests. Sometimes, the test fails so quickly that the random seed is the same for the subsequent test, which fails the exact same way. 

This MR uses a nanosecond seed which resolves the issue described above. Now, if the test does not pass on the first attempt but passes on the retries, the gitlab job status will be yellow but still be treated as a pass in the ci/cd pipeline. Hopefully, this means we will get more passes and help us identify room for improvement.

### Additional information
<!--Any additional information you think is important.-->

See merge request libeigen/eigen!2025
2025-10-22 04:51:51 +00:00
Antonio Sánchez
8e60d4173c Support AVX for i686.
<!-- 
Thanks for contributing a merge request!

We recommend that first-time contributors read our [contribution guidelines](https://eigen.tuxfamily.org/index.php?title=Contributing_to_Eigen).

Before submitting the MR, please complete the following checks:
- Create one PR per feature or bugfix,
- Run the test suite to verify your changes.
  See our [test guidelines](https://eigen.tuxfamily.org/index.php?title=Tests).
- Add tests to cover the bug addressed or any new feature.
- Document new features.  If it is a substantial change, add it to the [Changelog](https://gitlab.com/libeigen/eigen/-/blob/master/CHANGELOG.md).
- Leave the following box checked when submitting: `Allow commits from members who can merge to the target branch`.
  This allows us to rebase and merge your change.

Note that we are a team of volunteers; we appreciate your patience during the review process.
-->

### Description
<!--Please explain your changes.-->

Support AVX for i686.

There was an existing work-around for windows.  Added the more generic
architecture comparison to also apply for linux.

### Reference issue
<!--
You can link to a specific issue using the gitlab syntax #<issue number>. 
If the MR fixes an issue, write "Fixes #<issue number>" to have the issue automatically closed on merge.
-->

Fixes #2991.

Closes #2991

See merge request libeigen/eigen!2037
2025-10-20 21:47:42 +00:00
Antonio Sánchez
2aa2ff2900 More ComplexQZ fixes.
<!-- 
Thanks for contributing a merge request!

We recommend that first-time contributors read our [contribution guidelines](https://eigen.tuxfamily.org/index.php?title=Contributing_to_Eigen).

Before submitting the MR, please complete the following checks:
- Create one PR per feature or bugfix,
- Run the test suite to verify your changes.
  See our [test guidelines](https://eigen.tuxfamily.org/index.php?title=Tests).
- Add tests to cover the bug addressed or any new feature.
- Document new features.  If it is a substantial change, add it to the [Changelog](https://gitlab.com/libeigen/eigen/-/blob/master/CHANGELOG.md).
- Leave the following box checked when submitting: `Allow commits from members who can merge to the target branch`.
  This allows us to rebase and merge your change.

Note that we are a team of volunteers; we appreciate your patience during the review process.
-->

### Description
<!--Please explain your changes.-->

More ComplexQZ fixes.

Extra semicolons are triggering some warnings and errors with `-Werror`.
Moved the `Sparse` import up to the umbrella header to avoid IWYU exports.

### Reference issue
<!--
You can link to a specific issue using the gitlab syntax #<issue number>. 
If the MR fixes an issue, write "Fixes #<issue number>" to have the issue automatically closed on merge.
-->

### Additional information
<!--Any additional information you think is important.-->

See merge request libeigen/eigen!2036
2025-10-20 21:09:53 +00:00
Chip Kerchner
f456635bfa Merge remote-tracking branch 'refs/remotes/origin/master' 2025-10-20 16:20:42 +00:00
Antonio Sánchez
f5907c5930 Fix commit references in changelog. 2025-10-18 23:48:30 +00:00
Antonio Sánchez
cc8748791c Include required headers with relative paths in ComplexQZ 2025-10-18 23:46:12 +00:00
Antonio Sanchez
73da4623b1 Try disabling the cache again for ROCm. 2025-10-17 15:17:33 -07:00
Antonio Sánchez
d739b9dc60 Set the merge request template to be default. 2025-10-17 22:16:57 +00:00
Antonio Sánchez
e77977e231 Set the merge request template to be default. 2025-10-17 22:06:46 +00:00
Chip Kerchner
745e019edc Merge remote-tracking branch 'refs/remotes/origin/master' 2025-10-17 15:29:54 +00:00
Ludwig Striet
4c8744774f Fixes #2987: delete unused variable steps 2025-10-16 13:30:48 +00:00
Charles Schlosser
d426838d01 fix complexqz Wpedantic warnings 2025-10-15 15:12:33 +00:00
Saran Tunyasuvunakool
db02f97850 Add a missing #include <version> to Core. 2025-10-15 15:10:30 +00:00
Rasmus Munk Larsen
da55dd1471 Cleanup: Move 2x2 real SVD into the Jacobi module where it naturally belongs. 2025-10-14 00:58:37 +00:00
Ludwig Striet
99f8512985 ComplexQZ 2025-10-13 17:35:03 +00:00
Antonio Sánchez
e1f1a608be Fix DLL builds and c++ lapack declarations. 2025-10-13 16:25:08 +00:00
Antonio Sánchez
3abaabb999 Streamline merge request and bug templates. 2025-10-12 22:19:03 +00:00
Antonio Sanchez
52358cb93b Grammar fix "must has" --> "must have". 2025-10-12 00:07:41 +00:00
Rasmus Munk Larsen
565db1c603 Optimize ApplyOnTheRight for Jacobi rotations when FMA is available 2025-10-12 00:04:19 +00:00
Antonio Sánchez
3bd0bfe0e0 Disable ROCm job cache. 2025-10-11 23:29:42 +00:00
Charlie Schlosser
cd4f989f8f assume_aligned uses bytes not bits 2025-10-10 14:08:10 -04:00
Antonio Sánchez
ac7c192e1b Add a bunch of useful scripts for planning releases. 2025-10-10 00:49:58 +00:00
Damiano Franzò
5bc944a3ef Fix jacobi svd for TriangularBase 2025-10-10 00:10:50 +00:00
Antonio Sánchez
dbe9e6961e Fix BLAS/LAPACK DLL usage on Windows. 2025-10-10 00:09:45 +00:00
Antonio Sánchez
ef3c5c1d1d Add workaround for using std::fma for scalar multiply-add. 2025-10-09 18:57:46 +00:00
Charles Schlosser
5996176b88 Fix alignment bug in avx pcast<Packet4l, Packet4d> 2025-10-09 02:50:42 +00:00
Laurenz
4bd382df56 Fix SSE PacketMath Compilation Error on QNX 2025-10-08 17:13:16 +00:00
Charles Schlosser
13bd14974d fix errors in windows builds and tests 2025-10-07 22:47:35 +00:00
Chip Kerchner
e9b178bfe2 Merge branch 'master' of https://gitlab.com/libeigen/eigen 2025-10-07 19:32:29 +00:00
Jeremy Nimmer
eea6587b0e Fix scalar_inner_product_op when binary ops return a different type 2025-10-05 22:51:50 +00:00
Rasmus Munk Larsen
7eaf9ae68d Add a method to SelfAdjointEigenSolver for computing the matrix exponential 2025-10-05 15:06:04 +00:00
Sergiu Deitsch
32b0f386bc Eliminate possible -Wstringop-overflow warning in .setZero() 2025-10-04 00:03:03 +02:00
Olav
1edf360e3c Fix line endings 2025-10-03 13:21:05 +02:00
Antonio Sánchez
ccde35bcd5 Update dev version number. 2025-10-01 22:58:44 +00:00
Guilhem Saurel
a67f9dabb0 tests: add missing link 2025-10-01 22:38:52 +00:00
Antonio Sánchez
e6792039fb Update changelog to reflect 3.4.1 and 5.0.0 releases. 2025-10-01 18:43:54 +00:00
Antonio Sánchez
4916887f2c Update geo_homogeneous test, add eval() to PermutationMatrix. 2025-10-01 18:01:11 +00:00
Eugene Zhulenev
5c1029be1a The 'CompressedStorageIterator<>' needs to satisfy the RandomAccessIterator 2025-09-30 16:28:41 +00:00
Charles Schlosser
f9f515fb55 get rid of a bunch of windows jobs 2025-09-30 01:44:48 +00:00
1029 changed files with 42520 additions and 45501 deletions

37
.clang-tidy Normal file
View File

@@ -0,0 +1,37 @@
---
# Conservative clang-tidy configuration for Eigen.
#
# Focuses on bug-finding checks with low false-positive rates.
# Intentionally omits style-enforcement checks (modernize-*, google-*,
# cppcoreguidelines-*) since Eigen has its own conventions and is a
# heavily-templated math library where many "modern C++" idioms don't apply.
Checks: >
-*,
bugprone-*,
-bugprone-narrowing-conversions,
-bugprone-easily-swappable-parameters,
-bugprone-implicit-widening-of-multiplication-result,
-bugprone-exception-escape,
misc-redundant-expression,
misc-unused-using-decls,
misc-misleading-identifier,
performance-for-range-copy,
performance-implicit-conversion-in-loop,
performance-unnecessary-copy-initialization,
performance-unnecessary-value-param,
readability-container-size-empty,
readability-duplicate-include,
readability-misleading-indentation,
readability-redundant-control-flow,
readability-redundant-smartptr-get,
WarningsAsErrors: ''
HeaderFilterRegex: 'Eigen/.*|test/.*|blas/.*|lapack/.*|unsupported/Eigen/.*'
# Eigen uses its own assert macros.
CheckOptions:
- key: bugprone-assert-side-effect.AssertMacros
value: 'eigen_assert,eigen_internal_assert,EIGEN_STATIC_ASSERT,VERIFY,VERIFY_IS_APPROX,VERIFY_IS_EQUAL,VERIFY_IS_MUCH_SMALLER_THAN,VERIFY_IS_NOT_APPROX,VERIFY_IS_NOT_EQUAL,VERIFY_IS_UNITARY,VERIFY_RAISES_ASSERT'
...

1
.gitignore vendored
View File

@@ -39,3 +39,4 @@ Makefile
!scripts/buildtests.in
!Eigen/Core
!Eigen/src/Core
CLAUDE.md

View File

@@ -7,10 +7,27 @@
# Public License v. 2.0. If a copy of the MPL was not distributed
# with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
default:
interruptible: true
# For MR pipelines, auto-cancel running jobs when new commits are pushed.
# For scheduled (nightly) pipelines, never auto-cancel so all jobs run to
# completion and all failures are visible for debugging.
workflow:
auto_cancel:
on_new_commit: interruptible
on_job_failure: none
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
auto_cancel:
on_new_commit: none
- when: always
stages:
- checkformat
- build
- test
- benchmark
- deploy
variables:
@@ -31,4 +48,5 @@ include:
- "/ci/build.windows.gitlab-ci.yml"
- "/ci/test.linux.gitlab-ci.yml"
- "/ci/test.windows.gitlab-ci.yml"
- "/ci/benchmark.gitlab-ci.yml"
- "/ci/deploy.gitlab-ci.yml"

View File

@@ -1,42 +1,37 @@
<!--
Please read this!
Thank you for submitting an issue!
Before opening a new issue, make sure to search for keywords in the issues
filtered by "bug::confirmed" or "bug::unconfirmed" and "bugzilla" label:
- https://gitlab.com/libeigen/eigen/-/issues?scope=all&utf8=%E2%9C%93&state=opened&label_name[]=bug%3A%3Aconfirmed
- https://gitlab.com/libeigen/eigen/-/issues?scope=all&utf8=%E2%9C%93&state=opened&label_name[]=bug%3A%3Aunconfirmed
- https://gitlab.com/libeigen/eigen/-/issues?scope=all&utf8=%E2%9C%93&state=opened&label_name[]=bugzilla
and verify the issue you're about to submit isn't a duplicate. -->
Before opening a new issue, please search for keywords in the existing [list of issues](https://gitlab.com/libeigen/eigen/-/issues?state=opened) to verify it isn't a duplicate.
-->
### Summary
<!-- Summarize the bug encountered concisely. -->
### Environment
<!-- Please provide your development environment here -->
<!-- Please provide your development environment. -->
- **Operating System** : Windows/Linux
- **Architecture** : x64/Arm64/PowerPC ...
- **Eigen Version** : 3.3.9
- **Compiler Version** : Gcc7.0
- **Eigen Version** : 5.0.0
- **Compiler Version** : gcc-12.0
- **Compile Flags** : -O3 -march=native
- **Vector Extension** : SSE/AVX/NEON ...
### Minimal Example
<!-- If possible, please create a minimal example here that exhibits the problematic behavior.
You can also link to [godbolt](https://godbolt.org). But please note that you need to click
the "Share" button in the top right-hand corner of the godbolt page where you reproduce the sample
code to get the share link instead of in your browser address bar.
<!--
Please create a minimal reproducing example here that exhibits the problematic behavior.
The example should be complete, in that it can fully build and run. See the [the guidelines on stackoverflow](https://stackoverflow.com/help/minimal-reproducible-example) for how to create a good minimal example.
You can read [the guidelines on stackoverflow](https://stackoverflow.com/help/minimal-reproducible-example)
on how to create a good minimal example. -->
You can also link to [godbolt](https://godbolt.org). Note that you need to click
the "Share" button in the top right-hand corner of the godbolt page to get the share link
instead of the URL in your browser address bar.
-->
```cpp
//show your code here
// Insert your code here.
```
### Steps to reproduce
<!-- Describe how one can reproduce the issue - this is very important. Please use an ordered list. -->
### Steps to reproduce the issue
<!-- Describe the necessary steps to reproduce the issue. -->
1. first step
2. second step
@@ -49,21 +44,16 @@ on how to create a good minimal example. -->
<!-- Describe what you should see instead. -->
### Relevant logs
<!-- Add relevant code snippets or program output within blocks marked by " ``` " -->
<!-- Add relevant build logs or program output within blocks marked by " ``` " -->
<!-- OPTIONAL: remove this section if you are not reporting a compilation warning issue.-->
### Warning Messages
<!-- Show us the warning messages you got! -->
<!-- OPTIONAL: remove this section if you are not reporting a performance issue. -->
### Benchmark scripts and results
### [Optional] Benchmark scripts and results
<!-- Please share any benchmark scripts - either standalone, or using [Google Benchmark](https://github.com/google/benchmark). -->
### Anything else that might help
<!-- It will be better to provide us more information to help narrow down the cause.
<!--
It will be better to provide us more information to help narrow down the cause.
Including but not limited to the following:
- lines of code that might help us diagnose the problem.
- potential ways to address the issue.
- last known working/first broken version (release number or commit hash). -->
- [ ] Have a plan to fix this issue.
- last known working/first broken version (release number or commit hash).
-->

View File

@@ -1,6 +1,13 @@
<!--
Thank you for submitting a Feature Request!
If you want to run ideas by the maintainers and the Eigen community first,
you can chat about them on the [Eigen Discord server](https://discord.gg/2SkEJGqZjR).
-->
### Describe the feature you would like to be implemented.
### Would such a feature be useful for other users? Why?
### Why Would such a feature be useful for other users?
### Any hints on how to implement the requested feature?

View File

@@ -0,0 +1,30 @@
<!--
Thanks for contributing a merge request!
We recommend that first-time contributors read our [contribution guidelines](https://eigen.tuxfamily.org/index.php?title=Contributing_to_Eigen).
Before submitting the MR, please complete the following checks:
- Create one PR per feature or bugfix,
- Run the test suite to verify your changes.
See our [test guidelines](https://eigen.tuxfamily.org/index.php?title=Tests).
- Add tests to cover the bug addressed or any new feature.
- Document new features. If it is a substantial change, add it to the [Changelog](https://gitlab.com/libeigen/eigen/-/blob/master/CHANGELOG.md).
- Leave the following box checked when submitting: `Allow commits from members who can merge to the target branch`.
This allows us to rebase and merge your change.
Note that we are a team of volunteers; we appreciate your patience during the review process.
-->
### Description
<!--Please explain your changes.-->
%{first_multiline_commit}
### Reference issue
<!--
You can link to a specific issue using the gitlab syntax #<issue number>.
If the MR fixes an issue, write "Fixes #<issue number>" to have the issue automatically closed on merge.
-->
### Additional information
<!--Any additional information you think is important.-->

View File

@@ -1,26 +0,0 @@
<!--
Thanks for contributing a merge request! Please name and fully describe your MR as you would for a commit message.
If the MR fixes an issue, please include "Fixes #issue" in the commit message and the MR description.
In addition, we recommend that first-time contributors read our [contribution guidelines](https://eigen.tuxfamily.org/index.php?title=Contributing_to_Eigen) and [git page](https://eigen.tuxfamily.org/index.php?title=Git), which will help you submit a more standardized MR.
Before submitting the MR, you also need to complete the following checks:
- Make one PR per feature/bugfix (don't mix multiple changes into one PR). Avoid committing unrelated changes.
- Rebase before committing
- For code changes, run the test suite (at least the tests that are likely affected by the change).
See our [test guidelines](https://eigen.tuxfamily.org/index.php?title=Tests).
- If possible, add a test (both for bug-fixes as well as new features)
- Make sure new features are documented
Note that we are a team of volunteers; we appreciate your patience during the review process.
Again, thanks for contributing! -->
### Reference issue
<!-- You can link to a specific issue using the gitlab syntax #<issue number> -->
### What does this implement/fix?
<!--Please explain your changes.-->
### Additional information
<!--Any additional information you think is important.-->

View File

@@ -2,9 +2,64 @@
## [Unreleased]
## [3.4.0]
New features:
- ComplexQZ implementation [!1962]
- Generic clang vector extension backend [!2051]
Released on August 18, 2021
## [5.0.1] - 2025-11-11
A few bug-fixes from the master branch, including
- Dirty git state [#2995]
- Failing geo_homogeneous tests [#2977]
- Alignment issues [#2982, #2984]
- Missing C++20 `<version>` header [#2986]
- BLAS/LAPACK build on windows [#2980]
See the full lists of [addressed bugs](https://gitlab.com/libeigen/eigen/-/issues?state=all&label_name%5B%5D=release%3A%3A5.0.1) and [merge requests](https://gitlab.com/libeigen/eigen/-/merge_requests?state=all&label_name%5B%5D=release%3A%3A5.0.1) for more details.
## [5.0.0] - 2025-09-30
Eigen 5.0 provides many new features, performance enhancements, and bugfixes throughout Eigens core template expression infrastructure and linear algebra facilities. The full set of changes and related issues are too large to list here, but can be accessed via the release milestone %"5.0".
This is the last major release to support the C++14 language standard. The master branch and subsequent releases will require support for C++17.
### Versioning
This release marks a transition to [Semantic Versioning](https://semver.org/). Previously, Eigen used a WORLD.MAJOR.MINOR scheme. From now on, version numbers will follow the MAJOR.MINOR.PATCH format, indicating breaking changes, new features, and bug fixes, respectively. The WORLD version will remain 3 for this and subsequent releases for posterity. See the table below:
```
╔═════════╦═════╦═════╗
║ Release ║ 3.4 ║ 5.0 ║
╠═════════╬═════╬═════╣
║ WORLD ║ 3 ║ 3 ║
║ MAJOR ║ 4 ║ 5 ║
║ MINOR ║ 0 ║ 0 ║
║ PATCH ║ - ║ 0 ║
╚═════════╩═════╩═════╝
```
### Breaking changes
* Eigen 5.X.X requires C++14. When building with GNU-compatible compilers, set `-std=c++14` or later. As part of this change, some macros such as `EIGEN_HAS_CXX11` have also been removed.
* The CMake build system has been modernized and older properties have been removed - projects relying on CMake may need to update their configurations [!485].
* All LGPL-licensed code has been removed (i.e. Constrained Conjugate Gradient) [!1197]. These were "unsupported" anyways, and weren't widely used.
* Due to name conflicts with other projects, `Eigen::all` and `Eigen::last` have been moved to `Eigen::placeholders::all` and `Eigen::placeholders::last` [!649].
* Any direct inclusion of an internal header (i.e. under a `../src/..` path) will result in a compilation error [!631].
* Runtime SVD options for computing thin/full U/V have been deprecated: use compile-time options instead [!826].
* Scalar (i.e. non-vectorized) comparisons now return masks with values of `Scalar(1)` rather than having all bits set to avoid undefined behavior [!1862].
* BLAS return types have been changed for Eigen BLAS to `void` instead of `int` for compatibility with other BLAS implementations [!1497].
* `Eigen::aligned_allocator` no longer inherits from `std::allocator` due to a change in the standard and the use of `allocate_at_least` [!1795].
* Euler angles are now returned in a more canonical form, potentially resulting in a change of behavior [!1301, !1314].
* Eigen's random number generation has changed, resulting in a change of behavior. Please do not rely on specific random numbers from Eigen - these were never guaranteed to be consistent across Eigen versions, nor are they generally consistent across platforms [!1437].
## [3.4.1] - 2025-09-30
Many bug fixes have been backported from the main branch.
A list of new issues addressed can be found via the [3.4.1](https://gitlab.com/libeigen/eigen/-/issues?state=all&label_name%5B%5D=3.4.1) label on GitLab.
Check the [git commit history](https://gitlab.com/libeigen/eigen/-/commits/3.4.1) for the full list of changes.
## [3.4.0] - 2021-08-18
**Notice:** 3.4.x will be the last major release series of Eigen that will support c++03.
@@ -160,9 +215,7 @@ Released on August 18, 2021
See the [announcement](https://www.eigen.tuxfamily.org/index.php?title=3.4) for more details.
## [3.3.9]
Released on December 4, 2020.
## [3.3.9] - 2020-12-04
Changes since 3.3.8:
@@ -175,9 +228,7 @@ Changes since 3.3.8:
* #2012: Define coeff-wise binary array operators for base class to fix an issue when using Eigen with C++20
* Commit bfdd4a990: Fix an issue with Intel® MKL PARDISO support.
## [3.3.8]
Released on October 5, 2020.
## [3.3.8] - 2020-10-05
Changes since 3.3.7:
@@ -243,9 +294,7 @@ Changes since 3.3.7:
* Commit 6c4d57dc9: Fix a gcc7 warning about bool * bool in abs2 default implementation.
* Commit 89a86ed42: Fix a warning in SparseSelfAdjointView about a branch statement always evaluation to false.
## [3.3.8-rc1]
Released on September 14, 2020.
## [3.3.8-rc1] - 2020-09-14
Changes since 3.3.7:
@@ -308,137 +357,129 @@ Changes since 3.3.7:
* Commit 89a86ed42: Fix a warning in SparseSelfAdjointView about a branch statement always evaluation to false.
* Commit dd6de618: Fix a bug with half-precision floats on GPUs.
## [3.3.7]
Released on December 11, 2018.
## [3.3.7] - 2018-12-11
Changes since 3.3.6:
* #1643: Fix compilation with GCC>=6 and compiler optimization turned off.
## [3.3.6]
Released on December 10, 2018.
## [3.3.6] - 2018-12-10
Changes since 3.3.5:
* #1617: Fix triangular solve crashing for empty matrix.
* #785: Make dense Cholesky decomposition work for empty matrices.
* #1634: Remove double copy in move-ctor of non movable Matrix/Array.
* Changeset 588e1eb34eff: Workaround weird MSVC bug.
* Changeset a2d6c106a450: Workaround weird MSVC bug.
* #1637 Workaround performance regression in matrix products with gcc>=6 and clang>=6.0.
* Changeset bf0f100339c1: Fix some implicit 0 to Scalar conversions.
* Changeset 9ccbaaf3dd4c: Fix some implicit 0 to Scalar conversions.
* #1605: Workaround ABI issue with vector types (aka `__m128`) versus scalar types (aka float).
* Changeset d1421c479baa: Fix for gcc<4.6 regarding usage of #pragma GCC diagnostic push/pop.
* Changeset c20b83b9d736: Fix conjugate-gradient for right-hand-sides with a very small magnitude.
* Changeset 281a877a3bf7: Fix product of empty arrays (returned 0 instead of 1).
* Changeset 148e579cc004: Fix for gcc<4.6 regarding usage of #pragma GCC diagnostic push/pop.
* Changeset bc000deaae45: Fix conjugate-gradient for right-hand-sides with a very small magnitude.
* Changeset 5be00b0e2964: Fix product of empty arrays (returned 0 instead of 1).
* #1590: Fix collision with some system headers defining the macro FP32.
* #1584: Fix possible undefined behavior in random generation.
* Changeset d632d18db8ca: Fix fallback to BLAS for rankUpdate.
* Changeset e4127b0f7d3b: Fix fallback to BLAS for rankUpdate.
* Fixes for NVCC 9.
* Fix matrix-market IO.
* Various fixes in the doc.
* Various minor warning fixes/workarounds.
## [3.3.5]
Released on July 23, 2018.
## [3.3.5] - 2018-07-23
Changes since 3.3.4:
* General bug fixes:
* Fix GeneralizedEigenSolver when requesting for eigenvalues only (0d15855abb30)
* #1560 fix product with a 1x1 diagonal matrix (90d7654f4a59)
* Fix GeneralizedEigenSolver when requesting for eigenvalues only (ab3fa2e12308)
* #1560 fix product with a 1x1 diagonal matrix (483beabab9bf)
* #1543: fix linear indexing in generic block evaluation
* Fix compilation of product with inverse transpositions (e.g., `mat * Transpositions().inverse()`) (14a13748d761)
* #1509: fix `computeInverseWithCheck` for complexes (8be258ef0b6d)
* #1521: avoid signalling `NaN` in hypot and make it std::complex<> friendly (a9c06b854991).
* #1517: fix triangular product with unit diagonal and nested scaling factor: `(s*A).triangularView<UpperUnit>()*B` (a546d43bdd4f)
* Fix compilation of stableNorm for some odd expressions as input (499e982b9281)
* #1485: fix linking issue of non template functions (ae28c2aaeeda)
* Fix overflow issues in BDCSVD (92060f82e1de)
* #1468: add missing `std::` to `memcpy` (4565282592ae)
* #1453: fix Map with non-default inner-stride but no outer-stride (af00212cf3a4)
* Fix mixing types in sparse matrix products (7e5fcd0008bd)
* #1544: Generate correct Q matrix in complex case (c0c410b508a1)
* #1461: fix compilation of `Map<const Quaternion>::x()` (69652a06967d)
* Fix compilation of product with inverse transpositions (e.g., `mat * Transpositions().inverse()`) (170914dbbcc3)
* #1509: fix `computeInverseWithCheck` for complexes (a2a2c3c86507)
* #1521: avoid signalling `NaN` in hypot and make it std::complex<> friendly (b18e2d422b09).
* #1517: fix triangular product with unit diagonal and nested scaling factor: `(s*A).triangularView<UpperUnit>()*B` (c24844195d90)
* Fix compilation of stableNorm for some odd expressions as input (33b972d8b384)
* #1485: fix linking issue of non template functions (d18877f18d8e)
* Fix overflow issues in BDCSVD (7a875acfb05f)
* #1468: add missing `std::` to `memcpy` (32a6db0f8cd5)
* #1453: fix Map with non-default inner-stride but no outer-stride (1ca9072b51d8)
* Fix mixing types in sparse matrix products (4ead16cdd6c8)
* #1544: Generate correct Q matrix in complex case (39125654ce9e)
* #1461: fix compilation of `Map<const Quaternion>::x()` (9a266e5118cf)
* Backends:
* Fix MKL backend for symmetric eigenvalues on row-major matrices (4726d6a24f69)
* #1527: fix support for MKL's VML (972424860545)
* Fix incorrect ldvt in LAPACKE call from JacobiSVD (88c4604601b9)
* Fix support for MKL's BLAS when using `MKL_DIRECT_CALL` (205731b87e19, b88c70c6ced7, 46e2367262e1)
* Use MKL's lapacke.h header when using MKL (19bc9df6b726)
* Fix MKL backend for symmetric eigenvalues on row-major matrices (eab7afe25273)
* #1527: fix support for MKL's VML (86a939451c75)
* Fix incorrect ldvt in LAPACKE call from JacobiSVD (bfc66e8b9a3b)
* Fix support for MKL's BLAS when using `MKL_DIRECT_CALL` (9df7f3d8e9cd, 3108fbf76708, 292dea7922e7)
* Use MKL's lapacke.h header when using MKL (070b5958e0ae)
* Diagnostics:
* #1516: add assertion for out-of-range diagonal index in `MatrixBase::diagonal(i)` (783d38b3c78c)
* Add static assertion for fixed sizes `Ref<>` (e1203d5ceb8e)
* Add static assertion on selfadjoint-view's UpLo parameter. (b84db94c677e, 0ffe8a819801)
* #1479: fix failure detection in LDLT (67719139abc3)
* #1516: add assertion for out-of-range diagonal index in `MatrixBase::diagonal(i)` (273738ba6f6e)
* Add static assertion for fixed sizes `Ref<>` (1724dae8b834)
* Add static assertion on selfadjoint-view's UpLo parameter. (74daf12e525e, 190b46dd1f05)
* #1479: fix failure detection in LDLT (c20043c8fd64)
* Compiler support:
* #1555: compilation fix with XLC
* Workaround MSVC 2013 ambiguous calls (1c7b59b0b5f4)
* Adds missing `EIGEN_STRONG_INLINE` to help MSVC properly inlining small vector calculations (1ba3f10b91f2)
* Several minor warning fixes: 3c87fc0f1042, ad6bcf0e8efc, "used uninitialized" (20efc44c5500), Wint-in-bool-context (131da2cbc695, b4f969795d1b)
* #1428: make NEON vectorization compilable by MSVC. (* 3d1b3dbe5927, 4e1b7350182a)
* Fix compilation and SSE support with PGI compiler (faabf000855d 90d33b09040f)
* #1555: compilation fix with XLC (23eb37691f14)
* #1520: workaround some `-Wfloat-equal` warnings by calling `std::equal_to` (7d9a9456ed7c)
* Make the TensorStorage class compile with clang 3.9 (eff7001e1f0a)
* Misc: some old compiler fixes (493691b29be1)
* Fix MSVC warning C4290: C++ exception specification ignored except to indicate a function is not `__declspec(nothrow)` (524918622506)
* Workaround MSVC 2013 ambiguous calls (c92536d92647)
* Adds missing `EIGEN_STRONG_INLINE` to help MSVC properly inlining small vector calculations (01fb6217335b)
* Several minor warning fixes: f90d136c8445, 542fb03968c2, "used uninitialized" (7634a44bfe11), Wint-in-bool-context (3d1795da28c2, d1c2d6683c55)
* #1428: make NEON vectorization compilable by MSVC. (* 1e2d2693b911, 927d023ceaab)
* Fix compilation and SSE support with PGI compiler (bb87f618bfc3 450c5e5d2771)
* #1555: compilation fix with XLC (20ca86888e70)
* #1520: workaround some `-Wfloat-equal` warnings by calling `std::equal_to` (1c4fdad7bd6f)
* Make the TensorStorage class compile with clang 3.9 (a7144f8d6a94)
* Misc: some old compiler fixes (b60cbbef3791)
* Fix MSVC warning C4290: C++ exception specification ignored except to indicate a function is not `__declspec(nothrow)` (3df78d5afc1e)
* Architecture support:
* Several AVX512 fixes for `log`, `sqrt`, `rsqrt`, non `AVX512ER` CPUs, `apply_rotation_in_the_plane` b64275e912ba cab3d626a59e 7ce234652ab9, d89b9a754371.
* AltiVec fixes: 9450038e380d
* NEON fixes: const-cast (e8a69835ccda), compilation of Jacobi rotations (c06cfd545b15,#1436).
* Changeset d0658cc9d4a2: Define `pcast<>` for SSE types even when AVX is enabled. (otherwise float are silently reinterpreted as int instead of being converted)
* #1494: makes `pmin`/`pmax` behave on Altivec/VSX as on x86 regarding NaNs (d0af83f82b19)
* Several AVX512 fixes for `log`, `sqrt`, `rsqrt`, non `AVX512ER` CPUs, `apply_rotation_in_the_plane` 5c59564bfb92 1939c971a3db c2f9e6cb37e5, 609e425166f6.
* AltiVec fixes: 1641a6cdd5a4
* NEON fixes: const-cast (877a2b64c9ba), compilation of Jacobi rotations (bc837b797559,#1436).
* Changeset 971b32440c74: Define `pcast<>` for SSE types even when AVX is enabled. (otherwise float are silently reinterpreted as int instead of being converted)
* #1494: makes `pmin`/`pmax` behave on Altivec/VSX as on x86 regarding NaNs (892c0a79ce93)
* Documentation:
* Update manual pages regarding BDCSVD (#1538)
* Add aliasing in common pitfaffs (2a5a8408fdc5)
* Update `aligned_allocator` (21e03aef9f2b)
* #1456: add perf recommendation for LLT and storage format (c8c154ebf130, 9aef1e23dbe0)
* #1455: Cholesky module depends on Jacobi for rank-updates (2e6e26b851a8)
* #1458: fix documentation of LLT and LDLT `info()` method (2a4cf4f473dd)
* Warn about constness in `LLT::solveInPlace` (518f97b69bdf)
* Fix lazyness of `operator*` with CUDA (c4dbb556bd36)
* #336: improve doc for `PlainObjectBase::Map` (13dc446545fe)
* Add aliasing in common pitfaffs (656712d48f6b)
* Update `aligned_allocator` (6fc0f2be70a4)
* #1456: add perf recommendation for LLT and storage format (55fbf4fedd04, 9fd138e2b333)
* #1455: Cholesky module depends on Jacobi for rank-updates (b87875abf8dc)
* #1458: fix documentation of LLT and LDLT `info()` method (ac2c97edff07)
* Warn about constness in `LLT::solveInPlace` (51e1aa153957)
* Fix lazyness of `operator*` with CUDA (fa77d713359d)
* #336: improve doc for `PlainObjectBase::Map` (18868228adae)
* Other general improvements:
* Enable linear indexing in generic block evaluation (31537598bf83, 5967bc3c2cdb, #1543).
* Fix packet and alignment propagation logic of `Block<Xpr>` expressions. In particular, `(A+B).col(j)` now preserve vectorisation. (b323cc9c2c7f)
* Several fixes regarding custom scalar type support: hypot (f8d6c791791d), boost-multiprec (acb8ef9b2478), literal casts (6bbd97f17534, 39f65d65894f),
* LLT: avoid making a copy when decomposing in place (2f7e28920f4e), const the arg to `solveInPlace()` to allow passing `.transpose()`, `.block()`, etc. (c31c0090e998).
* Add possibility to overwrite `EIGEN_STRONG_INLINE` (7094bbdf3f4d)
* #1528: use `numeric_limits::min()` instead of `1/highest()` that might underflow (dd823c64ade7)
* #1532: disable `stl::*_negate` in C++17 (they are deprecated) (88e9452099d5)
* Add C++11 `max_digits10` for half (faf74dde8ed1)
* Make sparse QR result sizes consistent with dense QR (4638bc4d0f96)
* Enable linear indexing in generic block evaluation (15752027ec2f, 80af7d6a47c1, #1543).
* Fix packet and alignment propagation logic of `Block<Xpr>` expressions. In particular, `(A+B).col(j)` now preserve vectorisation. (9c9e90f6db7e)
* Several fixes regarding custom scalar type support: hypot (385d8b5e42c2), boost-multiprec (5f71579a2d3f), literal casts (e6577f3c3049, fbb0c510c52f),
* LLT: avoid making a copy when decomposing in place (9d03711df8bc), const the arg to `solveInPlace()` to allow passing `.transpose()`, `.block()`, etc. (0137ed4f19b6).
* Add possibility to overwrite `EIGEN_STRONG_INLINE` (6d6e5fcd4356)
* #1528: use `numeric_limits::min()` instead of `1/highest()` that might underflow (9ff315024335)
* #1532: disable `stl::*_negate` in C++17 (they are deprecated) (3fb42ff7b278)
* Add C++11 `max_digits10` for half (70ac6c923001)
* Make sparse QR result sizes consistent with dense QR (2136cfa17e28)
* Unsupported/unit-tests/cmake/unvisible internals/etc.
* #1484: restore deleted line for 128 bits long doubles, and improve dispatching logic. (dffc0f957f19)
* #1462: remove all occurences of the deprecated `__CUDACC_VER__` macro by introducing `EIGEN_CUDACC_VER` (a201b8438d36)
* Changeset 2722aa8eb93f: Fix oversharding bug in parallelFor.
* Changeset ea1db80eab46: commit 45e9c9996da790b55ed9c4b0dfeae49492ac5c46 (HEAD -> memory_fix)
* Changeset 350957be012c: Fix int versus Index
* Changeset 424038431015: fix linking issue
* Changeset 3f938790b7e0: Fix short vs long
* Changeset ba14974d054a: Fix cmake scripts with no fortran compiler
* Changeset 2ac088501976: add cmake-option to enable/disable creation of tests
* Changeset 56996c54158b: Use col method for column-major matrix
* Changeset 762373ca9793: #1449: fix `redux_3` unit test
* Changeset eda96fd2fa30: Fix uninitialized output argument.
* Changeset 75a12dff8ca4: Handle min/max/inf/etc issue in `cuda_fp16.h` directly in `test/main.h`
* Changeset 568614bf79b8: Add tests for sparseQR results (value and size) covering bugs 1522 and 1544
* Changeset 12c9ece47d14: `SelfAdjointView<...,Mode>` causes a static assert since commit c73a77e47db8
* Changeset 899fd2ef704f: weird compilation issue in `mapped_matrix.cpp`
* #1484: restore deleted line for 128 bits long doubles, and improve dispatching logic. (c8e663fe87ec)
* #1462: remove all occurences of the deprecated `__CUDACC_VER__` macro by introducing `EIGEN_CUDACC_VER` (e7c065ec717b)
* Changeset fea50d40ea79: Fix oversharding bug in parallelFor.
* Changeset 866d222d6065: commit 45e9c9996da790b55ed9c4b0dfeae49492ac5c46 (HEAD -> memory_fix)
* Changeset 48048172e5aa: Fix int versus Index
* Changeset 906a98fe39c3: fix linking issue
* Changeset 352489edbe36: Fix short vs long
* Changeset 81e94eea024c: Fix cmake scripts with no fortran compiler
* Changeset 8bd392ca0e3f: add cmake-option to enable/disable creation of tests
* Changeset 02c0cef97fb5: Use col method for column-major matrix
* Changeset a8d2459f8e1f: #1449: fix `redux_3` unit test
* Changeset e90a14609a56: Fix uninitialized output argument.
* Changeset 5d40715db6a7: Handle min/max/inf/etc issue in `cuda_fp16.h` directly in `test/main.h`
* Changeset 2f9de522457b: Add tests for sparseQR results (value and size) covering bugs 1522 and 1544
* Changeset 4662c610c13c: `SelfAdjointView<...,Mode>` causes a static assert since commit d820ab9edc0b
* Changeset 96134409fc91: weird compilation issue in `mapped_matrix.cpp`
## [3.3.4]
Released on June 15, 2017.
## [3.3.4] - 2017-06-15
Changes since 3.3.3:
@@ -469,9 +510,7 @@ Changes since 3.3.3:
* Add specializations of `std::numeric_limits` for `Eigen::half` and and `AutoDiffScalar`
* Fix compilation of streaming nested Array, i.e., `std::cout << Array<Array<...>>`
## [3.3.3]
Released on February 21, 2017.
## [3.3.3] - 2017-02-21
Changes since 3.3.2:
@@ -502,9 +541,7 @@ Changes since 3.3.2:
* Fix usage of `size_t` instead of Index in sefl-adjoint `matrix * vector`
* #1378: fix doc (`DiagonalIndex` vs `Diagonal`).
## [3.3.2]
Released on January 18, 2017.
## [3.3.2] - 2017-01-18
Changes since 3.3.1:
@@ -535,9 +572,7 @@ Changes since 3.3.1:
* Fix some warnings with ICC, Power8, etc.
* Fix compilation with MSVC 2017
## [3.3.1]
Released on December 06, 2016.
## [3.3.1] - 2016-12-06
Changes since 3.3.0:
@@ -558,9 +593,7 @@ Changes since 3.3.0:
* Bugs #1346,#1347: make Eigen's installation relocatable.
* Fix some harmless compilation warnings.
## [3.3]
Released on November 10, 2016
## [3.3] - 2016-11-10
For a comprehensive list of change since the 3.2 series, see this [page](https://www.eigen.tuxfamily.org/index.php?title=3.3).
@@ -569,9 +602,7 @@ Main changes since 3.3-rc2:
* Fix regression in printing sparse expressions.
* Fix sparse solvers when using a SparseVector as the result and/or right-hand-side.
## [3.3-rc2]
Released on November 04, 2016
## [3.3-rc2] - 2016-11-04
For a comprehensive list of change since the 3.2 series, see this [page](https://www.eigen.tuxfamily.org/index.php?title=3.3).
@@ -600,9 +631,7 @@ Main changes since 3.3-rc1:
* SuiteSparse, fix SPQR for rectangular matrices
* Fix compilation of `qr.inverse()` for column and full pivoting variants
## [3.2.10]
Released on October 04, 2016
## [3.2.10] - 2016-10-04
Changes since 3.2.9:
@@ -621,9 +650,7 @@ Main fixes and improvements:
* #1249: disable the use of `__builtin_prefetch` for compilers other than GCC, clang, and ICC.
* #1265: fix doc of QR decompositions
## [3.3-rc1]
Released on September 22, 2016
## [3.3-rc1] - 2016-09-22
For a comprehensive list of change since the 3.2 series, see this [page](https://www.eigen.tuxfamily.org/index.php?title=3.3).
@@ -662,9 +689,7 @@ Main changes since 3.3-beta2:
* Fix vectorization logic for coeff-based product for some corner cases
* Bugs #1260, #1261, #1264: several fixes in AutoDiffScalar.
## [3.3-beta2]
Released on July 26, 2016
## [3.3-beta2] - 2016-08-26
For a comprehensive list of change since the 3.2 series, see this [page](https://www.eigen.tuxfamily.org/index.php?title=3.3).
@@ -687,7 +712,7 @@ Main changes since 3.3-beta1:
* #779: in `Map`, allows non aligned buffers for buffers smaller than the requested alignment.
* Add a complete orthogonal decomposition class: [CompleteOrthogonalDecomposition](http://eigen.tuxfamily.org/dox-devel/classEigen_1_1CompleteOrthogonalDecomposition.html)
* Improve robustness of JacoviSVD with complexes (underflow, noise amplification in complex to real conversion, compare off-diagonal entries to the current biggest diagonal entry instead of the global biggest, null inputs).
* Change Eigen's ColPivHouseholderQR to use a numerically stable norm downdate formula (changeset 9da6c621d055)
* Change Eigen's ColPivHouseholderQR to use a numerically stable norm downdate formula (changeset acce4dd0500f)
* #1214: consider denormals as zero in D&C SVD. This also workaround infinite binary search when compiling with ICC's unsafe optimizations.
* Add log1p for arrays.
* #1193: now `lpNorm<Infinity>` supports empty inputs.
@@ -710,7 +735,7 @@ Main changes since 3.3-beta1:
* Performance improvements:
* #256: enable vectorization with unaligned loads/stores. This concerns all architectures and all sizes. This new behavior can be disabled by defining `EIGEN_UNALIGNED_VECTORIZE=0`
* Add support for s390x(zEC13) ZVECTOR instruction set.
* Optimize mixing of real with complex matrices by avoiding a conversion from real to complex when the real types do not match exactly. (see bccae23d7018)
* Optimize mixing of real with complex matrices by avoiding a conversion from real to complex when the real types do not match exactly. (see 76faf4a9657e)
* Speedup square roots in performance critical methods such as norm, normalize(d).
* #1154: use dynamic scheduling for spmv products.
* #667, #1181: improve perf with MSVC and ICC through `FORCE_INLINE`
@@ -800,9 +825,7 @@ Main changes since 3.3-beta1:
* #1249: fix compilation with compilers that do not support `__builtin_prefetch` .
* #1250: fix `pow()` for `AutoDiffScalar` with custom nested scalar type.
## [3.2.9]
Released on July 18, 2016
## [3.2.9] - 2016-08-18
Changes since 3.2.8:
@@ -836,9 +859,7 @@ Changes since 3.2.8:
* #1221: shutdown some GCC6's warnings.
* #1175: fix index type conversion warnings in sparse to dense conversion.
## [3.2.8]
Released on February 16, 2016
## [3.2.8] - 2016-02-16
Changes since 3.2.7:
@@ -869,9 +890,7 @@ Changes since 3.2.7:
* Some warning fixes.
* Several other documentation clarifications.
## [3.3-beta1]
Released on December 16, 2015
## [3.3-beta1] - 2015-12-16
For a comprehensive list of change since the 3.2 series, see this [page](https://www.eigen.tuxfamily.org/index.php?title=3.3).
@@ -906,7 +925,7 @@ Main changes since 3.3-alpha1:
* Add temporary-free evaluation of `D.nolias() *= C + A*B`.
* Add vectorization of round, ceil and floor for SSE4.1/AVX.
* Optimize assignment into a `Block<SparseMatrix>` by using Ref and avoiding useless updates in non-compressed mode. This make row-by-row filling of a row-major sparse matrix very efficient.
* Improve internal cost model leading to faster code in some cases (see changeset 1bcb41187a45).
* Improve internal cost model leading to faster code in some cases (see changeset 77ff3386b7d2).
* #1090: improve redux evaluation logic.
* Enable unaligned vectorization of small fixed size matrix products.
@@ -938,9 +957,7 @@ Main changes since 3.3-alpha1:
* Fix ICE with VC2015 Update1.
* Improve cmake install scripts.
## [3.2.7]
Released on November 5, 2015
## [3.2.7] - 2015-11-05
Changes since 3.2.6:
@@ -966,9 +983,7 @@ Changes since 3.2.6:
* unsupported/ArpackSupport is now properly installed by make install.
* #1080: warning fixes
## [3.2.6]
Released on October 1, 2015
## [3.2.6] - 2015-10-01
Changes since 3.2.5:
@@ -984,15 +999,11 @@ Changes since 3.2.5:
* MKL: fix support for the 11.2 version, and fix a naming conflict (#1067)
* #1033: explicit type conversion from 0 to RealScalar
## [3.3-alpha1]
Released on September 4, 2015
## [3.3-alpha1] - 2015-09-04
See the [announcement](https://www.eigen.tuxfamily.org/index.php?title=3.3).
## [3.2.5]
Released on June 16, 2015
## [3.2.5] - 2015-06-16
Changes since 3.2.4:
@@ -1036,9 +1047,7 @@ Changes since 3.2.4:
* #1012: enable alloca on Mac OS or if alloca is defined as macro
* Doc and build system: #733, #914, #952, #961, #999
## [3.2.4]
Released on January 21, 2015
## [3.2.4] - 2015-01-21
Changes since 3.2.3:
@@ -1047,9 +1056,7 @@ Changes since 3.2.3:
* #921: fix utilization of bitwise operation on enums in `first_aligned`.
* Fix compilation with NEON on some platforms.
## [3.2.3]
Released on December 16, 2014
## [3.2.3] - 2014-12-16
Changes since 3.2.2:
@@ -1088,9 +1095,7 @@ Changes since 3.2.2:
* #861: enable posix_memalign with PGI.
* Fix BiCGSTAB doc example.
## [3.2.2]
Released on August 4, 2014
## [3.2.2] - 2014-08-04
Changes since 3.2.1:
@@ -1134,9 +1139,7 @@ Changes since 3.2.1:
* #632: doc: Note that `dm2 = sm1 + dm1` is not possible
* Extend AsciiQuickReference (real, imag, conjugate, rot90)
## [3.2.1]
Released on February 26, 2014
## [3.2.1] - 2014-02-26
Changes since 3.2.0:
@@ -1181,9 +1184,7 @@ Changes since 3.2.0:
* Fix a few compiler warnings (bug #317 and more).
* Documentation fixes (bugs #609, #638 and #739 and more).
## [3.1.4]
Released on August 02, 2013
## [3.1.4] - 2013-08-02
Changes since 3.1.3:
@@ -1196,18 +1197,14 @@ Changes since 3.1.3:
* Fix a few warnings and compilation issues with recent compiler versions.
* Documentation fixes.
## [3.0.7]
Released on August 02, 2013
## [3.0.7] - 2013-08-02
Changes since 3.0.6:
* Fix traits of `Map<Quaternion>`.
* Fix a few warnings (#507) and documentation (#531).
## [3.2.0]
Released on July 24, 2013.
## [3.2.0] - 2013-07-24
Major new features and optimizations since 3.1:
@@ -1234,18 +1231,14 @@ Major new features and optimizations since 3.1:
Eigen 3.2 represents about 600 commits since Eigen 3.1.
## [3.2-rc2]
Released on July 19, 2013.
## [3.2-rc2] - 2013-07-19
Changes since 3.2-rc1:
* Rename `DenseBase::isFinite()` to `allFinite()` to avoid a future naming collision.
* Fix an ICE with ICC 11.1.
## [3.2-rc1]
Released on July 17, 2013.
## [3.2-rc1] - 2013-07-17
Main changes since 3.2-beta1:
* New features:
@@ -1290,9 +1283,7 @@ Main changes since 3.2-beta1:
* Fix many warnings and compilation issues with recent compiler versions.
* Many other fixes including #230, #482, #542, #561, #564, #565, #566, #578, #581, #595, #597, #598, #599, #605, #606, #615.
## [3.1.3]
Released on April 16, 2013
## [3.1.3] - 2013-04-16
Changes since 3.1.2:
@@ -1310,9 +1301,7 @@ Changes since 3.1.2:
* Enable SSE with ICC even when it mimics a gcc version lower than 4.2
* Workaround [gcc-4.7 bug #53900](http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53900) (too aggressive optimization in our alignment check)
## [3.2-beta1]
Released on March 07, 2013
## [3.2-beta1] - 2013-03-07
Main changes since 3.1:
@@ -1338,9 +1327,7 @@ Main changes since 3.1:
* New compilation token `EIGEN_INITIALIZE_MATRICES_BY_NAN` to help debugging.
* All bug fixes of the 3.1 branch, plus a couple of other fixes (including 211, 479, 496, 508, 552)
## [3.1.2]
Released on Nov 05, 2012
## [3.1.2] - 2012-11-05
Changes since 3.1.1:
@@ -1364,9 +1351,7 @@ Changes since 3.1.1:
* Remove stupid assert in blue norm.
* Workaround a weird compilation error with MSVC.
## [3.1.1]
Released on July 22, 2012
## [3.1.1] - 2012-07-22
Changes since 3.1.0:
* [relicense to MPL2](https://www.eigen.tuxfamily.org/index.php?title=Main_Page#License)
@@ -1382,9 +1367,7 @@ Changes since 3.1.0:
* Fixed Geometry module compilation under MSVC
* Fixed Sparse module compilation under MSVC 2005
## [3.0.6]
Released on July 9, 2012
## [3.0.6] - 2012-07-09
Changes since 3.0.5:
* #447 - fix infinite recursion in `ProductBase::coeff()`
@@ -1404,9 +1387,7 @@ Changes since 3.0.5:
* Fix typo in NumericalDiff (unsupported module)
* Fix LevenbergMarquart for non double scalar type (unsupported module)
## [3.1.0]
Released on June 24, 2012.
## [3.1.0] - 2012-06-24
Major changes between Eigen 3.0 and Eigen 3.1:
* New features
@@ -1429,9 +1410,7 @@ Major changes between Eigen 3.0 and Eigen 3.1:
Eigen 3.1 represents about 600 commits since Eigen 3.0.
## [3.1.0-rc2]
Released on June 21, 2012.
## [3.1.0-rc2] - 2012-06-21
Changes since 3.1.0-rc1:
* Fix a couple of compilation warnings
@@ -1440,9 +1419,7 @@ Changes since 3.1.0-rc1:
* #466: `RealSchur` failed on a zero matrix
* Update Adolc and MPReal support modules
## [3.1.0-rc1]
Released on June 14, 2012
## [3.1.0-rc1] - 2012-06-14
Main changes since 3.1.0-beta1:
* #466: fix a possible race condition issue. from now, multithreaded applications that call Eigen from multiple thread must initialize Eigen by calling `initParallel()`.
@@ -1454,9 +1431,7 @@ Main changes since 3.1.0-beta1:
* Fix ambiguous calls in the math functors
* Fix BTL interface.
## [3.1.0-beta1]
Released on June 7, 2012
## [3.1.0-beta1] - 2012-06-07
Main changes since 3.1.0-alpha2:
* **API changes**
@@ -1487,9 +1462,7 @@ Main changes since 3.1.0-alpha2:
* New tutorial page on Map
* and many other bug fixes such as: #417, #419, #450
## [3.0.5]
Released February 10, 2012
## [3.0.5] - 2012-02-10
Changes since 3.0.4:
* #417 - fix nesting of `Map` expressions
@@ -1503,9 +1476,7 @@ Changes since 3.0.4:
* Changeset 4432 - fix asserts in eigenvalue decompositions
* Changeset 4416 - fix MSVC integer overflow warning
## [3.1.0-alpha2]
Released February 6, 2012
## [3.1.0-alpha2] - 2012-02-06
Main changes since 3.0.1-alpha1:
* New optional support for Intel MKL and other BLAS including: ([details](http://eigen.tuxfamily.org/dox-devel/TopicUsingIntelMKL.html))
@@ -1532,9 +1503,7 @@ Main changes since 3.0.1-alpha1:
* and many other bug fixes such as: #406, #410, #398, #396, #394, #354, #352, #301,
## [3.1.0-alpha1]
Released December 6, 2011
## [3.1.0-alpha1] - 2011-12-06
Main changes since 3.0:
* Officially supported set of sparse modules. See this [page](http://eigen.tuxfamily.org/dox-devel/TutorialSparse.html) for an overview of the features. Main changes:
@@ -1555,10 +1524,7 @@ Main changes since 3.0:
* All the fixes and improvements of the 3.0 branch up to the 3.0.4 release (see below)
## [3.0.4]
Released December 6, 2011
## [3.0.4] - 2011-12-06
Changes since 3.0.3:
@@ -1572,9 +1538,7 @@ Changes since 3.0.3:
* Fix compilation issue with `QuaternionBase::cast`
## [2.0.17]
Released December 6, 2011
## [2.0.17] - 2011-12-06
Changes since 2.0.16:
@@ -1582,9 +1546,7 @@ Changes since 2.0.16:
* Fix a typo in ParametrizedLine documentation
## [3.0.3]
Released October 6, 2011
## [3.0.3] - 2011-10-06
Changes since 3.0.2:
@@ -1596,9 +1558,7 @@ Changes since 3.0.2:
* Several improvements to the documentation.
## [3.0.2]
Released August 26, 2011
## [3.0.2] - 2011-08-26
Changes since 3.0.1:
@@ -1615,9 +1575,7 @@ Changes since 3.0.1:
* fix a few documentation issues.
## [3.0.1]
Released May 30, 2011
## [3.0.1] - 2011-05-30
Changes since 3.0.0:
@@ -1634,9 +1592,7 @@ Changes since 3.0.0:
* Fix Qt support in Transform.
* Improved documentation.
## [2.0.16]
Released May 28, 2011
## [2.0.16] - 2011-05-28
Changes since 2.0.15:
@@ -1647,18 +1603,16 @@ Changes since 2.0.15:
* New feature: support for `part<SelfAdjoint>`.
* Fix bug in SparseLU::setOrderingMethod.
## [3.0.0]
## [3.0.0] - 2011-03-19
Released March 19, 2011, at the [meeting](https://www.eigen.tuxfamily.org/index.php?title=Paris_2011_Meeting).
Released at the [meeting](https://www.eigen.tuxfamily.org/index.php?title=Paris_2011_Meeting).
See the [Eigen 3.0 release notes](https://www.eigen.tuxfamily.org/index.php?title=3.0).
Only change since 3.0-rc1:
* Fixed compilation of the unsupported 'openglsupport' test.
## [3.0-rc1]
Released March 14, 2011.
## [3.0-rc1] - 2011-03-14
Main changes since 3.0-beta4:
@@ -1677,9 +1631,7 @@ Main changes since 3.0-beta4:
* more compiler warnings fixes
* fixed GDB pretty-printer for dynamic-size matrices (#210)
## [3.0-beta4]
Released February 28, 2011.
## [3.0-beta4] - 2011-02-28
Main changes since 3.0-beta3:
@@ -1715,9 +1667,7 @@ Main changes since 3.0-beta3:
* misc documentation improvements
* improve documentation of plugins
## [3.0-beta3]
Released February 12, 2011.
## [3.0-beta3] - 2011-02-12
The biggest news is that the API is now **100% stable**.
@@ -1763,9 +1713,7 @@ Main changes since 3.0-beta2:
* imported a copy of the Eigen 2 test suite, made sure that Eigen 3 passes it. That also allowed to fix several issues.
## [3.0-beta2]
Released October 15, 2010.
## [3.0-beta2] - 2010-10-15
Main changes since 3.0-beta1:
@@ -1790,9 +1738,7 @@ Main changes since 3.0-beta1:
* Remove the Taucs backend (obsolete).
* Remove the old SVD class (was causing too much troubles, a new decompozition based on bidiagonalisation/householder should come back soon, `JacobiSVD` can be used meanwhile).
## [2.0.15]
Released July 16, 2010
## [2.0.15] - 2010-07-16
Changes since 2.0.14:
@@ -1803,15 +1749,11 @@ Changes since 2.0.14:
* Fix for ICC in SSE code.
* Fix some C++ issues found by Clang (patch by Nick Lewycky).
## [3.0-beta1]
Released July 5, 2010
## [3.0-beta1] - 2010-07-05
See the [announcement](https://www.eigen.tuxfamily.org/index.php?title=3.0).
## [2.0.14]
Released June 22, 2010
## [2.0.14] - 2010-06-22
Changes since 2.0.13:
@@ -1819,9 +1761,7 @@ Changes since 2.0.13:
* Fix #142: LU of fixed-size matrices was causing dynamic memory allocation (patch by Stuart Glaser).
* Fix #127: remove useless static keywords (also fixes warnings with clang++).
## [2.0.13]
Released June 10, 2010
## [2.0.13] - 2010-06-10
Changes since 2.0.12:
@@ -1836,9 +1776,7 @@ Changes since 2.0.12:
* Fix compilation of the BTL benchmarks.
* Some dox updates.
## [2.0.12]
Released February 12, 2010
## [2.0.12] - 2010-02-12
Changes since 2.0.11:
@@ -1854,9 +1792,7 @@ Changes since 2.0.11:
* Backport improvements to benchmarking code.
* Documentation fixes
## [2.0.11]
Released January 10, 2010
## [2.0.11] - 2010-01-10
Changes since 2.0.10:
@@ -1869,9 +1805,7 @@ Changes since 2.0.10:
* Fix MSVC 2010 compatibility.
* Some documentation improvements.
## [2.0.10]
Released November 25, 2009
## [2.0.10] - 2009-11-25
Changes since 2.0.9:
@@ -1887,27 +1821,21 @@ Changes since 2.0.9:
* fix compilation with MSVC 2010
* adjust to repository name change
## [2.0.9]
Released October 24, 2009
## [2.0.9] - 2009-10-24
Changes since 2.0.8:
* Really fix installation and the pkg-config file.
* Install the `NewStdVector` header that was introduced in 2.0.6.
## [2.0.8]
Released October 23, 2009
## [2.0.8] - 2009-10-23
Changes since 2.0.7:
* fix installation error introduced in 2.0.7: it was choking on the pkg-config file eigen2.pc not being found. The fix had been proposed long ago by Ingmar Vanhassel for the development branch, and when recently the pkg-config support was back-ported to the 2.0 branch, nobody thought of backporting this fix too, and apparently nobody tested "make install" !
* SVD: add default constructor. Users were relying on the compiler to generate one, and apparenty 2.0.7 triggered a little MSVC 2008 subtlety in this respect. Also added an assert.
## [2.0.7]
Released October 22, 2009
## [2.0.7] - 2009-10-22
Changes since 2.0.6:
@@ -1922,9 +1850,7 @@ Changes since 2.0.6:
* add pkg-config support by Rhys Ulerich.
* documentation fix and doc-generation-script updates by Thomas Capricelli
## [2.0.6]
Released September 23, 2009
## [2.0.6] - 2009-09-23
Changes since 2.0.5:
@@ -1938,9 +1864,7 @@ Changes since 2.0.5:
* fix a warning in `ei_aligned_malloc`; fixed by backporting the body from the devel branch; may result in a different choice of system aligned malloc function.
* update the documentation.
## [2.0.5]
Released August 22, 2009
## [2.0.5] - 2009-08-22
Changes since 2.0.4:
@@ -1959,9 +1883,7 @@ Changes since 2.0.4:
* fix the option to build a binary library, although it's not very useful and will be removed
* add basic .hgignore file and script to build the docs (thanks to Thomas Capricelli)
## [2.0.4]
Released August 1, 2009
## [2.0.4] - 2009-08-01
Changes since 2.0.3:
* Several fixes in the overloaded new and delete operators. Thanks to Hauke Heibel.
@@ -1975,9 +1897,7 @@ Changes since 2.0.3:
* several ctest improvements: use our own dashboard, use a separate project for the 2.0 branch.
* documentation: improvement on the pages on unaligned arrays (the online copies have been updated immediately).
## [2.0.3]
Released June 21, 2009
## [2.0.3] - 2009-06-21
Changes since 2.0.2:
* precision and reliability fixes in various algorithms, especially LLT, QR, Tridiagonalization, and also a precision improvement in LU.
@@ -1987,9 +1907,7 @@ Changes since 2.0.2:
* backport documentation improvements on transpose() and adjoint()
* updates in the Sparse module (was needed to support KDE 4.3)
## [2.0.2]
Released May 22, 2009
## [2.0.2] - 2009-05-22
Changes since 2.0.1:
* Fix `linearRegression()` compilation, actually it is reimplemented using the better fitHyperplane() which does total least-squares.
@@ -1999,9 +1917,7 @@ Changes since 2.0.1:
* Fix compatibility with the old GCC 3.3: it is now fully supported again.
* Fix warnings with recent GCC (4.4.0 and 4.3.3).
## [2.0.1]
Released April 14, 2009
## [2.0.1] - 2009-04-14
Changes since 2.0.0:
* disable alignment altogether on exotic platforms on which we don't vectorize anyway. This allows e.g. to use Eigen on ARM platforms.
@@ -2014,6 +1930,6 @@ Changes since 2.0.0:
* fix wrong static assertion (patch by Markus Moll)
* add missing operators in `aligned_allocator` (thanks to Hauke Heibel)
## [2.0.0]
## [2.0.0] - 2009-02-02
Released February 2, 2009
First public release.

View File

@@ -34,6 +34,11 @@ if (POLICY CMP0177)
cmake_policy(SET CMP0177 NEW)
endif ()
# Respect <PackageName>_ROOT variables.
if (POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif ()
#==============================================================================
# CMake Project.
#==============================================================================
@@ -63,19 +68,12 @@ option(EIGEN_LEAVE_TEST_IN_ALL_TARGET "Leaves tests in the all target, needed by
option(EIGEN_BUILD_BLAS "Toggles the building of the Eigen Blas library" ${PROJECT_IS_TOP_LEVEL})
option(EIGEN_BUILD_LAPACK "Toggles the building of the included Eigen LAPACK library" ${PROJECT_IS_TOP_LEVEL})
if (EIGEN_BUILD_BLAS OR EIGEN_BUILD_LAPACK)
# BLAS and LAPACK currently need a fortran compiler.
include(CMakeDetermineFortranCompiler)
if (NOT CMAKE_Fortran_COMPILER)
set(EIGEN_BUILD_BLAS OFF)
set(EIGEN_BUILD_LAPACK OFF)
else()
# Determine if we should build shared libraries for BLAS/LAPACK on this platform.
# Determine if we should build shared libraries for BLAS/LAPACK on this platform.
if (NOT EIGEN_BUILD_SHARED_LIBS)
get_cmake_property(EIGEN_BUILD_SHARED_LIBS TARGET_SUPPORTS_SHARED_LIBS)
endif()
endif()
option(EIGEN_BUILD_BTL "Build benchmark suite" OFF)
option(EIGEN_BUILD_SPBENCH "Build sparse benchmark suite" OFF)
# Avoid building docs if included from another project.
# Building documentation requires creating and running executables on the host
# platform. We shouldn't do this if cross-compiling.
@@ -92,7 +90,7 @@ if(NOT WIN32 OR NOT CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
endif()
option(EIGEN_BUILD_CMAKE_PACKAGE "Enables the creation of EigenConfig.cmake and related files" ${PROJECT_IS_TOP_LEVEL})
if (EIGEN_BUILD_TESTING OR EIGEN_BUILD_BLAS OR EIGEN_BUILD_LAPACK OR EIGEN_BUILT_BTL OR EIGEN_BUILD_BTL OR EIGEN_BUILD_SPBENCH OR EIGEN_BUILD_DOC OR EIGEN_BUILD_DEMOS)
if (EIGEN_BUILD_TESTING OR EIGEN_BUILD_BLAS OR EIGEN_BUILD_LAPACK OR EIGEN_BUILD_DOC OR EIGEN_BUILD_DEMOS)
set(EIGEN_IS_BUILDING_ ON)
endif()
@@ -105,19 +103,19 @@ endif()
file(READ "${PROJECT_SOURCE_DIR}/Eigen/Version" _eigen_version_header)
if (NOT DEFINED EIGEN_WORLD_VERSION)
string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen_world_version_match "${_eigen_version_header}")
set(EIGEN_WORLD_VERSION "${CMAKE_MATCH_1}")
set(EIGEN_WORLD_VERSION "${CMAKE_MATCH_1}" CACHE STRING "")
endif()
if (NOT DEFINED EIGEN_MAJOR_VERSION)
string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen_major_version_match "${_eigen_version_header}")
set(EIGEN_MAJOR_VERSION "${CMAKE_MATCH_1}")
set(EIGEN_MAJOR_VERSION "${CMAKE_MATCH_1}" CACHE STRING "")
endif()
if (NOT DEFINED EIGEN_MINOR_VERSION)
string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen_minor_version_match "${_eigen_version_header}")
set(EIGEN_MINOR_VERSION "${CMAKE_MATCH_1}")
set(EIGEN_MINOR_VERSION "${CMAKE_MATCH_1}" CACHE STRING "")
endif()
if (NOT DEFINED EIGEN_PATCH_VERSION)
string(REGEX MATCH "define[ \t]+EIGEN_PATCH_VERSION[ \t]+([0-9]+)" _eigen_patch_version_match "${_eigen_version_header}")
set(EIGEN_PATCH_VERSION "${CMAKE_MATCH_1}")
set(EIGEN_PATCH_VERSION "${CMAKE_MATCH_1}" CACHE STRING "")
endif()
if (NOT DEFINED EIGEN_PRERELEASE_VERSION)
set(EIGEN_PRERELEASE_VERSION "dev")
@@ -139,18 +137,18 @@ endif()
if (NOT DEFINED EIGEN_BUILD_VERSION AND DEFINED EIGEN_GIT_REVNUM)
string(SUBSTRING "${EIGEN_GIT_REVNUM}" 0 8 EIGEN_BUILD_VERSION)
else()
set(EIGEN_BUILD_VERSION "")
set(EIGEN_BUILD_VERSION "" CACHE STRING "")
endif()
# The EIGEN_VERSION_NUMBER must be of the form <major.minor.patch>.
# The EIGEN_VERSION_STRING can contain the preprelease/build strings.
set(EIGEN_VERSION_NUMBER "${EIGEN_MAJOR_VERSION}.${EIGEN_MINOR_VERSION}.${EIGEN_PATCH_VERSION}")
set(EIGEN_VERSION_STRING "${EIGEN_VERSION_NUMBER}")
set(EIGEN_VERSION_NUMBER "${EIGEN_MAJOR_VERSION}.${EIGEN_MINOR_VERSION}.${EIGEN_PATCH_VERSION}" CACHE STRING "")
set(EIGEN_VERSION_STRING "${EIGEN_VERSION_NUMBER}" CACHE STRING "")
if (NOT "x${EIGEN_PRERELEASE_VERSION}" STREQUAL "x")
set(EIGEN_VERSION_STRING "${EIGEN_VERSION_STRING}-${EIGEN_PRERELEASE_VERSION}")
set(EIGEN_VERSION_STRING "${EIGEN_VERSION_STRING}-${EIGEN_PRERELEASE_VERSION}" CACHE STRING "")
endif()
if (NOT "x${EIGEN_BUILD_VERSION}" STREQUAL "x")
set(EIGEN_VERSION_STRING "${EIGEN_VERSION_STRING}+${EIGEN_BUILD_VERSION}")
set(EIGEN_VERSION_STRING "${EIGEN_VERSION_STRING}+${EIGEN_BUILD_VERSION}" CACHE STRING "")
endif()
@@ -310,17 +308,29 @@ if (EIGEN_IS_BUILDING_)
set(CMAKE_INCLUDE_CURRENT_DIR OFF)
find_package(StandardMathLibrary)
find_package(AOCL QUIET)
set(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO "")
if(NOT STANDARD_MATH_LIBRARY_FOUND)
message(FATAL_ERROR
"Can't link to the standard math library. Please report to the Eigen developers, telling them about your platform.")
else()
if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
set(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO "${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO} ${STANDARD_MATH_LIBRARY}")
else()
set(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO "${STANDARD_MATH_LIBRARY}")
if(AOCL_FOUND)
list(APPEND EIGEN_STANDARD_LIBRARIES_TO_LINK_TO ${AOCL_LIBRARIES})
if(AOCL_INCLUDE_DIRS)
include_directories(${AOCL_INCLUDE_DIRS})
endif()
endif()
if(NOT STANDARD_MATH_LIBRARY_FOUND)
message(FATAL_ERROR
"Can't link to the standard math library. Please report to the Eigen developers, telling them about your platform.")
else()
if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
set(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO "${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO} ${STANDARD_MATH_LIBRARY}")
else()
set(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO "${STANDARD_MATH_LIBRARY}")
endif()
# Clean up any leading/trailing whitespace in the variable to avoid CMP0004 errors
string(STRIP "${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO}" EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
endif()
if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
message(STATUS "Standard libraries to link to explicitly: ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO}")
else()
@@ -404,6 +414,7 @@ if (EIGEN_BUILD_TESTING)
ei_add_cxx_compiler_flag("-Wno-psabi")
ei_add_cxx_compiler_flag("-Wno-variadic-macros")
ei_add_cxx_compiler_flag("-Wno-long-long")
ei_add_cxx_compiler_flag("-Wno-pass-failed") # disable clang's warning for unrolling when the loop count is dynamic.
ei_add_cxx_compiler_flag("-fno-common")
ei_add_cxx_compiler_flag("-fstrict-aliasing")
ei_add_cxx_compiler_flag("-wd981") # disable ICC's "operands are evaluated in unspecified order" remark
@@ -414,6 +425,17 @@ if (EIGEN_BUILD_TESTING)
ei_add_cxx_compiler_flag("-fno-check-new")
endif()
# GCC 12+ emits false-positive -Warray-bounds, -Wmaybe-uninitialized,
# -Wstringop-overread, and -Wnonnull warnings at -O2/-O3 in heavily
# templated code with mixed static/dynamic sizes. These are well-known
# compiler bugs (see GCC PR 109394, 106247, 105329, 98610, among others).
if (CMAKE_COMPILER_IS_GNUCXX)
ei_add_cxx_compiler_flag("-Wno-array-bounds")
ei_add_cxx_compiler_flag("-Wno-maybe-uninitialized")
ei_add_cxx_compiler_flag("-Wno-stringop-overread")
ei_add_cxx_compiler_flag("-Wno-nonnull")
endif()
if(ANDROID_NDK)
ei_add_cxx_compiler_flag("-pie")
@@ -740,15 +762,6 @@ if(EIGEN_BUILD_DOC)
add_subdirectory(doc EXCLUDE_FROM_ALL)
endif()
# TODO: consider also replacing EIGEN_BUILD_BTL by a custom target "make btl"?
if(EIGEN_BUILD_BTL)
add_subdirectory(bench/btl EXCLUDE_FROM_ALL)
endif()
if(NOT WIN32 AND EIGEN_BUILD_SPBENCH)
add_subdirectory(bench/spbench EXCLUDE_FROM_ALL)
endif()
if (EIGEN_BUILD_DEMOS)
add_subdirectory(demos EXCLUDE_FROM_ALL)
endif()
@@ -804,3 +817,4 @@ endif()
message(STATUS "")
message(STATUS "Configured Eigen ${EIGEN_VERSION_STRING}")
message(STATUS "")

View File

@@ -2,5 +2,10 @@ Eigen is primarily MPL2 licensed. See COPYING.MPL2 and these links:
http://www.mozilla.org/MPL/2.0/
http://www.mozilla.org/MPL/2.0/FAQ.html
Some files contain third-party code under BSD or other MPL2-compatible licenses,
whence the other COPYING.* files here.
Some files contain third-party code under BSD, LGPL, Apache, or other
MPL2-compatible licenses, hence the other COPYING.* files here.
Note that some optional external dependencies (e.g. FFTW, MPFR C++)
are distributed under different licenses, including the GPL. Refer to
the individual source files and their respective COPYING files for
details.

View File

@@ -14,8 +14,6 @@
#include "src/Core/util/DisableStupidWarnings.h"
/** \defgroup Cholesky_Module Cholesky module
*
*
*
* This module provides two variants of the Cholesky decomposition for selfadjoint (hermitian) matrices.
* Those decompositions are also accessible via the following methods:

View File

@@ -26,7 +26,7 @@
* For the sake of completeness, this module also propose the two following classes:
* - class CholmodSimplicialLLT
* - class CholmodSimplicialLDLT
* Note that these classes does not bring any particular advantage compared to the built-in
* Note that these classes do not bring any particular advantage compared to the built-in
* SimplicialLLT and SimplicialLDLT factorization classes.
*
* \code

View File

@@ -36,12 +36,6 @@
#include <new>
#endif
// Disable the ipa-cp-clone optimization flag with MinGW 6.x or older (enabled by default with -O3)
// See http://eigen.tuxfamily.org/bz/show_bug.cgi?id=556 for details.
#if EIGEN_COMP_MINGW && EIGEN_GNUC_STRICT_LESS_THAN(6, 0, 0)
#pragma GCC optimize("-fno-ipa-cp-clone")
#endif
// Prevent ICC from specializing std::complex operators that silently fail
// on device. This allows us to use our own device-compatible specializations
// instead.
@@ -53,6 +47,8 @@
// this include file manages BLAS and MKL related macros
// and inclusion of their respective header files
#include "src/Core/util/MKL_support.h"
#include "src/Core/util/AOCL_Support.h"
#if defined(EIGEN_HAS_CUDA_FP16) || defined(EIGEN_HAS_HIP_FP16)
#define EIGEN_HAS_GPU_FP16
@@ -71,8 +67,7 @@
#include <omp.h>
#endif
// MSVC for windows mobile does not have the errno.h file
#if !(EIGEN_COMP_MSVC && EIGEN_OS_WINCE) && !EIGEN_COMP_ARM
#if !EIGEN_COMP_ARM
#define EIGEN_HAS_ERRNO
#endif
@@ -106,6 +101,11 @@
#include <thread>
#endif
// for __cpp_lib feature test macros
#if defined(__has_include) && __has_include(<version>)
#include <version>
#endif
// for std::bit_cast()
#if defined(__cpp_lib_bit_cast) && __cpp_lib_bit_cast >= 201806L
#include <bit>
@@ -118,10 +118,18 @@
// required for __cpuid, needs to be included after cmath
// also required for _BitScanReverse on Windows on ARM
#if EIGEN_COMP_MSVC && (EIGEN_ARCH_i386_OR_x86_64 || EIGEN_ARCH_ARM64) && !EIGEN_OS_WINCE
#if EIGEN_COMP_MSVC && (EIGEN_ARCH_i386_OR_x86_64 || EIGEN_ARCH_ARM64)
#include <intrin.h>
#endif
// Required for querying cache sizes on Linux and macOS.
#if EIGEN_OS_LINUX
#include <unistd.h>
#elif EIGEN_OS_MAC
#include <sys/types.h>
#include <sys/sysctl.h>
#endif
#if defined(EIGEN_USE_SYCL)
#undef min
#undef max
@@ -140,19 +148,9 @@
#endif
#endif
#if defined EIGEN2_SUPPORT_STAGE40_FULL_EIGEN3_STRICTNESS || defined EIGEN2_SUPPORT_STAGE30_FULL_EIGEN3_API || \
defined EIGEN2_SUPPORT_STAGE20_RESOLVE_API_CONFLICTS || defined EIGEN2_SUPPORT_STAGE10_FULL_EIGEN2_API || \
defined EIGEN2_SUPPORT
// This will generate an error message:
#error Eigen2-support is only available up to version 3.2. Please go to "http://eigen.tuxfamily.org/index.php?title=Eigen2" for further information
#endif
namespace Eigen {
// we use size_t frequently and we'll never remember to prepend it with std:: every time just to
// ensure QNX/QCC support
using std::size_t;
// gcc 4.6.0 wants std:: for ptrdiff_t
using std::ptrdiff_t;
} // namespace Eigen
@@ -170,6 +168,8 @@ using std::ptrdiff_t;
#ifdef EIGEN_USE_LAPACKE
#ifdef EIGEN_USE_MKL
#include "mkl_lapacke.h"
#elif defined(EIGEN_LAPACKE_SYSTEM)
#include <lapacke.h>
#else
#include "src/misc/lapacke.h"
#endif
@@ -200,6 +200,13 @@ using std::ptrdiff_t;
#include "src/Core/arch/Default/BFloat16.h"
#include "src/Core/arch/Default/GenericPacketMathFunctionsFwd.h"
#if defined(EIGEN_VECTORIZE_GENERIC) && !defined(EIGEN_DONT_VECTORIZE)
#include "src/Core/arch/clang/PacketMath.h"
#include "src/Core/arch/clang/TypeCasting.h"
#include "src/Core/arch/clang/Complex.h"
#include "src/Core/arch/clang/Reductions.h"
#include "src/Core/arch/clang/MathFunctions.h"
#else
#if defined EIGEN_VECTORIZE_AVX512
#include "src/Core/arch/SSE/PacketMath.h"
#include "src/Core/arch/SSE/Reductions.h"
@@ -265,6 +272,18 @@ using std::ptrdiff_t;
#include "src/Core/arch/SVE/PacketMath.h"
#include "src/Core/arch/SVE/TypeCasting.h"
#include "src/Core/arch/SVE/MathFunctions.h"
#elif defined EIGEN_VECTORIZE_RVV10
#include "src/Core/arch/RVV10/PacketMath.h"
#include "src/Core/arch/RVV10/PacketMath4.h"
#include "src/Core/arch/RVV10/PacketMath2.h"
#include "src/Core/arch/RVV10/TypeCasting.h"
#include "src/Core/arch/RVV10/MathFunctions.h"
#if defined EIGEN_VECTORIZE_RVV10FP16
#include "src/Core/arch/RVV10/PacketMathFP16.h"
#endif
#if defined EIGEN_VECTORIZE_RVV10BF16
#include "src/Core/arch/RVV10/PacketMathBF16.h"
#endif
#elif defined EIGEN_VECTORIZE_ZVECTOR
#include "src/Core/arch/ZVector/PacketMath.h"
#include "src/Core/arch/ZVector/MathFunctions.h"
@@ -292,6 +311,8 @@ using std::ptrdiff_t;
#endif
#endif
#endif // #ifndef EIGEN_VECTORIZE_GENERIC
#include "src/Core/arch/Default/Settings.h"
// This file provides generic implementations valid for scalar as well
#include "src/Core/arch/Default/GenericPacketMathFunctions.h"
@@ -335,8 +356,6 @@ using std::ptrdiff_t;
#include "src/Core/DenseStorage.h"
#include "src/Core/NestByValue.h"
// #include "src/Core/ForceAlignedAccess.h"
#include "src/Core/ReturnByValue.h"
#include "src/Core/NoAlias.h"
#include "src/Core/PlainObjectBase.h"
@@ -402,17 +421,21 @@ using std::ptrdiff_t;
#include "src/Core/CoreIterators.h"
#include "src/Core/ConditionEstimator.h"
#if !defined(EIGEN_VECTORIZE_GENERIC)
#if defined(EIGEN_VECTORIZE_VSX)
#include "src/Core/arch/AltiVec/MatrixProduct.h"
#elif defined EIGEN_VECTORIZE_NEON
#include "src/Core/arch/NEON/GeneralBlockPanelKernel.h"
#elif defined EIGEN_VECTORIZE_LSX
#include "src/Core/arch/LSX/GeneralBlockPanelKernel.h"
#elif defined EIGEN_VECTORIZE_RVV10
#include "src/Core/arch/RVV10/GeneralBlockPanelKernel.h"
#endif
#if defined(EIGEN_VECTORIZE_AVX512)
#include "src/Core/arch/AVX512/GemmKernel.h"
#endif
#endif
#include "src/Core/Select.h"
#include "src/Core/VectorwiseOp.h"
@@ -438,6 +461,10 @@ using std::ptrdiff_t;
#include "src/Core/Assign_MKL.h"
#endif
#ifdef EIGEN_USE_AOCL_VML
#include "src/Core/Assign_AOCL.h"
#endif
#include "src/Core/GlobalFunctions.h"
// IWYU pragma: end_exports

View File

@@ -1,3 +1,13 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef EIGEN_DENSE_MODULE_H
#define EIGEN_DENSE_MODULE_H
#include "Core"
#include "LU"
#include "Cholesky"
@@ -5,3 +15,5 @@
#include "SVD"
#include "Geometry"
#include "Eigenvalues"
#endif // EIGEN_DENSE_MODULE_H

View File

@@ -1,2 +1,14 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef EIGEN_EIGEN_MODULE_H
#define EIGEN_EIGEN_MODULE_H
#include "Dense"
#include "Sparse"
#endif // EIGEN_EIGEN_MODULE_H

View File

@@ -11,16 +11,13 @@
#include "Core"
#include "Cholesky"
#include "Jacobi"
#include "Householder"
#include "LU"
#include "Geometry"
#include "Sparse" // Needed by ComplexQZ.
#include "src/Core/util/DisableStupidWarnings.h"
/** \defgroup Eigenvalues_Module Eigenvalues module
*
*
*
* This module mainly provides various eigenvalue solvers.
* This module also provides some MatrixBase methods, including:
@@ -32,8 +29,6 @@
* \endcode
*/
#include "src/misc/RealSvd2x2.h"
// IWYU pragma: begin_exports
#include "src/Eigenvalues/Tridiagonalization.h"
#include "src/Eigenvalues/RealSchur.h"
@@ -44,11 +39,14 @@
#include "src/Eigenvalues/ComplexSchur.h"
#include "src/Eigenvalues/ComplexEigenSolver.h"
#include "src/Eigenvalues/RealQZ.h"
#include "src/Eigenvalues/ComplexQZ.h"
#include "src/Eigenvalues/GeneralizedEigenSolver.h"
#include "src/Eigenvalues/MatrixBaseEigenvalues.h"
#ifdef EIGEN_USE_LAPACKE
#ifdef EIGEN_USE_MKL
#include "mkl_lapacke.h"
#elif defined(EIGEN_LAPACKE_SYSTEM)
#include <lapacke.h>
#else
#include "src/misc/lapacke.h"
#endif

View File

@@ -12,7 +12,6 @@
#include "SVD"
#include "LU"
#include <limits>
#include "src/Core/util/DisableStupidWarnings.h"
@@ -48,10 +47,13 @@
#include "src/Geometry/AlignedBox.h"
#include "src/Geometry/Umeyama.h"
#ifndef EIGEN_VECTORIZE_GENERIC
// TODO(rmlarsen): Make these work with generic vectorization if possible.
// Use the SSE optimized version whenever possible.
#if (defined EIGEN_VECTORIZE_SSE) || (defined EIGEN_VECTORIZE_NEON)
#include "src/Geometry/arch/Geometry_SIMD.h"
#endif
#endif
// IWYU pragma: end_exports
#include "src/Core/util/ReenableStupidWarnings.h"

View File

@@ -22,8 +22,8 @@
// IWYU pragma: begin_exports
#include "src/Householder/Householder.h"
#include "src/Householder/HouseholderSequence.h"
#include "src/Householder/BlockHouseholder.h"
#include "src/Householder/HouseholderSequence.h"
// IWYU pragma: end_exports
#include "src/Core/util/ReenableStupidWarnings.h"

View File

@@ -29,7 +29,7 @@ extern "C" {
* \endcode
*
* In order to use this module, the klu and btf headers must be accessible from the include paths, and your binary must
* be linked to the klu library and its dependencies. The dependencies depend on how umfpack has been compiled. For a
* be linked to the klu library and its dependencies. The dependencies depend on how KLU has been compiled. For a
* cmake based project, you can use our FindKLU.cmake module to help you in this task.
*
*/

View File

@@ -23,10 +23,10 @@
* \endcode
*/
// IWYU pragma: begin_exports
#include "src/misc/Kernel.h"
#include "src/misc/Image.h"
// IWYU pragma: begin_exports
#include "src/misc/RankRevealingBase.h"
#include "src/LU/FullPivLU.h"
#include "src/LU/PartialPivLU.h"
#ifdef EIGEN_USE_LAPACKE
@@ -36,9 +36,12 @@
#include "src/LU/Determinant.h"
#include "src/LU/InverseImpl.h"
#ifndef EIGEN_VECTORIZE_GENERIC
// TODO(rmlarsen): Make these work with generic vectorization if possible.
#if defined EIGEN_VECTORIZE_SSE || defined EIGEN_VECTORIZE_NEON
#include "src/LU/arch/InverseSize4.h"
#endif
#endif
// IWYU pragma: end_exports
#include "src/Core/util/ReenableStupidWarnings.h"

View File

@@ -36,7 +36,7 @@ extern "C" {
* \endcode
*
* In order to use this module, the PaSTiX headers must be accessible from the include paths, and your binary must be
* linked to the PaSTiX library and its dependencies. This wrapper resuires PaStiX version 5.x compiled without MPI
* linked to the PaSTiX library and its dependencies. This wrapper requires PaStiX version 5.x compiled without MPI
* support. The dependencies depend on how PaSTiX has been compiled. For a cmake based project, you can use our
* FindPaSTiX.cmake module to help you in this task.
*

View File

@@ -11,14 +11,11 @@
#include "Core"
#include "Cholesky"
#include "Jacobi"
#include "Householder"
#include "src/Core/util/DisableStupidWarnings.h"
/** \defgroup QR_Module QR module
*
*
*
* This module provides various QR decompositions
* This module also provides some MatrixBase methods, including:
@@ -31,6 +28,8 @@
* \endcode
*/
#include "src/misc/RankRevealingBase.h"
// IWYU pragma: begin_exports
#include "src/QR/HouseholderQR.h"
#include "src/QR/FullPivHouseholderQR.h"

View File

@@ -14,11 +14,11 @@
#include "src/Core/util/DisableStupidWarnings.h"
void *qMalloc(std::size_t size) { return Eigen::internal::aligned_malloc(size); }
inline void *qMalloc(std::size_t size) { return Eigen::internal::aligned_malloc(size); }
void qFree(void *ptr) { Eigen::internal::aligned_free(ptr); }
inline void qFree(void *ptr) { Eigen::internal::aligned_free(ptr); }
void *qRealloc(void *ptr, std::size_t size) {
inline void *qRealloc(void *ptr, std::size_t size) {
void *newPtr = Eigen::internal::aligned_malloc(size);
std::memcpy(newPtr, ptr, size);
Eigen::internal::aligned_free(ptr);

View File

@@ -38,4 +38,4 @@
#include "src/Core/util/ReenableStupidWarnings.h"
#endif
#endif // EIGEN_SPQRSUPPORT_MODULE_H

View File

@@ -9,14 +9,10 @@
#define EIGEN_SVD_MODULE_H
#include "QR"
#include "Householder"
#include "Jacobi"
#include "src/Core/util/DisableStupidWarnings.h"
/** \defgroup SVD_Module SVD module
*
*
*
* This module provides SVD decomposition for matrices (both real and complex).
* Two decomposition algorithms are provided:
@@ -33,7 +29,6 @@
*/
// IWYU pragma: begin_exports
#include "src/misc/RealSvd2x2.h"
#include "src/SVD/UpperBidiagonalization.h"
#include "src/SVD/SVDBase.h"
#include "src/SVD/JacobiSVD.h"
@@ -41,6 +36,8 @@
#ifdef EIGEN_USE_LAPACKE
#ifdef EIGEN_USE_MKL
#include "mkl_lapacke.h"
#elif defined(EIGEN_LAPACKE_SYSTEM)
#include <lapacke.h>
#else
#include "src/misc/lapacke.h"
#endif

View File

@@ -12,11 +12,7 @@
#include "src/Core/util/DisableStupidWarnings.h"
#include <vector>
#include <map>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
/**

View File

@@ -35,4 +35,4 @@
#include "src/Core/util/ReenableStupidWarnings.h"
#endif
#endif // EIGEN_SPARSEQR_MODULE_H

View File

@@ -16,6 +16,7 @@
#define EIGEN_EMPTY_WAS_ALREADY_DEFINED
#endif
// Required by SuperLU headers, which expect int_t to be defined as a global typedef.
typedef int int_t;
#include <slu_Cnames.h>
#include <supermatrix.h>

View File

@@ -27,7 +27,7 @@
#include <cstddef>
#include <cstring>
#include <time.h>
#include <ctime>
#include <vector>
#include <atomic>
@@ -77,4 +77,4 @@
#include "src/Core/util/ReenableStupidWarnings.h"
#endif // EIGEN_CXX11_THREADPOOL_MODULE_H
#endif // EIGEN_THREADPOOL_MODULE_H

View File

@@ -35,7 +35,7 @@ extern "C" {
// IWYU pragma: begin_exports
#include "src/UmfPackSupport/UmfPackSupport.h"
// IWYU pragma: endexports
// IWYU pragma: end_exports
#include "src/Core/util/ReenableStupidWarnings.h"

View File

@@ -1,3 +1,10 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef EIGEN_VERSION_H
#define EIGEN_VERSION_H
@@ -6,9 +13,9 @@
// As of Eigen3 5.0.0, we have moved to Semantic Versioning (semver.org).
#define EIGEN_MAJOR_VERSION 5
#define EIGEN_MINOR_VERSION 0
#define EIGEN_PATCH_VERSION 0
#define EIGEN_PATCH_VERSION 1
#define EIGEN_PRERELEASE_VERSION "dev"
#define EIGEN_BUILD_VERSION "master"
#define EIGEN_VERSION_STRING "5.0.0-dev+master"
#define EIGEN_VERSION_STRING "5.0.1-dev+master"
#endif // EIGEN_VERSION_H

View File

@@ -110,7 +110,7 @@ using AccelerateCholeskyAtA = AccelerateImpl<MatrixType, 0, SparseFactorizationC
namespace internal {
template <typename T>
struct AccelFactorizationDeleter {
void operator()(T* sym) {
void operator()(T* sym) const {
if (sym) {
SparseCleanup(*sym);
delete sym;

View File

@@ -84,7 +84,13 @@ class LDLT : public SolverBase<LDLT<MatrixType_, UpLo_> > {
* The default constructor is useful in cases in which the user intends to
* perform decompositions via LDLT::compute(const MatrixType&).
*/
LDLT() : m_matrix(), m_transpositions(), m_sign(internal::ZeroSign), m_isInitialized(false) {}
LDLT()
: m_matrix(),
m_l1_norm(0),
m_transpositions(),
m_sign(internal::ZeroSign),
m_isInitialized(false),
m_info(InvalidInput) {}
/** \brief Default Constructor with memory preallocation
*
@@ -94,10 +100,12 @@ class LDLT : public SolverBase<LDLT<MatrixType_, UpLo_> > {
*/
explicit LDLT(Index size)
: m_matrix(size, size),
m_l1_norm(0),
m_transpositions(size),
m_temporary(size),
m_sign(internal::ZeroSign),
m_isInitialized(false) {}
m_isInitialized(false),
m_info(InvalidInput) {}
/** \brief Constructor with decomposition
*
@@ -108,10 +116,12 @@ class LDLT : public SolverBase<LDLT<MatrixType_, UpLo_> > {
template <typename InputType>
explicit LDLT(const EigenBase<InputType>& matrix)
: m_matrix(matrix.rows(), matrix.cols()),
m_l1_norm(0),
m_transpositions(matrix.rows()),
m_temporary(matrix.rows()),
m_sign(internal::ZeroSign),
m_isInitialized(false) {
m_isInitialized(false),
m_info(InvalidInput) {
compute(matrix.derived());
}
@@ -125,10 +135,12 @@ class LDLT : public SolverBase<LDLT<MatrixType_, UpLo_> > {
template <typename InputType>
explicit LDLT(EigenBase<InputType>& matrix)
: m_matrix(matrix.derived()),
m_l1_norm(0),
m_transpositions(matrix.rows()),
m_temporary(matrix.rows()),
m_sign(internal::ZeroSign),
m_isInitialized(false) {
m_isInitialized(false),
m_info(InvalidInput) {
compute(matrix.derived());
}
@@ -191,7 +203,7 @@ class LDLT : public SolverBase<LDLT<MatrixType_, UpLo_> > {
* \sa MatrixBase::ldlt(), SelfAdjointView::ldlt()
*/
template <typename Rhs>
inline const Solve<LDLT, Rhs> solve(const MatrixBase<Rhs>& b) const;
inline Solve<LDLT, Rhs> solve(const MatrixBase<Rhs>& b) const;
#endif
template <typename Derived>
@@ -213,7 +225,7 @@ class LDLT : public SolverBase<LDLT<MatrixType_, UpLo_> > {
/** \returns the internal LDLT decomposition matrix
*
* TODO: document the storage layout
* TODO: document the storage layout.
*/
inline const MatrixType& matrixLDLT() const {
eigen_assert(m_isInitialized && "LDLT is not initialized.");
@@ -479,7 +491,7 @@ LDLT<MatrixType, UpLo_>& LDLT<MatrixType, UpLo_>::compute(const EigenBase<InputT
// Compute matrix L1 norm = max abs column sum.
m_l1_norm = RealScalar(0);
// TODO move this code to SelfAdjointView
// TODO: move this code to SelfAdjointView
for (Index col = 0; col < size; ++col) {
RealScalar abs_col_sum;
if (UpLo_ == Lower)
@@ -630,8 +642,8 @@ MatrixType LDLT<MatrixType, UpLo_>::reconstructedMatrix() const {
* \sa MatrixBase::ldlt()
*/
template <typename MatrixType, unsigned int UpLo>
inline const LDLT<typename SelfAdjointView<MatrixType, UpLo>::PlainObject, UpLo>
SelfAdjointView<MatrixType, UpLo>::ldlt() const {
inline LDLT<typename SelfAdjointView<MatrixType, UpLo>::PlainObject, UpLo> SelfAdjointView<MatrixType, UpLo>::ldlt()
const {
return LDLT<PlainObject, UpLo>(m_matrix);
}
@@ -640,7 +652,7 @@ SelfAdjointView<MatrixType, UpLo>::ldlt() const {
* \sa SelfAdjointView::ldlt()
*/
template <typename Derived>
inline const LDLT<typename MatrixBase<Derived>::PlainObject> MatrixBase<Derived>::ldlt() const {
inline LDLT<typename MatrixBase<Derived>::PlainObject> MatrixBase<Derived>::ldlt() const {
return LDLT<PlainObject>(derived());
}

View File

@@ -86,7 +86,7 @@ class LLT : public SolverBase<LLT<MatrixType_, UpLo_> > {
* The default constructor is useful in cases in which the user intends to
* perform decompositions via LLT::compute(const MatrixType&).
*/
LLT() : m_matrix(), m_isInitialized(false) {}
LLT() : m_matrix(), m_l1_norm(0), m_isInitialized(false), m_info(InvalidInput) {}
/** \brief Default Constructor with memory preallocation
*
@@ -94,10 +94,11 @@ class LLT : public SolverBase<LLT<MatrixType_, UpLo_> > {
* according to the specified problem \a size.
* \sa LLT()
*/
explicit LLT(Index size) : m_matrix(size, size), m_isInitialized(false) {}
explicit LLT(Index size) : m_matrix(size, size), m_l1_norm(0), m_isInitialized(false), m_info(InvalidInput) {}
template <typename InputType>
explicit LLT(const EigenBase<InputType>& matrix) : m_matrix(matrix.rows(), matrix.cols()), m_isInitialized(false) {
explicit LLT(const EigenBase<InputType>& matrix)
: m_matrix(matrix.rows(), matrix.cols()), m_l1_norm(0), m_isInitialized(false), m_info(InvalidInput) {
compute(matrix.derived());
}
@@ -109,7 +110,8 @@ class LLT : public SolverBase<LLT<MatrixType_, UpLo_> > {
* \sa LLT(const EigenBase&)
*/
template <typename InputType>
explicit LLT(EigenBase<InputType>& matrix) : m_matrix(matrix.derived()), m_isInitialized(false) {
explicit LLT(EigenBase<InputType>& matrix)
: m_matrix(matrix.derived()), m_l1_norm(0), m_isInitialized(false), m_info(InvalidInput) {
compute(matrix.derived());
}
@@ -137,7 +139,7 @@ class LLT : public SolverBase<LLT<MatrixType_, UpLo_> > {
* \sa solveInPlace(), MatrixBase::llt(), SelfAdjointView::llt()
*/
template <typename Rhs>
inline const Solve<LLT, Rhs> solve(const MatrixBase<Rhs>& b) const;
inline Solve<LLT, Rhs> solve(const MatrixBase<Rhs>& b) const;
#endif
template <typename Derived>
@@ -404,7 +406,7 @@ LLT<MatrixType, UpLo_>& LLT<MatrixType, UpLo_>::compute(const EigenBase<InputTyp
// Compute matrix L1 norm = max abs column sum.
m_l1_norm = RealScalar(0);
// TODO move this code to SelfAdjointView
// TODO: move this code to SelfAdjointView
for (Index col = 0; col < size; ++col) {
RealScalar abs_col_sum;
if (UpLo_ == Lower)
@@ -495,7 +497,7 @@ MatrixType LLT<MatrixType, UpLo_>::reconstructedMatrix() const {
* \sa SelfAdjointView::llt()
*/
template <typename Derived>
inline const LLT<typename MatrixBase<Derived>::PlainObject> MatrixBase<Derived>::llt() const {
inline LLT<typename MatrixBase<Derived>::PlainObject> MatrixBase<Derived>::llt() const {
return LLT<PlainObject>(derived());
}
@@ -504,7 +506,7 @@ inline const LLT<typename MatrixBase<Derived>::PlainObject> MatrixBase<Derived>:
* \sa SelfAdjointView::llt()
*/
template <typename MatrixType, unsigned int UpLo>
inline const LLT<typename SelfAdjointView<MatrixType, UpLo>::PlainObject, UpLo> SelfAdjointView<MatrixType, UpLo>::llt()
inline LLT<typename SelfAdjointView<MatrixType, UpLo>::PlainObject, UpLo> SelfAdjointView<MatrixType, UpLo>::llt()
const {
return LLT<PlainObject, UpLo>(m_matrix);
}

View File

@@ -360,7 +360,7 @@ class CholmodBase : public SparseSolverBase<Derived> {
this->m_info = NumericalIssue;
return;
}
// TODO optimize this copy by swapping when possible (be careful with alignment, etc.)
// TODO: optimize this copy by swapping when possible (be careful with alignment, etc.)
// NOTE Actually, the copy can be avoided by calling cholmod_solve2 instead of cholmod_solve
dest = Matrix<Scalar, Dest::RowsAtCompileTime, Dest::ColsAtCompileTime>::Map(reinterpret_cast<Scalar*>(x_cd->x),
b.rows(), b.cols());
@@ -386,7 +386,7 @@ class CholmodBase : public SparseSolverBase<Derived> {
this->m_info = NumericalIssue;
return;
}
// TODO optimize this copy by swapping when possible (be careful with alignment, etc.)
// TODO: optimize this copy by swapping when possible (be careful with alignment, etc.)
// NOTE cholmod_spsolve in fact just calls the dense solver for blocks of 4 columns at a time (similar to Eigen's
// sparse solver)
dest.derived() = viewAsEigen<typename DestDerived::Scalar, typename DestDerived::StorageIndex>(*x_cs);

View File

@@ -182,7 +182,7 @@ namespace placeholders {
* \returns a symbolic ArithmeticSequence representing the last \a size elements with increment \a incr.
*
* It is a shortcut for: \code seqN(last-(size-fix<1>)*incr, size, incr) \endcode
*
* \anchor Eigen_placeholders_lastN
* \sa lastN(SizeType), seqN(FirstType,SizeType), seq(FirstType,LastType,IncrType) */
template <typename SizeType, typename IncrType>
auto lastN(SizeType size, IncrType incr)

View File

@@ -123,12 +123,12 @@ class Array : public PlainObjectBase<Array<Scalar_, Rows_, Cols_, Options_, MaxR
* \sa resize(Index,Index)
*/
#ifdef EIGEN_INITIALIZE_COEFFS
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Array() : Base() { EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED }
EIGEN_DEVICE_FUNC constexpr Array() : Base() { EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED }
#else
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Array() = default;
EIGEN_DEVICE_FUNC constexpr Array() = default;
#endif
/** \brief Move constructor */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Array(Array&&) = default;
EIGEN_DEVICE_FUNC constexpr Array(Array&&) = default;
EIGEN_DEVICE_FUNC Array& operator=(Array&& other) noexcept(std::is_nothrow_move_assignable<Scalar>::value) {
Base::operator=(std::move(other));
return *this;
@@ -141,7 +141,7 @@ class Array : public PlainObjectBase<Array<Scalar_, Rows_, Cols_, Options_, MaxR
* This constructor is for 1D array or vectors with more than 4 coefficients.
*
* \warning To construct a column (resp. row) vector of fixed length, the number of values passed to this
* constructor must match the the fixed number of rows (resp. columns) of \c *this.
* constructor must match the fixed number of rows (resp. columns) of \c *this.
*
*
* Example: \include Array_variadic_ctor_cxx11.cpp
@@ -178,9 +178,7 @@ class Array : public PlainObjectBase<Array<Scalar_, Rows_, Cols_, Options_, MaxR
*
* \sa Array(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args)
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Array(
const std::initializer_list<std::initializer_list<Scalar>>& list)
: Base(list) {}
EIGEN_DEVICE_FUNC constexpr Array(const std::initializer_list<std::initializer_list<Scalar>>& list) : Base(list) {}
#ifndef EIGEN_PARSED_BY_DOXYGEN
template <typename T>
@@ -239,7 +237,7 @@ class Array : public PlainObjectBase<Array<Scalar_, Rows_, Cols_, Options_, MaxR
}
/** Copy constructor */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Array(const Array&) = default;
EIGEN_DEVICE_FUNC constexpr Array(const Array&) = default;
private:
struct PrivateType {};
@@ -247,7 +245,7 @@ class Array : public PlainObjectBase<Array<Scalar_, Rows_, Cols_, Options_, MaxR
public:
/** \sa MatrixBase::operator=(const EigenBase<OtherDerived>&) */
template <typename OtherDerived>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Array(
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Array(
const EigenBase<OtherDerived>& other,
std::enable_if_t<internal::is_convertible<typename OtherDerived::Scalar, Scalar>::value, PrivateType> =
PrivateType())

View File

@@ -168,19 +168,16 @@ class ArrayBase : public DenseBase<Derived> {
}
public:
EIGEN_DEVICE_FUNC ArrayBase<Derived>& array() { return *this; }
EIGEN_DEVICE_FUNC const ArrayBase<Derived>& array() const { return *this; }
EIGEN_DEVICE_FUNC constexpr ArrayBase<Derived>& array() { return *this; }
EIGEN_DEVICE_FUNC constexpr const ArrayBase<Derived>& array() const { return *this; }
/** \returns an \link Eigen::MatrixBase Matrix \endlink expression of this array
* \sa MatrixBase::array() */
EIGEN_DEVICE_FUNC MatrixWrapper<Derived> matrix() { return MatrixWrapper<Derived>(derived()); }
EIGEN_DEVICE_FUNC const MatrixWrapper<const Derived> matrix() const {
EIGEN_DEVICE_FUNC constexpr MatrixWrapper<Derived> matrix() { return MatrixWrapper<Derived>(derived()); }
EIGEN_DEVICE_FUNC constexpr const MatrixWrapper<const Derived> matrix() const {
return MatrixWrapper<const Derived>(derived());
}
// template<typename Dest>
// inline void evalTo(Dest& dst) const { dst = matrix(); }
protected:
EIGEN_DEFAULT_COPY_CONSTRUCTOR(ArrayBase)
EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(ArrayBase)

View File

@@ -21,7 +21,7 @@ namespace Eigen {
* \brief Expression of a mathematical vector or matrix as an array object
*
* This class is the return type of MatrixBase::array(), and most of the time
* this is the only way it is use.
* this is the only way it is used.
*
* \sa MatrixBase::array(), class MatrixWrapper
*/
@@ -54,7 +54,8 @@ class ArrayWrapper : public ArrayBase<ArrayWrapper<ExpressionType> > {
using Base::coeffRef;
EIGEN_DEVICE_FUNC explicit EIGEN_STRONG_INLINE ArrayWrapper(ExpressionType& matrix) : m_expression(matrix) {}
EIGEN_DEVICE_FUNC constexpr explicit EIGEN_STRONG_INLINE ArrayWrapper(ExpressionType& matrix)
: m_expression(matrix) {}
EIGEN_DEVICE_FUNC constexpr Index rows() const noexcept { return m_expression.rows(); }
EIGEN_DEVICE_FUNC constexpr Index cols() const noexcept { return m_expression.cols(); }
@@ -75,7 +76,7 @@ class ArrayWrapper : public ArrayBase<ArrayWrapper<ExpressionType> > {
dst = m_expression;
}
EIGEN_DEVICE_FUNC const internal::remove_all_t<NestedExpressionType>& nestedExpression() const {
EIGEN_DEVICE_FUNC constexpr const internal::remove_all_t<NestedExpressionType>& nestedExpression() const {
return m_expression;
}
@@ -96,7 +97,7 @@ class ArrayWrapper : public ArrayBase<ArrayWrapper<ExpressionType> > {
* \brief Expression of an array as a mathematical vector or matrix
*
* This class is the return type of ArrayBase::matrix(), and most of the time
* this is the only way it is use.
* this is the only way it is used.
*
* \sa MatrixBase::matrix(), class ArrayWrapper
*/
@@ -129,7 +130,7 @@ class MatrixWrapper : public MatrixBase<MatrixWrapper<ExpressionType> > {
using Base::coeffRef;
EIGEN_DEVICE_FUNC explicit inline MatrixWrapper(ExpressionType& matrix) : m_expression(matrix) {}
EIGEN_DEVICE_FUNC constexpr explicit inline MatrixWrapper(ExpressionType& matrix) : m_expression(matrix) {}
EIGEN_DEVICE_FUNC constexpr Index rows() const noexcept { return m_expression.rows(); }
EIGEN_DEVICE_FUNC constexpr Index cols() const noexcept { return m_expression.cols(); }
@@ -145,7 +146,7 @@ class MatrixWrapper : public MatrixBase<MatrixWrapper<ExpressionType> > {
EIGEN_DEVICE_FUNC inline const Scalar& coeffRef(Index index) const { return m_expression.coeffRef(index); }
EIGEN_DEVICE_FUNC const internal::remove_all_t<NestedExpressionType>& nestedExpression() const {
EIGEN_DEVICE_FUNC constexpr const internal::remove_all_t<NestedExpressionType>& nestedExpression() const {
return m_expression;
}

View File

@@ -19,7 +19,8 @@ namespace Eigen {
template <typename Derived>
template <typename OtherDerived>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::lazyAssign(const DenseBase<OtherDerived>& other) {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::lazyAssign(
const DenseBase<OtherDerived>& other) {
enum { SameType = internal::is_same<typename Derived::Scalar, typename OtherDerived::Scalar>::value };
EIGEN_STATIC_ASSERT_LVALUE(Derived)
@@ -36,40 +37,43 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::lazyAssign(co
template <typename Derived>
template <typename OtherDerived>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator=(const DenseBase<OtherDerived>& other) {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator=(
const DenseBase<OtherDerived>& other) {
internal::call_assignment(derived(), other.derived());
return derived();
}
template <typename Derived>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator=(const DenseBase& other) {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator=(const DenseBase& other) {
internal::call_assignment(derived(), other.derived());
return derived();
}
template <typename Derived>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(const MatrixBase& other) {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(const MatrixBase& other) {
internal::call_assignment(derived(), other.derived());
return derived();
}
template <typename Derived>
template <typename OtherDerived>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(const DenseBase<OtherDerived>& other) {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(
const DenseBase<OtherDerived>& other) {
internal::call_assignment(derived(), other.derived());
return derived();
}
template <typename Derived>
template <typename OtherDerived>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(const EigenBase<OtherDerived>& other) {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(
const EigenBase<OtherDerived>& other) {
internal::call_assignment(derived(), other.derived());
return derived();
}
template <typename Derived>
template <typename OtherDerived>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(
const ReturnByValue<OtherDerived>& other) {
other.derived().evalTo(derived());
return derived();

View File

@@ -63,7 +63,7 @@ struct copy_using_evaluator_traits {
static constexpr int RestrictedLinearSize = min_size_prefer_fixed(MaxSizeAtCompileTime, MaxPacketSize);
static constexpr int OuterStride = outer_stride_at_compile_time<Dst>::ret;
// TODO distinguish between linear traversal and inner-traversals
// TODO: distinguish between linear traversal and inner-traversal packet types.
using LinearPacketType = typename find_best_packet<DstScalar, RestrictedLinearSize>::type;
using InnerPacketType = typename find_best_packet<DstScalar, RestrictedInnerSize>::type;
@@ -474,8 +474,8 @@ struct dense_assignment_loop_impl<Kernel, LinearVectorizedTraversal, NoUnrolling
static constexpr int SrcAlignment = Kernel::AssignmentTraits::JointAlignment;
static constexpr int DstAlignment = plain_enum_max(Kernel::AssignmentTraits::DstAlignment, alignof(Scalar));
static constexpr int RequestedAlignment = unpacket_traits<PacketType>::alignment;
static constexpr bool Alignable =
(DstAlignment >= RequestedAlignment) || ((RequestedAlignment - DstAlignment) % sizeof(Scalar) == 0);
static constexpr bool Alignable = (DstAlignment >= RequestedAlignment) ||
(static_cast<std::size_t>(RequestedAlignment - DstAlignment) % sizeof(Scalar) == 0);
static constexpr int Alignment = Alignable ? RequestedAlignment : DstAlignment;
static constexpr bool DstIsAligned = DstAlignment >= Alignment;
static constexpr bool UsePacketSegment = Kernel::AssignmentTraits::UsePacketSegment;
@@ -587,8 +587,8 @@ struct dense_assignment_loop_impl<Kernel, SliceVectorizedTraversal, NoUnrolling>
static constexpr int SrcAlignment = Kernel::AssignmentTraits::JointAlignment;
static constexpr int DstAlignment = plain_enum_max(Kernel::AssignmentTraits::DstAlignment, alignof(Scalar));
static constexpr int RequestedAlignment = unpacket_traits<PacketType>::alignment;
static constexpr bool Alignable =
(DstAlignment >= RequestedAlignment) || ((RequestedAlignment - DstAlignment) % sizeof(Scalar) == 0);
static constexpr bool Alignable = (DstAlignment >= RequestedAlignment) ||
(static_cast<std::size_t>(RequestedAlignment - DstAlignment) % sizeof(Scalar) == 0);
static constexpr int Alignment = Alignable ? RequestedAlignment : DstAlignment;
static constexpr bool DstIsAligned = DstAlignment >= Alignment;
static constexpr bool UsePacketSegment = Kernel::AssignmentTraits::UsePacketSegment;
@@ -654,15 +654,15 @@ struct dense_assignment_loop_impl<Kernel, SliceVectorizedTraversal, InnerUnrolli
template <typename DstEvaluatorTypeT, typename SrcEvaluatorTypeT, typename Functor, int Version = Specialized>
class generic_dense_assignment_kernel {
protected:
typedef typename DstEvaluatorTypeT::XprType DstXprType;
typedef typename SrcEvaluatorTypeT::XprType SrcXprType;
using DstXprType = typename DstEvaluatorTypeT::XprType;
using SrcXprType = typename SrcEvaluatorTypeT::XprType;
public:
typedef DstEvaluatorTypeT DstEvaluatorType;
typedef SrcEvaluatorTypeT SrcEvaluatorType;
typedef typename DstEvaluatorType::Scalar Scalar;
typedef copy_using_evaluator_traits<DstEvaluatorTypeT, SrcEvaluatorTypeT, Functor> AssignmentTraits;
typedef typename AssignmentTraits::PacketType PacketType;
using DstEvaluatorType = DstEvaluatorTypeT;
using SrcEvaluatorType = SrcEvaluatorTypeT;
using Scalar = typename DstEvaluatorType::Scalar;
using AssignmentTraits = copy_using_evaluator_traits<DstEvaluatorTypeT, SrcEvaluatorTypeT, Functor>;
using PacketType = typename AssignmentTraits::PacketType;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr generic_dense_assignment_kernel(DstEvaluatorType& dst,
const SrcEvaluatorType& src,
@@ -681,8 +681,8 @@ class generic_dense_assignment_kernel {
EIGEN_DEVICE_FUNC constexpr Index cols() const noexcept { return m_dstExpr.cols(); }
EIGEN_DEVICE_FUNC constexpr Index outerStride() const noexcept { return m_dstExpr.outerStride(); }
EIGEN_DEVICE_FUNC DstEvaluatorType& dstEvaluator() noexcept { return m_dst; }
EIGEN_DEVICE_FUNC const SrcEvaluatorType& srcEvaluator() const noexcept { return m_src; }
EIGEN_DEVICE_FUNC constexpr DstEvaluatorType& dstEvaluator() noexcept { return m_dst; }
EIGEN_DEVICE_FUNC constexpr const SrcEvaluatorType& srcEvaluator() const noexcept { return m_src; }
/// Assign src(row,col) to dst(row,col) through the assignment functor.
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void assignCoeff(Index row, Index col) {
@@ -690,7 +690,7 @@ class generic_dense_assignment_kernel {
}
/// \sa assignCoeff(Index,Index)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignCoeff(Index index) {
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void assignCoeff(Index index) {
m_functor.assignCoeff(m_dst.coeffRef(index), m_src.coeff(index));
}
@@ -741,7 +741,7 @@ class generic_dense_assignment_kernel {
}
EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE constexpr Index rowIndexByOuterInner(Index outer, Index inner) {
typedef typename DstEvaluatorType::ExpressionTraits Traits;
using Traits = typename DstEvaluatorType::ExpressionTraits;
return int(Traits::RowsAtCompileTime) == 1 ? 0
: int(Traits::ColsAtCompileTime) == 1 ? inner
: int(DstEvaluatorType::Flags) & RowMajorBit ? outer
@@ -749,7 +749,7 @@ class generic_dense_assignment_kernel {
}
EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE constexpr Index colIndexByOuterInner(Index outer, Index inner) {
typedef typename DstEvaluatorType::ExpressionTraits Traits;
using Traits = typename DstEvaluatorType::ExpressionTraits;
return int(Traits::ColsAtCompileTime) == 1 ? 0
: int(Traits::RowsAtCompileTime) == 1 ? inner
: int(DstEvaluatorType::Flags) & RowMajorBit ? inner
@@ -762,7 +762,7 @@ class generic_dense_assignment_kernel {
DstEvaluatorType& m_dst;
const SrcEvaluatorType& m_src;
const Functor& m_functor;
// TODO find a way to avoid the needs of the original expression
// TODO: find a way to avoid the needs of the original expression
DstXprType& m_dstExpr;
};
@@ -774,13 +774,13 @@ template <typename DstEvaluatorTypeT, typename SrcEvaluatorTypeT, typename Funct
class restricted_packet_dense_assignment_kernel
: public generic_dense_assignment_kernel<DstEvaluatorTypeT, SrcEvaluatorTypeT, Functor, BuiltIn> {
protected:
typedef generic_dense_assignment_kernel<DstEvaluatorTypeT, SrcEvaluatorTypeT, Functor, BuiltIn> Base;
using Base = generic_dense_assignment_kernel<DstEvaluatorTypeT, SrcEvaluatorTypeT, Functor, BuiltIn>;
public:
typedef typename Base::Scalar Scalar;
typedef typename Base::DstXprType DstXprType;
typedef copy_using_evaluator_traits<DstEvaluatorTypeT, SrcEvaluatorTypeT, Functor, 4> AssignmentTraits;
typedef typename AssignmentTraits::PacketType PacketType;
using Scalar = typename Base::Scalar;
using DstXprType = typename Base::DstXprType;
using AssignmentTraits = copy_using_evaluator_traits<DstEvaluatorTypeT, SrcEvaluatorTypeT, Functor, 4>;
using PacketType = typename AssignmentTraits::PacketType;
EIGEN_DEVICE_FUNC restricted_packet_dense_assignment_kernel(DstEvaluatorTypeT& dst, const SrcEvaluatorTypeT& src,
const Functor& func, DstXprType& dstExpr)
@@ -804,15 +804,27 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void resize_if_allowed(DstXprTyp
const internal::assign_op<T1, T2>& /*func*/) {
Index dstRows = src.rows();
Index dstCols = src.cols();
if (((dst.rows() != dstRows) || (dst.cols() != dstCols))) dst.resize(dstRows, dstCols);
eigen_assert(dst.rows() == dstRows && dst.cols() == dstCols);
if (((dst.rows() != dstRows) || (dst.cols() != dstCols))) {
#ifdef EIGEN_NO_AUTOMATIC_RESIZING
eigen_assert(
(dst.size() == 0 || (DstXprType::IsVectorAtCompileTime ? (dst.size() == src.size())
: (dst.rows() == dstRows && dst.cols() == dstCols))) &&
"Size mismatch. Automatic resizing is disabled because EIGEN_NO_AUTOMATIC_RESIZING is defined");
if (dst.size() == 0) {
dst.resize(dstRows, dstCols);
}
#else
dst.resize(dstRows, dstCols);
eigen_assert(dst.rows() == dstRows && dst.cols() == dstCols);
#endif
}
}
template <typename DstXprType, typename SrcXprType, typename Functor>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void call_dense_assignment_loop(DstXprType& dst, const SrcXprType& src,
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE constexpr void call_dense_assignment_loop(DstXprType& dst, const SrcXprType& src,
const Functor& func) {
typedef evaluator<DstXprType> DstEvaluatorType;
typedef evaluator<SrcXprType> SrcEvaluatorType;
using DstEvaluatorType = evaluator<DstXprType>;
using SrcEvaluatorType = evaluator<SrcXprType>;
SrcEvaluatorType srcEvaluator(src);
@@ -822,14 +834,14 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void call_dense_assignment_loop(
DstEvaluatorType dstEvaluator(dst);
typedef generic_dense_assignment_kernel<DstEvaluatorType, SrcEvaluatorType, Functor> Kernel;
using Kernel = generic_dense_assignment_kernel<DstEvaluatorType, SrcEvaluatorType, Functor>;
Kernel kernel(dstEvaluator, srcEvaluator, func, dst.const_cast_derived());
dense_assignment_loop<Kernel>::run(kernel);
}
template <typename DstXprType, typename SrcXprType>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_dense_assignment_loop(DstXprType& dst, const SrcXprType& src) {
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void call_dense_assignment_loop(DstXprType& dst, const SrcXprType& src) {
call_dense_assignment_loop(dst, src, internal::assign_op<typename DstXprType::Scalar, typename SrcXprType::Scalar>());
}
@@ -849,11 +861,11 @@ struct EigenBase2EigenBase {};
template <typename, typename>
struct AssignmentKind {
typedef EigenBase2EigenBase Kind;
using Kind = EigenBase2EigenBase;
};
template <>
struct AssignmentKind<DenseShape, DenseShape> {
typedef Dense2Dense Kind;
using Kind = Dense2Dense;
};
// This is the main assignment class
@@ -908,11 +920,11 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void call_assignment_no_alias(Ds
int(Dst::SizeAtCompileTime) != 1
};
typedef std::conditional_t<NeedToTranspose, Transpose<Dst>, Dst> ActualDstTypeCleaned;
typedef std::conditional_t<NeedToTranspose, Transpose<Dst>, Dst&> ActualDstType;
using ActualDstTypeCleaned = std::conditional_t<NeedToTranspose, Transpose<Dst>, Dst>;
using ActualDstType = std::conditional_t<NeedToTranspose, Transpose<Dst>, Dst&>;
ActualDstType actualDst(dst);
// TODO check whether this is the right place to perform these checks:
// TODO: check whether this is the right place to perform these checks:
EIGEN_STATIC_ASSERT_LVALUE(Dst)
EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(ActualDstTypeCleaned, Src)
EIGEN_CHECK_BINARY_COMPATIBILIY(Func, typename ActualDstTypeCleaned::Scalar, typename Src::Scalar);
@@ -923,9 +935,9 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void call_assignment_no_alias(Ds
template <typename Dst, typename Src, typename Func>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_restricted_packet_assignment_no_alias(Dst& dst, const Src& src,
const Func& func) {
typedef evaluator<Dst> DstEvaluatorType;
typedef evaluator<Src> SrcEvaluatorType;
typedef restricted_packet_dense_assignment_kernel<DstEvaluatorType, SrcEvaluatorType, Func> Kernel;
using DstEvaluatorType = evaluator<Dst>;
using SrcEvaluatorType = evaluator<Src>;
using Kernel = restricted_packet_dense_assignment_kernel<DstEvaluatorType, SrcEvaluatorType, Func>;
EIGEN_STATIC_ASSERT_LVALUE(Dst)
EIGEN_CHECK_BINARY_COMPATIBILIY(Func, typename Dst::Scalar, typename Src::Scalar);
@@ -947,7 +959,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void call_assignment_no_alias(Ds
template <typename Dst, typename Src, typename Func>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void call_assignment_no_alias_no_transpose(Dst& dst, const Src& src,
const Func& func) {
// TODO check whether this is the right place to perform these checks:
// TODO: check whether this is the right place to perform these checks:
EIGEN_STATIC_ASSERT_LVALUE(Dst)
EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Dst, Src)
EIGEN_CHECK_BINARY_COMPATIBILIY(Func, typename Dst::Scalar, typename Src::Scalar);
@@ -1007,7 +1019,7 @@ struct Assignment<DstXprType, CwiseNullaryOp<scalar_zero_op<typename DstXprType:
};
// Generic assignment through evalTo.
// TODO: not sure we have to keep that one, but it helps porting current code to new evaluator mechanism.
// TODO: evaluate whether this generic evalTo-based assignment path is still needed.
// Note that the last template argument "Weak" is needed to make it possible to perform
// both partial specialization+SFINAE without ambiguous specialization
template <typename DstXprType, typename SrcXprType, typename Functor, typename Weak>

View File

@@ -0,0 +1,301 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* Assign_AOCL.h - AOCL Vectorized Math Dispatch Layer for Eigen
*
* Copyright (c) 2025, Advanced Micro Devices, Inc. All rights reserved.
*
* Description:
* ------------
* This file implements a high-performance dispatch layer that automatically
* routes Eigen's element-wise mathematical operations to AMD Optimizing CPU
* Libraries (AOCL) Vector Math Library (VML) functions when beneficial for
* performance.
*
* The dispatch system uses C++ template specialization to intercept Eigen's
* assignment operations and redirect them to AOCL's VRDA functions, which
* provide optimized implementations for AMD Zen architectures.
*
* Key Features:
* -------------
* 1. Automatic Dispatch: Seamlessly routes supported operations to AOCL without
* requiring code changes in user applications
*
* 2. Performance Optimization: Uses AOCL VRDA functions optimized for Zen
* family processors with automatic SIMD instruction selection (AVX2, AVX-512)
*
* 3. Threshold-Based Activation: Only activates for vectors larger than
* EIGEN_AOCL_VML_THRESHOLD (default: 128 elements) to avoid overhead on
* small vectors
*
* 4. Precision-Specific Handling:
* - Double precision: AOCL VRDA vectorized functions
* - Single precision: Scalar fallback (preserves correctness)
*
* 5. Memory Layout Compatibility: Ensures direct memory access and compatible
* storage orders between source and destination for optimal performance
*
* Supported Operations:
* ---------------------
* UNARY OPERATIONS (vector → vector):
* - Transcendental: exp(), sin(), cos(), sqrt(), log(), log10(), log2()
*
* BINARY OPERATIONS (vector op vector → vector):
* - Arithmetic: +, *, pow()
*
* Template Specialization Mechanism:
* -----------------------------------
* The system works by specializing Eigen's Assignment template for:
* 1. CwiseUnaryOp with scalar_*_op functors (unary operations)
* 2. CwiseBinaryOp with scalar_*_op functors (binary operations)
* 3. Dense2Dense assignment context with AOCL-compatible traits
*
* Dispatch conditions (all must be true):
* - Source and destination have DirectAccessBit (contiguous memory)
* - Compatible storage orders (both row-major or both column-major)
* - Vector size ≥ EIGEN_AOCL_VML_THRESHOLD or Dynamic size
* - Supported data type (currently double precision for VRDA)
*
* Integration Example:
* --------------------
* // Standard Eigen code - no changes required
* VectorXd x = VectorXd::Random(10000);
* VectorXd y = VectorXd::Random(10000);
* VectorXd result;
*
* // These operations are automatically dispatched to AOCL:
* result = x.array().exp(); // → amd_vrda_exp()
* result = x.array().sin(); // → amd_vrda_sin()
* result = x.array() + y.array(); // → amd_vrda_add()
* result = x.array().pow(y.array()); // → amd_vrda_pow()
*
* Configuration:
* --------------
* Required preprocessor definitions:
* - EIGEN_USE_AOCL_ALL or EIGEN_USE_AOCL_MT: Enable AOCL integration
* - EIGEN_USE_AOCL_VML: Enable Vector Math Library dispatch
*
* Compilation Requirements:
* -------------------------
* Include paths:
* - AOCL headers: -I${AOCL_ROOT}/include
* - Eigen headers: -I/path/to/eigen
*
* Link libraries:
* - AOCL MathLib: -lamdlibm
* - Standard math: -lm
*
* Compiler flags:
* - Optimization: -O3 (required for inlining)
* - Architecture: -march=znver5 or -march=native
* - Vectorization: -mfma -mavx512f (if supported)
*
* Platform Support:
* ------------------
* - Primary: Linux x86_64 with AMD Zen family processors
* - Compilers: GCC 8+, Clang 10+, AOCC (recommended)
* - AOCL Version: 4.0+ (with VRDA support)
*
* Error Handling:
* ---------------
* - Graceful fallback to scalar operations for unsupported configurations
* - Compile-time detection of AOCL availability
* - Runtime size and alignment validation with eigen_assert()
*
* Developer:
* ----------
* Name: Sharad Saurabh Bhaskar
* Email: shbhaska@amd.com
* Organization: Advanced Micro Devices, Inc.
*/
#ifndef EIGEN_ASSIGN_AOCL_H
#define EIGEN_ASSIGN_AOCL_H
namespace Eigen {
namespace internal {
// Traits for unary operations.
template <typename Dst, typename Src> class aocl_assign_traits {
private:
enum {
DstHasDirectAccess = !!(Dst::Flags & DirectAccessBit),
SrcHasDirectAccess = !!(Src::Flags & DirectAccessBit),
StorageOrdersAgree = (int(Dst::IsRowMajor) == int(Src::IsRowMajor)),
InnerSize = Dst::IsVectorAtCompileTime ? int(Dst::SizeAtCompileTime)
: (Dst::Flags & RowMajorBit) ? int(Dst::ColsAtCompileTime)
: int(Dst::RowsAtCompileTime),
LargeEnough =
(InnerSize == Dynamic) || (InnerSize >= EIGEN_AOCL_VML_THRESHOLD)
};
public:
enum {
EnableAoclVML = DstHasDirectAccess && SrcHasDirectAccess &&
StorageOrdersAgree && LargeEnough,
Traversal = LinearTraversal
};
};
// Traits for binary operations (e.g., add, pow).
template <typename Dst, typename Lhs, typename Rhs>
class aocl_assign_binary_traits {
private:
enum {
DstHasDirectAccess = !!(Dst::Flags & DirectAccessBit),
LhsHasDirectAccess = !!(Lhs::Flags & DirectAccessBit),
RhsHasDirectAccess = !!(Rhs::Flags & DirectAccessBit),
StorageOrdersAgree = (int(Dst::IsRowMajor) == int(Lhs::IsRowMajor)) &&
(int(Dst::IsRowMajor) == int(Rhs::IsRowMajor)),
InnerSize = Dst::IsVectorAtCompileTime ? int(Dst::SizeAtCompileTime)
: (Dst::Flags & RowMajorBit) ? int(Dst::ColsAtCompileTime)
: int(Dst::RowsAtCompileTime),
LargeEnough =
(InnerSize == Dynamic) || (InnerSize >= EIGEN_AOCL_VML_THRESHOLD)
};
public:
enum {
EnableAoclVML = DstHasDirectAccess && LhsHasDirectAccess &&
RhsHasDirectAccess && StorageOrdersAgree && LargeEnough
};
};
// Unary operation dispatch for float (scalar fallback).
#define EIGEN_AOCL_VML_UNARY_CALL_FLOAT(EIGENOP) \
template <typename DstXprType, typename SrcXprNested> \
struct Assignment< \
DstXprType, CwiseUnaryOp<scalar_##EIGENOP##_op<float>, SrcXprNested>, \
assign_op<float, float>, Dense2Dense, \
std::enable_if_t< \
aocl_assign_traits<DstXprType, SrcXprNested>::EnableAoclVML>> { \
typedef CwiseUnaryOp<scalar_##EIGENOP##_op<float>, SrcXprNested> \
SrcXprType; \
static void run(DstXprType &dst, const SrcXprType &src, \
const assign_op<float, float> &) { \
eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); \
Eigen::Index n = dst.size(); \
if (n <= 0) \
return; \
const float *input = \
reinterpret_cast<const float *>(src.nestedExpression().data()); \
float *output = reinterpret_cast<float *>(dst.data()); \
for (Eigen::Index i = 0; i < n; ++i) { \
output[i] = std::EIGENOP(input[i]); \
} \
} \
};
// Unary operation dispatch for double (AOCL vectorized).
#define EIGEN_AOCL_VML_UNARY_CALL_DOUBLE(EIGENOP, AOCLOP) \
template <typename DstXprType, typename SrcXprNested> \
struct Assignment< \
DstXprType, CwiseUnaryOp<scalar_##EIGENOP##_op<double>, SrcXprNested>, \
assign_op<double, double>, Dense2Dense, \
std::enable_if_t< \
aocl_assign_traits<DstXprType, SrcXprNested>::EnableAoclVML>> { \
typedef CwiseUnaryOp<scalar_##EIGENOP##_op<double>, SrcXprNested> \
SrcXprType; \
static void run(DstXprType &dst, const SrcXprType &src, \
const assign_op<double, double> &) { \
eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); \
Eigen::Index n = dst.size(); \
eigen_assert(n <= INT_MAX && "AOCL does not support arrays larger than INT_MAX"); \
if (n <= 0) \
return; \
const double *input = \
reinterpret_cast<const double *>(src.nestedExpression().data()); \
double *output = reinterpret_cast<double *>(dst.data()); \
int aocl_n = internal::convert_index<int>(n); \
AOCLOP(aocl_n, const_cast<double *>(input), output); \
} \
};
// Instantiate unary calls for float (scalar).
// EIGEN_AOCL_VML_UNARY_CALL_FLOAT(exp)
// Instantiate unary calls for double (AOCL vectorized).
EIGEN_AOCL_VML_UNARY_CALL_DOUBLE(exp2, amd_vrda_exp2)
EIGEN_AOCL_VML_UNARY_CALL_DOUBLE(exp, amd_vrda_exp)
EIGEN_AOCL_VML_UNARY_CALL_DOUBLE(sin, amd_vrda_sin)
EIGEN_AOCL_VML_UNARY_CALL_DOUBLE(cos, amd_vrda_cos)
EIGEN_AOCL_VML_UNARY_CALL_DOUBLE(sqrt, amd_vrda_sqrt)
EIGEN_AOCL_VML_UNARY_CALL_DOUBLE(cbrt, amd_vrda_cbrt)
EIGEN_AOCL_VML_UNARY_CALL_DOUBLE(abs, amd_vrda_fabs)
EIGEN_AOCL_VML_UNARY_CALL_DOUBLE(log, amd_vrda_log)
EIGEN_AOCL_VML_UNARY_CALL_DOUBLE(log10, amd_vrda_log10)
EIGEN_AOCL_VML_UNARY_CALL_DOUBLE(log2, amd_vrda_log2)
// Binary operation dispatch for float (scalar fallback).
#define EIGEN_AOCL_VML_BINARY_CALL_FLOAT(EIGENOP, STDFUNC) \
template <typename DstXprType, typename LhsXprNested, typename RhsXprNested> \
struct Assignment< \
DstXprType, \
CwiseBinaryOp<scalar_##EIGENOP##_op<float, float>, LhsXprNested, \
RhsXprNested>, \
assign_op<float, float>, Dense2Dense, \
std::enable_if_t<aocl_assign_binary_traits< \
DstXprType, LhsXprNested, RhsXprNested>::EnableAoclVML>> { \
typedef CwiseBinaryOp<scalar_##EIGENOP##_op<float, float>, LhsXprNested, \
RhsXprNested> \
SrcXprType; \
static void run(DstXprType &dst, const SrcXprType &src, \
const assign_op<float, float> &) { \
eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); \
Eigen::Index n = dst.size(); \
if (n <= 0) \
return; \
const float *lhs = reinterpret_cast<const float *>(src.lhs().data()); \
const float *rhs = reinterpret_cast<const float *>(src.rhs().data()); \
float *output = reinterpret_cast<float *>(dst.data()); \
for (Eigen::Index i = 0; i < n; ++i) { \
output[i] = STDFUNC(lhs[i], rhs[i]); \
} \
} \
};
// Binary operation dispatch for double (AOCL vectorized).
#define EIGEN_AOCL_VML_BINARY_CALL_DOUBLE(EIGENOP, AOCLOP) \
template <typename DstXprType, typename LhsXprNested, typename RhsXprNested> \
struct Assignment< \
DstXprType, \
CwiseBinaryOp<scalar_##EIGENOP##_op<double, double>, LhsXprNested, \
RhsXprNested>, \
assign_op<double, double>, Dense2Dense, \
std::enable_if_t<aocl_assign_binary_traits< \
DstXprType, LhsXprNested, RhsXprNested>::EnableAoclVML>> { \
typedef CwiseBinaryOp<scalar_##EIGENOP##_op<double, double>, LhsXprNested, \
RhsXprNested> \
SrcXprType; \
static void run(DstXprType &dst, const SrcXprType &src, \
const assign_op<double, double> &) { \
eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); \
Eigen::Index n = dst.size(); \
eigen_assert(n <= INT_MAX && "AOCL does not support arrays larger than INT_MAX"); \
if (n <= 0) \
return; \
const double *lhs = reinterpret_cast<const double *>(src.lhs().data()); \
const double *rhs = reinterpret_cast<const double *>(src.rhs().data()); \
double *output = reinterpret_cast<double *>(dst.data()); \
int aocl_n = internal::convert_index<int>(n); \
AOCLOP(aocl_n, const_cast<double *>(lhs), const_cast<double *>(rhs), output); \
} \
};
// Instantiate binary calls for float (scalar).
// EIGEN_AOCL_VML_BINARY_CALL_FLOAT(sum, std::plus<float>) // Using
// scalar_sum_op for addition EIGEN_AOCL_VML_BINARY_CALL_FLOAT(pow, std::pow)
// Instantiate binary calls for double (AOCL vectorized).
EIGEN_AOCL_VML_BINARY_CALL_DOUBLE(sum, amd_vrda_add) // Using scalar_sum_op for addition
EIGEN_AOCL_VML_BINARY_CALL_DOUBLE(pow, amd_vrda_pow)
EIGEN_AOCL_VML_BINARY_CALL_DOUBLE(max, amd_vrda_fmax)
EIGEN_AOCL_VML_BINARY_CALL_DOUBLE(min, amd_vrda_fmin)
} // namespace internal
} // namespace Eigen
#endif // EIGEN_ASSIGN_AOCL_H

View File

@@ -56,11 +56,11 @@ class vml_assign_traits {
: int(Dst::MaxRowsAtCompileTime),
MaxSizeAtCompileTime = Dst::SizeAtCompileTime,
MightEnableVml = StorageOrdersAgree && DstHasDirectAccess && SrcHasDirectAccess &&
MightEnableVml = bool(StorageOrdersAgree) && bool(DstHasDirectAccess) && bool(SrcHasDirectAccess) &&
Src::InnerStrideAtCompileTime == 1 && Dst::InnerStrideAtCompileTime == 1,
MightLinearize = MightEnableVml && (int(Dst::Flags) & int(Src::Flags) & LinearAccessBit),
VmlSize = MightLinearize ? MaxSizeAtCompileTime : InnerMaxSize,
LargeEnough = VmlSize == Dynamic || VmlSize >= EIGEN_MKL_VML_THRESHOLD
MightLinearize = bool(MightEnableVml) && (int(Dst::Flags) & int(Src::Flags) & LinearAccessBit),
VmlSize = bool(MightLinearize) ? MaxSizeAtCompileTime : InnerMaxSize,
LargeEnough = (VmlSize == Dynamic) || VmlSize >= EIGEN_MKL_VML_THRESHOLD
};
public:

View File

@@ -121,14 +121,14 @@ class Block
/** Column or Row constructor
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Block(XprType& xpr, Index i) : Impl(xpr, i) {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Block(XprType& xpr, Index i) : Impl(xpr, i) {
eigen_assert((i >= 0) && (((BlockRows == 1) && (BlockCols == XprType::ColsAtCompileTime) && i < xpr.rows()) ||
((BlockRows == XprType::RowsAtCompileTime) && (BlockCols == 1) && i < xpr.cols())));
}
/** Fixed-size constructor
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Block(XprType& xpr, Index startRow, Index startCol)
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Block(XprType& xpr, Index startRow, Index startCol)
: Impl(xpr, startRow, startCol) {
EIGEN_STATIC_ASSERT(RowsAtCompileTime != Dynamic && ColsAtCompileTime != Dynamic,
THIS_METHOD_IS_ONLY_FOR_FIXED_SIZE)
@@ -138,8 +138,8 @@ class Block
/** Dynamic-size constructor
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Block(XprType& xpr, Index startRow, Index startCol, Index blockRows,
Index blockCols)
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Block(XprType& xpr, Index startRow, Index startCol, Index blockRows,
Index blockCols)
: Impl(xpr, startRow, startCol, blockRows, blockCols) {
eigen_assert((RowsAtCompileTime == Dynamic || RowsAtCompileTime == blockRows) &&
(ColsAtCompileTime == Dynamic || ColsAtCompileTime == blockCols));
@@ -175,11 +175,11 @@ class BlockImpl<XprType, BlockRows, BlockCols, InnerPanel, Dense>
public:
typedef Impl Base;
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(BlockImpl)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE BlockImpl(XprType& xpr, Index i) : Impl(xpr, i) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE BlockImpl(XprType& xpr, Index startRow, Index startCol)
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE BlockImpl(XprType& xpr, Index i) : Impl(xpr, i) {}
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE BlockImpl(XprType& xpr, Index startRow, Index startCol)
: Impl(xpr, startRow, startCol) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE BlockImpl(XprType& xpr, Index startRow, Index startCol, Index blockRows,
Index blockCols)
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE BlockImpl(XprType& xpr, Index startRow, Index startCol,
Index blockRows, Index blockCols)
: Impl(xpr, startRow, startCol, blockRows, blockCols) {}
};
@@ -196,11 +196,9 @@ class BlockImpl_dense : public internal::dense_xpr_base<Block<XprType, BlockRows
EIGEN_DENSE_PUBLIC_INTERFACE(BlockType)
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(BlockImpl_dense)
// class InnerIterator; // FIXME apparently never used
/** Column or Row constructor
*/
EIGEN_DEVICE_FUNC inline BlockImpl_dense(XprType& xpr, Index i)
EIGEN_DEVICE_FUNC constexpr BlockImpl_dense(XprType& xpr, Index i)
: m_xpr(xpr),
// It is a row if and only if BlockRows==1 and BlockCols==XprType::ColsAtCompileTime,
// and it is a column if and only if BlockRows==XprType::RowsAtCompileTime and BlockCols==1,
@@ -213,17 +211,17 @@ class BlockImpl_dense : public internal::dense_xpr_base<Block<XprType, BlockRows
/** Fixed-size constructor
*/
EIGEN_DEVICE_FUNC inline BlockImpl_dense(XprType& xpr, Index startRow, Index startCol)
EIGEN_DEVICE_FUNC constexpr BlockImpl_dense(XprType& xpr, Index startRow, Index startCol)
: m_xpr(xpr), m_startRow(startRow), m_startCol(startCol), m_blockRows(BlockRows), m_blockCols(BlockCols) {}
/** Dynamic-size constructor
*/
EIGEN_DEVICE_FUNC inline BlockImpl_dense(XprType& xpr, Index startRow, Index startCol, Index blockRows,
Index blockCols)
EIGEN_DEVICE_FUNC constexpr BlockImpl_dense(XprType& xpr, Index startRow, Index startCol, Index blockRows,
Index blockCols)
: m_xpr(xpr), m_startRow(startRow), m_startCol(startCol), m_blockRows(blockRows), m_blockCols(blockCols) {}
EIGEN_DEVICE_FUNC inline Index rows() const { return m_blockRows.value(); }
EIGEN_DEVICE_FUNC inline Index cols() const { return m_blockCols.value(); }
EIGEN_DEVICE_FUNC constexpr Index rows() const { return m_blockRows.value(); }
EIGEN_DEVICE_FUNC constexpr Index cols() const { return m_blockCols.value(); }
EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index rowId, Index colId) {
EIGEN_STATIC_ASSERT_LVALUE(XprType)
@@ -289,9 +287,9 @@ class BlockImpl_dense : public internal::dense_xpr_base<Block<XprType, BlockRows
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE XprType& nestedExpression() { return m_xpr; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr StorageIndex startRow() const noexcept { return m_startRow.value(); }
EIGEN_DEVICE_FUNC constexpr StorageIndex startRow() const noexcept { return m_startRow.value(); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr StorageIndex startCol() const noexcept { return m_startCol.value(); }
EIGEN_DEVICE_FUNC constexpr StorageIndex startCol() const noexcept { return m_startCol.value(); }
protected:
XprTypeNested m_xpr;
@@ -380,18 +378,18 @@ class BlockImpl_dense<XprType, BlockRows, BlockCols, InnerPanel, true>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE XprType& nestedExpression() { return m_xpr; }
/** \sa MapBase::innerStride() */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index innerStride() const noexcept {
EIGEN_DEVICE_FUNC constexpr Index innerStride() const noexcept {
return internal::traits<BlockType>::HasSameStorageOrderAsXprType ? m_xpr.innerStride() : m_xpr.outerStride();
}
/** \sa MapBase::outerStride() */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index outerStride() const noexcept {
EIGEN_DEVICE_FUNC constexpr Index outerStride() const noexcept {
return internal::traits<BlockType>::HasSameStorageOrderAsXprType ? m_xpr.outerStride() : m_xpr.innerStride();
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr StorageIndex startRow() const noexcept { return m_startRow.value(); }
EIGEN_DEVICE_FUNC constexpr StorageIndex startRow() const noexcept { return m_startRow.value(); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr StorageIndex startCol() const noexcept { return m_startCol.value(); }
EIGEN_DEVICE_FUNC constexpr StorageIndex startCol() const noexcept { return m_startCol.value(); }
#ifndef __SUNPRO_CC
// FIXME sunstudio is not friendly with the above friend...

View File

@@ -31,7 +31,7 @@ template <typename XprType>
struct CommaInitializer {
typedef typename XprType::Scalar Scalar;
EIGEN_DEVICE_FUNC inline CommaInitializer(XprType& xpr, const Scalar& s)
EIGEN_DEVICE_FUNC constexpr CommaInitializer(XprType& xpr, const Scalar& s)
: m_xpr(xpr), m_row(0), m_col(1), m_currentBlockRows(1) {
eigen_assert(m_xpr.rows() > 0 && m_xpr.cols() > 0 && "Cannot comma-initialize a 0x0 matrix (operator<<)");
m_xpr.coeffRef(0, 0) = s;
@@ -48,7 +48,6 @@ struct CommaInitializer {
/* Copy/Move constructor which transfers ownership. This is crucial in
* absence of return value optimization to avoid assertions during destruction. */
// FIXME in C++11 mode this could be replaced by a proper RValue constructor
EIGEN_DEVICE_FUNC inline CommaInitializer(const CommaInitializer& o)
: m_xpr(o.m_xpr), m_row(o.m_row), m_col(o.m_col), m_currentBlockRows(o.m_currentBlockRows) {
// Mark original object as finished. In absence of R-value references we need to const_cast:

View File

@@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2016 Rasmus Munk Larsen (rmlarsen@google.com)
// Copyright (C) 2016 Rasmus Munk Larsen (rmlarsen@gmail.com)
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
@@ -40,18 +40,17 @@ struct rcond_compute_sign<Vector, Vector, false> {
* \a matrix that implements .solve() and .adjoint().solve() methods.
*
* This function implements Algorithms 4.1 and 5.1 from
* http://www.maths.manchester.ac.uk/~higham/narep/narep135.pdf
* which also forms the basis for the condition number estimators in
* LAPACK. Since at most 10 calls to the solve method of dec are
* performed, the total cost is O(dims^2), as opposed to O(dims^3)
* needed to compute the inverse matrix explicitly.
* Higham, "Experience with a Matrix Norm Estimator",
* SIAM J. Sci. Stat. Comput., 11(4):804-809, 1990.
* with Higham's alternating-sign safety-net estimate from
* Higham and Tisseur, "A Block Algorithm for Matrix 1-Norm Estimation,
* with an Application to 1-Norm Pseudospectra", SIAM J. Matrix Anal. Appl.,
* 21(4):1185-1201, 2000.
*
* The most common usage is in estimating the condition number
* ||matrix||_1 * ||inv(matrix)||_1. The first term ||matrix||_1 can be
* computed directly in O(n^2) operations.
* The Hager/Higham gradient ascent uses at most 5 iterations of 2 solves
* each, giving a total cost of O(n^2).
*
* Supports the following decompositions: FullPivLU, PartialPivLU, LDLT, and
* LLT.
* Supports the following decompositions: FullPivLU, PartialPivLU, LDLT, LLT.
*
* \sa FullPivLU, PartialPivLU, LDLT, LLT.
*/
@@ -66,7 +65,7 @@ typename Decomposition::RealScalar rcond_invmatrix_L1_norm_estimate(const Decomp
eigen_assert(dec.rows() == dec.cols());
const Index n = dec.rows();
if (n == 0) return 0;
if (n == 0) return RealScalar(0);
// Disable Index to float conversion warning
#ifdef __INTEL_COMPILER
@@ -80,14 +79,12 @@ typename Decomposition::RealScalar rcond_invmatrix_L1_norm_estimate(const Decomp
// lower_bound is a lower bound on
// ||inv(matrix)||_1 = sup_v ||inv(matrix) v||_1 / ||v||_1
// and is the objective maximized by the ("super-") gradient ascent
// algorithm below.
// and is the objective maximized by the supergradient ascent algorithm below.
RealScalar lower_bound = v.template lpNorm<1>();
if (n == 1) return lower_bound;
// Gradient ascent algorithm follows: We know that the optimum is achieved at
// one of the simplices v = e_i, so in each iteration we follow a
// super-gradient to move towards the optimal one.
// Gradient ascent: the optimum is achieved at a unit vector e_j. Each
// iteration follows the supergradient to find which unit vector to probe next.
RealScalar old_lower_bound = lower_bound;
Vector sign_vector(n);
Vector old_sign_vector;
@@ -96,21 +93,21 @@ typename Decomposition::RealScalar rcond_invmatrix_L1_norm_estimate(const Decomp
for (int k = 0; k < 4; ++k) {
sign_vector = internal::rcond_compute_sign<Vector, RealVector, is_complex>::run(v);
if (k > 0 && !is_complex && sign_vector == old_sign_vector) {
// Break if the solution stagnated.
// Break if the sign vector stagnated.
break;
}
// v_max_abs_index = argmax |real( inv(matrix)^T * sign_vector )|
// Supergradient: z = A^{-T} * sign(v), pick argmax |z_i|.
v = dec.adjoint().solve(sign_vector);
v.real().cwiseAbs().maxCoeff(&v_max_abs_index);
if (v_max_abs_index == old_v_max_abs_index) {
// Break if the solution stagnated.
// Optimality: supergradient points to the same unit vector.
break;
}
// Move to the new simplex e_j, where j = v_max_abs_index.
v = dec.solve(Vector::Unit(n, v_max_abs_index)); // v = inv(matrix) * e_j.
// Probe the best unit vector: v = A^{-1} * e_j.
v = dec.solve(Vector::Unit(n, v_max_abs_index));
lower_bound = v.template lpNorm<1>();
if (lower_bound <= old_lower_bound) {
// Break if the gradient step did not increase the lower_bound.
// No improvement from the gradient step.
break;
}
if (!is_complex) {
@@ -119,25 +116,19 @@ typename Decomposition::RealScalar rcond_invmatrix_L1_norm_estimate(const Decomp
old_v_max_abs_index = v_max_abs_index;
old_lower_bound = lower_bound;
}
// The following calculates an independent estimate of ||matrix||_1 by
// multiplying matrix by a vector with entries of slowly increasing
// magnitude and alternating sign:
// v_i = (-1)^{i} (1 + (i / (dim-1))), i = 0,...,dim-1.
// This improvement to Hager's algorithm above is due to Higham. It was
// added to make the algorithm more robust in certain corner cases where
// large elements in the matrix might otherwise escape detection due to
// exact cancellation (especially when op and op_adjoint correspond to a
// sequence of backsubstitutions and permutations), which could cause
// Hager's algorithm to vastly underestimate ||matrix||_1.
// Higham's alternating-sign estimate: an independent safety-net that catches
// cases where the gradient ascent converges to a local maximum due to exact
// cancellation patterns (especially with permutations and backsubstitutions).
// v_i = (-1)^i * (1 + i/(n-1)), then estimate = 2*||A^{-1}*v||_1 / (3*n).
Scalar alternating_sign(RealScalar(1));
for (Index i = 0; i < n; ++i) {
// The static_cast is needed when Scalar is a complex and RealScalar implements expression templates
// The static_cast is needed when Scalar is complex and RealScalar uses expression templates.
v[i] = alternating_sign * static_cast<RealScalar>(RealScalar(1) + (RealScalar(i) / (RealScalar(n - 1))));
alternating_sign = -alternating_sign;
}
v = dec.solve(v);
const RealScalar alternate_lower_bound = (2 * v.template lpNorm<1>()) / (3 * RealScalar(n));
return numext::maxi(lower_bound, alternate_lower_bound);
const RealScalar alt_est = (RealScalar(2) * v.template lpNorm<1>()) / (RealScalar(3) * RealScalar(n));
return numext::maxi(lower_bound, alt_est);
}
/** \brief Reciprocal condition number estimator.

File diff suppressed because it is too large Load Diff

View File

@@ -57,7 +57,7 @@ class InnerIterator {
m_iter.operator+=(i);
return *this;
}
EIGEN_STRONG_INLINE InnerIterator operator+(Index i) {
EIGEN_STRONG_INLINE InnerIterator operator+(Index i) const {
InnerIterator result(*this);
result += i;
return result;

View File

@@ -98,33 +98,33 @@ class CwiseBinaryOp : public CwiseBinaryOpImpl<BinaryOp, LhsType, RhsType,
typedef std::remove_reference_t<RhsNested> RhsNested_;
#if EIGEN_COMP_MSVC
// Required for Visual Studio or the Copy constructor will probably not get inlined!
// Required for Visual Studio, which may fail to inline the copy constructor otherwise.
EIGEN_STRONG_INLINE CwiseBinaryOp(const CwiseBinaryOp<BinaryOp, LhsType, RhsType>&) = default;
#endif
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CwiseBinaryOp(const Lhs& aLhs, const Rhs& aRhs,
const BinaryOp& func = BinaryOp())
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE CwiseBinaryOp(const Lhs& aLhs, const Rhs& aRhs,
const BinaryOp& func = BinaryOp())
: m_lhs(aLhs), m_rhs(aRhs), m_functor(func) {
eigen_assert(aLhs.rows() == aRhs.rows() && aLhs.cols() == aRhs.cols());
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const noexcept {
EIGEN_DEVICE_FUNC constexpr Index rows() const noexcept {
// return the fixed size type if available to enable compile time optimizations
return internal::traits<internal::remove_all_t<LhsNested>>::RowsAtCompileTime == Dynamic ? m_rhs.rows()
: m_lhs.rows();
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const noexcept {
EIGEN_DEVICE_FUNC constexpr Index cols() const noexcept {
// return the fixed size type if available to enable compile time optimizations
return internal::traits<internal::remove_all_t<LhsNested>>::ColsAtCompileTime == Dynamic ? m_rhs.cols()
: m_lhs.cols();
}
/** \returns the left hand side nested expression */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const LhsNested_& lhs() const { return m_lhs; }
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const LhsNested_& lhs() const { return m_lhs; }
/** \returns the right hand side nested expression */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const RhsNested_& rhs() const { return m_rhs; }
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const RhsNested_& rhs() const { return m_rhs; }
/** \returns the functor representing the binary operation */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const BinaryOp& functor() const { return m_functor; }
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const BinaryOp& functor() const { return m_functor; }
protected:
LhsNested m_lhs;
@@ -145,7 +145,7 @@ class CwiseBinaryOpImpl : public internal::generic_xpr_base<CwiseBinaryOp<Binary
*/
template <typename Derived>
template <typename OtherDerived>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator-=(const MatrixBase<OtherDerived>& other) {
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Derived& MatrixBase<Derived>::operator-=(const MatrixBase<OtherDerived>& other) {
call_assignment(derived(), other.derived(), internal::sub_assign_op<Scalar, typename OtherDerived::Scalar>());
return derived();
}
@@ -156,7 +156,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator-=(c
*/
template <typename Derived>
template <typename OtherDerived>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator+=(const MatrixBase<OtherDerived>& other) {
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Derived& MatrixBase<Derived>::operator+=(const MatrixBase<OtherDerived>& other) {
call_assignment(derived(), other.derived(), internal::add_assign_op<Scalar, typename OtherDerived::Scalar>());
return derived();
}

View File

@@ -66,21 +66,21 @@ class CwiseNullaryOp : public internal::dense_xpr_base<CwiseNullaryOp<NullaryOp,
typedef typename internal::dense_xpr_base<CwiseNullaryOp>::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(CwiseNullaryOp)
EIGEN_DEVICE_FUNC CwiseNullaryOp(Index rows, Index cols, const NullaryOp& func = NullaryOp())
EIGEN_DEVICE_FUNC constexpr CwiseNullaryOp(Index rows, Index cols, const NullaryOp& func = NullaryOp())
: m_rows(rows), m_cols(cols), m_functor(func) {
eigen_assert(rows >= 0 && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows) && cols >= 0 &&
(ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols));
}
EIGEN_DEVICE_FUNC CwiseNullaryOp(Index size, const NullaryOp& func = NullaryOp())
EIGEN_DEVICE_FUNC constexpr CwiseNullaryOp(Index size, const NullaryOp& func = NullaryOp())
: CwiseNullaryOp(RowsAtCompileTime == 1 ? 1 : size, RowsAtCompileTime == 1 ? size : 1, func) {
EIGEN_STATIC_ASSERT(CwiseNullaryOp::IsVectorAtCompileTime, YOU_TRIED_CALLING_A_VECTOR_METHOD_ON_A_MATRIX);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const { return m_rows.value(); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const { return m_cols.value(); }
EIGEN_DEVICE_FUNC constexpr Index rows() const { return m_rows.value(); }
EIGEN_DEVICE_FUNC constexpr Index cols() const { return m_cols.value(); }
/** \returns the functor representing the nullary operation */
EIGEN_DEVICE_FUNC const NullaryOp& functor() const { return m_functor; }
EIGEN_DEVICE_FUNC constexpr const NullaryOp& functor() const { return m_functor; }
protected:
const internal::variable_if_dynamic<Index, RowsAtCompileTime> m_rows;
@@ -94,7 +94,7 @@ class CwiseNullaryOp : public internal::dense_xpr_base<CwiseNullaryOp<NullaryOp,
* the returned matrix. Must be compatible with this MatrixBase type.
*
* This variant is meant to be used for dynamic-size matrix types. For fixed-size types,
* it is redundant to pass \a rows and \a cols as arguments, so Zero() should be used
* it is redundant to pass \a rows and \a cols as arguments, so NullaryExpr(const CustomNullaryOp&) should be used
* instead.
*
* The template parameter \a CustomNullaryOp is the type of the functor.
@@ -121,7 +121,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
* \only_for_vectors
*
* This variant is meant to be used for dynamic-size vector types. For fixed-size types,
* it is redundant to pass \a size as argument, so Zero() should be used
* it is redundant to pass \a size as argument, so NullaryExpr(const CustomNullaryOp&) should be used
* instead.
*
* The template parameter \a CustomNullaryOp is the type of the functor.
@@ -174,7 +174,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
* the returned matrix. Must be compatible with this DenseBase type.
*
* This variant is meant to be used for dynamic-size matrix types. For fixed-size types,
* it is redundant to pass \a rows and \a cols as arguments, so Zero() should be used
* it is redundant to pass \a rows and \a cols as arguments, so Constant(const Scalar&) should be used
* instead.
*
* The template parameter \a CustomNullaryOp is the type of the functor.
@@ -195,7 +195,7 @@ DenseBase<Derived>::Constant(Index rows, Index cols, const Scalar& value) {
* \only_for_vectors
*
* This variant is meant to be used for dynamic-size vector types. For fixed-size types,
* it is redundant to pass \a size as argument, so Zero() should be used
* it is redundant to pass \a size as argument, so Constant(const Scalar&) should be used
* instead.
*
* The template parameter \a CustomNullaryOp is the type of the functor.

View File

@@ -118,7 +118,7 @@ class CwiseTernaryOp : public CwiseTernaryOpImpl<TernaryOp, Arg1Type, Arg2Type,
eigen_assert(a1.rows() == a2.rows() && a1.cols() == a2.cols() && a1.rows() == a3.rows() && a1.cols() == a3.cols());
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index rows() const {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Index rows() const {
// return the fixed size type if available to enable compile time
// optimizations
if (internal::traits<internal::remove_all_t<Arg1Nested>>::RowsAtCompileTime == Dynamic &&
@@ -130,7 +130,7 @@ class CwiseTernaryOp : public CwiseTernaryOpImpl<TernaryOp, Arg1Type, Arg2Type,
else
return m_arg1.rows();
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index cols() const {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Index cols() const {
// return the fixed size type if available to enable compile time
// optimizations
if (internal::traits<internal::remove_all_t<Arg1Nested>>::ColsAtCompileTime == Dynamic &&
@@ -144,13 +144,13 @@ class CwiseTernaryOp : public CwiseTernaryOpImpl<TernaryOp, Arg1Type, Arg2Type,
}
/** \returns the first argument nested expression */
EIGEN_DEVICE_FUNC const Arg1Nested_& arg1() const { return m_arg1; }
EIGEN_DEVICE_FUNC constexpr const Arg1Nested_& arg1() const { return m_arg1; }
/** \returns the first argument nested expression */
EIGEN_DEVICE_FUNC const Arg2Nested_& arg2() const { return m_arg2; }
EIGEN_DEVICE_FUNC constexpr const Arg2Nested_& arg2() const { return m_arg2; }
/** \returns the third argument nested expression */
EIGEN_DEVICE_FUNC const Arg3Nested_& arg3() const { return m_arg3; }
EIGEN_DEVICE_FUNC constexpr const Arg3Nested_& arg3() const { return m_arg3; }
/** \returns the functor representing the ternary operation */
EIGEN_DEVICE_FUNC const TernaryOp& functor() const { return m_functor; }
EIGEN_DEVICE_FUNC constexpr const TernaryOp& functor() const { return m_functor; }
protected:
Arg1Nested m_arg1;

View File

@@ -57,22 +57,26 @@ class CwiseUnaryOp : public CwiseUnaryOpImpl<UnaryOp, XprType, typename internal
typedef typename internal::ref_selector<XprType>::type XprTypeNested;
typedef internal::remove_all_t<XprType> NestedExpression;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit CwiseUnaryOp(const XprType& xpr, const UnaryOp& func = UnaryOp())
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE explicit CwiseUnaryOp(const XprType& xpr,
const UnaryOp& func = UnaryOp())
: m_xpr(xpr), m_functor(func) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const noexcept { return m_xpr.rows(); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const noexcept { return m_xpr.cols(); }
EIGEN_DEVICE_FUNC constexpr Index rows() const noexcept { return m_xpr.rows(); }
EIGEN_DEVICE_FUNC constexpr Index cols() const noexcept { return m_xpr.cols(); }
/** \returns the functor representing the unary operation */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const UnaryOp& functor() const { return m_functor; }
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const UnaryOp& functor() const { return m_functor; }
/** \returns the nested expression */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const internal::remove_all_t<XprTypeNested>& nestedExpression() const {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const internal::remove_all_t<XprTypeNested>& nestedExpression()
const {
return m_xpr;
}
/** \returns the nested expression */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE internal::remove_all_t<XprTypeNested>& nestedExpression() { return m_xpr; }
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE internal::remove_all_t<XprTypeNested>& nestedExpression() {
return m_xpr;
}
protected:
XprTypeNested m_xpr;

View File

@@ -140,22 +140,24 @@ class CwiseUnaryView : public internal::CwiseUnaryViewImpl<ViewOp, MatrixType, S
typedef typename internal::ref_selector<MatrixType>::non_const_type MatrixTypeNested;
typedef internal::remove_all_t<MatrixType> NestedExpression;
explicit EIGEN_DEVICE_FUNC inline CwiseUnaryView(MatrixType& mat, const ViewOp& func = ViewOp())
explicit EIGEN_DEVICE_FUNC constexpr inline CwiseUnaryView(MatrixType& mat, const ViewOp& func = ViewOp())
: m_matrix(mat), m_functor(func) {}
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(CwiseUnaryView)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const noexcept { return m_matrix.rows(); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const noexcept { return m_matrix.cols(); }
EIGEN_DEVICE_FUNC constexpr Index rows() const noexcept { return m_matrix.rows(); }
EIGEN_DEVICE_FUNC constexpr Index cols() const noexcept { return m_matrix.cols(); }
/** \returns the functor representing unary operation */
EIGEN_DEVICE_FUNC const ViewOp& functor() const { return m_functor; }
EIGEN_DEVICE_FUNC constexpr const ViewOp& functor() const { return m_functor; }
/** \returns the nested expression */
EIGEN_DEVICE_FUNC const internal::remove_all_t<MatrixTypeNested>& nestedExpression() const { return m_matrix; }
EIGEN_DEVICE_FUNC constexpr const internal::remove_all_t<MatrixTypeNested>& nestedExpression() const {
return m_matrix;
}
/** \returns the nested expression */
EIGEN_DEVICE_FUNC std::remove_reference_t<MatrixTypeNested>& nestedExpression() { return m_matrix; }
EIGEN_DEVICE_FUNC constexpr std::remove_reference_t<MatrixTypeNested>& nestedExpression() { return m_matrix; }
protected:
MatrixTypeNested m_matrix;

View File

@@ -260,21 +260,21 @@ class DenseBase
/** Copies \a other into *this. \returns a reference to *this. */
template <typename OtherDerived>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const DenseBase<OtherDerived>& other);
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Derived& operator=(const DenseBase<OtherDerived>& other);
/** Special case of the template operator=, in order to prevent the compiler
* from generating a default operator= (issue hit with g++ 4.1)
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const DenseBase& other);
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Derived& operator=(const DenseBase& other);
template <typename OtherDerived>
EIGEN_DEVICE_FUNC Derived& operator=(const EigenBase<OtherDerived>& other);
EIGEN_DEVICE_FUNC constexpr Derived& operator=(const EigenBase<OtherDerived>& other);
template <typename OtherDerived>
EIGEN_DEVICE_FUNC Derived& operator+=(const EigenBase<OtherDerived>& other);
EIGEN_DEVICE_FUNC constexpr Derived& operator+=(const EigenBase<OtherDerived>& other);
template <typename OtherDerived>
EIGEN_DEVICE_FUNC Derived& operator-=(const EigenBase<OtherDerived>& other);
EIGEN_DEVICE_FUNC constexpr Derived& operator-=(const EigenBase<OtherDerived>& other);
template <typename OtherDerived>
EIGEN_DEVICE_FUNC Derived& operator=(const ReturnByValue<OtherDerived>& func);
@@ -283,7 +283,7 @@ class DenseBase
* Copies \a other into *this without evaluating other. \returns a reference to *this. */
template <typename OtherDerived>
/** \deprecated */
EIGEN_DEPRECATED EIGEN_DEVICE_FUNC Derived& lazyAssign(const DenseBase<OtherDerived>& other);
EIGEN_DEPRECATED EIGEN_DEVICE_FUNC constexpr Derived& lazyAssign(const DenseBase<OtherDerived>& other);
EIGEN_DEVICE_FUNC CommaInitializer<Derived> operator<<(const Scalar& s);
@@ -348,13 +348,13 @@ class DenseBase
EIGEN_DEVICE_FUNC Derived& setRandom();
template <typename OtherDerived>
EIGEN_DEVICE_FUNC bool isApprox(const DenseBase<OtherDerived>& other,
const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
EIGEN_DEVICE_FUNC bool isMuchSmallerThan(const RealScalar& other,
const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
EIGEN_DEVICE_FUNC constexpr bool isApprox(const DenseBase<OtherDerived>& other,
const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
EIGEN_DEVICE_FUNC constexpr bool isMuchSmallerThan(
const RealScalar& other, const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
template <typename OtherDerived>
EIGEN_DEVICE_FUNC bool isMuchSmallerThan(const DenseBase<OtherDerived>& other,
const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
EIGEN_DEVICE_FUNC constexpr bool isMuchSmallerThan(
const DenseBase<OtherDerived>& other, const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
EIGEN_DEVICE_FUNC bool isApproxToConstant(const Scalar& value,
const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
@@ -366,13 +366,13 @@ class DenseBase
EIGEN_DEVICE_FUNC inline bool hasNaN() const;
EIGEN_DEVICE_FUNC inline bool allFinite() const;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator*=(const Scalar& other);
template <bool Enable = !internal::is_same<Scalar, RealScalar>::value, typename = std::enable_if_t<Enable>>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator*=(const RealScalar& other);
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Derived& operator*=(const Scalar& other);
template <bool Enable = internal::complex_array_access<Scalar>::value, typename = std::enable_if_t<Enable>>
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Derived& operator*=(const RealScalar& other);
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator/=(const Scalar& other);
template <bool Enable = !internal::is_same<Scalar, RealScalar>::value, typename = std::enable_if_t<Enable>>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator/=(const RealScalar& other);
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Derived& operator/=(const Scalar& other);
template <bool Enable = internal::complex_array_access<Scalar>::value, typename = std::enable_if_t<Enable>>
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Derived& operator/=(const RealScalar& other);
typedef internal::add_const_on_value_type_t<typename internal::eval<Derived>::type> EvalReturnType;
/** \returns the matrix or vector obtained by evaluating this expression.
@@ -409,7 +409,7 @@ class DenseBase
call_assignment(derived(), other.derived(), internal::swap_assign_op<Scalar>());
}
EIGEN_DEVICE_FUNC inline const NestByValue<Derived> nestByValue() const;
EIGEN_DEVICE_FUNC constexpr inline const NestByValue<Derived> nestByValue() const;
EIGEN_DEVICE_FUNC inline const ForceAlignedAccess<Derived> forceAlignedAccess() const;
EIGEN_DEVICE_FUNC inline ForceAlignedAccess<Derived> forceAlignedAccess();
template <bool Enable>
@@ -431,8 +431,7 @@ class DenseBase
// By default, the fastest version with undefined NaN propagation semantics is
// used.
// TODO(rmlarsen): Replace with default template argument when we move to
// c++11 or beyond.
// TODO(rmlarsen): Replace with default template argument (C++14 is now the minimum standard).
EIGEN_DEVICE_FUNC inline typename internal::traits<Derived>::Scalar minCoeff() const {
return minCoeff<PropagateFast>();
}
@@ -449,7 +448,7 @@ class DenseBase
template <int NaNPropagation, typename IndexType>
EIGEN_DEVICE_FUNC typename internal::traits<Derived>::Scalar maxCoeff(IndexType* index) const;
// TODO(rmlarsen): Replace these methods with a default template argument.
// TODO(rmlarsen): Replace these methods with a default template argument (C++14 is now the minimum standard).
template <typename IndexType>
EIGEN_DEVICE_FUNC inline typename internal::traits<Derived>::Scalar minCoeff(IndexType* row, IndexType* col) const {
return minCoeff<PropagateFast>(row, col);
@@ -524,25 +523,25 @@ class DenseBase
static const RandomReturnType Random();
template <typename ThenDerived, typename ElseDerived>
inline EIGEN_DEVICE_FUNC
CwiseTernaryOp<internal::scalar_boolean_select_op<typename DenseBase<ThenDerived>::Scalar,
typename DenseBase<ElseDerived>::Scalar, Scalar>,
ThenDerived, ElseDerived, Derived>
select(const DenseBase<ThenDerived>& thenMatrix, const DenseBase<ElseDerived>& elseMatrix) const;
inline EIGEN_DEVICE_FUNC constexpr CwiseTernaryOp<
internal::scalar_boolean_select_op<typename DenseBase<ThenDerived>::Scalar,
typename DenseBase<ElseDerived>::Scalar, Scalar>,
ThenDerived, ElseDerived, Derived>
select(const DenseBase<ThenDerived>& thenMatrix, const DenseBase<ElseDerived>& elseMatrix) const;
template <typename ThenDerived>
inline EIGEN_DEVICE_FUNC
CwiseTernaryOp<internal::scalar_boolean_select_op<typename DenseBase<ThenDerived>::Scalar,
typename DenseBase<ThenDerived>::Scalar, Scalar>,
ThenDerived, typename DenseBase<ThenDerived>::ConstantReturnType, Derived>
select(const DenseBase<ThenDerived>& thenMatrix, const typename DenseBase<ThenDerived>::Scalar& elseScalar) const;
inline EIGEN_DEVICE_FUNC constexpr CwiseTernaryOp<
internal::scalar_boolean_select_op<typename DenseBase<ThenDerived>::Scalar,
typename DenseBase<ThenDerived>::Scalar, Scalar>,
ThenDerived, typename DenseBase<ThenDerived>::ConstantReturnType, Derived>
select(const DenseBase<ThenDerived>& thenMatrix, const typename DenseBase<ThenDerived>::Scalar& elseScalar) const;
template <typename ElseDerived>
inline EIGEN_DEVICE_FUNC
CwiseTernaryOp<internal::scalar_boolean_select_op<typename DenseBase<ElseDerived>::Scalar,
typename DenseBase<ElseDerived>::Scalar, Scalar>,
typename DenseBase<ElseDerived>::ConstantReturnType, ElseDerived, Derived>
select(const typename DenseBase<ElseDerived>::Scalar& thenScalar, const DenseBase<ElseDerived>& elseMatrix) const;
inline EIGEN_DEVICE_FUNC constexpr CwiseTernaryOp<
internal::scalar_boolean_select_op<typename DenseBase<ElseDerived>::Scalar,
typename DenseBase<ElseDerived>::Scalar, Scalar>,
typename DenseBase<ElseDerived>::ConstantReturnType, ElseDerived, Derived>
select(const typename DenseBase<ElseDerived>::Scalar& thenScalar, const DenseBase<ElseDerived>& elseMatrix) const;
template <int p>
RealScalar lpNorm() const;
@@ -580,12 +579,12 @@ class DenseBase
#else
typedef std::conditional_t<(Flags & DirectAccessBit) == DirectAccessBit,
internal::pointer_based_stl_iterator<Derived>,
internal::generic_randaccess_stl_iterator<Derived> >
internal::generic_randaccess_stl_iterator<Derived>>
iterator_type;
typedef std::conditional_t<(Flags & DirectAccessBit) == DirectAccessBit,
internal::pointer_based_stl_iterator<const Derived>,
internal::generic_randaccess_stl_iterator<const Derived> >
internal::generic_randaccess_stl_iterator<const Derived>>
const_iterator_type;
// Stl-style iterators are supported only for vectors.
@@ -615,6 +614,7 @@ class DenseBase
#define EIGEN_DOC_UNARY_ADDONS(X, Y)
#include "../plugins/CommonCwiseUnaryOps.inc"
#include "../plugins/BlockMethods.inc"
// Defines operator()(const RowIndices&, const ColIndices&) and other indexed view methods.
#include "../plugins/IndexedViewMethods.inc"
#include "../plugins/ReshapedMethods.inc"
#ifdef EIGEN_DENSEBASE_PLUGIN

View File

@@ -67,14 +67,14 @@ class DenseCoeffsBase<Derived, ReadOnlyAccessors> : public EigenBase<Derived> {
using Base::rows;
using Base::size;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index rowIndexByOuterInner(Index outer, Index inner) const {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Index rowIndexByOuterInner(Index outer, Index inner) const {
return int(Derived::RowsAtCompileTime) == 1 ? 0
: int(Derived::ColsAtCompileTime) == 1 ? inner
: int(Derived::Flags) & RowMajorBit ? outer
: inner;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index colIndexByOuterInner(Index outer, Index inner) const {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Index colIndexByOuterInner(Index outer, Index inner) const {
return int(Derived::ColsAtCompileTime) == 1 ? 0
: int(Derived::RowsAtCompileTime) == 1 ? inner
: int(Derived::Flags) & RowMajorBit ? inner
@@ -95,12 +95,12 @@ class DenseCoeffsBase<Derived, ReadOnlyAccessors> : public EigenBase<Derived> {
*
* \sa operator()(Index,Index) const, coeffRef(Index,Index), coeff(Index) const
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr CoeffReturnType coeff(Index row, Index col) const {
EIGEN_DEVICE_FUNC constexpr CoeffReturnType coeff(Index row, Index col) const {
eigen_internal_assert(row >= 0 && row < rows() && col >= 0 && col < cols());
return internal::evaluator<Derived>(derived()).coeff(row, col);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr CoeffReturnType coeffByOuterInner(Index outer, Index inner) const {
EIGEN_DEVICE_FUNC constexpr CoeffReturnType coeffByOuterInner(Index outer, Index inner) const {
return coeff(rowIndexByOuterInner(outer, inner), colIndexByOuterInner(outer, inner));
}
@@ -108,11 +108,19 @@ class DenseCoeffsBase<Derived, ReadOnlyAccessors> : public EigenBase<Derived> {
*
* \sa operator()(Index,Index), operator[](Index)
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr CoeffReturnType operator()(Index row, Index col) const {
EIGEN_DEVICE_FUNC constexpr CoeffReturnType operator()(Index row, Index col) const {
eigen_assert(row >= 0 && row < rows() && col >= 0 && col < cols());
return coeff(row, col);
}
#ifdef EIGEN_MULTIDIMENSIONAL_SUBSCRIPT
/** \returns the coefficient at given the given row and column.
*
* \sa operator[](Index,Index), operator[](Index)
*/
EIGEN_DEVICE_FUNC constexpr CoeffReturnType operator[](Index row, Index col) const { return operator()(row, col); }
#endif
/** Short version: don't use this function, use
* \link operator[](Index) const \endlink instead.
*
@@ -128,7 +136,7 @@ class DenseCoeffsBase<Derived, ReadOnlyAccessors> : public EigenBase<Derived> {
* \sa operator[](Index) const, coeffRef(Index), coeff(Index,Index) const
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr CoeffReturnType coeff(Index index) const {
EIGEN_DEVICE_FUNC constexpr CoeffReturnType coeff(Index index) const {
EIGEN_STATIC_ASSERT(internal::evaluator<Derived>::Flags & LinearAccessBit,
THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS)
eigen_internal_assert(index >= 0 && index < size());
@@ -143,7 +151,7 @@ class DenseCoeffsBase<Derived, ReadOnlyAccessors> : public EigenBase<Derived> {
* z() const, w() const
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr CoeffReturnType operator[](Index index) const {
EIGEN_DEVICE_FUNC constexpr CoeffReturnType operator[](Index index) const {
EIGEN_STATIC_ASSERT(Derived::IsVectorAtCompileTime,
THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD)
eigen_assert(index >= 0 && index < size());
@@ -160,32 +168,32 @@ class DenseCoeffsBase<Derived, ReadOnlyAccessors> : public EigenBase<Derived> {
* z() const, w() const
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr CoeffReturnType operator()(Index index) const {
EIGEN_DEVICE_FUNC constexpr CoeffReturnType operator()(Index index) const {
eigen_assert(index >= 0 && index < size());
return coeff(index);
}
/** equivalent to operator[](0). */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr CoeffReturnType x() const { return (*this)[0]; }
EIGEN_DEVICE_FUNC constexpr CoeffReturnType x() const { return (*this)[0]; }
/** equivalent to operator[](1). */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr CoeffReturnType y() const {
EIGEN_DEVICE_FUNC constexpr CoeffReturnType y() const {
EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime == -1 || Derived::SizeAtCompileTime >= 2, OUT_OF_RANGE_ACCESS);
return (*this)[1];
}
/** equivalent to operator[](2). */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr CoeffReturnType z() const {
EIGEN_DEVICE_FUNC constexpr CoeffReturnType z() const {
EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime == -1 || Derived::SizeAtCompileTime >= 3, OUT_OF_RANGE_ACCESS);
return (*this)[2];
}
/** equivalent to operator[](3). */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr CoeffReturnType w() const {
EIGEN_DEVICE_FUNC constexpr CoeffReturnType w() const {
EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime == -1 || Derived::SizeAtCompileTime >= 4, OUT_OF_RANGE_ACCESS);
return (*this)[3];
}
@@ -303,12 +311,12 @@ class DenseCoeffsBase<Derived, WriteAccessors> : public DenseCoeffsBase<Derived,
*
* \sa operator()(Index,Index), coeff(Index, Index) const, coeffRef(Index)
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Scalar& coeffRef(Index row, Index col) {
EIGEN_DEVICE_FUNC constexpr Scalar& coeffRef(Index row, Index col) {
eigen_internal_assert(row >= 0 && row < rows() && col >= 0 && col < cols());
return internal::evaluator<Derived>(derived()).coeffRef(row, col);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& coeffRefByOuterInner(Index outer, Index inner) {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Scalar& coeffRefByOuterInner(Index outer, Index inner) {
return coeffRef(rowIndexByOuterInner(outer, inner), colIndexByOuterInner(outer, inner));
}
@@ -316,12 +324,19 @@ class DenseCoeffsBase<Derived, WriteAccessors> : public DenseCoeffsBase<Derived,
*
* \sa operator[](Index)
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Scalar& operator()(Index row, Index col) {
EIGEN_DEVICE_FUNC constexpr Scalar& operator()(Index row, Index col) {
eigen_assert(row >= 0 && row < rows() && col >= 0 && col < cols());
return coeffRef(row, col);
}
#ifdef EIGEN_MULTIDIMENSIONAL_SUBSCRIPT
/** \returns a reference to the coefficient at given the given row and column.
*
* \sa operator[](Index)
*/
EIGEN_DEVICE_FUNC constexpr Scalar& operator[](Index row, Index col) { return operator()(row, col); }
#endif
/** Short version: don't use this function, use
* \link operator[](Index) \endlink instead.
*
@@ -337,7 +352,7 @@ class DenseCoeffsBase<Derived, WriteAccessors> : public DenseCoeffsBase<Derived,
* \sa operator[](Index), coeff(Index) const, coeffRef(Index,Index)
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Scalar& coeffRef(Index index) {
EIGEN_DEVICE_FUNC constexpr Scalar& coeffRef(Index index) {
EIGEN_STATIC_ASSERT(internal::evaluator<Derived>::Flags & LinearAccessBit,
THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS)
eigen_internal_assert(index >= 0 && index < size());
@@ -351,7 +366,7 @@ class DenseCoeffsBase<Derived, WriteAccessors> : public DenseCoeffsBase<Derived,
* \sa operator[](Index) const, operator()(Index,Index), x(), y(), z(), w()
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Scalar& operator[](Index index) {
EIGEN_DEVICE_FUNC constexpr Scalar& operator[](Index index) {
EIGEN_STATIC_ASSERT(Derived::IsVectorAtCompileTime,
THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD)
eigen_assert(index >= 0 && index < size());
@@ -367,32 +382,32 @@ class DenseCoeffsBase<Derived, WriteAccessors> : public DenseCoeffsBase<Derived,
* \sa operator[](Index) const, operator()(Index,Index), x(), y(), z(), w()
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Scalar& operator()(Index index) {
EIGEN_DEVICE_FUNC constexpr Scalar& operator()(Index index) {
eigen_assert(index >= 0 && index < size());
return coeffRef(index);
}
/** equivalent to operator[](0). */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Scalar& x() { return (*this)[0]; }
EIGEN_DEVICE_FUNC constexpr Scalar& x() { return (*this)[0]; }
/** equivalent to operator[](1). */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Scalar& y() {
EIGEN_DEVICE_FUNC constexpr Scalar& y() {
EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime == -1 || Derived::SizeAtCompileTime >= 2, OUT_OF_RANGE_ACCESS);
return (*this)[1];
}
/** equivalent to operator[](2). */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Scalar& z() {
EIGEN_DEVICE_FUNC constexpr Scalar& z() {
EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime == -1 || Derived::SizeAtCompileTime >= 3, OUT_OF_RANGE_ACCESS);
return (*this)[2];
}
/** equivalent to operator[](3). */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Scalar& w() {
EIGEN_DEVICE_FUNC constexpr Scalar& w() {
EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime == -1 || Derived::SizeAtCompileTime >= 4, OUT_OF_RANGE_ACCESS);
return (*this)[3];
}

View File

@@ -54,7 +54,7 @@ template <typename T, int Size, int MatrixOrArrayOptions,
struct plain_array {
EIGEN_ALIGN_TO_BOUNDARY(Alignment) T array[Size];
#if defined(EIGEN_NO_DEBUG) || defined(EIGEN_TESTING_PLAINOBJECT_CTOR)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr plain_array() = default;
EIGEN_DEVICE_FUNC constexpr plain_array() = default;
#else
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr plain_array() {
EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(Alignment)
@@ -65,20 +65,15 @@ struct plain_array {
template <typename T, int Size, int MatrixOrArrayOptions>
struct plain_array<T, Size, MatrixOrArrayOptions, 0> {
T array[Size];
// on some 32-bit platforms, stack-allocated arrays are aligned to 4 bytes, not the preferred alignment of T
EIGEN_ALIGN_TO_BOUNDARY(alignof(T)) T array[Size];
#if defined(EIGEN_NO_DEBUG) || defined(EIGEN_TESTING_PLAINOBJECT_CTOR)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr plain_array() = default;
EIGEN_DEVICE_FUNC constexpr plain_array() = default;
#else
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr plain_array() { EIGEN_MAKE_STACK_ALLOCATION_ASSERT(Size * sizeof(T)) }
#endif
};
template <typename T, int MatrixOrArrayOptions, int Alignment>
struct plain_array<T, 0, MatrixOrArrayOptions, Alignment> {
T array[1];
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr plain_array() = default;
};
template <typename T, int Size, int Options, int Alignment>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void swap_plain_array(plain_array<T, Size, Options, Alignment>& a,
plain_array<T, Size, Options, Alignment>& b,
@@ -97,8 +92,8 @@ class DenseStorage_impl {
public:
#ifndef EIGEN_DENSE_STORAGE_CTOR_PLUGIN
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl(const DenseStorage_impl&) = default;
#else
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl() {
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = Size)
@@ -108,19 +103,18 @@ class DenseStorage_impl {
smart_copy(other.m_data.array, other.m_data.array + Size, m_data.array);
}
#endif
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(Index /*size*/, Index /*rows*/, Index /*cols*/) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl& operator=(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl(Index /*size*/, Index /*rows*/, Index /*cols*/) {}
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl& operator=(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void swap(DenseStorage_impl& other) {
numext::swap(m_data, other.m_data);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void conservativeResize(Index /*size*/, Index /*rows*/,
Index /*cols*/) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void resize(Index /*size*/, Index /*rows*/, Index /*cols*/) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const { return Rows; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const { return Cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index size() const { return Rows * Cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr T* data() { return m_data.array; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const T* data() const { return m_data.array; }
EIGEN_DEVICE_FUNC constexpr void conservativeResize(Index /*size*/, Index /*rows*/, Index /*cols*/) {}
EIGEN_DEVICE_FUNC constexpr void resize(Index /*size*/, Index /*rows*/, Index /*cols*/) {}
EIGEN_DEVICE_FUNC constexpr Index rows() const { return Rows; }
EIGEN_DEVICE_FUNC constexpr Index cols() const { return Cols; }
EIGEN_DEVICE_FUNC constexpr Index size() const { return Rows * Cols; }
EIGEN_DEVICE_FUNC constexpr T* data() { return m_data.array; }
EIGEN_DEVICE_FUNC constexpr const T* data() const { return m_data.array; }
};
template <typename T, int Size, int Cols, int Options>
class DenseStorage_impl<T, Size, Dynamic, Cols, Options> {
@@ -128,7 +122,7 @@ class DenseStorage_impl<T, Size, Dynamic, Cols, Options> {
Index m_rows = 0;
public:
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(const DenseStorage_impl& other)
: m_rows(other.m_rows) {
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = other.size())
@@ -137,7 +131,7 @@ class DenseStorage_impl<T, Size, Dynamic, Cols, Options> {
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(Index size, Index rows, Index /*cols*/)
: m_rows(rows) {
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({})
EIGEN_UNUSED_VARIABLE(size)
EIGEN_UNUSED_VARIABLE(size);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl& operator=(const DenseStorage_impl& other) {
smart_copy(other.m_data.array, other.m_data.array + other.size(), m_data.array);
@@ -148,17 +142,13 @@ class DenseStorage_impl<T, Size, Dynamic, Cols, Options> {
swap_plain_array(m_data, other.m_data, size(), other.size());
numext::swap(m_rows, other.m_rows);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void conservativeResize(Index /*size*/, Index rows, Index /*cols*/) {
m_rows = rows;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void resize(Index /*size*/, Index rows, Index /*cols*/) {
m_rows = rows;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const { return m_rows; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const { return Cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index size() const { return m_rows * Cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr T* data() { return m_data.array; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const T* data() const { return m_data.array; }
EIGEN_DEVICE_FUNC constexpr void conservativeResize(Index /*size*/, Index rows, Index /*cols*/) { m_rows = rows; }
EIGEN_DEVICE_FUNC constexpr void resize(Index /*size*/, Index rows, Index /*cols*/) { m_rows = rows; }
EIGEN_DEVICE_FUNC constexpr Index rows() const { return m_rows; }
EIGEN_DEVICE_FUNC constexpr Index cols() const { return Cols; }
EIGEN_DEVICE_FUNC constexpr Index size() const { return m_rows * Cols; }
EIGEN_DEVICE_FUNC constexpr T* data() { return m_data.array; }
EIGEN_DEVICE_FUNC constexpr const T* data() const { return m_data.array; }
};
template <typename T, int Size, int Rows, int Options>
class DenseStorage_impl<T, Size, Rows, Dynamic, Options> {
@@ -166,7 +156,7 @@ class DenseStorage_impl<T, Size, Rows, Dynamic, Options> {
Index m_cols = 0;
public:
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(const DenseStorage_impl& other)
: m_cols(other.m_cols) {
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = other.size())
@@ -175,7 +165,7 @@ class DenseStorage_impl<T, Size, Rows, Dynamic, Options> {
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(Index size, Index /*rows*/, Index cols)
: m_cols(cols) {
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({})
EIGEN_UNUSED_VARIABLE(size)
EIGEN_UNUSED_VARIABLE(size);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl& operator=(const DenseStorage_impl& other) {
smart_copy(other.m_data.array, other.m_data.array + other.size(), m_data.array);
@@ -186,17 +176,13 @@ class DenseStorage_impl<T, Size, Rows, Dynamic, Options> {
swap_plain_array(m_data, other.m_data, size(), other.size());
numext::swap(m_cols, other.m_cols);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void conservativeResize(Index /*size*/, Index /*rows*/, Index cols) {
m_cols = cols;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void resize(Index /*size*/, Index /*rows*/, Index cols) {
m_cols = cols;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const { return Rows; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const { return m_cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index size() const { return Rows * m_cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr T* data() { return m_data.array; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const T* data() const { return m_data.array; }
EIGEN_DEVICE_FUNC constexpr void conservativeResize(Index /*size*/, Index /*rows*/, Index cols) { m_cols = cols; }
EIGEN_DEVICE_FUNC constexpr void resize(Index /*size*/, Index /*rows*/, Index cols) { m_cols = cols; }
EIGEN_DEVICE_FUNC constexpr Index rows() const { return Rows; }
EIGEN_DEVICE_FUNC constexpr Index cols() const { return m_cols; }
EIGEN_DEVICE_FUNC constexpr Index size() const { return Rows * m_cols; }
EIGEN_DEVICE_FUNC constexpr T* data() { return m_data.array; }
EIGEN_DEVICE_FUNC constexpr const T* data() const { return m_data.array; }
};
template <typename T, int Size, int Options>
class DenseStorage_impl<T, Size, Dynamic, Dynamic, Options> {
@@ -205,7 +191,7 @@ class DenseStorage_impl<T, Size, Dynamic, Dynamic, Options> {
Index m_cols = 0;
public:
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(const DenseStorage_impl& other)
: m_rows(other.m_rows), m_cols(other.m_cols) {
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = other.size())
@@ -214,7 +200,7 @@ class DenseStorage_impl<T, Size, Dynamic, Dynamic, Options> {
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(Index size, Index rows, Index cols)
: m_rows(rows), m_cols(cols) {
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({})
EIGEN_UNUSED_VARIABLE(size)
EIGEN_UNUSED_VARIABLE(size);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl& operator=(const DenseStorage_impl& other) {
smart_copy(other.m_data.array, other.m_data.array + other.size(), m_data.array);
@@ -227,87 +213,72 @@ class DenseStorage_impl<T, Size, Dynamic, Dynamic, Options> {
numext::swap(m_rows, other.m_rows);
numext::swap(m_cols, other.m_cols);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void conservativeResize(Index /*size*/, Index rows, Index cols) {
EIGEN_DEVICE_FUNC constexpr void conservativeResize(Index /*size*/, Index rows, Index cols) {
m_rows = rows;
m_cols = cols;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void resize(Index /*size*/, Index rows, Index cols) {
EIGEN_DEVICE_FUNC constexpr void resize(Index /*size*/, Index rows, Index cols) {
m_rows = rows;
m_cols = cols;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const { return m_rows; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const { return m_cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index size() const { return m_rows * m_cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr T* data() { return m_data.array; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const T* data() const { return m_data.array; }
EIGEN_DEVICE_FUNC constexpr Index rows() const { return m_rows; }
EIGEN_DEVICE_FUNC constexpr Index cols() const { return m_cols; }
EIGEN_DEVICE_FUNC constexpr Index size() const { return m_rows * m_cols; }
EIGEN_DEVICE_FUNC constexpr T* data() { return m_data.array; }
EIGEN_DEVICE_FUNC constexpr const T* data() const { return m_data.array; }
};
// null matrix variants
template <typename T, int Rows, int Cols, int Options>
class DenseStorage_impl<T, 0, Rows, Cols, Options> {
public:
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(Index /*size*/, Index /*rows*/, Index /*cols*/) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl& operator=(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void swap(DenseStorage_impl&) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void conservativeResize(Index /*size*/, Index /*rows*/,
Index /*cols*/) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void resize(Index /*size*/, Index /*rows*/, Index /*cols*/) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const { return Rows; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const { return Cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index size() const { return Rows * Cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr T* data() { return nullptr; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const T* data() const { return nullptr; }
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl(Index /*size*/, Index /*rows*/, Index /*cols*/) {}
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl& operator=(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC constexpr void swap(DenseStorage_impl&) {}
EIGEN_DEVICE_FUNC constexpr void conservativeResize(Index /*size*/, Index /*rows*/, Index /*cols*/) {}
EIGEN_DEVICE_FUNC constexpr void resize(Index /*size*/, Index /*rows*/, Index /*cols*/) {}
EIGEN_DEVICE_FUNC constexpr Index rows() const { return Rows; }
EIGEN_DEVICE_FUNC constexpr Index cols() const { return Cols; }
EIGEN_DEVICE_FUNC constexpr Index size() const { return Rows * Cols; }
EIGEN_DEVICE_FUNC constexpr T* data() { return nullptr; }
EIGEN_DEVICE_FUNC constexpr const T* data() const { return nullptr; }
};
template <typename T, int Cols, int Options>
class DenseStorage_impl<T, 0, Dynamic, Cols, Options> {
Index m_rows = 0;
public:
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(Index /*size*/, Index rows, Index /*cols*/)
: m_rows(rows) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl& operator=(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void swap(DenseStorage_impl& other) noexcept {
numext::swap(m_rows, other.m_rows);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void conservativeResize(Index /*size*/, Index rows, Index /*cols*/) {
m_rows = rows;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void resize(Index /*size*/, Index rows, Index /*cols*/) {
m_rows = rows;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const { return m_rows; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const { return Cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index size() const { return m_rows * Cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr T* data() { return nullptr; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const T* data() const { return nullptr; }
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl(Index /*size*/, Index rows, Index /*cols*/) : m_rows(rows) {}
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl& operator=(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC constexpr void swap(DenseStorage_impl& other) noexcept { numext::swap(m_rows, other.m_rows); }
EIGEN_DEVICE_FUNC constexpr void conservativeResize(Index /*size*/, Index rows, Index /*cols*/) { m_rows = rows; }
EIGEN_DEVICE_FUNC constexpr void resize(Index /*size*/, Index rows, Index /*cols*/) { m_rows = rows; }
EIGEN_DEVICE_FUNC constexpr Index rows() const { return m_rows; }
EIGEN_DEVICE_FUNC constexpr Index cols() const { return Cols; }
EIGEN_DEVICE_FUNC constexpr Index size() const { return m_rows * Cols; }
EIGEN_DEVICE_FUNC constexpr T* data() { return nullptr; }
EIGEN_DEVICE_FUNC constexpr const T* data() const { return nullptr; }
};
template <typename T, int Rows, int Options>
class DenseStorage_impl<T, 0, Rows, Dynamic, Options> {
Index m_cols = 0;
public:
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(Index /*size*/, Index /*rows*/, Index cols)
: m_cols(cols) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl& operator=(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void swap(DenseStorage_impl& other) noexcept {
numext::swap(m_cols, other.m_cols);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void conservativeResize(Index /*size*/, Index /*rows*/, Index cols) {
m_cols = cols;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void resize(Index /*size*/, Index /*rows*/, Index cols) {
m_cols = cols;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const { return Rows; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const { return m_cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index size() const { return Rows * m_cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr T* data() { return nullptr; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const T* data() const { return nullptr; }
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl(Index /*size*/, Index /*rows*/, Index cols) : m_cols(cols) {}
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl& operator=(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC constexpr void swap(DenseStorage_impl& other) noexcept { numext::swap(m_cols, other.m_cols); }
EIGEN_DEVICE_FUNC constexpr void conservativeResize(Index /*size*/, Index /*rows*/, Index cols) { m_cols = cols; }
EIGEN_DEVICE_FUNC constexpr void resize(Index /*size*/, Index /*rows*/, Index cols) { m_cols = cols; }
EIGEN_DEVICE_FUNC constexpr Index rows() const { return Rows; }
EIGEN_DEVICE_FUNC constexpr Index cols() const { return m_cols; }
EIGEN_DEVICE_FUNC constexpr Index size() const { return Rows * m_cols; }
EIGEN_DEVICE_FUNC constexpr T* data() { return nullptr; }
EIGEN_DEVICE_FUNC constexpr const T* data() const { return nullptr; }
};
template <typename T, int Options>
class DenseStorage_impl<T, 0, Dynamic, Dynamic, Options> {
@@ -315,28 +286,27 @@ class DenseStorage_impl<T, 0, Dynamic, Dynamic, Options> {
Index m_cols = 0;
public:
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(Index /*size*/, Index rows, Index cols)
: m_rows(rows), m_cols(cols) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl& operator=(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void swap(DenseStorage_impl& other) noexcept {
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl(Index /*size*/, Index rows, Index cols) : m_rows(rows), m_cols(cols) {}
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl& operator=(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC constexpr void swap(DenseStorage_impl& other) noexcept {
numext::swap(m_rows, other.m_rows);
numext::swap(m_cols, other.m_cols);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void conservativeResize(Index /*size*/, Index rows, Index cols) {
EIGEN_DEVICE_FUNC constexpr void conservativeResize(Index /*size*/, Index rows, Index cols) {
m_rows = rows;
m_cols = cols;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void resize(Index /*size*/, Index rows, Index cols) {
EIGEN_DEVICE_FUNC constexpr void resize(Index /*size*/, Index rows, Index cols) {
m_rows = rows;
m_cols = cols;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const { return m_rows; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const { return m_cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index size() const { return m_rows * m_cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr T* data() { return nullptr; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const T* data() const { return nullptr; }
EIGEN_DEVICE_FUNC constexpr Index rows() const { return m_rows; }
EIGEN_DEVICE_FUNC constexpr Index cols() const { return m_cols; }
EIGEN_DEVICE_FUNC constexpr Index size() const { return m_rows * m_cols; }
EIGEN_DEVICE_FUNC constexpr T* data() { return nullptr; }
EIGEN_DEVICE_FUNC constexpr const T* data() const { return nullptr; }
};
// fixed-size matrix with dynamic memory allocation not currently supported
template <typename T, int Rows, int Cols, int Options>
@@ -350,7 +320,7 @@ class DenseStorage_impl<T, Dynamic, Dynamic, Cols, Options> {
public:
static constexpr int Size = Dynamic;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(const DenseStorage_impl& other)
: m_data(conditional_aligned_new_auto<T, Align>(other.size())), m_rows(other.m_rows) {
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = other.size())
@@ -360,7 +330,7 @@ class DenseStorage_impl<T, Dynamic, Dynamic, Cols, Options> {
: m_data(conditional_aligned_new_auto<T, Align>(size)), m_rows(rows) {
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({})
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(DenseStorage_impl&& other) noexcept
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl(DenseStorage_impl&& other) noexcept
: m_data(other.m_data), m_rows(other.m_rows) {
other.m_data = nullptr;
other.m_rows = 0;
@@ -371,11 +341,11 @@ class DenseStorage_impl<T, Dynamic, Dynamic, Cols, Options> {
smart_copy(other.m_data, other.m_data + other.size(), m_data);
return *this;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl& operator=(DenseStorage_impl&& other) noexcept {
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl& operator=(DenseStorage_impl&& other) noexcept {
this->swap(other);
return *this;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void swap(DenseStorage_impl& other) noexcept {
EIGEN_DEVICE_FUNC constexpr void swap(DenseStorage_impl& other) noexcept {
numext::swap(m_data, other.m_data);
numext::swap(m_rows, other.m_rows);
}
@@ -392,11 +362,11 @@ class DenseStorage_impl<T, Dynamic, Dynamic, Cols, Options> {
}
m_rows = rows;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const { return m_rows; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const { return Cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index size() const { return m_rows * Cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr T* data() { return m_data; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const T* data() const { return m_data; }
EIGEN_DEVICE_FUNC constexpr Index rows() const { return m_rows; }
EIGEN_DEVICE_FUNC constexpr Index cols() const { return Cols; }
EIGEN_DEVICE_FUNC constexpr Index size() const { return m_rows * Cols; }
EIGEN_DEVICE_FUNC constexpr T* data() { return m_data; }
EIGEN_DEVICE_FUNC constexpr const T* data() const { return m_data; }
};
template <typename T, int Rows, int Options>
class DenseStorage_impl<T, Dynamic, Rows, Dynamic, Options> {
@@ -406,7 +376,7 @@ class DenseStorage_impl<T, Dynamic, Rows, Dynamic, Options> {
public:
static constexpr int Size = Dynamic;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(const DenseStorage_impl& other)
: m_data(conditional_aligned_new_auto<T, Align>(other.size())), m_cols(other.m_cols) {
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = other.size())
@@ -416,7 +386,7 @@ class DenseStorage_impl<T, Dynamic, Rows, Dynamic, Options> {
: m_data(conditional_aligned_new_auto<T, Align>(size)), m_cols(cols) {
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({})
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(DenseStorage_impl&& other) noexcept
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl(DenseStorage_impl&& other) noexcept
: m_data(other.m_data), m_cols(other.m_cols) {
other.m_data = nullptr;
other.m_cols = 0;
@@ -427,11 +397,11 @@ class DenseStorage_impl<T, Dynamic, Rows, Dynamic, Options> {
smart_copy(other.m_data, other.m_data + other.size(), m_data);
return *this;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl& operator=(DenseStorage_impl&& other) noexcept {
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl& operator=(DenseStorage_impl&& other) noexcept {
this->swap(other);
return *this;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void swap(DenseStorage_impl& other) noexcept {
EIGEN_DEVICE_FUNC constexpr void swap(DenseStorage_impl& other) noexcept {
numext::swap(m_data, other.m_data);
numext::swap(m_cols, other.m_cols);
}
@@ -448,11 +418,11 @@ class DenseStorage_impl<T, Dynamic, Rows, Dynamic, Options> {
}
m_cols = cols;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const { return Rows; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const { return m_cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index size() const { return Rows * m_cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr T* data() { return m_data; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const T* data() const { return m_data; }
EIGEN_DEVICE_FUNC constexpr Index rows() const { return Rows; }
EIGEN_DEVICE_FUNC constexpr Index cols() const { return m_cols; }
EIGEN_DEVICE_FUNC constexpr Index size() const { return Rows * m_cols; }
EIGEN_DEVICE_FUNC constexpr T* data() { return m_data; }
EIGEN_DEVICE_FUNC constexpr const T* data() const { return m_data; }
};
template <typename T, int Options>
class DenseStorage_impl<T, Dynamic, Dynamic, Dynamic, Options> {
@@ -463,7 +433,7 @@ class DenseStorage_impl<T, Dynamic, Dynamic, Dynamic, Options> {
public:
static constexpr int Size = Dynamic;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(const DenseStorage_impl& other)
: m_data(conditional_aligned_new_auto<T, Align>(other.size())), m_rows(other.m_rows), m_cols(other.m_cols) {
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = other.size())
@@ -473,7 +443,7 @@ class DenseStorage_impl<T, Dynamic, Dynamic, Dynamic, Options> {
: m_data(conditional_aligned_new_auto<T, Align>(size)), m_rows(rows), m_cols(cols) {
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({})
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(DenseStorage_impl&& other) noexcept
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl(DenseStorage_impl&& other) noexcept
: m_data(other.m_data), m_rows(other.m_rows), m_cols(other.m_cols) {
other.m_data = nullptr;
other.m_rows = 0;
@@ -485,11 +455,11 @@ class DenseStorage_impl<T, Dynamic, Dynamic, Dynamic, Options> {
smart_copy(other.m_data, other.m_data + other.size(), m_data);
return *this;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl& operator=(DenseStorage_impl&& other) noexcept {
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl& operator=(DenseStorage_impl&& other) noexcept {
this->swap(other);
return *this;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void swap(DenseStorage_impl& other) noexcept {
EIGEN_DEVICE_FUNC constexpr void swap(DenseStorage_impl& other) noexcept {
numext::swap(m_data, other.m_data);
numext::swap(m_rows, other.m_rows);
numext::swap(m_cols, other.m_cols);
@@ -509,11 +479,11 @@ class DenseStorage_impl<T, Dynamic, Dynamic, Dynamic, Options> {
m_rows = rows;
m_cols = cols;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const { return m_rows; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const { return m_cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index size() const { return m_rows * m_cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr T* data() { return m_data; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const T* data() const { return m_data; }
EIGEN_DEVICE_FUNC constexpr Index rows() const { return m_rows; }
EIGEN_DEVICE_FUNC constexpr Index cols() const { return m_cols; }
EIGEN_DEVICE_FUNC constexpr Index size() const { return m_rows * m_cols; }
EIGEN_DEVICE_FUNC constexpr T* data() { return m_data; }
EIGEN_DEVICE_FUNC constexpr const T* data() const { return m_data; }
};
template <typename T, int Size, int Rows, int Cols>
struct use_default_move {
@@ -542,15 +512,14 @@ class DenseStorage : public internal::DenseStorage_impl<T, Size, Rows, Cols, Opt
using Base = internal::DenseStorage_impl<T, Size, Rows, Cols, Options>;
public:
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage() = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage(const DenseStorage&) = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage(Index size, Index rows, Index cols)
: Base(size, rows, cols) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage& operator=(const DenseStorage&) = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage() = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage(const DenseStorage&) = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage(Index size, Index rows, Index cols) : Base(size, rows, cols) {}
EIGEN_DEVICE_FUNC constexpr DenseStorage& operator=(const DenseStorage&) = default;
// if DenseStorage meets the requirements of use_default_move, then use the move construction and move assignment
// operation defined in DenseStorage_impl, or the compiler-generated version if none is defined
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage(DenseStorage&&) = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage& operator=(DenseStorage&&) = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage(DenseStorage&&) = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage& operator=(DenseStorage&&) = default;
};
template <typename T, int Size, int Rows, int Cols, int Options>
class DenseStorage<T, Size, Rows, Cols, Options, false>
@@ -558,16 +527,15 @@ class DenseStorage<T, Size, Rows, Cols, Options, false>
using Base = internal::DenseStorage_impl<T, Size, Rows, Cols, Options>;
public:
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage() = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage(const DenseStorage&) = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage(Index size, Index rows, Index cols)
: Base(size, rows, cols) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage& operator=(const DenseStorage&) = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage() = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage(const DenseStorage&) = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage(Index size, Index rows, Index cols) : Base(size, rows, cols) {}
EIGEN_DEVICE_FUNC constexpr DenseStorage& operator=(const DenseStorage&) = default;
// if DenseStorage does not meet the requirements of use_default_move, then defer to the copy construction and copy
// assignment behavior
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage(DenseStorage&& other)
EIGEN_DEVICE_FUNC constexpr DenseStorage(DenseStorage&& other)
: DenseStorage(static_cast<const DenseStorage&>(other)) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage& operator=(DenseStorage&& other) {
EIGEN_DEVICE_FUNC constexpr DenseStorage& operator=(DenseStorage&& other) {
*this = other;
return *this;
}

View File

@@ -87,7 +87,7 @@ template <typename Kernel, typename Device, int Traversal = Kernel::AssignmentTr
int Unrolling = Kernel::AssignmentTraits::Unrolling>
struct dense_assignment_loop_with_device {
using Base = dense_assignment_loop<Kernel, Traversal, Unrolling>;
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void run(Kernel& kernel, Device&) { Base::run(kernel); }
static EIGEN_DEVICE_FUNC constexpr void run(Kernel& kernel, Device&) { Base::run(kernel); }
};
// entry point for a generic expression with device
@@ -104,7 +104,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void call_assignment_no_alias(De
using ActualDstType = std::conditional_t<NeedToTranspose, Transpose<Dst>, Dst&>;
ActualDstType actualDst(dst.derived());
// TODO check whether this is the right place to perform these checks:
// TODO: check whether this is the right place to perform these checks:
EIGEN_STATIC_ASSERT_LVALUE(Dst)
EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(ActualDstTypeCleaned, Src)
EIGEN_CHECK_BINARY_COMPATIBILIY(Func, typename ActualDstTypeCleaned::Scalar, typename Src::Scalar);

View File

@@ -71,14 +71,14 @@ class Diagonal : public internal::dense_xpr_base<Diagonal<MatrixType, DiagIndex_
typedef typename internal::dense_xpr_base<Diagonal>::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(Diagonal)
EIGEN_DEVICE_FUNC explicit inline Diagonal(MatrixType& matrix, Index a_index = DiagIndex)
EIGEN_DEVICE_FUNC constexpr explicit inline Diagonal(MatrixType& matrix, Index a_index = DiagIndex)
: m_matrix(matrix), m_index(a_index) {
eigen_assert(a_index <= m_matrix.cols() && -a_index <= m_matrix.rows());
}
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Diagonal)
EIGEN_DEVICE_FUNC inline Index rows() const {
EIGEN_DEVICE_FUNC constexpr inline Index rows() const {
return m_index.value() < 0 ? numext::mini<Index>(m_matrix.cols(), m_matrix.rows() + m_index.value())
: numext::mini<Index>(m_matrix.rows(), m_matrix.cols() - m_index.value());
}
@@ -91,8 +91,12 @@ class Diagonal : public internal::dense_xpr_base<Diagonal<MatrixType, DiagIndex_
typedef std::conditional_t<internal::is_lvalue<MatrixType>::value, Scalar, const Scalar> ScalarWithConstIfNotLvalue;
EIGEN_DEVICE_FUNC inline ScalarWithConstIfNotLvalue* data() { return &(m_matrix.coeffRef(rowOffset(), colOffset())); }
EIGEN_DEVICE_FUNC inline const Scalar* data() const { return &(m_matrix.coeffRef(rowOffset(), colOffset())); }
EIGEN_DEVICE_FUNC inline ScalarWithConstIfNotLvalue* data() {
return rows() > 0 ? &(m_matrix.coeffRef(rowOffset(), colOffset())) : nullptr;
}
EIGEN_DEVICE_FUNC inline const Scalar* data() const {
return rows() > 0 ? &(m_matrix.coeffRef(rowOffset(), colOffset())) : nullptr;
}
EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index row, Index) {
EIGEN_STATIC_ASSERT_LVALUE(MatrixType)
@@ -120,11 +124,12 @@ class Diagonal : public internal::dense_xpr_base<Diagonal<MatrixType, DiagIndex_
return m_matrix.coeff(idx + rowOffset(), idx + colOffset());
}
EIGEN_DEVICE_FUNC inline const internal::remove_all_t<typename MatrixType::Nested>& nestedExpression() const {
EIGEN_DEVICE_FUNC constexpr inline const internal::remove_all_t<typename MatrixType::Nested>& nestedExpression()
const {
return m_matrix;
}
EIGEN_DEVICE_FUNC inline Index index() const { return m_index.value(); }
EIGEN_DEVICE_FUNC constexpr inline Index index() const { return m_index.value(); }
protected:
typename internal::ref_selector<MatrixType>::non_const_type m_matrix;
@@ -132,15 +137,11 @@ class Diagonal : public internal::dense_xpr_base<Diagonal<MatrixType, DiagIndex_
private:
// some compilers may fail to optimize std::max etc in case of compile-time constants...
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index absDiagIndex() const noexcept {
EIGEN_DEVICE_FUNC constexpr Index absDiagIndex() const noexcept {
return m_index.value() > 0 ? m_index.value() : -m_index.value();
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rowOffset() const noexcept {
return m_index.value() > 0 ? 0 : -m_index.value();
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index colOffset() const noexcept {
return m_index.value() > 0 ? m_index.value() : 0;
}
EIGEN_DEVICE_FUNC constexpr Index rowOffset() const noexcept { return m_index.value() > 0 ? 0 : -m_index.value(); }
EIGEN_DEVICE_FUNC constexpr Index colOffset() const noexcept { return m_index.value() > 0 ? m_index.value() : 0; }
// trigger a compile-time error if someone try to call packet
template <int LoadMode>
typename MatrixType::PacketReturnType packet(Index) const;
@@ -157,13 +158,13 @@ class Diagonal : public internal::dense_xpr_base<Diagonal<MatrixType, DiagIndex_
*
* \sa class Diagonal */
template <typename Derived>
EIGEN_DEVICE_FUNC inline typename MatrixBase<Derived>::DiagonalReturnType MatrixBase<Derived>::diagonal() {
EIGEN_DEVICE_FUNC constexpr typename MatrixBase<Derived>::DiagonalReturnType MatrixBase<Derived>::diagonal() {
return DiagonalReturnType(derived());
}
/** This is the const version of diagonal(). */
template <typename Derived>
EIGEN_DEVICE_FUNC inline const typename MatrixBase<Derived>::ConstDiagonalReturnType MatrixBase<Derived>::diagonal()
EIGEN_DEVICE_FUNC constexpr const typename MatrixBase<Derived>::ConstDiagonalReturnType MatrixBase<Derived>::diagonal()
const {
return ConstDiagonalReturnType(derived());
}
@@ -180,13 +181,14 @@ EIGEN_DEVICE_FUNC inline const typename MatrixBase<Derived>::ConstDiagonalReturn
*
* \sa MatrixBase::diagonal(), class Diagonal */
template <typename Derived>
EIGEN_DEVICE_FUNC inline Diagonal<Derived, DynamicIndex> MatrixBase<Derived>::diagonal(Index index) {
EIGEN_DEVICE_FUNC constexpr Diagonal<Derived, DynamicIndex> MatrixBase<Derived>::diagonal(Index index) {
return Diagonal<Derived, DynamicIndex>(derived(), index);
}
/** This is the const version of diagonal(Index). */
template <typename Derived>
EIGEN_DEVICE_FUNC inline const Diagonal<const Derived, DynamicIndex> MatrixBase<Derived>::diagonal(Index index) const {
EIGEN_DEVICE_FUNC constexpr const Diagonal<const Derived, DynamicIndex> MatrixBase<Derived>::diagonal(
Index index) const {
return Diagonal<const Derived, DynamicIndex>(derived(), index);
}
@@ -203,14 +205,14 @@ EIGEN_DEVICE_FUNC inline const Diagonal<const Derived, DynamicIndex> MatrixBase<
* \sa MatrixBase::diagonal(), class Diagonal */
template <typename Derived>
template <int Index_>
EIGEN_DEVICE_FUNC inline Diagonal<Derived, Index_> MatrixBase<Derived>::diagonal() {
EIGEN_DEVICE_FUNC constexpr Diagonal<Derived, Index_> MatrixBase<Derived>::diagonal() {
return Diagonal<Derived, Index_>(derived());
}
/** This is the const version of diagonal<int>(). */
template <typename Derived>
template <int Index_>
EIGEN_DEVICE_FUNC inline const Diagonal<const Derived, Index_> MatrixBase<Derived>::diagonal() const {
EIGEN_DEVICE_FUNC constexpr const Diagonal<const Derived, Index_> MatrixBase<Derived>::diagonal() const {
return Diagonal<const Derived, Index_>(derived());
}

View File

@@ -61,7 +61,7 @@ class DiagonalBase : public EigenBase<Derived> {
/**
* Constructs a dense matrix from \c *this. Note, this directly returns a dense matrix type,
* not an expression.
* \returns A dense matrix, with its diagonal entries set from the the derived object. */
* \returns A dense matrix, with its diagonal entries set from the derived object. */
EIGEN_DEVICE_FUNC DenseMatrixType toDenseMatrix() const { return derived(); }
/** \returns a reference to the derived object's vector of diagonal coefficients. */
@@ -184,21 +184,22 @@ class DiagonalMatrix : public DiagonalBase<DiagonalMatrix<Scalar_, SizeAtCompile
public:
/** const version of diagonal(). */
EIGEN_DEVICE_FUNC inline const DiagonalVectorType& diagonal() const { return m_diagonal; }
EIGEN_DEVICE_FUNC constexpr inline const DiagonalVectorType& diagonal() const { return m_diagonal; }
/** \returns a reference to the stored vector of diagonal coefficients. */
EIGEN_DEVICE_FUNC inline DiagonalVectorType& diagonal() { return m_diagonal; }
EIGEN_DEVICE_FUNC constexpr inline DiagonalVectorType& diagonal() { return m_diagonal; }
/** Default constructor without initialization */
EIGEN_DEVICE_FUNC inline DiagonalMatrix() {}
EIGEN_DEVICE_FUNC constexpr inline DiagonalMatrix() {}
/** Constructs a diagonal matrix with given dimension */
EIGEN_DEVICE_FUNC explicit inline DiagonalMatrix(Index dim) : m_diagonal(dim) {}
EIGEN_DEVICE_FUNC constexpr explicit inline DiagonalMatrix(Index dim) : m_diagonal(dim) {}
/** 2D constructor. */
EIGEN_DEVICE_FUNC inline DiagonalMatrix(const Scalar& x, const Scalar& y) : m_diagonal(x, y) {}
EIGEN_DEVICE_FUNC constexpr inline DiagonalMatrix(const Scalar& x, const Scalar& y) : m_diagonal(x, y) {}
/** 3D constructor. */
EIGEN_DEVICE_FUNC inline DiagonalMatrix(const Scalar& x, const Scalar& y, const Scalar& z) : m_diagonal(x, y, z) {}
EIGEN_DEVICE_FUNC constexpr inline DiagonalMatrix(const Scalar& x, const Scalar& y, const Scalar& z)
: m_diagonal(x, y, z) {}
/** \brief Construct a diagonal matrix with fixed size from an arbitrary number of coefficients.
*
@@ -209,8 +210,8 @@ class DiagonalMatrix : public DiagonalBase<DiagonalMatrix<Scalar_, SizeAtCompile
* \sa DiagonalMatrix(const Scalar&, const Scalar&, const Scalar&)
*/
template <typename... ArgTypes>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DiagonalMatrix(const Scalar& a0, const Scalar& a1, const Scalar& a2,
const ArgTypes&... args)
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE DiagonalMatrix(const Scalar& a0, const Scalar& a1, const Scalar& a2,
const ArgTypes&... args)
: m_diagonal(a0, a1, a2, args...) {}
/** \brief Constructs a DiagonalMatrix and initializes it by elements given by an initializer list of initializer
@@ -221,11 +222,12 @@ class DiagonalMatrix : public DiagonalBase<DiagonalMatrix<Scalar_, SizeAtCompile
: m_diagonal(list) {}
/** \brief Constructs a DiagonalMatrix from an r-value diagonal vector type */
EIGEN_DEVICE_FUNC explicit inline DiagonalMatrix(DiagonalVectorType&& diag) : m_diagonal(std::move(diag)) {}
EIGEN_DEVICE_FUNC constexpr explicit inline DiagonalMatrix(DiagonalVectorType&& diag) : m_diagonal(std::move(diag)) {}
/** Copy constructor. */
template <typename OtherDerived>
EIGEN_DEVICE_FUNC inline DiagonalMatrix(const DiagonalBase<OtherDerived>& other) : m_diagonal(other.diagonal()) {}
EIGEN_DEVICE_FUNC constexpr inline DiagonalMatrix(const DiagonalBase<OtherDerived>& other)
: m_diagonal(other.diagonal()) {}
#ifndef EIGEN_PARSED_BY_DOXYGEN
/** copy constructor. prevent a default copy constructor from hiding the other templated constructor */
@@ -234,7 +236,8 @@ class DiagonalMatrix : public DiagonalBase<DiagonalMatrix<Scalar_, SizeAtCompile
/** generic constructor from expression of the diagonal coefficients */
template <typename OtherDerived>
EIGEN_DEVICE_FUNC explicit inline DiagonalMatrix(const MatrixBase<OtherDerived>& other) : m_diagonal(other) {}
EIGEN_DEVICE_FUNC constexpr explicit inline DiagonalMatrix(const MatrixBase<OtherDerived>& other)
: m_diagonal(other) {}
/** Copy operator. */
template <typename OtherDerived>
@@ -325,10 +328,11 @@ class DiagonalWrapper : public DiagonalBase<DiagonalWrapper<DiagonalVectorType_>
#endif
/** Constructor from expression of diagonal coefficients to wrap. */
EIGEN_DEVICE_FUNC explicit inline DiagonalWrapper(DiagonalVectorType& a_diagonal) : m_diagonal(a_diagonal) {}
EIGEN_DEVICE_FUNC constexpr explicit inline DiagonalWrapper(DiagonalVectorType& a_diagonal)
: m_diagonal(a_diagonal) {}
/** \returns a const reference to the wrapped expression of diagonal coefficients. */
EIGEN_DEVICE_FUNC const DiagonalVectorType& diagonal() const { return m_diagonal; }
EIGEN_DEVICE_FUNC constexpr const DiagonalVectorType& diagonal() const { return m_diagonal; }
protected:
typename DiagonalVectorType::Nested m_diagonal;
@@ -344,7 +348,7 @@ class DiagonalWrapper : public DiagonalBase<DiagonalWrapper<DiagonalVectorType_>
* \sa class DiagonalWrapper, class DiagonalMatrix, diagonal(), isDiagonal()
**/
template <typename Derived>
EIGEN_DEVICE_FUNC inline const DiagonalWrapper<const Derived> MatrixBase<Derived>::asDiagonal() const {
EIGEN_DEVICE_FUNC constexpr const DiagonalWrapper<const Derived> MatrixBase<Derived>::asDiagonal() const {
return DiagonalWrapper<const Derived>(derived());
}
@@ -372,6 +376,55 @@ bool MatrixBase<Derived>::isDiagonal(const RealScalar& prec) const {
return true;
}
/** \returns DiagonalWrapper.
*
* Example: \include MatrixBase_diagonalView.cpp
* Output: \verbinclude MatrixBase_diagonalView.out
*
* \sa diagonalView()
*/
/** This is the non-const version of diagonalView() with DiagIndex_ . */
template <typename Derived>
template <int DiagIndex_>
EIGEN_DEVICE_FUNC constexpr DiagonalWrapper<Diagonal<Derived, DiagIndex_>> MatrixBase<Derived>::diagonalView() {
typedef Diagonal<Derived, DiagIndex_> DiagType;
typedef DiagonalWrapper<DiagType> ReturnType;
DiagType diag(this->derived());
return ReturnType(diag);
}
/** This is the const version of diagonalView() with DiagIndex_ . */
template <typename Derived>
template <int DiagIndex_>
EIGEN_DEVICE_FUNC constexpr DiagonalWrapper<Diagonal<const Derived, DiagIndex_>> MatrixBase<Derived>::diagonalView()
const {
typedef Diagonal<const Derived, DiagIndex_> DiagType;
typedef DiagonalWrapper<DiagType> ReturnType;
DiagType diag(this->derived());
return ReturnType(diag);
}
/** This is the non-const version of diagonalView() with dynamic index. */
template <typename Derived>
EIGEN_DEVICE_FUNC constexpr DiagonalWrapper<Diagonal<Derived, DynamicIndex>> MatrixBase<Derived>::diagonalView(
Index index) {
typedef Diagonal<Derived, DynamicIndex> DiagType;
typedef DiagonalWrapper<DiagType> ReturnType;
DiagType diag(this->derived(), index);
return ReturnType(diag);
}
/** This is the const version of diagonalView() with dynamic index. */
template <typename Derived>
EIGEN_DEVICE_FUNC constexpr DiagonalWrapper<Diagonal<const Derived, DynamicIndex>> MatrixBase<Derived>::diagonalView(
Index index) const {
typedef Diagonal<const Derived, DynamicIndex> DiagType;
typedef DiagonalWrapper<DiagType> ReturnType;
DiagType diag(this->derived(), index);
return ReturnType(diag);
}
namespace internal {
template <>

View File

@@ -20,15 +20,14 @@ namespace internal {
template <typename Derived, typename Scalar = typename traits<Derived>::Scalar>
struct squared_norm_impl {
using Real = typename NumTraits<Scalar>::Real;
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Real run(const Derived& a) {
Scalar result = a.unaryExpr(squared_norm_functor<Scalar>()).sum();
return numext::real(result) + numext::imag(result);
static EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Real run(const Derived& a) {
return a.realView().cwiseAbs2().sum();
}
};
template <typename Derived>
struct squared_norm_impl<Derived, bool> {
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool run(const Derived& a) { return a.any(); }
static EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE bool run(const Derived& a) { return a.any(); }
};
} // end namespace internal
@@ -46,7 +45,7 @@ struct squared_norm_impl<Derived, bool> {
*/
template <typename Derived>
template <typename OtherDerived>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
typename ScalarBinaryOpTraits<typename internal::traits<Derived>::Scalar,
typename internal::traits<OtherDerived>::Scalar>::ReturnType
MatrixBase<Derived>::dot(const MatrixBase<OtherDerived>& other) const {
@@ -57,19 +56,19 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
/** \returns, for vectors, the squared \em l2 norm of \c *this, and for matrices the squared Frobenius norm.
* In both cases, it consists in the sum of the square of all the matrix entries.
* For vectors, this is also equals to the dot product of \c *this with itself.
* For vectors, this is also equal to the dot product of \c *this with itself.
*
* \sa dot(), norm(), lpNorm()
*/
template <typename Derived>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename NumTraits<typename internal::traits<Derived>::Scalar>::Real
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename NumTraits<typename internal::traits<Derived>::Scalar>::Real
MatrixBase<Derived>::squaredNorm() const {
return internal::squared_norm_impl<Derived>::run(derived());
}
/** \returns, for vectors, the \em l2 norm of \c *this, and for matrices the Frobenius norm.
* In both cases, it consists in the square root of the sum of the square of all the matrix entries.
* For vectors, this is also equals to the square root of the dot product of \c *this with itself.
* For vectors, this is also equal to the square root of the dot product of \c *this with itself.
*
* \sa lpNorm(), dot(), squaredNorm()
*/

View File

@@ -53,7 +53,7 @@ struct EigenBase {
EIGEN_DEVICE_FUNC inline constexpr Derived& const_cast_derived() const {
return *static_cast<Derived*>(const_cast<EigenBase*>(this));
}
EIGEN_DEVICE_FUNC inline const Derived& const_derived() const { return *static_cast<const Derived*>(this); }
EIGEN_DEVICE_FUNC constexpr inline const Derived& const_derived() const { return *static_cast<const Derived*>(this); }
/** \returns the number of rows. \sa cols(), RowsAtCompileTime */
EIGEN_DEVICE_FUNC constexpr Index rows() const noexcept { return derived().rows(); }
@@ -65,13 +65,13 @@ struct EigenBase {
/** \internal Don't use it, but do the equivalent: \code dst = *this; \endcode */
template <typename Dest>
EIGEN_DEVICE_FUNC inline void evalTo(Dest& dst) const {
EIGEN_DEVICE_FUNC constexpr inline void evalTo(Dest& dst) const {
derived().evalTo(dst);
}
/** \internal Don't use it, but do the equivalent: \code dst += *this; \endcode */
template <typename Dest>
EIGEN_DEVICE_FUNC inline void addTo(Dest& dst) const {
EIGEN_DEVICE_FUNC constexpr inline void addTo(Dest& dst) const {
// This is the default implementation,
// derived class can reimplement it in a more optimized way.
typename Dest::PlainObject res(rows(), cols());
@@ -81,7 +81,7 @@ struct EigenBase {
/** \internal Don't use it, but do the equivalent: \code dst -= *this; \endcode */
template <typename Dest>
EIGEN_DEVICE_FUNC inline void subTo(Dest& dst) const {
EIGEN_DEVICE_FUNC constexpr inline void subTo(Dest& dst) const {
// This is the default implementation,
// derived class can reimplement it in a more optimized way.
typename Dest::PlainObject res(rows(), cols());
@@ -91,7 +91,7 @@ struct EigenBase {
/** \internal Don't use it, but do the equivalent: \code dst.applyOnTheRight(*this); \endcode */
template <typename Dest>
EIGEN_DEVICE_FUNC inline void applyThisOnTheRight(Dest& dst) const {
EIGEN_DEVICE_FUNC constexpr inline void applyThisOnTheRight(Dest& dst) const {
// This is the default implementation,
// derived class can reimplement it in a more optimized way.
dst = dst * this->derived();
@@ -99,7 +99,7 @@ struct EigenBase {
/** \internal Don't use it, but do the equivalent: \code dst.applyOnTheLeft(*this); \endcode */
template <typename Dest>
EIGEN_DEVICE_FUNC inline void applyThisOnTheLeft(Dest& dst) const {
EIGEN_DEVICE_FUNC constexpr inline void applyThisOnTheLeft(Dest& dst) const {
// This is the default implementation,
// derived class can reimplement it in a more optimized way.
dst = this->derived() * dst;
@@ -125,21 +125,21 @@ struct EigenBase {
*/
template <typename Derived>
template <typename OtherDerived>
EIGEN_DEVICE_FUNC Derived& DenseBase<Derived>::operator=(const EigenBase<OtherDerived>& other) {
EIGEN_DEVICE_FUNC constexpr Derived& DenseBase<Derived>::operator=(const EigenBase<OtherDerived>& other) {
call_assignment(derived(), other.derived());
return derived();
}
template <typename Derived>
template <typename OtherDerived>
EIGEN_DEVICE_FUNC Derived& DenseBase<Derived>::operator+=(const EigenBase<OtherDerived>& other) {
EIGEN_DEVICE_FUNC constexpr Derived& DenseBase<Derived>::operator+=(const EigenBase<OtherDerived>& other) {
call_assignment(derived(), other.derived(), internal::add_assign_op<Scalar, typename OtherDerived::Scalar>());
return derived();
}
template <typename Derived>
template <typename OtherDerived>
EIGEN_DEVICE_FUNC Derived& DenseBase<Derived>::operator-=(const EigenBase<OtherDerived>& other) {
EIGEN_DEVICE_FUNC constexpr Derived& DenseBase<Derived>::operator-=(const EigenBase<OtherDerived>& other) {
call_assignment(derived(), other.derived(), internal::sub_assign_op<Scalar, typename OtherDerived::Scalar>());
return derived();
}

View File

@@ -20,11 +20,14 @@ namespace internal {
template <typename Xpr>
struct eigen_fill_helper : std::false_type {};
// Only enable std::fill_n for trivially copyable scalars. GCC's libstdc++
// fill_n pessimizes non-trivially-copyable types (extra moves per iteration),
// causing measurable regressions for types like AutoDiffScalar (issue #2956).
template <typename Scalar, int Rows, int Cols, int Options, int MaxRows, int MaxCols>
struct eigen_fill_helper<Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols>> : std::true_type {};
struct eigen_fill_helper<Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols>> : std::is_trivially_copyable<Scalar> {};
template <typename Scalar, int Rows, int Cols, int Options, int MaxRows, int MaxCols>
struct eigen_fill_helper<Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols>> : std::true_type {};
struct eigen_fill_helper<Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols>> : std::is_trivially_copyable<Scalar> {};
template <typename Xpr, int BlockRows, int BlockCols>
struct eigen_fill_helper<Block<Xpr, BlockRows, BlockCols, /*InnerPanel*/ true>> : eigen_fill_helper<Xpr> {};
@@ -60,12 +63,12 @@ struct eigen_fill_impl<Xpr, /*use_fill*/ false> {
using Func = scalar_constant_op<Scalar>;
using PlainObject = typename Xpr::PlainObject;
using Constant = typename PlainObject::ConstantReturnType;
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void run(Xpr& dst, const Scalar& val) {
static EIGEN_DEVICE_FUNC constexpr void run(Xpr& dst, const Scalar& val) {
const Constant src(dst.rows(), dst.cols(), val);
run(dst, src);
}
template <typename SrcXpr>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void run(Xpr& dst, const SrcXpr& src) {
static EIGEN_DEVICE_FUNC constexpr void run(Xpr& dst, const SrcXpr& src) {
call_dense_assignment_loop(dst, src, assign_op<Scalar, Scalar>());
}
};
@@ -93,8 +96,10 @@ struct eigen_fill_impl<Xpr, /*use_fill*/ true> {
template <typename Xpr>
struct eigen_memset_helper {
static constexpr bool value =
std::is_trivially_copyable<typename Xpr::Scalar>::value && eigen_fill_helper<Xpr>::value;
using Scalar = typename Xpr::Scalar;
static constexpr bool value = std::is_trivially_copyable<Scalar>::value &&
!static_cast<bool>(NumTraits<Scalar>::RequireInitialization) &&
eigen_fill_helper<Xpr>::value;
};
template <typename Xpr>
@@ -102,12 +107,12 @@ struct eigen_zero_impl<Xpr, /*use_memset*/ false> {
using Scalar = typename Xpr::Scalar;
using PlainObject = typename Xpr::PlainObject;
using Zero = typename PlainObject::ZeroReturnType;
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void run(Xpr& dst) {
static EIGEN_DEVICE_FUNC constexpr void run(Xpr& dst) {
const Zero src(dst.rows(), dst.cols());
run(dst, src);
}
template <typename SrcXpr>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void run(Xpr& dst, const SrcXpr& src) {
static EIGEN_DEVICE_FUNC constexpr void run(Xpr& dst, const SrcXpr& src) {
call_dense_assignment_loop(dst, src, assign_op<Scalar, Scalar>());
}
};
@@ -115,17 +120,15 @@ struct eigen_zero_impl<Xpr, /*use_memset*/ false> {
template <typename Xpr>
struct eigen_zero_impl<Xpr, /*use_memset*/ true> {
using Scalar = typename Xpr::Scalar;
static constexpr size_t max_bytes = (std::numeric_limits<std::ptrdiff_t>::max)();
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Xpr& dst) {
const size_t num_bytes = dst.size() * sizeof(Scalar);
if (num_bytes == 0) return;
const std::ptrdiff_t num_bytes = dst.size() * static_cast<std::ptrdiff_t>(sizeof(Scalar));
if (num_bytes <= 0) return;
void* dst_ptr = static_cast<void*>(dst.data());
#ifndef EIGEN_NO_DEBUG
if (num_bytes > max_bytes) throw_std_bad_alloc();
eigen_assert((dst_ptr != nullptr) && "null pointer dereference error!");
#endif
EIGEN_USING_STD(memset);
memset(dst_ptr, 0, num_bytes);
memset(dst_ptr, 0, static_cast<std::size_t>(num_bytes));
}
template <typename SrcXpr>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Xpr& dst, const SrcXpr& src) {

View File

@@ -34,11 +34,11 @@ struct max_coeff_functor {
template <typename Scalar>
struct max_coeff_functor<Scalar, PropagateNaN, false> {
EIGEN_DEVICE_FUNC inline Scalar compareCoeff(const Scalar& incumbent, const Scalar& candidate) {
EIGEN_DEVICE_FUNC inline Scalar compareCoeff(const Scalar& incumbent, const Scalar& candidate) const {
return (candidate > incumbent) || ((candidate != candidate) && (incumbent == incumbent));
}
template <typename Packet>
EIGEN_DEVICE_FUNC inline Packet comparePacket(const Packet& incumbent, const Packet& candidate) {
EIGEN_DEVICE_FUNC inline Packet comparePacket(const Packet& incumbent, const Packet& candidate) const {
return pandnot(pcmp_lt_or_nan(incumbent, candidate), pisnan(incumbent));
}
template <typename Packet>
@@ -79,11 +79,11 @@ struct min_coeff_functor {
template <typename Scalar>
struct min_coeff_functor<Scalar, PropagateNaN, false> {
EIGEN_DEVICE_FUNC inline Scalar compareCoeff(const Scalar& incumbent, const Scalar& candidate) {
EIGEN_DEVICE_FUNC inline Scalar compareCoeff(const Scalar& incumbent, const Scalar& candidate) const {
return (candidate < incumbent) || ((candidate != candidate) && (incumbent == incumbent));
}
template <typename Packet>
EIGEN_DEVICE_FUNC inline Packet comparePacket(const Packet& incumbent, const Packet& candidate) {
EIGEN_DEVICE_FUNC inline Packet comparePacket(const Packet& incumbent, const Packet& candidate) const {
return pandnot(pcmp_lt_or_nan(candidate, incumbent), pisnan(incumbent));
}
template <typename Packet>

View File

@@ -39,7 +39,7 @@ class ForceAlignedAccess : public internal::dense_xpr_base<ForceAlignedAccess<Ex
typedef typename internal::dense_xpr_base<ForceAlignedAccess>::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(ForceAlignedAccess)
EIGEN_DEVICE_FUNC explicit inline ForceAlignedAccess(const ExpressionType& matrix) : m_expression(matrix) {}
EIGEN_DEVICE_FUNC explicit constexpr ForceAlignedAccess(const ExpressionType& matrix) : m_expression(matrix) {}
EIGEN_DEVICE_FUNC constexpr Index rows() const noexcept { return m_expression.rows(); }
EIGEN_DEVICE_FUNC constexpr Index cols() const noexcept { return m_expression.cols(); }
@@ -103,25 +103,6 @@ inline ForceAlignedAccess<Derived> MatrixBase<Derived>::forceAlignedAccess() {
return ForceAlignedAccess<Derived>(derived());
}
/** \returns an expression of *this with forced aligned access if \a Enable is true.
* \sa forceAlignedAccess(), class ForceAlignedAccess
*/
template <typename Derived>
template <bool Enable>
inline add_const_on_value_type_t<std::conditional_t<Enable, ForceAlignedAccess<Derived>, Derived&>>
MatrixBase<Derived>::forceAlignedAccessIf() const {
return derived(); // FIXME This should not work but apparently is never used
}
/** \returns an expression of *this with forced aligned access if \a Enable is true.
* \sa forceAlignedAccess(), class ForceAlignedAccess
*/
template <typename Derived>
template <bool Enable>
inline std::conditional_t<Enable, ForceAlignedAccess<Derived>, Derived&> MatrixBase<Derived>::forceAlignedAccessIf() {
return derived(); // FIXME This should not work but apparently is never used
}
} // end namespace Eigen
#endif // EIGEN_FORCEALIGNEDACCESS_H

View File

@@ -86,8 +86,8 @@ struct isMuchSmallerThan_scalar_selector<Derived, true> {
*/
template <typename Derived>
template <typename OtherDerived>
EIGEN_DEVICE_FUNC bool DenseBase<Derived>::isApprox(const DenseBase<OtherDerived>& other,
const RealScalar& prec) const {
EIGEN_DEVICE_FUNC constexpr bool DenseBase<Derived>::isApprox(const DenseBase<OtherDerived>& other,
const RealScalar& prec) const {
return internal::isApprox_selector<Derived, OtherDerived>::run(derived(), other.derived(), prec);
}
@@ -105,8 +105,8 @@ EIGEN_DEVICE_FUNC bool DenseBase<Derived>::isApprox(const DenseBase<OtherDerived
* \sa isApprox(), isMuchSmallerThan(const DenseBase<OtherDerived>&, RealScalar) const
*/
template <typename Derived>
EIGEN_DEVICE_FUNC bool DenseBase<Derived>::isMuchSmallerThan(const typename NumTraits<Scalar>::Real& other,
const RealScalar& prec) const {
EIGEN_DEVICE_FUNC constexpr bool DenseBase<Derived>::isMuchSmallerThan(const typename NumTraits<Scalar>::Real& other,
const RealScalar& prec) const {
return internal::isMuchSmallerThan_scalar_selector<Derived>::run(derived(), other, prec);
}
@@ -122,8 +122,8 @@ EIGEN_DEVICE_FUNC bool DenseBase<Derived>::isMuchSmallerThan(const typename NumT
*/
template <typename Derived>
template <typename OtherDerived>
EIGEN_DEVICE_FUNC bool DenseBase<Derived>::isMuchSmallerThan(const DenseBase<OtherDerived>& other,
const RealScalar& prec) const {
EIGEN_DEVICE_FUNC constexpr bool DenseBase<Derived>::isMuchSmallerThan(const DenseBase<OtherDerived>& other,
const RealScalar& prec) const {
return internal::isMuchSmallerThan_object_selector<Derived, OtherDerived>::run(derived(), other.derived(), prec);
}

View File

@@ -89,7 +89,7 @@ struct product_type {
/* The following allows to select the kind of product at compile time
* based on the three dimensions of the product.
* This is a compile time mapping from {1,Small,Large}^3 -> {product types} */
// FIXME I'm not sure the current mapping is the ideal one.
// FIXME: the current compile-time product-type mapping may not be optimal.
template <int M, int N>
struct product_type_selector<M, N, 1> {
enum { ret = OuterProduct };
@@ -193,12 +193,11 @@ struct product_type_selector<Large, Large, Small> {
* Implementation of Inner Vector Vector Product
***********************************************************************/
// FIXME : maybe the "inner product" could return a Scalar
// instead of a 1x1 matrix ??
// Pro: more natural for the user
// Cons: this could be a problem if in a meta unrolled algorithm a matrix-matrix
// product ends up to a row-vector times col-vector product... To tackle this use
// case, we could have a specialization for Block<MatrixType,1,1> with: operator=(Scalar x);
// FIXME: consider returning a Scalar instead of a 1x1 matrix for inner products.
// Pro: more natural for the user.
// Con: in a meta-unrolled algorithm a matrix-matrix product may reduce to a
// row-vector times column-vector product. To handle this, we could specialize
// Block<MatrixType,1,1> with operator=(Scalar x).
/***********************************************************************
* Implementation of Outer Vector Vector Product
@@ -208,7 +207,7 @@ struct product_type_selector<Large, Large, Small> {
* Implementation of General Matrix Vector Product
***********************************************************************/
/* According to the shape/flags of the matrix we have to distinghish 3 different cases:
/* According to the shape/flags of the matrix we have to distinguish 3 different cases:
* 1 - the matrix is col-major, BLAS compatible and M is large => call fast BLAS-like colmajor routine
* 2 - the matrix is row-major, BLAS compatible and N is large => call fast BLAS-like rowmajor routine
* 3 - all other cases are handled using a simple loop along the outer-storage direction.
@@ -229,7 +228,7 @@ struct gemv_static_vector_if;
template <typename Scalar, int Size, int MaxSize>
struct gemv_static_vector_if<Scalar, Size, MaxSize, false> {
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC constexpr Scalar* data() {
EIGEN_DEVICE_FUNC constexpr Scalar* data() {
eigen_internal_assert(false && "should never be called");
return 0;
}
@@ -237,19 +236,19 @@ struct gemv_static_vector_if<Scalar, Size, MaxSize, false> {
template <typename Scalar, int Size>
struct gemv_static_vector_if<Scalar, Size, Dynamic, true> {
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC constexpr Scalar* data() { return 0; }
EIGEN_DEVICE_FUNC constexpr Scalar* data() { return 0; }
};
template <typename Scalar, int Size, int MaxSize>
struct gemv_static_vector_if<Scalar, Size, MaxSize, true> {
#if EIGEN_MAX_STATIC_ALIGN_BYTES != 0
internal::plain_array<Scalar, internal::min_size_prefer_fixed(Size, MaxSize), 0, AlignedMax> m_data;
EIGEN_STRONG_INLINE constexpr Scalar* data() { return m_data.array; }
constexpr Scalar* data() { return m_data.array; }
#else
// Some architectures cannot align on the stack,
// => let's manually enforce alignment by allocating more data and return the address of the first aligned element.
internal::plain_array<Scalar, internal::min_size_prefer_fixed(Size, MaxSize) + EIGEN_MAX_ALIGN_BYTES, 0> m_data;
EIGEN_STRONG_INLINE constexpr Scalar* data() {
constexpr Scalar* data() {
return reinterpret_cast<Scalar*>((std::uintptr_t(m_data.array) & ~(std::size_t(EIGEN_MAX_ALIGN_BYTES - 1))) +
EIGEN_MAX_ALIGN_BYTES);
}
@@ -293,7 +292,7 @@ struct gemv_dense_selector<OnTheRight, ColMajor, true> {
typedef std::conditional_t<Dest::IsVectorAtCompileTime, Dest, typename Dest::ColXpr> ActualDest;
enum {
// FIXME find a way to allow an inner stride on the result if packet_traits<Scalar>::size==1
// FIXME: find a way to allow an inner stride on the result if packet_traits<Scalar>::size==1
// on, the other hand it is good for the cache to pack the vector anyways...
EvalToDestAtCompileTime = (ActualDest::InnerStrideAtCompileTime == 1),
ComplexByReal = (NumTraits<LhsScalar>::IsComplex) && (!NumTraits<RhsScalar>::IsComplex),
@@ -376,7 +375,7 @@ struct gemv_dense_selector<OnTheRight, RowMajor, true> {
ResScalar actualAlpha = combine_scalar_factors(alpha, lhs, rhs);
enum {
// FIXME find a way to allow an inner stride on the result if packet_traits<Scalar>::size==1
// FIXME: find a way to allow an inner stride on the result if packet_traits<Scalar>::size==1
// on, the other hand it is good for the cache to pack the vector anyways...
DirectlyUseRhs =
ActualRhsTypeCleaned::InnerStrideAtCompileTime == 1 || ActualRhsTypeCleaned::MaxSizeAtCompileTime == 0
@@ -417,7 +416,7 @@ struct gemv_dense_selector<OnTheRight, ColMajor, false> {
static void run(const Lhs& lhs, const Rhs& rhs, Dest& dest, const typename Dest::Scalar& alpha) {
EIGEN_STATIC_ASSERT((!nested_eval<Lhs, 1>::Evaluate),
EIGEN_INTERNAL_COMPILATION_ERROR_OR_YOU_MADE_A_PROGRAMMING_MISTAKE);
// TODO if rhs is large enough it might be beneficial to make sure that dest is sequentially stored in memory,
// TODO: if rhs is large enough it might be beneficial to make sure that dest is sequentially stored in memory,
// otherwise use a temp
typename nested_eval<Rhs, 1>::type actual_rhs(rhs);
const Index size = rhs.rows();

View File

@@ -57,13 +57,12 @@ struct default_packet_traits {
HasConj = 1,
HasSetLinear = 1,
HasSign = 1,
HasAbsDiff = 1,
// By default, the nearest integer functions (rint, round, floor, ceil, trunc) are enabled for all scalar and packet
// types
HasRound = 1,
HasArg = 0,
HasAbsDiff = 0,
HasBlend = 0,
// This flag is used to indicate whether packet comparison is supported.
// pcmp_eq and pcmp_lt should be defined for it to be true.
HasCmp = 0,
@@ -88,6 +87,8 @@ struct default_packet_traits {
HasATanh = 0,
HasSinh = 0,
HasCosh = 0,
HasASinh = 0,
HasACosh = 0,
HasTanh = 0,
HasLGamma = 0,
HasDiGamma = 0,
@@ -117,6 +118,7 @@ struct packet_traits : default_packet_traits {
enum {
HasAdd = 0,
HasSub = 0,
HasAbsDiff = 0,
HasMul = 0,
HasNegate = 0,
HasAbs = 0,
@@ -131,17 +133,18 @@ struct packet_traits : default_packet_traits {
template <typename T>
struct packet_traits<const T> : packet_traits<T> {};
struct default_unpacket_traits {
enum { vectorizable = false, masked_load_available = false, masked_store_available = false };
};
template <typename T>
struct unpacket_traits {
struct unpacket_traits : default_unpacket_traits {
typedef T type;
typedef T half;
typedef typename numext::get_integer_by_size<sizeof(T)>::signed_type integer_packet;
enum {
size = 1,
alignment = alignof(T),
vectorizable = false,
masked_load_available = false,
masked_store_available = false
};
};
@@ -609,7 +612,7 @@ EIGEN_DEVICE_FUNC inline bool pselect<bool>(const bool& cond, const bool& a, con
return cond ? a : b;
}
/** \internal \returns the min or of \a a and \a b (coeff-wise)
/** \internal \returns the min or max of \a a and \a b (coeff-wise)
If either \a a or \a b are NaN, the result is implementation defined. */
template <int NaNPropagation, bool IsInteger>
struct pminmax_impl {
@@ -647,7 +650,7 @@ struct pminmax_impl<PropagateNumbers, false> {
#define EIGEN_BINARY_OP_NAN_PROPAGATION(Type, Func) [](const Type& aa, const Type& bb) { return Func(aa, bb); }
/** \internal \returns the min of \a a and \a b (coeff-wise).
If \a a or \b b is NaN, the return value is implementation defined. */
If \a a or \a b is NaN, the return value is implementation defined. */
template <typename Packet>
EIGEN_DEVICE_FUNC inline Packet pmin(const Packet& a, const Packet& b) {
return numext::mini(a, b);
@@ -662,7 +665,7 @@ EIGEN_DEVICE_FUNC inline Packet pmin(const Packet& a, const Packet& b) {
}
/** \internal \returns the max of \a a and \a b (coeff-wise)
If \a a or \b b is NaN, the return value is implementation defined. */
If \a a or \a b is NaN, the return value is implementation defined. */
template <typename Packet>
EIGEN_DEVICE_FUNC inline Packet pmax(const Packet& a, const Packet& b) {
return numext::maxi(a, b);
@@ -748,9 +751,15 @@ EIGEN_DEVICE_FUNC inline Packet pldexp(const Packet& a, const Packet& exponent)
/** \internal \returns the min of \a a and \a b (coeff-wise) */
template <typename Packet>
EIGEN_DEVICE_FUNC inline Packet pabsdiff(const Packet& a, const Packet& b) {
EIGEN_DEVICE_FUNC inline std::enable_if_t<NumTraits<typename unpacket_traits<Packet>::type>::IsInteger, Packet>
pabsdiff(const Packet& a, const Packet& b) {
return pselect(pcmp_lt(a, b), psub(b, a), psub(a, b));
}
template <typename Packet>
EIGEN_DEVICE_FUNC inline std::enable_if_t<!NumTraits<typename unpacket_traits<Packet>::type>::IsInteger, Packet>
pabsdiff(const Packet& a, const Packet& b) {
return pabs(psub(a, b));
}
/** \internal \returns a packet version of \a *from, from must be properly aligned */
template <typename Packet>
@@ -814,10 +823,24 @@ EIGEN_DEVICE_FUNC inline Packet pset1(const typename unpacket_traits<Packet>::ty
template <typename Packet, typename BitsType>
EIGEN_DEVICE_FUNC inline Packet pset1frombits(BitsType a);
template <typename Scalar, std::enable_if_t<std::is_trivially_copyable<Scalar>::value, int> = 0>
EIGEN_DEVICE_FUNC inline Scalar pload1_scalar(const Scalar* a) {
Scalar scalar;
EIGEN_USING_STD(memcpy)
memcpy(&scalar, a, sizeof(Scalar));
return scalar;
}
template <typename Scalar, std::enable_if_t<!std::is_trivially_copyable<Scalar>::value, int> = 0>
EIGEN_DEVICE_FUNC inline Scalar pload1_scalar(const Scalar* a) {
return Scalar(*a);
}
/** \internal \returns a packet with constant coefficients \a a[0], e.g.: (a[0],a[0],a[0],a[0]) */
template <typename Packet>
EIGEN_DEVICE_FUNC inline Packet pload1(const typename unpacket_traits<Packet>::type* a) {
return pset1<Packet>(*a);
using Scalar = typename unpacket_traits<Packet>::type;
return pset1<Packet>(pload1_scalar<Scalar>(a));
}
/** \internal \returns a packet with elements of \a *from duplicated.
@@ -827,7 +850,7 @@ EIGEN_DEVICE_FUNC inline Packet pload1(const typename unpacket_traits<Packet>::t
*/
template <typename Packet>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet ploaddup(const typename unpacket_traits<Packet>::type* from) {
return *from;
return pload1<Packet>(from);
}
/** \internal \returns a packet with elements of \a *from quadrupled.
@@ -1003,12 +1026,26 @@ EIGEN_DEVICE_FUNC inline Packet preverse(const Packet& a) {
return a;
}
/** \internal \returns \a a with real and imaginary part flipped (for complex type only) */
/** \internal \returns \a a with real and imaginary parts flipped (for complex types only) */
template <typename Packet>
EIGEN_DEVICE_FUNC inline Packet pcplxflip(const Packet& a) {
return Packet(numext::imag(a), numext::real(a));
}
/** \internal \returns \a a with real part duplicated (for complex types only) */
// TODO(rmlarsen): Define and use in all complex backends.
template <typename Packet>
EIGEN_DEVICE_FUNC inline Packet pdupreal(const Packet& a) {
return Packet(numext::real(a), numext::real(a));
}
/** \internal \returns \a a with imaginary part duplicated (for complex types only) */
// TODO(rmlarsen): Define and use in all complex backends.
template <typename Packet>
EIGEN_DEVICE_FUNC inline Packet pdupimag(const Packet& a) {
return Packet(numext::imag(a), numext::imag(a));
}
/**************************
* Special math functions
***************************/
@@ -1097,6 +1134,20 @@ EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet patanh(const Packet&
return atanh(a);
}
/** \internal \returns the inverse hyperbolic sine of \a a (coeff-wise) */
template <typename Packet>
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pasinh(const Packet& a) {
EIGEN_USING_STD(asinh);
return asinh(a);
}
/** \internal \returns the inverse hyperbolic cosine of \a a (coeff-wise) */
template <typename Packet>
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pacosh(const Packet& a) {
EIGEN_USING_STD(acosh);
return acosh(a);
}
/** \internal \returns the exp of \a a (coeff-wise) */
template <typename Packet>
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pexp(const Packet& a) {
@@ -1225,7 +1276,7 @@ EIGEN_DEVICE_FUNC inline typename unpacket_traits<Packet>::type pfirst(const Pac
template <typename Packet>
EIGEN_DEVICE_FUNC inline std::conditional_t<(unpacket_traits<Packet>::size % 8) == 0,
typename unpacket_traits<Packet>::half, Packet>
predux_half_dowto4(const Packet& a) {
predux_half(const Packet& a) {
return a;
}
@@ -1308,9 +1359,7 @@ EIGEN_DEVICE_FUNC inline typename unpacket_traits<Packet>::type predux_max(const
/** \internal \returns true if all coeffs of \a a means "true"
* It is supposed to be called on values returned by pcmp_*.
*/
// not needed yet
// template<typename Packet> EIGEN_DEVICE_FUNC inline bool predux_all(const Packet& a)
// { return bool(a); }
// TODO: implement predux_all when needed.
/** \internal \returns true if any coeffs of \a a means "true"
* It is supposed to be called on values returned by pcmp_*.
@@ -1343,7 +1392,7 @@ struct pmadd_impl {
return psub(c, pmul(a, b));
}
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet pnmsub(const Packet& a, const Packet& b, const Packet& c) {
return pnegate(pmadd(a, b, c));
return pnegate(padd(pmul(a, b), c));
}
};
@@ -1477,26 +1526,11 @@ struct PacketBlock {
Packet packet[N];
};
template <typename Packet>
EIGEN_DEVICE_FUNC inline void ptranspose(PacketBlock<Packet, 1>& /*kernel*/) {
template <typename Packet, int size = 1>
EIGEN_DEVICE_FUNC inline void ptranspose(PacketBlock<Packet, size>& /*kernel*/) {
// Nothing to do in the scalar case, i.e. a 1x1 matrix.
}
/***************************************************************************
* Selector, i.e. vector of N boolean values used to select (i.e. blend)
* words from 2 packets.
***************************************************************************/
template <size_t N>
struct Selector {
bool select[N];
};
template <typename Packet>
EIGEN_DEVICE_FUNC inline Packet pblend(const Selector<unpacket_traits<Packet>::size>& ifPacket,
const Packet& thenPacket, const Packet& elsePacket) {
return ifPacket.select[0] ? thenPacket : elsePacket;
}
/** \internal \returns 1 / a (coeff-wise) */
template <typename Packet>
EIGEN_DEVICE_FUNC inline Packet preciprocal(const Packet& a) {

View File

@@ -130,12 +130,12 @@ using GlobalUnaryPowReturnType = std::enable_if_t<
*/
#ifdef EIGEN_PARSED_BY_DOXYGEN
template <typename Derived, typename ScalarExponent>
EIGEN_DEVICE_FUNC inline const GlobalUnaryPowReturnType<Derived, ScalarExponent> pow(const Eigen::ArrayBase<Derived>& x,
const ScalarExponent& exponent);
EIGEN_DEVICE_FUNC constexpr inline const GlobalUnaryPowReturnType<Derived, ScalarExponent> pow(
const Eigen::ArrayBase<Derived>& x, const ScalarExponent& exponent);
#else
template <typename Derived, typename ScalarExponent>
EIGEN_DEVICE_FUNC inline const GlobalUnaryPowReturnType<Derived, ScalarExponent> pow(const Eigen::ArrayBase<Derived>& x,
const ScalarExponent& exponent) {
EIGEN_DEVICE_FUNC constexpr inline const GlobalUnaryPowReturnType<Derived, ScalarExponent> pow(
const Eigen::ArrayBase<Derived>& x, const ScalarExponent& exponent) {
return GlobalUnaryPowReturnType<Derived, ScalarExponent>(
x.derived(), internal::scalar_unary_pow_op<typename Derived::Scalar, ScalarExponent>(exponent));
}

View File

@@ -65,7 +65,7 @@ struct IOFormat {
fill(_fill),
precision(_precision),
flags(_flags) {
// TODO check if rowPrefix, rowSuffix or rowSeparator contains a newline
// TODO: check if rowPrefix, rowSuffix or rowSeparator contains a newline
// don't add rowSpacer if columns are not to be aligned
if ((flags & DontAlignCols)) return;
int i = int(matPrefix.length()) - 1;

View File

@@ -59,7 +59,7 @@ struct traits<IndexedView<XprType, RowIndices, ColIndices>> : traits<XprType> {
ReturnAsBlock = (!ReturnAsScalar) && IsBlockAlike,
ReturnAsIndexedView = (!ReturnAsScalar) && (!ReturnAsBlock),
// FIXME we deal with compile-time strides if and only if we have DirectAccessBit flag,
// FIXME: we deal with compile-time strides if and only if we have DirectAccessBit flag,
// but this is too strict regarding negative strides...
DirectAccessMask = (int(InnerIncr) != Undefined && int(OuterIncr) != Undefined && InnerIncr >= 0 && OuterIncr >= 0)
? DirectAccessBit
@@ -259,26 +259,27 @@ struct unary_evaluator<IndexedView<ArgType, RowIndices, ColIndices>, IndexBased>
Alignment = 0
};
EIGEN_DEVICE_FUNC explicit unary_evaluator(const XprType& xpr) : m_argImpl(xpr.nestedExpression()), m_xpr(xpr) {
EIGEN_DEVICE_FUNC constexpr explicit unary_evaluator(const XprType& xpr)
: m_argImpl(xpr.nestedExpression()), m_xpr(xpr) {
EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
}
typedef typename XprType::Scalar Scalar;
typedef typename XprType::CoeffReturnType CoeffReturnType;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const {
eigen_assert(m_xpr.rowIndices()[row] >= 0 && m_xpr.rowIndices()[row] < m_xpr.nestedExpression().rows() &&
m_xpr.colIndices()[col] >= 0 && m_xpr.colIndices()[col] < m_xpr.nestedExpression().cols());
return m_argImpl.coeff(m_xpr.rowIndices()[row], m_xpr.colIndices()[col]);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& coeffRef(Index row, Index col) {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Scalar& coeffRef(Index row, Index col) {
eigen_assert(m_xpr.rowIndices()[row] >= 0 && m_xpr.rowIndices()[row] < m_xpr.nestedExpression().rows() &&
m_xpr.colIndices()[col] >= 0 && m_xpr.colIndices()[col] < m_xpr.nestedExpression().cols());
return m_argImpl.coeffRef(m_xpr.rowIndices()[row], m_xpr.colIndices()[col]);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& coeffRef(Index index) {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Scalar& coeffRef(Index index) {
EIGEN_STATIC_ASSERT_LVALUE(XprType)
Index row = XprType::RowsAtCompileTime == 1 ? 0 : index;
Index col = XprType::RowsAtCompileTime == 1 ? index : 0;
@@ -287,7 +288,7 @@ struct unary_evaluator<IndexedView<ArgType, RowIndices, ColIndices>, IndexBased>
return m_argImpl.coeffRef(m_xpr.rowIndices()[row], m_xpr.colIndices()[col]);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar& coeffRef(Index index) const {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const Scalar& coeffRef(Index index) const {
Index row = XprType::RowsAtCompileTime == 1 ? 0 : index;
Index col = XprType::RowsAtCompileTime == 1 ? index : 0;
eigen_assert(m_xpr.rowIndices()[row] >= 0 && m_xpr.rowIndices()[row] < m_xpr.nestedExpression().rows() &&
@@ -295,7 +296,7 @@ struct unary_evaluator<IndexedView<ArgType, RowIndices, ColIndices>, IndexBased>
return m_argImpl.coeffRef(m_xpr.rowIndices()[row], m_xpr.colIndices()[col]);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CoeffReturnType coeff(Index index) const {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const CoeffReturnType coeff(Index index) const {
Index row = XprType::RowsAtCompileTime == 1 ? 0 : index;
Index col = XprType::RowsAtCompileTime == 1 ? index : 0;
eigen_assert(m_xpr.rowIndices()[row] >= 0 && m_xpr.rowIndices()[row] < m_xpr.nestedExpression().rows() &&
@@ -310,9 +311,7 @@ struct unary_evaluator<IndexedView<ArgType, RowIndices, ColIndices>, IndexBased>
// Catch assignments to an IndexedView.
template <typename ArgType, typename RowIndices, typename ColIndices>
struct evaluator_assume_aliasing<IndexedView<ArgType, RowIndices, ColIndices>> {
static const bool value = true;
};
struct evaluator_assume_aliasing<IndexedView<ArgType, RowIndices, ColIndices>> : std::true_type {};
} // end namespace internal

View File

@@ -142,31 +142,36 @@ struct inner_product_impl<Evaluator, true> {
const UnsignedIndex numPackets = size / PacketSize;
const UnsignedIndex numRemPackets = (packetEnd - quadEnd) / PacketSize;
Packet presult0, presult1, presult2, presult3;
Packet presult0 = eval.template packet<Packet>(0 * PacketSize);
if (numPackets >= 2) {
Packet presult1 = eval.template packet<Packet>(1 * PacketSize);
if (numPackets >= 3) {
Packet presult2 = eval.template packet<Packet>(2 * PacketSize);
if (numPackets >= 4) {
Packet presult3 = eval.template packet<Packet>(3 * PacketSize);
presult0 = eval.template packet<Packet>(0 * PacketSize);
if (numPackets >= 2) presult1 = eval.template packet<Packet>(1 * PacketSize);
if (numPackets >= 3) presult2 = eval.template packet<Packet>(2 * PacketSize);
if (numPackets >= 4) {
presult3 = eval.template packet<Packet>(3 * PacketSize);
for (UnsignedIndex k = 4 * PacketSize; k < quadEnd; k += 4 * PacketSize) {
presult0 = eval.packet(presult0, k + 0 * PacketSize);
presult1 = eval.packet(presult1, k + 1 * PacketSize);
presult2 = eval.packet(presult2, k + 2 * PacketSize);
presult3 = eval.packet(presult3, k + 3 * PacketSize);
}
for (UnsignedIndex k = 4 * PacketSize; k < quadEnd; k += 4 * PacketSize) {
presult0 = eval.packet(presult0, k + 0 * PacketSize);
presult1 = eval.packet(presult1, k + 1 * PacketSize);
presult2 = eval.packet(presult2, k + 2 * PacketSize);
presult3 = eval.packet(presult3, k + 3 * PacketSize);
if (numRemPackets >= 1) {
presult0 = eval.packet(presult0, quadEnd + 0 * PacketSize);
if (numRemPackets >= 2) {
presult1 = eval.packet(presult1, quadEnd + 1 * PacketSize);
if (numRemPackets == 3) presult2 = eval.packet(presult2, quadEnd + 2 * PacketSize);
}
}
presult2 = padd(presult2, presult3);
}
presult1 = padd(presult1, presult2);
}
if (numRemPackets >= 1) presult0 = eval.packet(presult0, quadEnd + 0 * PacketSize);
if (numRemPackets >= 2) presult1 = eval.packet(presult1, quadEnd + 1 * PacketSize);
if (numRemPackets == 3) presult2 = eval.packet(presult2, quadEnd + 2 * PacketSize);
presult2 = padd(presult2, presult3);
presult0 = padd(presult0, presult1);
}
if (numPackets >= 3) presult1 = padd(presult1, presult2);
if (numPackets >= 2) presult0 = padd(presult0, presult1);
Scalar result = predux(presult0);
for (UnsignedIndex k = packetEnd; k < size; k++) {
result = eval.coeff(result, k);
@@ -211,8 +216,14 @@ struct scalar_inner_product_op {
static constexpr bool PacketAccess = false;
};
// Partial specialization for packet access if and only if
// LhsScalar == RhsScalar == ScalarBinaryOpTraits<LhsScalar, RhsScalar>::ReturnType.
template <typename Scalar, bool Conj>
struct scalar_inner_product_op<Scalar, Scalar, Conj> {
struct scalar_inner_product_op<
Scalar,
std::enable_if_t<internal::is_same<typename ScalarBinaryOpTraits<Scalar, Scalar>::ReturnType, Scalar>::value,
Scalar>,
Conj> {
using result_type = Scalar;
using conj_helper = conditional_conj<Scalar, Conj>;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar coeff(const Scalar& a, const Scalar& b) const {

View File

@@ -49,12 +49,12 @@ class Inverse : public InverseImpl<XprType, typename internal::traits<XprType>::
typedef typename internal::ref_selector<Inverse>::type Nested;
typedef internal::remove_all_t<XprType> NestedExpression;
explicit EIGEN_DEVICE_FUNC Inverse(const XprType& xpr) : m_xpr(xpr) {}
explicit EIGEN_DEVICE_FUNC constexpr Inverse(const XprType& xpr) : m_xpr(xpr) {}
EIGEN_DEVICE_FUNC constexpr Index rows() const noexcept { return m_xpr.cols(); }
EIGEN_DEVICE_FUNC constexpr Index cols() const noexcept { return m_xpr.rows(); }
EIGEN_DEVICE_FUNC const XprTypeNestedCleaned& nestedExpression() const { return m_xpr; }
EIGEN_DEVICE_FUNC constexpr const XprTypeNestedCleaned& nestedExpression() const { return m_xpr; }
protected:
XprTypeNested m_xpr;

View File

@@ -100,7 +100,7 @@ class Map : public MapBase<Map<PlainObjectType, MapOptions, StrideType> > {
typedef typename Base::PointerType PointerType;
typedef PointerType PointerArgType;
EIGEN_DEVICE_FUNC inline PointerType cast_to_pointer_type(PointerArgType ptr) { return ptr; }
EIGEN_DEVICE_FUNC constexpr inline PointerType cast_to_pointer_type(PointerArgType ptr) const { return ptr; }
EIGEN_DEVICE_FUNC constexpr Index innerStride() const {
return StrideType::InnerStrideAtCompileTime != 0 ? m_stride.inner() : 1;
@@ -120,7 +120,7 @@ class Map : public MapBase<Map<PlainObjectType, MapOptions, StrideType> > {
* \param dataPtr pointer to the array to map
* \param stride optional Stride object, passing the strides.
*/
EIGEN_DEVICE_FUNC explicit inline Map(PointerArgType dataPtr, const StrideType& stride = StrideType())
EIGEN_DEVICE_FUNC constexpr explicit inline Map(PointerArgType dataPtr, const StrideType& stride = StrideType())
: Base(cast_to_pointer_type(dataPtr)), m_stride(stride) {}
/** Constructor in the dynamic-size vector case.
@@ -129,7 +129,7 @@ class Map : public MapBase<Map<PlainObjectType, MapOptions, StrideType> > {
* \param size the size of the vector expression
* \param stride optional Stride object, passing the strides.
*/
EIGEN_DEVICE_FUNC inline Map(PointerArgType dataPtr, Index size, const StrideType& stride = StrideType())
EIGEN_DEVICE_FUNC constexpr inline Map(PointerArgType dataPtr, Index size, const StrideType& stride = StrideType())
: Base(cast_to_pointer_type(dataPtr), size), m_stride(stride) {}
/** Constructor in the dynamic-size matrix case.
@@ -139,7 +139,8 @@ class Map : public MapBase<Map<PlainObjectType, MapOptions, StrideType> > {
* \param cols the number of columns of the matrix expression
* \param stride optional Stride object, passing the strides.
*/
EIGEN_DEVICE_FUNC inline Map(PointerArgType dataPtr, Index rows, Index cols, const StrideType& stride = StrideType())
EIGEN_DEVICE_FUNC constexpr inline Map(PointerArgType dataPtr, Index rows, Index cols,
const StrideType& stride = StrideType())
: Base(cast_to_pointer_type(dataPtr), rows, cols), m_stride(stride) {}
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Map)

View File

@@ -97,23 +97,23 @@ class MapBase<Derived, ReadOnlyAccessors> : public internal::dense_xpr_base<Deri
EIGEN_DEVICE_FUNC constexpr const Scalar* data() const { return m_data; }
/** \copydoc PlainObjectBase::coeff(Index,Index) const */
EIGEN_DEVICE_FUNC inline const Scalar& coeff(Index rowId, Index colId) const {
EIGEN_DEVICE_FUNC constexpr inline const Scalar& coeff(Index rowId, Index colId) const {
return m_data[colId * colStride() + rowId * rowStride()];
}
/** \copydoc PlainObjectBase::coeff(Index) const */
EIGEN_DEVICE_FUNC inline const Scalar& coeff(Index index) const {
EIGEN_DEVICE_FUNC constexpr inline const Scalar& coeff(Index index) const {
EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived)
return m_data[index * innerStride()];
}
/** \copydoc PlainObjectBase::coeffRef(Index,Index) const */
EIGEN_DEVICE_FUNC inline const Scalar& coeffRef(Index rowId, Index colId) const {
EIGEN_DEVICE_FUNC constexpr inline const Scalar& coeffRef(Index rowId, Index colId) const {
return this->m_data[colId * colStride() + rowId * rowStride()];
}
/** \copydoc PlainObjectBase::coeffRef(Index) const */
EIGEN_DEVICE_FUNC inline const Scalar& coeffRef(Index index) const {
EIGEN_DEVICE_FUNC constexpr inline const Scalar& coeffRef(Index index) const {
EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived)
return this->m_data[index * innerStride()];
}
@@ -132,14 +132,14 @@ class MapBase<Derived, ReadOnlyAccessors> : public internal::dense_xpr_base<Deri
}
/** \internal Constructor for fixed size matrices or vectors */
EIGEN_DEVICE_FUNC explicit inline MapBase(PointerType dataPtr)
EIGEN_DEVICE_FUNC constexpr explicit inline MapBase(PointerType dataPtr)
: m_data(dataPtr), m_rows(RowsAtCompileTime), m_cols(ColsAtCompileTime) {
EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived)
checkSanity<Derived>();
}
/** \internal Constructor for dynamically sized vectors */
EIGEN_DEVICE_FUNC inline MapBase(PointerType dataPtr, Index vecSize)
EIGEN_DEVICE_FUNC constexpr inline MapBase(PointerType dataPtr, Index vecSize)
: m_data(dataPtr),
m_rows(RowsAtCompileTime == Dynamic ? vecSize : Index(RowsAtCompileTime)),
m_cols(ColsAtCompileTime == Dynamic ? vecSize : Index(ColsAtCompileTime)) {
@@ -150,7 +150,7 @@ class MapBase<Derived, ReadOnlyAccessors> : public internal::dense_xpr_base<Deri
}
/** \internal Constructor for dynamically sized matrices */
EIGEN_DEVICE_FUNC inline MapBase(PointerType dataPtr, Index rows, Index cols)
EIGEN_DEVICE_FUNC constexpr inline MapBase(PointerType dataPtr, Index rows, Index cols)
: m_data(dataPtr), m_rows(rows), m_cols(cols) {
eigen_assert((dataPtr == 0) || (rows >= 0 && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows) &&
cols >= 0 && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols)));
@@ -238,11 +238,11 @@ class MapBase<Derived, WriteAccessors> : public MapBase<Derived, ReadOnlyAccesso
return this->m_data;
} // no const-cast here so non-const-correct code will give a compile error
EIGEN_DEVICE_FUNC inline ScalarWithConstIfNotLvalue& coeffRef(Index row, Index col) {
EIGEN_DEVICE_FUNC constexpr inline ScalarWithConstIfNotLvalue& coeffRef(Index row, Index col) {
return this->m_data[col * colStride() + row * rowStride()];
}
EIGEN_DEVICE_FUNC inline ScalarWithConstIfNotLvalue& coeffRef(Index index) {
EIGEN_DEVICE_FUNC constexpr inline ScalarWithConstIfNotLvalue& coeffRef(Index index) {
EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived)
return this->m_data[index * innerStride()];
}
@@ -258,9 +258,9 @@ class MapBase<Derived, WriteAccessors> : public MapBase<Derived, ReadOnlyAccesso
internal::pstoret<Scalar, PacketScalar, StoreMode>(this->m_data + index * innerStride(), val);
}
EIGEN_DEVICE_FUNC explicit inline MapBase(PointerType dataPtr) : Base(dataPtr) {}
EIGEN_DEVICE_FUNC inline MapBase(PointerType dataPtr, Index vecSize) : Base(dataPtr, vecSize) {}
EIGEN_DEVICE_FUNC inline MapBase(PointerType dataPtr, Index rows, Index cols) : Base(dataPtr, rows, cols) {}
EIGEN_DEVICE_FUNC constexpr explicit inline MapBase(PointerType dataPtr) : Base(dataPtr) {}
EIGEN_DEVICE_FUNC constexpr inline MapBase(PointerType dataPtr, Index vecSize) : Base(dataPtr, vecSize) {}
EIGEN_DEVICE_FUNC constexpr inline MapBase(PointerType dataPtr, Index rows, Index cols) : Base(dataPtr, rows, cols) {}
EIGEN_DEVICE_FUNC Derived& operator=(const MapBase& other) {
ReadOnlyMapBase::Base::operator=(other);

View File

@@ -11,7 +11,7 @@
#ifndef EIGEN_MATHFUNCTIONS_H
#define EIGEN_MATHFUNCTIONS_H
// TODO this should better be moved to NumTraits
// TODO: consider moving these constants to NumTraits.
// Source: WolframAlpha
#define EIGEN_PI 3.141592653589793238462643383279502884197169399375105820974944592307816406L
#define EIGEN_LOG2E 1.442695040888963407359924681001892137426645954152985934135449406931109219L
@@ -74,7 +74,7 @@ struct global_math_functions_filtering_base<
template <typename Scalar, bool IsComplex = NumTraits<Scalar>::IsComplex>
struct real_default_impl {
typedef typename NumTraits<Scalar>::Real RealScalar;
EIGEN_DEVICE_FUNC static inline RealScalar run(const Scalar& x) { return x; }
EIGEN_DEVICE_FUNC static constexpr RealScalar run(const Scalar& x) { return x; }
};
template <typename Scalar>
@@ -170,18 +170,24 @@ struct imag_ref_default_impl {
template <typename Scalar>
struct imag_ref_default_impl<Scalar, false> {
EIGEN_DEVICE_FUNC constexpr static Scalar run(Scalar&) { return Scalar(0); }
EIGEN_DEVICE_FUNC constexpr static const Scalar run(const Scalar&) { return Scalar(0); }
typedef typename NumTraits<Scalar>::Real RealScalar;
EIGEN_DEVICE_FUNC constexpr static inline RealScalar run(Scalar&) { return RealScalar(0); }
EIGEN_DEVICE_FUNC constexpr static inline RealScalar run(const Scalar&) { return RealScalar(0); }
};
template <typename Scalar>
struct imag_ref_impl : imag_ref_default_impl<Scalar, NumTraits<Scalar>::IsComplex> {};
template <typename Scalar>
template <typename Scalar, bool IsComplex = NumTraits<Scalar>::IsComplex>
struct imag_ref_retval {
typedef typename NumTraits<Scalar>::Real& type;
};
template <typename Scalar>
struct imag_ref_retval<Scalar, false> {
typedef typename NumTraits<Scalar>::Real type;
};
} // namespace internal
namespace numext {
@@ -222,7 +228,7 @@ namespace internal {
template <typename Scalar, bool IsComplex = NumTraits<Scalar>::IsComplex>
struct conj_default_impl {
EIGEN_DEVICE_FUNC static inline Scalar run(const Scalar& x) { return x; }
EIGEN_DEVICE_FUNC static constexpr Scalar run(const Scalar& x) { return x; }
};
template <typename Scalar>
@@ -287,7 +293,7 @@ struct sqrt_impl {
// Complex sqrt defined in MathFunctionsImpl.h.
template <typename ComplexT>
EIGEN_DEVICE_FUNC ComplexT complex_sqrt(const ComplexT& a_x);
EIGEN_DEVICE_FUNC constexpr ComplexT complex_sqrt(const ComplexT& a_x);
// Custom implementation is faster than `std::sqrt`, works on
// GPU, and correctly handles special cases (unlike MSVC).
@@ -307,7 +313,7 @@ struct rsqrt_impl;
// Complex rsqrt defined in MathFunctionsImpl.h.
template <typename ComplexT>
EIGEN_DEVICE_FUNC ComplexT complex_rsqrt(const ComplexT& a_x);
EIGEN_DEVICE_FUNC constexpr ComplexT complex_rsqrt(const ComplexT& a_x);
template <typename T>
struct rsqrt_impl<std::complex<T>> {
@@ -390,7 +396,7 @@ struct cast_impl<OldType, NewType,
}
};
// here, for once, we're plainly returning NewType: we don't want cast to do weird things.
// Returns NewType directly to avoid unintended intermediate conversions.
template <typename OldType, typename NewType>
EIGEN_DEVICE_FUNC inline NewType cast(const OldType& x) {
@@ -504,7 +510,7 @@ struct expm1_retval {
// Complex log defined in MathFunctionsImpl.h.
template <typename ComplexT>
EIGEN_DEVICE_FUNC ComplexT complex_log(const ComplexT& z);
EIGEN_DEVICE_FUNC constexpr ComplexT complex_log(const ComplexT& z);
template <typename Scalar>
struct log_impl {
@@ -832,8 +838,8 @@ EIGEN_DEVICE_FUNC std::enable_if_t<(std::numeric_limits<T>::has_infinity && !Num
template <typename T>
EIGEN_DEVICE_FUNC
std::enable_if_t<!(std::numeric_limits<T>::has_quiet_NaN || std::numeric_limits<T>::has_signaling_NaN), bool>
isnan_impl(const T&) {
std::enable_if_t<!(std::numeric_limits<T>::has_quiet_NaN || std::numeric_limits<T>::has_signaling_NaN), bool>
isnan_impl(const T&) {
return false;
}
@@ -1004,8 +1010,7 @@ struct madd_impl {
}
};
// Use FMA if there is a single CPU instruction.
#ifdef EIGEN_VECTORIZE_FMA
#if EIGEN_SCALAR_MADD_USE_FMA
template <typename Scalar>
struct madd_impl<Scalar, std::enable_if_t<has_fma<Scalar>::value>> {
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run(const Scalar& x, const Scalar& y, const Scalar& z) {
@@ -1024,13 +1029,13 @@ namespace numext {
#if (!defined(EIGEN_GPUCC) || defined(EIGEN_CONSTEXPR_ARE_DEVICE_FUNC))
template <typename T>
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T mini(const T& x, const T& y) {
EIGEN_DEVICE_FUNC constexpr EIGEN_ALWAYS_INLINE T mini(const T& x, const T& y) {
EIGEN_USING_STD(min)
return min EIGEN_NOT_A_MACRO(x, y);
}
template <typename T>
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T maxi(const T& x, const T& y) {
EIGEN_DEVICE_FUNC constexpr EIGEN_ALWAYS_INLINE T maxi(const T& x, const T& y) {
EIGEN_USING_STD(max)
return max EIGEN_NOT_A_MACRO(x, y);
}
@@ -1358,6 +1363,12 @@ EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE constexpr T round_down(T a, U b) {
return ub * (ua / ub);
}
template <typename T>
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T log2(T x) {
EIGEN_USING_STD(log2);
return log2(x);
}
/** Log base 2 for 32 bits positive integers.
* Conveniently returns 0 for x==0. */
constexpr int log2(int x) {
@@ -1437,17 +1448,17 @@ EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE double log(const double& x) {
#endif
template <typename T>
EIGEN_DEVICE_FUNC
EIGEN_ALWAYS_INLINE std::enable_if_t<NumTraits<T>::IsSigned || NumTraits<T>::IsComplex, typename NumTraits<T>::Real>
abs(const T& x) {
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
std::enable_if_t<NumTraits<T>::IsSigned || NumTraits<T>::IsComplex, typename NumTraits<T>::Real>
abs(const T& x) {
EIGEN_USING_STD(abs);
return abs(x);
}
template <typename T>
EIGEN_DEVICE_FUNC
EIGEN_ALWAYS_INLINE std::enable_if_t<!(NumTraits<T>::IsSigned || NumTraits<T>::IsComplex), typename NumTraits<T>::Real>
abs(const T& x) {
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
std::enable_if_t<!(NumTraits<T>::IsSigned || NumTraits<T>::IsComplex), typename NumTraits<T>::Real>
abs(const T& x) {
return x;
}
@@ -1912,7 +1923,8 @@ EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE double fmod(const double& a, const double&
template <typename Scalar, typename Enable = std::enable_if_t<std::is_integral<Scalar>::value>>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar logical_shift_left(const Scalar& a, int n) {
return a << n;
using UnsignedScalar = typename numext::get_integer_by_size<sizeof(Scalar)>::unsigned_type;
return bit_cast<Scalar, UnsignedScalar>(bit_cast<UnsignedScalar, Scalar>(a) << n);
}
template <typename Scalar, typename Enable = std::enable_if_t<std::is_integral<Scalar>::value>>
@@ -1927,7 +1939,6 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar arithmetic_shift_right(const Scalar
return bit_cast<Scalar, SignedScalar>(bit_cast<SignedScalar, Scalar>(a) >> n);
}
// Otherwise, rely on template implementation.
template <typename Scalar>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar fma(const Scalar& x, const Scalar& y, const Scalar& z) {
return internal::fma_impl<Scalar>::run(x, y, z);
@@ -2086,7 +2097,15 @@ struct expm1_impl<std::complex<RealScalar>> {
template <typename T>
struct rsqrt_impl {
// C4804: unsafe use of type 'bool' in operation. Unavoidable when instantiated with T=bool.
#if EIGEN_COMP_MSVC
#pragma warning(push)
#pragma warning(disable : 4804)
#endif
EIGEN_DEVICE_FUNC static EIGEN_ALWAYS_INLINE T run(const T& x) { return T(1) / numext::sqrt(x); }
#if EIGEN_COMP_MSVC
#pragma warning(pop)
#endif
};
#if defined(EIGEN_GPU_COMPILE_PHASE)
@@ -2098,6 +2117,57 @@ struct conj_impl<std::complex<T>, true> {
};
#endif
// Complex multiply and division operators.
// Note that these do not handle the case if inf+NaNi, which is considered an infinity.
// This is for consistency with our standard pmul, pdiv implementations.
template <typename T>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE std::complex<T> complex_multiply(const std::complex<T>& a,
const std::complex<T>& b) {
const T a_real = numext::real(a);
const T a_imag = numext::imag(a);
const T b_real = numext::real(b);
const T b_imag = numext::imag(b);
return std::complex<T>(a_real * b_real - a_imag * b_imag, a_imag * b_real + a_real * b_imag);
}
template <typename T>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE std::complex<T> complex_divide_fast(const std::complex<T>& a,
const std::complex<T>& b) {
const T a_real = numext::real(a);
const T a_imag = numext::imag(a);
const T b_real = numext::real(b);
const T b_imag = numext::imag(b);
const T norm = (b_real * b_real + b_imag * b_imag);
return std::complex<T>((a_real * b_real + a_imag * b_imag) / norm, (a_imag * b_real - a_real * b_imag) / norm);
}
template <typename T>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE std::complex<T> complex_divide_smith(const std::complex<T>& a,
const std::complex<T>& b) {
const T a_real = numext::real(a);
const T a_imag = numext::imag(a);
const T b_real = numext::real(b);
const T b_imag = numext::imag(b);
// Smith's complex division (https://arxiv.org/pdf/1210.4539.pdf),
// guards against over/under-flow.
const bool scale_imag = numext::abs(b_imag) <= numext::abs(b_real);
const T rscale = scale_imag ? T(1) : b_real / b_imag;
const T iscale = scale_imag ? b_imag / b_real : T(1);
const T denominator = b_real * rscale + b_imag * iscale;
return std::complex<T>((a_real * rscale + a_imag * iscale) / denominator,
(a_imag * rscale - a_real * iscale) / denominator);
}
template <typename T>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE std::complex<T> complex_divide(const std::complex<T>& a,
const std::complex<T>& b) {
#if EIGEN_FAST_MATH
return complex_divide_fast(a, b);
#else
return complex_divide_smith(a, b);
#endif
}
} // end namespace internal
} // end namespace Eigen

View File

@@ -37,15 +37,16 @@ struct generic_reciprocal_newton_step {
static_assert(Steps > 0, "Steps must be at least 1.");
EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Packet run(const Packet& a, const Packet& approx_a_recip) {
using Scalar = typename unpacket_traits<Packet>::type;
const Packet two = pset1<Packet>(Scalar(2));
const Packet one = pset1<Packet>(Scalar(1));
// Refine the approximation using one Newton-Raphson step:
// x_{i} = x_{i-1} * (2 - a * x_{i-1})
const Packet x = generic_reciprocal_newton_step<Packet, Steps - 1>::run(a, approx_a_recip);
const Packet tmp = pnmadd(a, x, two);
const Packet tmp = pnmadd(a, x, one);
// If tmp is NaN, it means that a is either +/-0 or +/-Inf.
// In this case return the approximation directly.
const Packet is_not_nan = pcmp_eq(tmp, tmp);
return pselect(is_not_nan, pmul(x, tmp), x);
// Use two FMAs instead of FMA+FMUL to improve precision.
return pselect(is_not_nan, pmadd(x, tmp, x), x);
}
};
@@ -147,16 +148,16 @@ struct generic_sqrt_newton_step {
};
template <typename RealScalar>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE RealScalar positive_real_hypot(const RealScalar& x, const RealScalar& y) {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE RealScalar positive_real_hypot(const RealScalar& x,
const RealScalar& y) {
// IEEE IEC 6059 special cases.
if ((numext::isinf)(x) || (numext::isinf)(y)) return NumTraits<RealScalar>::infinity();
if ((numext::isnan)(x) || (numext::isnan)(y)) return NumTraits<RealScalar>::quiet_NaN();
EIGEN_USING_STD(sqrt);
RealScalar p, qp;
p = numext::maxi(x, y);
RealScalar p = numext::maxi(x, y);
if (numext::is_exactly_zero(p)) return RealScalar(0);
qp = numext::mini(y, x) / p;
RealScalar qp = numext::mini(y, x) / p;
return p * sqrt(RealScalar(1) + qp * qp);
}
@@ -172,7 +173,7 @@ struct hypot_impl {
// Generic complex sqrt implementation that correctly handles corner cases
// according to https://en.cppreference.com/w/cpp/numeric/complex/sqrt
template <typename ComplexT>
EIGEN_DEVICE_FUNC ComplexT complex_sqrt(const ComplexT& z) {
EIGEN_DEVICE_FUNC constexpr ComplexT complex_sqrt(const ComplexT& z) {
// Computes the principal sqrt of the input.
//
// For a complex square root of the number x + i*y. We want to find real
@@ -208,7 +209,7 @@ EIGEN_DEVICE_FUNC ComplexT complex_sqrt(const ComplexT& z) {
// Generic complex rsqrt implementation.
template <typename ComplexT>
EIGEN_DEVICE_FUNC ComplexT complex_rsqrt(const ComplexT& z) {
EIGEN_DEVICE_FUNC constexpr ComplexT complex_rsqrt(const ComplexT& z) {
// Computes the principal reciprocal sqrt of the input.
//
// For a complex reciprocal square root of the number z = x + i*y. We want to
@@ -247,7 +248,7 @@ EIGEN_DEVICE_FUNC ComplexT complex_rsqrt(const ComplexT& z) {
}
template <typename ComplexT>
EIGEN_DEVICE_FUNC ComplexT complex_log(const ComplexT& z) {
EIGEN_DEVICE_FUNC constexpr ComplexT complex_log(const ComplexT& z) {
// Computes complex log.
using T = typename NumTraits<ComplexT>::Real;
T a = numext::abs(z);

View File

@@ -207,7 +207,7 @@ class Matrix : public PlainObjectBase<Matrix<Scalar_, Rows_, Cols_, Options_, Ma
*
* \callgraph
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Matrix& operator=(const Matrix& other) { return Base::_set(other); }
EIGEN_DEVICE_FUNC constexpr Matrix& operator=(const Matrix& other) { return Base::_set(other); }
/** \internal
* \brief Copies the value of the expression \a other into \c *this with automatic resizing.
@@ -249,16 +249,16 @@ class Matrix : public PlainObjectBase<Matrix<Scalar_, Rows_, Cols_, Options_, Ma
* \sa resize(Index,Index)
*/
#if defined(EIGEN_INITIALIZE_COEFFS)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Matrix() { EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED }
EIGEN_DEVICE_FUNC constexpr Matrix() { EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED }
#else
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Matrix() = default;
EIGEN_DEVICE_FUNC constexpr Matrix() = default;
#endif
/** \brief Move constructor */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Matrix(Matrix&&) = default;
EIGEN_DEVICE_FUNC constexpr Matrix(Matrix&&) = default;
/** \brief Moves the matrix into the other one.
*
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Matrix& operator=(Matrix&& other) noexcept(
EIGEN_DEVICE_FUNC constexpr Matrix& operator=(Matrix&& other) noexcept(
std::is_nothrow_move_assignable<Scalar>::value) {
Base::operator=(std::move(other));
return *this;
@@ -271,7 +271,7 @@ class Matrix : public PlainObjectBase<Matrix<Scalar_, Rows_, Cols_, Options_, Ma
* This constructor is for 1D array or vectors with more than 4 coefficients.
*
* \warning To construct a column (resp. row) vector of fixed length, the number of values passed to this
* constructor must match the the fixed number of rows (resp. columns) of \c *this.
* constructor must match the fixed number of rows (resp. columns) of \c *this.
*
*
* Example: \include Matrix_variadic_ctor_cxx11.cpp
@@ -316,12 +316,12 @@ class Matrix : public PlainObjectBase<Matrix<Scalar_, Rows_, Cols_, Options_, Ma
// This constructor is for both 1x1 matrices and dynamic vectors
template <typename T>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit Matrix(const T& x) {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE explicit Matrix(const T& x) {
Base::template _init1<T>(x);
}
template <typename T0, typename T1>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Matrix(const T0& x, const T1& y) {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Matrix(const T0& x, const T1& y) {
Base::template _init2<T0, T1>(x, y);
}
@@ -367,7 +367,7 @@ class Matrix : public PlainObjectBase<Matrix<Scalar_, Rows_, Cols_, Options_, Ma
/** \brief Constructs an initialized 3D vector with given coefficients
* \sa Matrix(const Scalar&, const Scalar&, const Scalar&, const Scalar&, const ArgTypes&...)
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Matrix(const Scalar& x, const Scalar& y, const Scalar& z) {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Matrix(const Scalar& x, const Scalar& y, const Scalar& z) {
EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Matrix, 3)
m_storage.data()[0] = x;
m_storage.data()[1] = y;
@@ -376,7 +376,8 @@ class Matrix : public PlainObjectBase<Matrix<Scalar_, Rows_, Cols_, Options_, Ma
/** \brief Constructs an initialized 4D vector with given coefficients
* \sa Matrix(const Scalar&, const Scalar&, const Scalar&, const Scalar&, const ArgTypes&...)
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Matrix(const Scalar& x, const Scalar& y, const Scalar& z, const Scalar& w) {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Matrix(const Scalar& x, const Scalar& y, const Scalar& z,
const Scalar& w) {
EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Matrix, 4)
m_storage.data()[0] = x;
m_storage.data()[1] = y;
@@ -385,13 +386,14 @@ class Matrix : public PlainObjectBase<Matrix<Scalar_, Rows_, Cols_, Options_, Ma
}
/** \brief Copy constructor */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Matrix(const Matrix&) = default;
EIGEN_DEVICE_FUNC constexpr Matrix(const Matrix&) = default;
/** \brief Copy constructor for generic expressions.
* \sa MatrixBase::operator=(const EigenBase<OtherDerived>&)
*/
template <typename OtherDerived>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Matrix(const EigenBase<OtherDerived>& other) : Base(other.derived()) {}
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Matrix(const EigenBase<OtherDerived>& other)
: Base(other.derived()) {}
EIGEN_DEVICE_FUNC constexpr Index innerStride() const noexcept { return 1; }
EIGEN_DEVICE_FUNC constexpr Index outerStride() const noexcept { return this->innerSize(); }

View File

@@ -99,7 +99,7 @@ class MatrixBase : public DenseBase<Derived> {
/** \returns the size of the main diagonal, which is min(rows(),cols()).
* \sa rows(), cols(), SizeAtCompileTime. */
EIGEN_DEVICE_FUNC inline Index diagonalSize() const { return (numext::mini)(rows(), cols()); }
EIGEN_DEVICE_FUNC constexpr Index diagonalSize() const { return (numext::mini)(rows(), cols()); }
typedef typename Base::PlainObject PlainObject;
@@ -136,19 +136,19 @@ class MatrixBase : public DenseBase<Derived> {
/** Special case of the template operator=, in order to prevent the compiler
* from generating a default operator= (issue hit with g++ 4.1)
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const MatrixBase& other);
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Derived& operator=(const MatrixBase& other);
// We cannot inherit here via Base::operator= since it is causing
// trouble with MSVC.
template <typename OtherDerived>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const DenseBase<OtherDerived>& other);
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Derived& operator=(const DenseBase<OtherDerived>& other);
template <typename OtherDerived>
EIGEN_DEVICE_FUNC Derived& operator=(const EigenBase<OtherDerived>& other);
EIGEN_DEVICE_FUNC constexpr Derived& operator=(const EigenBase<OtherDerived>& other);
template <typename OtherDerived>
EIGEN_DEVICE_FUNC Derived& operator=(const ReturnByValue<OtherDerived>& other);
EIGEN_DEVICE_FUNC constexpr Derived& operator=(const ReturnByValue<OtherDerived>& other);
template <typename OtherDerived>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator+=(const MatrixBase<OtherDerived>& other);
@@ -180,11 +180,11 @@ class MatrixBase : public DenseBase<Derived> {
const SkewSymmetricBase<SkewDerived>& skew) const;
template <typename OtherDerived>
EIGEN_DEVICE_FUNC typename ScalarBinaryOpTraits<typename internal::traits<Derived>::Scalar,
typename internal::traits<OtherDerived>::Scalar>::ReturnType
EIGEN_DEVICE_FUNC constexpr typename ScalarBinaryOpTraits<typename internal::traits<Derived>::Scalar,
typename internal::traits<OtherDerived>::Scalar>::ReturnType
dot(const MatrixBase<OtherDerived>& other) const;
EIGEN_DEVICE_FUNC RealScalar squaredNorm() const;
EIGEN_DEVICE_FUNC constexpr RealScalar squaredNorm() const;
EIGEN_DEVICE_FUNC RealScalar norm() const;
RealScalar stableNorm() const;
RealScalar blueNorm() const;
@@ -194,23 +194,23 @@ class MatrixBase : public DenseBase<Derived> {
EIGEN_DEVICE_FUNC void normalize();
EIGEN_DEVICE_FUNC void stableNormalize();
EIGEN_DEVICE_FUNC const AdjointReturnType adjoint() const;
EIGEN_DEVICE_FUNC constexpr const AdjointReturnType adjoint() const;
EIGEN_DEVICE_FUNC void adjointInPlace();
typedef Diagonal<Derived> DiagonalReturnType;
EIGEN_DEVICE_FUNC DiagonalReturnType diagonal();
EIGEN_DEVICE_FUNC constexpr DiagonalReturnType diagonal();
typedef Diagonal<const Derived> ConstDiagonalReturnType;
EIGEN_DEVICE_FUNC const ConstDiagonalReturnType diagonal() const;
EIGEN_DEVICE_FUNC constexpr const ConstDiagonalReturnType diagonal() const;
template <int Index>
EIGEN_DEVICE_FUNC Diagonal<Derived, Index> diagonal();
EIGEN_DEVICE_FUNC constexpr Diagonal<Derived, Index> diagonal();
template <int Index>
EIGEN_DEVICE_FUNC const Diagonal<const Derived, Index> diagonal() const;
EIGEN_DEVICE_FUNC constexpr const Diagonal<const Derived, Index> diagonal() const;
EIGEN_DEVICE_FUNC Diagonal<Derived, DynamicIndex> diagonal(Index index);
EIGEN_DEVICE_FUNC const Diagonal<const Derived, DynamicIndex> diagonal(Index index) const;
EIGEN_DEVICE_FUNC constexpr Diagonal<Derived, DynamicIndex> diagonal(Index index);
EIGEN_DEVICE_FUNC constexpr const Diagonal<const Derived, DynamicIndex> diagonal(Index index) const;
template <unsigned int Mode>
struct TriangularViewReturnType {
@@ -222,9 +222,9 @@ class MatrixBase : public DenseBase<Derived> {
};
template <unsigned int Mode>
EIGEN_DEVICE_FUNC typename TriangularViewReturnType<Mode>::Type triangularView();
EIGEN_DEVICE_FUNC constexpr typename TriangularViewReturnType<Mode>::Type triangularView();
template <unsigned int Mode>
EIGEN_DEVICE_FUNC typename ConstTriangularViewReturnType<Mode>::Type triangularView() const;
EIGEN_DEVICE_FUNC constexpr typename ConstTriangularViewReturnType<Mode>::Type triangularView() const;
template <unsigned int UpLo>
struct SelfAdjointViewReturnType {
@@ -236,9 +236,9 @@ class MatrixBase : public DenseBase<Derived> {
};
template <unsigned int UpLo>
EIGEN_DEVICE_FUNC typename SelfAdjointViewReturnType<UpLo>::Type selfadjointView();
EIGEN_DEVICE_FUNC constexpr typename SelfAdjointViewReturnType<UpLo>::Type selfadjointView();
template <unsigned int UpLo>
EIGEN_DEVICE_FUNC typename ConstSelfAdjointViewReturnType<UpLo>::Type selfadjointView() const;
EIGEN_DEVICE_FUNC constexpr typename ConstSelfAdjointViewReturnType<UpLo>::Type selfadjointView() const;
const SparseView<Derived> sparseView(
const Scalar& m_reference = Scalar(0),
@@ -252,9 +252,9 @@ class MatrixBase : public DenseBase<Derived> {
EIGEN_DEVICE_FUNC static const BasisReturnType UnitZ();
EIGEN_DEVICE_FUNC static const BasisReturnType UnitW();
EIGEN_DEVICE_FUNC const DiagonalWrapper<const Derived> asDiagonal() const;
EIGEN_DEVICE_FUNC constexpr const DiagonalWrapper<const Derived> asDiagonal() const;
const PermutationWrapper<const Derived> asPermutation() const;
EIGEN_DEVICE_FUNC const SkewSymmetricWrapper<const Derived> asSkewSymmetric() const;
EIGEN_DEVICE_FUNC constexpr const SkewSymmetricWrapper<const Derived> asSkewSymmetric() const;
EIGEN_DEVICE_FUNC Derived& setIdentity();
EIGEN_DEVICE_FUNC Derived& setIdentity(Index rows, Index cols);
@@ -274,6 +274,17 @@ class MatrixBase : public DenseBase<Derived> {
const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
bool isUnitary(const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
/* diagonalView */
template <int DiagIndex_ = 0>
EIGEN_DEVICE_FUNC constexpr DiagonalWrapper<Diagonal<Derived, DiagIndex_>> diagonalView();
template <int DiagIndex_ = 0>
EIGEN_DEVICE_FUNC constexpr DiagonalWrapper<Diagonal<const Derived, DiagIndex_>> diagonalView() const;
EIGEN_DEVICE_FUNC constexpr DiagonalWrapper<Diagonal<Derived, DynamicIndex>> diagonalView(Index index);
EIGEN_DEVICE_FUNC constexpr DiagonalWrapper<Diagonal<const Derived, DynamicIndex>> diagonalView(Index index) const;
/** \returns true if each coefficients of \c *this and \a other are all exactly equal.
* \warning When using floating point scalar values you probably should rather use a
* fuzzy comparison such as isApprox()
@@ -296,14 +307,14 @@ class MatrixBase : public DenseBase<Derived> {
// TODO forceAlignedAccess is temporarily disabled
// Need to find a nicer workaround.
inline const Derived& forceAlignedAccess() const { return derived(); }
inline Derived& forceAlignedAccess() { return derived(); }
constexpr const Derived& forceAlignedAccess() const { return derived(); }
constexpr Derived& forceAlignedAccess() { return derived(); }
template <bool Enable>
inline const Derived& forceAlignedAccessIf() const {
constexpr const Derived& forceAlignedAccessIf() const {
return derived();
}
template <bool Enable>
inline Derived& forceAlignedAccessIf() {
constexpr Derived& forceAlignedAccessIf() {
return derived();
}
@@ -312,29 +323,31 @@ class MatrixBase : public DenseBase<Derived> {
template <int p>
EIGEN_DEVICE_FUNC RealScalar lpNorm() const;
EIGEN_DEVICE_FUNC MatrixBase<Derived>& matrix() { return *this; }
EIGEN_DEVICE_FUNC const MatrixBase<Derived>& matrix() const { return *this; }
EIGEN_DEVICE_FUNC constexpr MatrixBase<Derived>& matrix() { return *this; }
EIGEN_DEVICE_FUNC constexpr const MatrixBase<Derived>& matrix() const { return *this; }
/** \returns an \link Eigen::ArrayBase Array \endlink expression of this matrix
* \sa ArrayBase::matrix() */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ArrayWrapper<Derived> array() { return ArrayWrapper<Derived>(derived()); }
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE ArrayWrapper<Derived> array() {
return ArrayWrapper<Derived>(derived());
}
/** \returns a const \link Eigen::ArrayBase Array \endlink expression of this matrix
* \sa ArrayBase::matrix() */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const ArrayWrapper<const Derived> array() const {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const ArrayWrapper<const Derived> array() const {
return ArrayWrapper<const Derived>(derived());
}
/////////// LU module ///////////
template <typename PermutationIndex = DefaultPermutationIndex>
inline const FullPivLU<PlainObject, PermutationIndex> fullPivLu() const;
inline FullPivLU<PlainObject, PermutationIndex> fullPivLu() const;
template <typename PermutationIndex = DefaultPermutationIndex>
inline const PartialPivLU<PlainObject, PermutationIndex> partialPivLu() const;
inline PartialPivLU<PlainObject, PermutationIndex> partialPivLu() const;
template <typename PermutationIndex = DefaultPermutationIndex>
inline const PartialPivLU<PlainObject, PermutationIndex> lu() const;
inline PartialPivLU<PlainObject, PermutationIndex> lu() const;
EIGEN_DEVICE_FUNC inline const Inverse<Derived> inverse() const;
EIGEN_DEVICE_FUNC inline Inverse<Derived> inverse() const;
template <typename ResultType>
inline void computeInverseAndDetWithCheck(
@@ -350,18 +363,18 @@ class MatrixBase : public DenseBase<Derived> {
/////////// Cholesky module ///////////
inline const LLT<PlainObject> llt() const;
inline const LDLT<PlainObject> ldlt() const;
inline LLT<PlainObject> llt() const;
inline LDLT<PlainObject> ldlt() const;
/////////// QR module ///////////
inline const HouseholderQR<PlainObject> householderQr() const;
inline HouseholderQR<PlainObject> householderQr() const;
template <typename PermutationIndex = DefaultPermutationIndex>
inline const ColPivHouseholderQR<PlainObject, PermutationIndex> colPivHouseholderQr() const;
inline ColPivHouseholderQR<PlainObject, PermutationIndex> colPivHouseholderQr() const;
template <typename PermutationIndex = DefaultPermutationIndex>
inline const FullPivHouseholderQR<PlainObject, PermutationIndex> fullPivHouseholderQr() const;
inline FullPivHouseholderQR<PlainObject, PermutationIndex> fullPivHouseholderQr() const;
template <typename PermutationIndex = DefaultPermutationIndex>
inline const CompleteOrthogonalDecomposition<PlainObject, PermutationIndex> completeOrthogonalDecomposition() const;
inline CompleteOrthogonalDecomposition<PlainObject, PermutationIndex> completeOrthogonalDecomposition() const;
/////////// Eigenvalues module ///////////
@@ -398,7 +411,6 @@ class MatrixBase : public DenseBase<Derived> {
EIGEN_DEVICE_FUNC inline Matrix<Scalar, 3, 1> canonicalEulerAngles(Index a0, Index a1, Index a2) const;
// put this as separate enum value to work around possible GCC 4.3 bug (?)
enum {
HomogeneousReturnTypeDirection =
ColsAtCompileTime == 1 && RowsAtCompileTime == 1

View File

@@ -43,24 +43,24 @@ class NestByValue : public internal::dense_xpr_base<NestByValue<ExpressionType>
EIGEN_DENSE_PUBLIC_INTERFACE(NestByValue)
EIGEN_DEVICE_FUNC explicit inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {}
EIGEN_DEVICE_FUNC constexpr explicit inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {}
EIGEN_DEVICE_FUNC constexpr Index rows() const noexcept { return m_expression.rows(); }
EIGEN_DEVICE_FUNC constexpr Index cols() const noexcept { return m_expression.cols(); }
EIGEN_DEVICE_FUNC operator const ExpressionType&() const { return m_expression; }
EIGEN_DEVICE_FUNC constexpr operator const ExpressionType&() const { return m_expression; }
EIGEN_DEVICE_FUNC const ExpressionType& nestedExpression() const { return m_expression; }
EIGEN_DEVICE_FUNC constexpr const ExpressionType& nestedExpression() const { return m_expression; }
EIGEN_DEVICE_FUNC typename std::enable_if<HasDirectAccess, const Scalar*>::type data() const {
EIGEN_DEVICE_FUNC constexpr std::enable_if_t<HasDirectAccess, const Scalar*> data() const {
return m_expression.data();
}
EIGEN_DEVICE_FUNC typename std::enable_if<HasDirectAccess, Index>::type innerStride() const {
EIGEN_DEVICE_FUNC constexpr std::enable_if_t<HasDirectAccess, Index> innerStride() const {
return m_expression.innerStride();
}
EIGEN_DEVICE_FUNC typename std::enable_if<HasDirectAccess, Index>::type outerStride() const {
EIGEN_DEVICE_FUNC constexpr std::enable_if_t<HasDirectAccess, Index> outerStride() const {
return m_expression.outerStride();
}
@@ -71,7 +71,7 @@ class NestByValue : public internal::dense_xpr_base<NestByValue<ExpressionType>
/** \returns an expression of the temporary version of *this.
*/
template <typename Derived>
EIGEN_DEVICE_FUNC inline const NestByValue<Derived> DenseBase<Derived>::nestByValue() const {
EIGEN_DEVICE_FUNC constexpr inline const NestByValue<Derived> DenseBase<Derived>::nestByValue() const {
return NestByValue<Derived>(derived());
}
@@ -82,7 +82,7 @@ template <typename ArgType>
struct evaluator<NestByValue<ArgType> > : public evaluator<ArgType> {
typedef evaluator<ArgType> Base;
EIGEN_DEVICE_FUNC explicit evaluator(const NestByValue<ArgType>& xpr) : Base(xpr.nestedExpression()) {}
EIGEN_DEVICE_FUNC constexpr explicit evaluator(const NestByValue<ArgType>& xpr) : Base(xpr.nestedExpression()) {}
};
} // namespace internal

View File

@@ -35,7 +35,7 @@ class NoAlias {
public:
typedef typename ExpressionType::Scalar Scalar;
EIGEN_DEVICE_FUNC explicit NoAlias(ExpressionType& expression) : m_expression(expression) {}
EIGEN_DEVICE_FUNC constexpr explicit NoAlias(ExpressionType& expression) : m_expression(expression) {}
template <typename OtherDerived>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ExpressionType& operator=(const StorageBase<OtherDerived>& other) {
@@ -58,7 +58,7 @@ class NoAlias {
return m_expression;
}
EIGEN_DEVICE_FUNC ExpressionType& expression() const { return m_expression; }
EIGEN_DEVICE_FUNC constexpr ExpressionType& expression() const { return m_expression; }
protected:
ExpressionType& m_expression;

View File

@@ -99,12 +99,12 @@ namespace numext {
/** \internal bit-wise cast without changing the underlying bit representation. */
#if defined(__cpp_lib_bit_cast) && __cpp_lib_bit_cast >= 201806L
template <typename Tgt, typename Src>
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC constexpr Tgt bit_cast(const Src& src) {
EIGEN_DEVICE_FUNC constexpr Tgt bit_cast(const Src& src) {
return std::bit_cast<Tgt>(src);
}
#elif EIGEN_HAS_BUILTIN(__builtin_bit_cast)
template <typename Tgt, typename Src>
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC constexpr Tgt bit_cast(const Src& src) {
EIGEN_DEVICE_FUNC constexpr Tgt bit_cast(const Src& src) {
EIGEN_STATIC_ASSERT(std::is_trivially_copyable<Src>::value, THIS_TYPE_IS_NOT_SUPPORTED)
EIGEN_STATIC_ASSERT(std::is_trivially_copyable<Tgt>::value, THIS_TYPE_IS_NOT_SUPPORTED)
EIGEN_STATIC_ASSERT(sizeof(Src) == sizeof(Tgt), THIS_TYPE_IS_NOT_SUPPORTED)

View File

@@ -42,12 +42,12 @@ namespace internal {
/* logic deciding a strategy for unrolling of vectorized paths */
template <typename Func, typename Evaluator>
struct packetwise_redux_traits {
enum {
OuterSize = int(Evaluator::IsRowMajor) ? Evaluator::RowsAtCompileTime : Evaluator::ColsAtCompileTime,
Cost = OuterSize == Dynamic ? HugeCost
: OuterSize * Evaluator::CoeffReadCost + (OuterSize - 1) * functor_traits<Func>::Cost,
Unrolling = Cost <= EIGEN_UNROLLING_LIMIT ? CompleteUnrolling : NoUnrolling
};
static constexpr int OuterSize =
int(Evaluator::IsRowMajor) ? Evaluator::RowsAtCompileTime : Evaluator::ColsAtCompileTime;
static constexpr int Cost = OuterSize == Dynamic
? HugeCost
: OuterSize * Evaluator::CoeffReadCost + (OuterSize - 1) * functor_traits<Func>::Cost;
static constexpr int Unrolling = Cost <= EIGEN_UNROLLING_LIMIT ? CompleteUnrolling : NoUnrolling;
};
/* Value to be returned when size==0 , by default let's return 0 */
@@ -70,8 +70,8 @@ struct packetwise_redux_impl;
/* Perform the actual reduction with unrolling */
template <typename Func, typename Evaluator>
struct packetwise_redux_impl<Func, Evaluator, CompleteUnrolling> {
typedef redux_novec_unroller<Func, Evaluator, 0, Evaluator::SizeAtCompileTime> Base;
typedef typename Evaluator::Scalar Scalar;
using Base = redux_novec_unroller<Func, Evaluator, 0, Evaluator::SizeAtCompileTime>;
using Scalar = typename Evaluator::Scalar;
template <typename PacketType>
EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE PacketType run(const Evaluator& eval, const Func& func, Index /*size*/) {
@@ -96,8 +96,8 @@ struct redux_vec_unroller<Func, Evaluator, Start, 0> {
/* Perform the actual reduction for dynamic sizes */
template <typename Func, typename Evaluator>
struct packetwise_redux_impl<Func, Evaluator, NoUnrolling> {
typedef typename Evaluator::Scalar Scalar;
typedef typename redux_traits<Func, Evaluator>::PacketType PacketScalar;
using Scalar = typename Evaluator::Scalar;
using PacketScalar = typename redux_traits<Func, Evaluator>::PacketType;
template <typename PacketType>
EIGEN_DEVICE_FUNC static PacketType run(const Evaluator& eval, const Func& func, Index size) {
@@ -122,8 +122,8 @@ struct packetwise_redux_impl<Func, Evaluator, NoUnrolling> {
template <typename Func, typename Evaluator>
struct packetwise_segment_redux_impl {
typedef typename Evaluator::Scalar Scalar;
typedef typename redux_traits<Func, Evaluator>::PacketType PacketScalar;
using Scalar = typename Evaluator::Scalar;
using PacketScalar = typename redux_traits<Func, Evaluator>::PacketType;
template <typename PacketType>
EIGEN_DEVICE_FUNC static PacketType run(const Evaluator& eval, const Func& func, Index size, Index begin,
@@ -140,16 +140,16 @@ struct packetwise_segment_redux_impl {
template <typename ArgType, typename MemberOp, int Direction>
struct evaluator<PartialReduxExpr<ArgType, MemberOp, Direction> >
: evaluator_base<PartialReduxExpr<ArgType, MemberOp, Direction> > {
typedef PartialReduxExpr<ArgType, MemberOp, Direction> XprType;
typedef typename internal::nested_eval<ArgType, 1>::type ArgTypeNested;
typedef add_const_on_value_type_t<ArgTypeNested> ConstArgTypeNested;
typedef internal::remove_all_t<ArgTypeNested> ArgTypeNestedCleaned;
typedef typename ArgType::Scalar InputScalar;
typedef typename XprType::Scalar Scalar;
using XprType = PartialReduxExpr<ArgType, MemberOp, Direction>;
using ArgTypeNested = typename internal::nested_eval<ArgType, 1>::type;
using ConstArgTypeNested = add_const_on_value_type_t<ArgTypeNested>;
using ArgTypeNestedCleaned = internal::remove_all_t<ArgTypeNested>;
using InputScalar = typename ArgType::Scalar;
using Scalar = typename XprType::Scalar;
enum {
TraversalSize = Direction == int(Vertical) ? int(ArgType::RowsAtCompileTime) : int(ArgType::ColsAtCompileTime)
};
typedef typename MemberOp::template Cost<int(TraversalSize)> CostOpType;
using CostOpType = typename MemberOp::template Cost<int(TraversalSize)>;
enum {
CoeffReadCost = TraversalSize == Dynamic ? HugeCost
: TraversalSize == 0
@@ -168,13 +168,13 @@ struct evaluator<PartialReduxExpr<ArgType, MemberOp, Direction> >
Alignment = 0 // FIXME this will need to be improved once PartialReduxExpr is vectorized
};
EIGEN_DEVICE_FUNC explicit evaluator(const XprType xpr) : m_arg(xpr.nestedExpression()), m_functor(xpr.functor()) {
EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr) : m_arg(xpr.nestedExpression()), m_functor(xpr.functor()) {
EIGEN_INTERNAL_CHECK_COST_VALUE(TraversalSize == Dynamic ? HugeCost
: (TraversalSize == 0 ? 1 : int(CostOpType::value)));
EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
}
typedef typename XprType::CoeffReturnType CoeffReturnType;
using CoeffReturnType = typename XprType::CoeffReturnType;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar coeff(Index i, Index j) const {
return coeff(Direction == Vertical ? j : i);
@@ -203,7 +203,7 @@ struct evaluator<PartialReduxExpr<ArgType, MemberOp, Direction> >
// See bug 1612, currently if PacketSize==1 (i.e. complex<double> with 128bits registers) then the storage-order of
// panel get reversed and methods like packetByOuterInner do not make sense anymore in this context. So let's just
// by pass "vectorization" in this case:
if (PacketSize == 1) return internal::pset1<PacketType>(coeff(idx));
EIGEN_IF_CONSTEXPR(PacketSize == 1) return internal::pset1<PacketType>(coeff(idx));
Index startRow = Direction == Vertical ? 0 : idx;
Index startCol = Direction == Vertical ? idx : 0;

View File

@@ -109,6 +109,9 @@ class PermutationBase : public EigenBase<Derived> {
*/
DenseMatrixType toDenseMatrix() const { return derived(); }
/** \returns the plain matrix representation of the permutation. */
DenseMatrixType eval() const { return toDenseMatrix(); }
/** const version of indices(). */
const IndicesType& indices() const { return derived().indices(); }
/** \returns a reference to the stored array representing the permutation. */

View File

@@ -159,17 +159,17 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type {
INVALID_MATRIX_TEMPLATE_PARAMETERS)
EIGEN_STATIC_ASSERT(((Options & (DontAlign | RowMajor)) == Options), INVALID_MATRIX_TEMPLATE_PARAMETERS)
EIGEN_DEVICE_FUNC Base& base() { return *static_cast<Base*>(this); }
EIGEN_DEVICE_FUNC const Base& base() const { return *static_cast<const Base*>(this); }
EIGEN_DEVICE_FUNC constexpr Base& base() { return *static_cast<Base*>(this); }
EIGEN_DEVICE_FUNC constexpr const Base& base() const { return *static_cast<const Base*>(this); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const noexcept { return m_storage.rows(); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const noexcept { return m_storage.cols(); }
EIGEN_DEVICE_FUNC constexpr Index rows() const noexcept { return m_storage.rows(); }
EIGEN_DEVICE_FUNC constexpr Index cols() const noexcept { return m_storage.cols(); }
/** This is an overloaded version of DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index,Index) const
* provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts.
*
* See DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index) const for details. */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const Scalar& coeff(Index rowId, Index colId) const {
EIGEN_DEVICE_FUNC constexpr const Scalar& coeff(Index rowId, Index colId) const {
if (Flags & RowMajorBit)
return m_storage.data()[colId + rowId * m_storage.cols()];
else // column-major
@@ -180,15 +180,13 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type {
* provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts.
*
* See DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index) const for details. */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const Scalar& coeff(Index index) const {
return m_storage.data()[index];
}
EIGEN_DEVICE_FUNC constexpr const Scalar& coeff(Index index) const { return m_storage.data()[index]; }
/** This is an overloaded version of DenseCoeffsBase<Derived,WriteAccessors>::coeffRef(Index,Index) const
* provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts.
*
* See DenseCoeffsBase<Derived,WriteAccessors>::coeffRef(Index,Index) const for details. */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Scalar& coeffRef(Index rowId, Index colId) {
EIGEN_DEVICE_FUNC constexpr Scalar& coeffRef(Index rowId, Index colId) {
if (Flags & RowMajorBit)
return m_storage.data()[colId + rowId * m_storage.cols()];
else // column-major
@@ -199,11 +197,11 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type {
* provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts.
*
* See DenseCoeffsBase<Derived,WriteAccessors>::coeffRef(Index) const for details. */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Scalar& coeffRef(Index index) { return m_storage.data()[index]; }
EIGEN_DEVICE_FUNC constexpr Scalar& coeffRef(Index index) { return m_storage.data()[index]; }
/** This is the const version of coeffRef(Index,Index) which is thus synonym of coeff(Index,Index).
* It is provided for convenience. */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const Scalar& coeffRef(Index rowId, Index colId) const {
EIGEN_DEVICE_FUNC constexpr const Scalar& coeffRef(Index rowId, Index colId) const {
if (Flags & RowMajorBit)
return m_storage.data()[colId + rowId * m_storage.cols()];
else // column-major
@@ -212,9 +210,7 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type {
/** This is the const version of coeffRef(Index) which is thus synonym of coeff(Index).
* It is provided for convenience. */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const Scalar& coeffRef(Index index) const {
return m_storage.data()[index];
}
EIGEN_DEVICE_FUNC constexpr const Scalar& coeffRef(Index index) const { return m_storage.data()[index]; }
/** \internal */
template <int LoadMode>
@@ -343,7 +339,7 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type {
* remain row-vectors and vectors remain vectors.
*/
template <typename OtherDerived>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resizeLike(const EigenBase<OtherDerived>& _other) {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE void resizeLike(const EigenBase<OtherDerived>& _other) {
const OtherDerived& other = _other.derived();
#ifndef EIGEN_NO_DEBUG
internal::check_rows_cols_for_overflow<MaxSizeAtCompileTime, MaxRowsAtCompileTime, MaxColsAtCompileTime>::run(
@@ -426,9 +422,7 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type {
/** This is a special case of the templated operator=. Its purpose is to
* prevent a default operator= from hiding the templated operator=.
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Derived& operator=(const PlainObjectBase& other) {
return _set(other);
}
EIGEN_DEVICE_FUNC constexpr Derived& operator=(const PlainObjectBase& other) { return _set(other); }
/** \sa MatrixBase::lazyAssign() */
template <typename OtherDerived>
@@ -446,9 +440,9 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type {
// Prevent user from trying to instantiate PlainObjectBase objects
// by making all its constructor protected. See bug 1074.
protected:
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr PlainObjectBase() = default;
EIGEN_DEVICE_FUNC constexpr PlainObjectBase() = default;
/** \brief Move constructor */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr PlainObjectBase(PlainObjectBase&&) = default;
EIGEN_DEVICE_FUNC constexpr PlainObjectBase(PlainObjectBase&&) = default;
/** \brief Move assignment operator */
EIGEN_DEVICE_FUNC constexpr PlainObjectBase& operator=(PlainObjectBase&& other) noexcept {
m_storage = std::move(other.m_storage);
@@ -456,7 +450,7 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type {
}
/** Copy constructor */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr PlainObjectBase(const PlainObjectBase&) = default;
EIGEN_DEVICE_FUNC constexpr PlainObjectBase(const PlainObjectBase&) = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PlainObjectBase(Index size, Index rows, Index cols)
: m_storage(size, rows, cols) {}
@@ -467,7 +461,7 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type {
* This constructor is for 1D array or vectors with more than 4 coefficients.
*
* \warning To construct a column (resp. row) vector of fixed length, the number of values passed to this
* constructor must match the the fixed number of rows (resp. columns) of \c *this.
* constructor must match the fixed number of rows (resp. columns) of \c *this.
*/
template <typename... ArgTypes>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PlainObjectBase(const Scalar& a0, const Scalar& a1, const Scalar& a2,
@@ -524,14 +518,14 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type {
/** \sa PlainObjectBase::operator=(const EigenBase<OtherDerived>&) */
template <typename OtherDerived>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PlainObjectBase(const DenseBase<OtherDerived>& other) : m_storage() {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE PlainObjectBase(const DenseBase<OtherDerived>& other) : m_storage() {
resizeLike(other);
_set_noalias(other);
}
/** \sa PlainObjectBase::operator=(const EigenBase<OtherDerived>&) */
template <typename OtherDerived>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PlainObjectBase(const EigenBase<OtherDerived>& other) : m_storage() {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE PlainObjectBase(const EigenBase<OtherDerived>& other) : m_storage() {
resizeLike(other);
*this = other.derived();
}
@@ -691,6 +685,7 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type {
eigen_assert((this->size() == 0 || (IsVectorAtCompileTime ? (this->size() == other.size())
: (rows() == other.rows() && cols() == other.cols()))) &&
"Size mismatch. Automatic resizing is disabled because EIGEN_NO_AUTOMATIC_RESIZING is defined");
if (this->size() == 0) resizeLike(other);
EIGEN_ONLY_USED_FOR_DEBUG(other);
#else
resizeLike(other);
@@ -714,7 +709,7 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type {
// aliasing is dealt once in internal::call_assignment
// so at this stage we have to assume aliasing... and resising has to be done later.
template <typename OtherDerived>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Derived& _set(const DenseBase<OtherDerived>& other) {
EIGEN_DEVICE_FUNC constexpr Derived& _set(const DenseBase<OtherDerived>& other) {
internal::call_assignment(this->derived(), other.derived());
return this->derived();
}
@@ -725,7 +720,7 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type {
* \sa operator=(const MatrixBase<OtherDerived>&), _set()
*/
template <typename OtherDerived>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Derived& _set_noalias(const DenseBase<OtherDerived>& other) {
EIGEN_DEVICE_FUNC constexpr Derived& _set_noalias(const DenseBase<OtherDerived>& other) {
// I don't think we need this resize call since the lazyAssign will anyways resize
// and lazyAssign will be called by the assign selector.
//_resize_to_match(other);
@@ -737,23 +732,23 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type {
}
template <typename T0, typename T1>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init2(Index rows, Index cols,
std::enable_if_t<Base::SizeAtCompileTime != 2, T0>* = 0) {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE void _init2(Index rows, Index cols,
std::enable_if_t<Base::SizeAtCompileTime != 2, T0>* = 0) {
EIGEN_STATIC_ASSERT(internal::is_valid_index_type<T0>::value && internal::is_valid_index_type<T1>::value,
T0 AND T1 MUST BE INTEGER TYPES)
resize(rows, cols);
}
template <typename T0, typename T1>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init2(const T0& val0, const T1& val1,
std::enable_if_t<Base::SizeAtCompileTime == 2, T0>* = 0) {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE void _init2(const T0& val0, const T1& val1,
std::enable_if_t<Base::SizeAtCompileTime == 2, T0>* = 0) {
EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 2)
m_storage.data()[0] = Scalar(val0);
m_storage.data()[1] = Scalar(val1);
}
template <typename T0, typename T1>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init2(
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE void _init2(
const Index& val0, const Index& val1,
std::enable_if_t<(!internal::is_same<Index, Scalar>::value) && (internal::is_same<T0, Index>::value) &&
(internal::is_same<T1, Index>::value) && Base::SizeAtCompileTime == 2,
@@ -766,7 +761,7 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type {
// The argument is convertible to the Index type and we either have a non 1x1 Matrix, or a dynamic-sized Array,
// then the argument is meant to be the size of the object.
template <typename T>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init1(
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE void _init1(
Index size,
std::enable_if_t<(Base::SizeAtCompileTime != 1 || !internal::is_convertible<T, Scalar>::value) &&
((!internal::is_same<typename internal::traits<Derived>::XprKind, ArrayXpr>::value ||
@@ -782,7 +777,7 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type {
// We have a 1x1 matrix/array => the argument is interpreted as the value of the unique coefficient (case where scalar
// type can be implicitly converted)
template <typename T>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init1(
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE void _init1(
const Scalar& val0,
std::enable_if_t<Base::SizeAtCompileTime == 1 && internal::is_convertible<T, Scalar>::value, T>* = 0) {
EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 1)
@@ -792,7 +787,7 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type {
// We have a 1x1 matrix/array => the argument is interpreted as the value of the unique coefficient (case where scalar
// type match the index type)
template <typename T>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init1(
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE void _init1(
const Index& val0,
std::enable_if_t<(!internal::is_same<Index, Scalar>::value) && (internal::is_same<Index, T>::value) &&
Base::SizeAtCompileTime == 1 && internal::is_convertible<T, Scalar>::value,
@@ -803,42 +798,42 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type {
// Initialize a fixed size matrix from a pointer to raw data
template <typename T>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init1(const Scalar* data) {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE void _init1(const Scalar* data) {
this->_set_noalias(ConstMapType(data));
}
// Initialize an arbitrary matrix from a dense expression
template <typename T, typename OtherDerived>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init1(const DenseBase<OtherDerived>& other) {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE void _init1(const DenseBase<OtherDerived>& other) {
this->_set_noalias(other);
}
// Initialize an arbitrary matrix from an object convertible to the Derived type.
template <typename T>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init1(const Derived& other) {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE void _init1(const Derived& other) {
this->_set_noalias(other);
}
// Initialize an arbitrary matrix from a generic Eigen expression
template <typename T, typename OtherDerived>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init1(const EigenBase<OtherDerived>& other) {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE void _init1(const EigenBase<OtherDerived>& other) {
this->derived() = other;
}
template <typename T, typename OtherDerived>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init1(const ReturnByValue<OtherDerived>& other) {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE void _init1(const ReturnByValue<OtherDerived>& other) {
resize(other.rows(), other.cols());
other.evalTo(this->derived());
}
template <typename T, typename OtherDerived, int ColsAtCompileTime>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init1(const RotationBase<OtherDerived, ColsAtCompileTime>& r) {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE void _init1(const RotationBase<OtherDerived, ColsAtCompileTime>& r) {
this->derived() = r;
}
// For fixed-size Array<Scalar,...>
template <typename T>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init1(
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE void _init1(
const Scalar& val0,
std::enable_if_t<Base::SizeAtCompileTime != Dynamic && Base::SizeAtCompileTime != 1 &&
internal::is_convertible<T, Scalar>::value &&
@@ -849,7 +844,7 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type {
// For fixed-size Array<Index,...>
template <typename T>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init1(
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE void _init1(
const Index& val0,
std::enable_if_t<(!internal::is_same<Index, Scalar>::value) && (internal::is_same<Index, T>::value) &&
Base::SizeAtCompileTime != Dynamic && Base::SizeAtCompileTime != 1 &&

View File

@@ -219,16 +219,16 @@ class Product
using TransposeReturnType = typename internal::product_transpose_helper<Lhs, Rhs, Option>::TransposeType;
using AdjointReturnType = typename internal::product_transpose_helper<Lhs, Rhs, Option>::AdjointType;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Product(const Lhs& lhs, const Rhs& rhs) : m_lhs(lhs), m_rhs(rhs) {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Product(const Lhs& lhs, const Rhs& rhs) : m_lhs(lhs), m_rhs(rhs) {
eigen_assert(lhs.cols() == rhs.rows() && "invalid matrix product" &&
"if you wanted a coeff-wise or a dot product use the respective explicit functions");
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const noexcept { return m_lhs.rows(); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const noexcept { return m_rhs.cols(); }
EIGEN_DEVICE_FUNC constexpr Index rows() const noexcept { return m_lhs.rows(); }
EIGEN_DEVICE_FUNC constexpr Index cols() const noexcept { return m_rhs.cols(); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const LhsNestedCleaned& lhs() const { return m_lhs; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const RhsNestedCleaned& rhs() const { return m_rhs; }
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const LhsNestedCleaned& lhs() const { return m_lhs; }
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const RhsNestedCleaned& rhs() const { return m_rhs; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TransposeReturnType transpose() const {
return internal::product_transpose_helper<Lhs, Rhs, Option>::run_transpose(*this);

View File

@@ -15,6 +15,13 @@
// IWYU pragma: private
#include "./InternalHeaderCheck.h"
// C4804: unsafe use of type 'bool' in operation. Unavoidable in generic code
// instantiated with bool scalars (e.g. += and * on bool).
#if EIGEN_COMP_MSVC
#pragma warning(push)
#pragma warning(disable : 4804)
#endif
namespace Eigen {
namespace internal {
@@ -29,30 +36,27 @@ namespace internal {
*/
template <typename Lhs, typename Rhs, int Options>
struct evaluator<Product<Lhs, Rhs, Options>> : public product_evaluator<Product<Lhs, Rhs, Options>> {
typedef Product<Lhs, Rhs, Options> XprType;
typedef product_evaluator<XprType> Base;
using XprType = Product<Lhs, Rhs, Options>;
using Base = product_evaluator<XprType>;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const XprType& xpr) : Base(xpr) {}
};
// Catch "scalar * ( A * B )" and transform it to "(A*scalar) * B"
// TODO we should apply that rule only if that's really helpful
// TODO: we should apply that rule only if that's really helpful
template <typename Lhs, typename Rhs, typename Scalar1, typename Scalar2, typename Plain1>
struct evaluator_assume_aliasing<CwiseBinaryOp<internal::scalar_product_op<Scalar1, Scalar2>,
const CwiseNullaryOp<internal::scalar_constant_op<Scalar1>, Plain1>,
const Product<Lhs, Rhs, DefaultProduct>>> {
static const bool value = true;
};
const Product<Lhs, Rhs, DefaultProduct>>> : std::true_type {};
template <typename Lhs, typename Rhs, typename Scalar1, typename Scalar2, typename Plain1>
struct evaluator<CwiseBinaryOp<internal::scalar_product_op<Scalar1, Scalar2>,
const CwiseNullaryOp<internal::scalar_constant_op<Scalar1>, Plain1>,
const Product<Lhs, Rhs, DefaultProduct>>>
: public evaluator<Product<EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(Scalar1, Lhs, product), Rhs, DefaultProduct>> {
typedef CwiseBinaryOp<internal::scalar_product_op<Scalar1, Scalar2>,
const CwiseNullaryOp<internal::scalar_constant_op<Scalar1>, Plain1>,
const Product<Lhs, Rhs, DefaultProduct>>
XprType;
typedef evaluator<Product<EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(Scalar1, Lhs, product), Rhs, DefaultProduct>> Base;
using XprType = CwiseBinaryOp<internal::scalar_product_op<Scalar1, Scalar2>,
const CwiseNullaryOp<internal::scalar_constant_op<Scalar1>, Plain1>,
const Product<Lhs, Rhs, DefaultProduct>>;
using Base = evaluator<Product<EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(Scalar1, Lhs, product), Rhs, DefaultProduct>>;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const XprType& xpr)
: Base(xpr.lhs().functor().m_other * xpr.rhs().lhs() * xpr.rhs().rhs()) {}
@@ -61,8 +65,8 @@ struct evaluator<CwiseBinaryOp<internal::scalar_product_op<Scalar1, Scalar2>,
template <typename Lhs, typename Rhs, int DiagIndex>
struct evaluator<Diagonal<const Product<Lhs, Rhs, DefaultProduct>, DiagIndex>>
: public evaluator<Diagonal<const Product<Lhs, Rhs, LazyProduct>, DiagIndex>> {
typedef Diagonal<const Product<Lhs, Rhs, DefaultProduct>, DiagIndex> XprType;
typedef evaluator<Diagonal<const Product<Lhs, Rhs, LazyProduct>, DiagIndex>> Base;
using XprType = Diagonal<const Product<Lhs, Rhs, DefaultProduct>, DiagIndex>;
using Base = evaluator<Diagonal<const Product<Lhs, Rhs, LazyProduct>, DiagIndex>>;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const XprType& xpr)
: Base(Diagonal<const Product<Lhs, Rhs, LazyProduct>, DiagIndex>(
@@ -78,18 +82,16 @@ template <typename Lhs, typename Rhs, typename LhsShape = typename evaluator_tra
struct generic_product_impl;
template <typename Lhs, typename Rhs>
struct evaluator_assume_aliasing<Product<Lhs, Rhs, DefaultProduct>> {
static const bool value = true;
};
struct evaluator_assume_aliasing<Product<Lhs, Rhs, DefaultProduct>> : std::true_type {};
// This is the default evaluator implementation for products:
// It creates a temporary and call generic_product_impl
template <typename Lhs, typename Rhs, int Options, int ProductTag, typename LhsShape, typename RhsShape>
struct product_evaluator<Product<Lhs, Rhs, Options>, ProductTag, LhsShape, RhsShape>
: public evaluator<typename Product<Lhs, Rhs, Options>::PlainObject> {
typedef Product<Lhs, Rhs, Options> XprType;
typedef typename XprType::PlainObject PlainObject;
typedef evaluator<PlainObject> Base;
using XprType = Product<Lhs, Rhs, Options>;
using PlainObject = typename XprType::PlainObject;
using Base = evaluator<PlainObject>;
enum { Flags = Base::Flags | EvalBeforeNestingBit };
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit product_evaluator(const XprType& xpr)
@@ -123,7 +125,7 @@ struct product_evaluator<Product<Lhs, Rhs, Options>, ProductTag, LhsShape, RhsSh
template <typename DstXprType, typename Lhs, typename Rhs, int Options, typename Scalar>
struct Assignment<DstXprType, Product<Lhs, Rhs, Options>, internal::assign_op<Scalar, Scalar>, Dense2Dense,
std::enable_if_t<(Options == DefaultProduct || Options == AliasFreeProduct)>> {
typedef Product<Lhs, Rhs, Options> SrcXprType;
using SrcXprType = Product<Lhs, Rhs, Options>;
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(DstXprType& dst, const SrcXprType& src,
const internal::assign_op<Scalar, Scalar>&) {
Index dstRows = src.rows();
@@ -138,7 +140,7 @@ struct Assignment<DstXprType, Product<Lhs, Rhs, Options>, internal::assign_op<Sc
template <typename DstXprType, typename Lhs, typename Rhs, int Options, typename Scalar>
struct Assignment<DstXprType, Product<Lhs, Rhs, Options>, internal::add_assign_op<Scalar, Scalar>, Dense2Dense,
std::enable_if_t<(Options == DefaultProduct || Options == AliasFreeProduct)>> {
typedef Product<Lhs, Rhs, Options> SrcXprType;
using SrcXprType = Product<Lhs, Rhs, Options>;
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(DstXprType& dst, const SrcXprType& src,
const internal::add_assign_op<Scalar, Scalar>&) {
eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols());
@@ -151,7 +153,7 @@ struct Assignment<DstXprType, Product<Lhs, Rhs, Options>, internal::add_assign_o
template <typename DstXprType, typename Lhs, typename Rhs, int Options, typename Scalar>
struct Assignment<DstXprType, Product<Lhs, Rhs, Options>, internal::sub_assign_op<Scalar, Scalar>, Dense2Dense,
std::enable_if_t<(Options == DefaultProduct || Options == AliasFreeProduct)>> {
typedef Product<Lhs, Rhs, Options> SrcXprType;
using SrcXprType = Product<Lhs, Rhs, Options>;
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(DstXprType& dst, const SrcXprType& src,
const internal::sub_assign_op<Scalar, Scalar>&) {
eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols());
@@ -161,7 +163,7 @@ struct Assignment<DstXprType, Product<Lhs, Rhs, Options>, internal::sub_assign_o
};
// Dense ?= scalar * Product
// TODO we should apply that rule if that's really helpful
// TODO: we should apply that rule if that's really helpful
// for instance, this is not good for inner products
template <typename DstXprType, typename Lhs, typename Rhs, typename AssignFunc, typename Scalar, typename ScalarBis,
typename Plain>
@@ -170,10 +172,9 @@ struct Assignment<DstXprType,
const CwiseNullaryOp<internal::scalar_constant_op<ScalarBis>, Plain>,
const Product<Lhs, Rhs, DefaultProduct>>,
AssignFunc, Dense2Dense> {
typedef CwiseBinaryOp<internal::scalar_product_op<ScalarBis, Scalar>,
const CwiseNullaryOp<internal::scalar_constant_op<ScalarBis>, Plain>,
const Product<Lhs, Rhs, DefaultProduct>>
SrcXprType;
using SrcXprType = CwiseBinaryOp<internal::scalar_product_op<ScalarBis, Scalar>,
const CwiseNullaryOp<internal::scalar_constant_op<ScalarBis>, Plain>,
const Product<Lhs, Rhs, DefaultProduct>>;
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(DstXprType& dst, const SrcXprType& src,
const AssignFunc& func) {
call_assignment_no_alias(dst, (src.lhs().functor().m_other * src.rhs().lhs()) * src.rhs().rhs(), func);
@@ -182,25 +183,21 @@ struct Assignment<DstXprType,
//----------------------------------------
// Catch "Dense ?= xpr + Product<>" expression to save one temporary
// FIXME we could probably enable these rules for any product, i.e., not only Dense and DefaultProduct
// FIXME: consider enabling these rules for all product types, not only Dense and DefaultProduct.
template <typename OtherXpr, typename Lhs, typename Rhs>
struct evaluator_assume_aliasing<
CwiseBinaryOp<
internal::scalar_sum_op<typename OtherXpr::Scalar, typename Product<Lhs, Rhs, DefaultProduct>::Scalar>,
const OtherXpr, const Product<Lhs, Rhs, DefaultProduct>>,
DenseShape> {
static const bool value = true;
};
DenseShape> : std::true_type {};
template <typename OtherXpr, typename Lhs, typename Rhs>
struct evaluator_assume_aliasing<
CwiseBinaryOp<
internal::scalar_difference_op<typename OtherXpr::Scalar, typename Product<Lhs, Rhs, DefaultProduct>::Scalar>,
const OtherXpr, const Product<Lhs, Rhs, DefaultProduct>>,
DenseShape> {
static const bool value = true;
};
DenseShape> : std::true_type {};
template <typename DstXprType, typename OtherXpr, typename ProductType, typename Func1, typename Func2>
struct assignment_from_xpr_op_product {
@@ -237,17 +234,17 @@ template <typename Lhs, typename Rhs>
struct generic_product_impl<Lhs, Rhs, DenseShape, DenseShape, InnerProduct> {
using impl = default_inner_product_impl<Lhs, Rhs, false>;
template <typename Dst>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) {
static EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) {
dst.coeffRef(0, 0) = impl::run(lhs, rhs);
}
template <typename Dst>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) {
static EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) {
dst.coeffRef(0, 0) += impl::run(lhs, rhs);
}
template <typename Dst>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void subTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) {
static EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE void subTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) {
dst.coeffRef(0, 0) -= impl::run(lhs, rhs);
}
};
@@ -284,9 +281,9 @@ template <typename Lhs, typename Rhs>
struct generic_product_impl<Lhs, Rhs, DenseShape, DenseShape, OuterProduct> {
template <typename T>
struct is_row_major : bool_constant<(int(T::Flags) & RowMajorBit)> {};
typedef typename Product<Lhs, Rhs>::Scalar Scalar;
using Scalar = typename Product<Lhs, Rhs>::Scalar;
// TODO it would be nice to be able to exploit our *_assign_op functors for that purpose
// TODO: it would be nice to be able to exploit our *_assign_op functors for that purpose
struct set {
template <typename Dst, typename Src>
EIGEN_DEVICE_FUNC void operator()(const Dst& dst, const Src& src) const {
@@ -343,7 +340,7 @@ struct generic_product_impl<Lhs, Rhs, DenseShape, DenseShape, OuterProduct> {
// This base class provides default implementations for evalTo, addTo, subTo, in terms of scaleAndAddTo
template <typename Lhs, typename Rhs, typename Derived>
struct generic_product_impl_base {
typedef typename Product<Lhs, Rhs>::Scalar Scalar;
using Scalar = typename Product<Lhs, Rhs>::Scalar;
template <typename Dst>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) {
@@ -371,11 +368,11 @@ struct generic_product_impl_base {
template <typename Lhs, typename Rhs>
struct generic_product_impl<Lhs, Rhs, DenseShape, DenseShape, GemvProduct>
: generic_product_impl_base<Lhs, Rhs, generic_product_impl<Lhs, Rhs, DenseShape, DenseShape, GemvProduct>> {
typedef typename nested_eval<Lhs, 1>::type LhsNested;
typedef typename nested_eval<Rhs, 1>::type RhsNested;
typedef typename Product<Lhs, Rhs>::Scalar Scalar;
using LhsNested = typename nested_eval<Lhs, 1>::type;
using RhsNested = typename nested_eval<Rhs, 1>::type;
using Scalar = typename Product<Lhs, Rhs>::Scalar;
enum { Side = Lhs::IsVectorAtCompileTime ? OnTheLeft : OnTheRight };
typedef internal::remove_all_t<std::conditional_t<int(Side) == OnTheRight, LhsNested, RhsNested>> MatrixType;
using MatrixType = internal::remove_all_t<std::conditional_t<int(Side) == OnTheRight, LhsNested, RhsNested>>;
template <typename Dest>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs,
@@ -396,7 +393,7 @@ struct generic_product_impl<Lhs, Rhs, DenseShape, DenseShape, GemvProduct>
template <typename Lhs, typename Rhs>
struct generic_product_impl<Lhs, Rhs, DenseShape, DenseShape, CoeffBasedProductMode> {
typedef typename Product<Lhs, Rhs>::Scalar Scalar;
using Scalar = typename Product<Lhs, Rhs>::Scalar;
template <typename Dst>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) {
@@ -485,9 +482,9 @@ struct etor_product_packet_impl;
template <typename Lhs, typename Rhs, int ProductTag>
struct product_evaluator<Product<Lhs, Rhs, LazyProduct>, ProductTag, DenseShape, DenseShape>
: evaluator_base<Product<Lhs, Rhs, LazyProduct>> {
typedef Product<Lhs, Rhs, LazyProduct> XprType;
typedef typename XprType::Scalar Scalar;
typedef typename XprType::CoeffReturnType CoeffReturnType;
using XprType = Product<Lhs, Rhs, LazyProduct>;
using Scalar = typename XprType::Scalar;
using CoeffReturnType = typename XprType::CoeffReturnType;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit product_evaluator(const XprType& xpr)
: m_lhs(xpr.lhs()),
@@ -500,30 +497,18 @@ struct product_evaluator<Product<Lhs, Rhs, LazyProduct>, ProductTag, DenseShape,
EIGEN_INTERNAL_CHECK_COST_VALUE(NumTraits<Scalar>::MulCost);
EIGEN_INTERNAL_CHECK_COST_VALUE(NumTraits<Scalar>::AddCost);
EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
#if 0
std::cerr << "LhsOuterStrideBytes= " << LhsOuterStrideBytes << "\n";
std::cerr << "RhsOuterStrideBytes= " << RhsOuterStrideBytes << "\n";
std::cerr << "LhsAlignment= " << LhsAlignment << "\n";
std::cerr << "RhsAlignment= " << RhsAlignment << "\n";
std::cerr << "CanVectorizeLhs= " << CanVectorizeLhs << "\n";
std::cerr << "CanVectorizeRhs= " << CanVectorizeRhs << "\n";
std::cerr << "CanVectorizeInner= " << CanVectorizeInner << "\n";
std::cerr << "EvalToRowMajor= " << EvalToRowMajor << "\n";
std::cerr << "Alignment= " << Alignment << "\n";
std::cerr << "Flags= " << Flags << "\n";
#endif
}
// Everything below here is taken from CoeffBasedProduct.h
typedef typename internal::nested_eval<Lhs, Rhs::ColsAtCompileTime>::type LhsNested;
typedef typename internal::nested_eval<Rhs, Lhs::RowsAtCompileTime>::type RhsNested;
using LhsNested = typename internal::nested_eval<Lhs, Rhs::ColsAtCompileTime>::type;
using RhsNested = typename internal::nested_eval<Rhs, Lhs::RowsAtCompileTime>::type;
typedef internal::remove_all_t<LhsNested> LhsNestedCleaned;
typedef internal::remove_all_t<RhsNested> RhsNestedCleaned;
using LhsNestedCleaned = internal::remove_all_t<LhsNested>;
using RhsNestedCleaned = internal::remove_all_t<RhsNested>;
typedef evaluator<LhsNestedCleaned> LhsEtorType;
typedef evaluator<RhsNestedCleaned> RhsEtorType;
using LhsEtorType = evaluator<LhsNestedCleaned>;
using RhsEtorType = evaluator<RhsNestedCleaned>;
enum {
RowsAtCompileTime = LhsNestedCleaned::RowsAtCompileTime,
@@ -533,78 +518,77 @@ struct product_evaluator<Product<Lhs, Rhs, LazyProduct>, ProductTag, DenseShape,
MaxColsAtCompileTime = RhsNestedCleaned::MaxColsAtCompileTime
};
typedef typename find_best_packet<Scalar, RowsAtCompileTime>::type LhsVecPacketType;
typedef typename find_best_packet<Scalar, ColsAtCompileTime>::type RhsVecPacketType;
using LhsVecPacketType = typename find_best_packet<Scalar, RowsAtCompileTime>::type;
using RhsVecPacketType = typename find_best_packet<Scalar, ColsAtCompileTime>::type;
enum {
static constexpr int LhsCoeffReadCost = LhsEtorType::CoeffReadCost;
static constexpr int RhsCoeffReadCost = RhsEtorType::CoeffReadCost;
static constexpr int CoeffReadCost =
InnerSize == 0 ? NumTraits<Scalar>::ReadCost
: InnerSize == Dynamic
? HugeCost
: InnerSize * (NumTraits<Scalar>::MulCost + int(LhsCoeffReadCost) + int(RhsCoeffReadCost)) +
(InnerSize - 1) * NumTraits<Scalar>::AddCost;
LhsCoeffReadCost = LhsEtorType::CoeffReadCost,
RhsCoeffReadCost = RhsEtorType::CoeffReadCost,
CoeffReadCost = InnerSize == 0 ? NumTraits<Scalar>::ReadCost
: InnerSize == Dynamic
? HugeCost
: InnerSize * (NumTraits<Scalar>::MulCost + int(LhsCoeffReadCost) + int(RhsCoeffReadCost)) +
(InnerSize - 1) * NumTraits<Scalar>::AddCost,
static constexpr bool Unroll = CoeffReadCost <= EIGEN_UNROLLING_LIMIT;
Unroll = CoeffReadCost <= EIGEN_UNROLLING_LIMIT,
static constexpr int LhsFlags = LhsEtorType::Flags;
static constexpr int RhsFlags = RhsEtorType::Flags;
LhsFlags = LhsEtorType::Flags,
RhsFlags = RhsEtorType::Flags,
static constexpr int LhsRowMajor = LhsFlags & RowMajorBit;
static constexpr int RhsRowMajor = RhsFlags & RowMajorBit;
LhsRowMajor = LhsFlags & RowMajorBit,
RhsRowMajor = RhsFlags & RowMajorBit,
static constexpr int LhsVecPacketSize = unpacket_traits<LhsVecPacketType>::size;
static constexpr int RhsVecPacketSize = unpacket_traits<RhsVecPacketType>::size;
LhsVecPacketSize = unpacket_traits<LhsVecPacketType>::size,
RhsVecPacketSize = unpacket_traits<RhsVecPacketType>::size,
// Here, we don't care about alignment larger than the usable packet size.
static constexpr int LhsAlignment =
plain_enum_min(LhsEtorType::Alignment, LhsVecPacketSize* int(sizeof(typename LhsNestedCleaned::Scalar)));
static constexpr int RhsAlignment =
plain_enum_min(RhsEtorType::Alignment, RhsVecPacketSize* int(sizeof(typename RhsNestedCleaned::Scalar)));
// Here, we don't care about alignment larger than the usable packet size.
LhsAlignment =
plain_enum_min(LhsEtorType::Alignment, LhsVecPacketSize* int(sizeof(typename LhsNestedCleaned::Scalar))),
RhsAlignment =
plain_enum_min(RhsEtorType::Alignment, RhsVecPacketSize* int(sizeof(typename RhsNestedCleaned::Scalar))),
static constexpr bool SameType = is_same<typename LhsNestedCleaned::Scalar, typename RhsNestedCleaned::Scalar>::value;
SameType = is_same<typename LhsNestedCleaned::Scalar, typename RhsNestedCleaned::Scalar>::value,
static constexpr bool CanVectorizeRhs = bool(RhsRowMajor) && (RhsFlags & PacketAccessBit) && (ColsAtCompileTime != 1);
static constexpr bool CanVectorizeLhs = (!LhsRowMajor) && (LhsFlags & PacketAccessBit) && (RowsAtCompileTime != 1);
CanVectorizeRhs = bool(RhsRowMajor) && (RhsFlags & PacketAccessBit) && (ColsAtCompileTime != 1),
CanVectorizeLhs = (!LhsRowMajor) && (LhsFlags & PacketAccessBit) && (RowsAtCompileTime != 1),
static constexpr int EvalToRowMajor = (MaxRowsAtCompileTime == 1 && MaxColsAtCompileTime != 1) ? 1
: (MaxColsAtCompileTime == 1 && MaxRowsAtCompileTime != 1)
? 0
: (bool(RhsRowMajor) && !CanVectorizeLhs);
EvalToRowMajor = (MaxRowsAtCompileTime == 1 && MaxColsAtCompileTime != 1) ? 1
: (MaxColsAtCompileTime == 1 && MaxRowsAtCompileTime != 1)
? 0
: (bool(RhsRowMajor) && !CanVectorizeLhs),
static constexpr int Flags = ((int(LhsFlags) | int(RhsFlags)) & HereditaryBits & ~RowMajorBit) |
(EvalToRowMajor ? RowMajorBit : 0)
// TODO: enable vectorization for mixed types
| (SameType && (CanVectorizeLhs || CanVectorizeRhs) ? PacketAccessBit : 0) |
(XprType::IsVectorAtCompileTime ? LinearAccessBit : 0);
Flags = ((int(LhsFlags) | int(RhsFlags)) & HereditaryBits & ~RowMajorBit) |
(EvalToRowMajor ? RowMajorBit : 0)
// TODO enable vectorization for mixed types
| (SameType && (CanVectorizeLhs || CanVectorizeRhs) ? PacketAccessBit : 0) |
(XprType::IsVectorAtCompileTime ? LinearAccessBit : 0),
static constexpr int LhsOuterStrideBytes =
int(LhsNestedCleaned::OuterStrideAtCompileTime) * int(sizeof(typename LhsNestedCleaned::Scalar));
static constexpr int RhsOuterStrideBytes =
int(RhsNestedCleaned::OuterStrideAtCompileTime) * int(sizeof(typename RhsNestedCleaned::Scalar));
LhsOuterStrideBytes =
int(LhsNestedCleaned::OuterStrideAtCompileTime) * int(sizeof(typename LhsNestedCleaned::Scalar)),
RhsOuterStrideBytes =
int(RhsNestedCleaned::OuterStrideAtCompileTime) * int(sizeof(typename RhsNestedCleaned::Scalar)),
static constexpr int Alignment =
bool(CanVectorizeLhs)
? (LhsOuterStrideBytes <= 0 || (int(LhsOuterStrideBytes) % plain_enum_max(1, LhsAlignment)) != 0
? 0
: LhsAlignment)
: bool(CanVectorizeRhs)
? (RhsOuterStrideBytes <= 0 || (int(RhsOuterStrideBytes) % plain_enum_max(1, RhsAlignment)) != 0
? 0
: RhsAlignment)
: 0;
Alignment = bool(CanVectorizeLhs)
? (LhsOuterStrideBytes <= 0 || (int(LhsOuterStrideBytes) % plain_enum_max(1, LhsAlignment)) != 0
? 0
: LhsAlignment)
: bool(CanVectorizeRhs)
? (RhsOuterStrideBytes <= 0 || (int(RhsOuterStrideBytes) % plain_enum_max(1, RhsAlignment)) != 0
? 0
: RhsAlignment)
: 0,
/* CanVectorizeInner deserves special explanation. It does not affect the product flags. It is not used outside
* of Product. If the Product itself is not a packet-access expression, there is still a chance that the inner
* loop of the product might be vectorized. This is the meaning of CanVectorizeInner. Since it doesn't affect
* the Flags, it is safe to make this value depend on ActualPacketAccessBit, that doesn't affect the ABI.
*/
static constexpr bool CanVectorizeInner = SameType && LhsRowMajor && (!RhsRowMajor) &&
(int(LhsFlags) & int(RhsFlags) & ActualPacketAccessBit) &&
(int(InnerSize) % packet_traits<Scalar>::size == 0);
/* CanVectorizeInner deserves special explanation. It does not affect the product flags. It is not used outside
* of Product. If the Product itself is not a packet-access expression, there is still a chance that the inner
* loop of the product might be vectorized. This is the meaning of CanVectorizeInner. Since it doesn't affect
* the Flags, it is safe to make this value depend on ActualPacketAccessBit, that doesn't affect the ABI.
*/
CanVectorizeInner = SameType && LhsRowMajor && (!RhsRowMajor) &&
(int(LhsFlags) & int(RhsFlags) & ActualPacketAccessBit) &&
(int(InnerSize) % packet_traits<Scalar>::size == 0)
};
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CoeffReturnType coeff(Index row, Index col) const {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const CoeffReturnType coeff(Index row, Index col) const {
return (m_lhs.row(row).transpose().cwiseProduct(m_rhs.col(col))).sum();
}
@@ -612,7 +596,7 @@ struct product_evaluator<Product<Lhs, Rhs, LazyProduct>, ProductTag, DenseShape,
* which is why we don't set the LinearAccessBit.
* TODO: this seems possible when the result is a vector
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CoeffReturnType coeff(Index index) const {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const CoeffReturnType coeff(Index index) const {
const Index row = (RowsAtCompileTime == 1 || MaxRowsAtCompileTime == 1) ? 0 : index;
const Index col = (RowsAtCompileTime == 1 || MaxRowsAtCompileTime == 1) ? index : 0;
return (m_lhs.row(row).transpose().cwiseProduct(m_rhs.col(col))).sum();
@@ -621,9 +605,9 @@ struct product_evaluator<Product<Lhs, Rhs, LazyProduct>, ProductTag, DenseShape,
template <int LoadMode, typename PacketType>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const PacketType packet(Index row, Index col) const {
PacketType res;
typedef etor_product_packet_impl<bool(int(Flags) & RowMajorBit) ? RowMajor : ColMajor,
Unroll ? int(InnerSize) : Dynamic, LhsEtorType, RhsEtorType, PacketType, LoadMode>
PacketImpl;
using PacketImpl =
etor_product_packet_impl<bool(int(Flags) & RowMajorBit) ? RowMajor : ColMajor,
Unroll ? int(InnerSize) : Dynamic, LhsEtorType, RhsEtorType, PacketType, LoadMode>;
PacketImpl::run(row, col, m_lhsImpl, m_rhsImpl, m_innerDim, res);
return res;
}
@@ -639,9 +623,9 @@ struct product_evaluator<Product<Lhs, Rhs, LazyProduct>, ProductTag, DenseShape,
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const PacketType packetSegment(Index row, Index col, Index begin,
Index count) const {
PacketType res;
typedef etor_product_packet_impl<bool(int(Flags) & RowMajorBit) ? RowMajor : ColMajor,
Unroll ? int(InnerSize) : Dynamic, LhsEtorType, RhsEtorType, PacketType, LoadMode>
PacketImpl;
using PacketImpl =
etor_product_packet_impl<bool(int(Flags) & RowMajorBit) ? RowMajor : ColMajor,
Unroll ? int(InnerSize) : Dynamic, LhsEtorType, RhsEtorType, PacketType, LoadMode>;
PacketImpl::run_segment(row, col, m_lhsImpl, m_rhsImpl, m_innerDim, res, begin, count);
return res;
}
@@ -660,16 +644,15 @@ struct product_evaluator<Product<Lhs, Rhs, LazyProduct>, ProductTag, DenseShape,
LhsEtorType m_lhsImpl;
RhsEtorType m_rhsImpl;
// TODO: Get rid of m_innerDim if known at compile time
Index m_innerDim;
variable_if_dynamic<Index, InnerSize> m_innerDim;
};
template <typename Lhs, typename Rhs>
struct product_evaluator<Product<Lhs, Rhs, DefaultProduct>, LazyCoeffBasedProductMode, DenseShape, DenseShape>
: product_evaluator<Product<Lhs, Rhs, LazyProduct>, CoeffBasedProductMode, DenseShape, DenseShape> {
typedef Product<Lhs, Rhs, DefaultProduct> XprType;
typedef Product<Lhs, Rhs, LazyProduct> BaseProduct;
typedef product_evaluator<BaseProduct, CoeffBasedProductMode, DenseShape, DenseShape> Base;
using XprType = Product<Lhs, Rhs, DefaultProduct>;
using BaseProduct = Product<Lhs, Rhs, LazyProduct>;
using Base = product_evaluator<BaseProduct, CoeffBasedProductMode, DenseShape, DenseShape>;
enum { Flags = Base::Flags | EvalBeforeNestingBit };
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit product_evaluator(const XprType& xpr)
: Base(BaseProduct(xpr.lhs(), xpr.rhs())) {}
@@ -717,8 +700,8 @@ struct etor_product_packet_impl<ColMajor, UnrollingIndex, Lhs, Rhs, Packet, Load
template <typename Lhs, typename Rhs, typename Packet, int LoadMode>
struct etor_product_packet_impl<RowMajor, 1, Lhs, Rhs, Packet, LoadMode> {
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs,
Index /*innerDim*/, Packet& res) {
static EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs,
Index /*innerDim*/, Packet& res) {
res = pmul(pset1<Packet>(lhs.coeff(row, Index(0))), rhs.template packet<LoadMode, Packet>(Index(0), col));
}
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run_segment(Index row, Index col, const Lhs& lhs, const Rhs& rhs,
@@ -731,8 +714,8 @@ struct etor_product_packet_impl<RowMajor, 1, Lhs, Rhs, Packet, LoadMode> {
template <typename Lhs, typename Rhs, typename Packet, int LoadMode>
struct etor_product_packet_impl<ColMajor, 1, Lhs, Rhs, Packet, LoadMode> {
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs,
Index /*innerDim*/, Packet& res) {
static EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs,
Index /*innerDim*/, Packet& res) {
res = pmul(lhs.template packet<LoadMode, Packet>(row, Index(0)), pset1<Packet>(rhs.coeff(Index(0), col)));
}
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run_segment(Index row, Index col, const Lhs& lhs, const Rhs& rhs,
@@ -812,7 +795,7 @@ struct triangular_product_impl;
template <typename Lhs, typename Rhs, int ProductTag>
struct generic_product_impl<Lhs, Rhs, TriangularShape, DenseShape, ProductTag>
: generic_product_impl_base<Lhs, Rhs, generic_product_impl<Lhs, Rhs, TriangularShape, DenseShape, ProductTag>> {
typedef typename Product<Lhs, Rhs>::Scalar Scalar;
using Scalar = typename Product<Lhs, Rhs>::Scalar;
template <typename Dest>
static void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) {
@@ -824,7 +807,7 @@ struct generic_product_impl<Lhs, Rhs, TriangularShape, DenseShape, ProductTag>
template <typename Lhs, typename Rhs, int ProductTag>
struct generic_product_impl<Lhs, Rhs, DenseShape, TriangularShape, ProductTag>
: generic_product_impl_base<Lhs, Rhs, generic_product_impl<Lhs, Rhs, DenseShape, TriangularShape, ProductTag>> {
typedef typename Product<Lhs, Rhs>::Scalar Scalar;
using Scalar = typename Product<Lhs, Rhs>::Scalar;
template <typename Dest>
static void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) {
@@ -842,7 +825,7 @@ struct selfadjoint_product_impl;
template <typename Lhs, typename Rhs, int ProductTag>
struct generic_product_impl<Lhs, Rhs, SelfAdjointShape, DenseShape, ProductTag>
: generic_product_impl_base<Lhs, Rhs, generic_product_impl<Lhs, Rhs, SelfAdjointShape, DenseShape, ProductTag>> {
typedef typename Product<Lhs, Rhs>::Scalar Scalar;
using Scalar = typename Product<Lhs, Rhs>::Scalar;
template <typename Dest>
static EIGEN_DEVICE_FUNC void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) {
@@ -854,7 +837,7 @@ struct generic_product_impl<Lhs, Rhs, SelfAdjointShape, DenseShape, ProductTag>
template <typename Lhs, typename Rhs, int ProductTag>
struct generic_product_impl<Lhs, Rhs, DenseShape, SelfAdjointShape, ProductTag>
: generic_product_impl_base<Lhs, Rhs, generic_product_impl<Lhs, Rhs, DenseShape, SelfAdjointShape, ProductTag>> {
typedef typename Product<Lhs, Rhs>::Scalar Scalar;
using Scalar = typename Product<Lhs, Rhs>::Scalar;
template <typename Dest>
static void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) {
@@ -869,7 +852,7 @@ struct generic_product_impl<Lhs, Rhs, DenseShape, SelfAdjointShape, ProductTag>
template <typename MatrixType, typename DiagonalType, typename Derived, int ProductOrder>
struct diagonal_product_evaluator_base : evaluator_base<Derived> {
typedef typename ScalarBinaryOpTraits<typename MatrixType::Scalar, typename DiagonalType::Scalar>::ReturnType Scalar;
using Scalar = typename ScalarBinaryOpTraits<typename MatrixType::Scalar, typename DiagonalType::Scalar>::ReturnType;
public:
enum {
@@ -896,8 +879,8 @@ struct diagonal_product_evaluator_base : evaluator_base<Derived> {
(ScalarAccessOnDiag_ || (bool(int(DiagFlags) & PacketAccessBit))),
LinearAccessMask_ =
(MatrixType::RowsAtCompileTime == 1 || MatrixType::ColsAtCompileTime == 1) ? LinearAccessBit : 0,
Flags =
((HereditaryBits | LinearAccessMask_) & (unsigned int)(MatrixFlags)) | (Vectorizable_ ? PacketAccessBit : 0),
Flags = ((HereditaryBits | LinearAccessMask_) & static_cast<unsigned int>(MatrixFlags)) |
(Vectorizable_ ? PacketAccessBit : 0),
Alignment = evaluator<MatrixType>::Alignment,
AsScalarProduct =
@@ -913,7 +896,7 @@ struct diagonal_product_evaluator_base : evaluator_base<Derived> {
EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar coeff(Index idx) const {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const Scalar coeff(Index idx) const {
if (AsScalarProduct)
return m_diagImpl.coeff(0) * m_matImpl.coeff(idx);
else
@@ -932,8 +915,9 @@ struct diagonal_product_evaluator_base : evaluator_base<Derived> {
enum {
InnerSize = (MatrixType::Flags & RowMajorBit) ? MatrixType::ColsAtCompileTime : MatrixType::RowsAtCompileTime,
DiagonalPacketLoadMode = plain_enum_min(
LoadMode,
((InnerSize % 16) == 0) ? int(Aligned16) : int(evaluator<DiagonalType>::Alignment)) // FIXME hardcoded 16!!
LoadMode, ((InnerSize * int(sizeof(Scalar))) % int(unpacket_traits<PacketType>::alignment) == 0)
? int(unpacket_traits<PacketType>::alignment)
: int(evaluator<DiagonalType>::Alignment))
};
return internal::pmul(m_matImpl.template packet<LoadMode, PacketType>(row, col),
m_diagImpl.template packet<DiagonalPacketLoadMode, PacketType>(id));
@@ -952,8 +936,9 @@ struct diagonal_product_evaluator_base : evaluator_base<Derived> {
enum {
InnerSize = (MatrixType::Flags & RowMajorBit) ? MatrixType::ColsAtCompileTime : MatrixType::RowsAtCompileTime,
DiagonalPacketLoadMode = plain_enum_min(
LoadMode,
((InnerSize % 16) == 0) ? int(Aligned16) : int(evaluator<DiagonalType>::Alignment)) // FIXME hardcoded 16!!
LoadMode, ((InnerSize * int(sizeof(Scalar))) % int(unpacket_traits<PacketType>::alignment) == 0)
? int(unpacket_traits<PacketType>::alignment)
: int(evaluator<DiagonalType>::Alignment))
};
return internal::pmul(m_matImpl.template packetSegment<LoadMode, PacketType>(row, col, begin, count),
m_diagImpl.template packetSegment<DiagonalPacketLoadMode, PacketType>(id, begin, count));
@@ -968,24 +953,23 @@ template <typename Lhs, typename Rhs, int ProductKind, int ProductTag>
struct product_evaluator<Product<Lhs, Rhs, ProductKind>, ProductTag, DiagonalShape, DenseShape>
: diagonal_product_evaluator_base<Rhs, typename Lhs::DiagonalVectorType, Product<Lhs, Rhs, LazyProduct>,
OnTheLeft> {
typedef diagonal_product_evaluator_base<Rhs, typename Lhs::DiagonalVectorType, Product<Lhs, Rhs, LazyProduct>,
OnTheLeft>
Base;
using Base =
diagonal_product_evaluator_base<Rhs, typename Lhs::DiagonalVectorType, Product<Lhs, Rhs, LazyProduct>, OnTheLeft>;
using Base::coeff;
using Base::m_diagImpl;
using Base::m_matImpl;
typedef typename Base::Scalar Scalar;
using Scalar = typename Base::Scalar;
typedef Product<Lhs, Rhs, ProductKind> XprType;
typedef typename XprType::PlainObject PlainObject;
typedef typename Lhs::DiagonalVectorType DiagonalType;
using XprType = Product<Lhs, Rhs, ProductKind>;
using PlainObject = typename XprType::PlainObject;
using DiagonalType = typename Lhs::DiagonalVectorType;
static constexpr int StorageOrder = Base::StorageOrder_;
using IsRowMajor_t = bool_constant<StorageOrder == RowMajor>;
EIGEN_DEVICE_FUNC explicit product_evaluator(const XprType& xpr) : Base(xpr.rhs(), xpr.lhs().diagonal()) {}
EIGEN_DEVICE_FUNC constexpr explicit product_evaluator(const XprType& xpr) : Base(xpr.rhs(), xpr.lhs().diagonal()) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const {
return m_diagImpl.coeff(row) * m_matImpl.coeff(row, col);
}
@@ -1023,23 +1007,22 @@ template <typename Lhs, typename Rhs, int ProductKind, int ProductTag>
struct product_evaluator<Product<Lhs, Rhs, ProductKind>, ProductTag, DenseShape, DiagonalShape>
: diagonal_product_evaluator_base<Lhs, typename Rhs::DiagonalVectorType, Product<Lhs, Rhs, LazyProduct>,
OnTheRight> {
typedef diagonal_product_evaluator_base<Lhs, typename Rhs::DiagonalVectorType, Product<Lhs, Rhs, LazyProduct>,
OnTheRight>
Base;
using Base = diagonal_product_evaluator_base<Lhs, typename Rhs::DiagonalVectorType, Product<Lhs, Rhs, LazyProduct>,
OnTheRight>;
using Base::coeff;
using Base::m_diagImpl;
using Base::m_matImpl;
typedef typename Base::Scalar Scalar;
using Scalar = typename Base::Scalar;
typedef Product<Lhs, Rhs, ProductKind> XprType;
typedef typename XprType::PlainObject PlainObject;
using XprType = Product<Lhs, Rhs, ProductKind>;
using PlainObject = typename XprType::PlainObject;
static constexpr int StorageOrder = Base::StorageOrder_;
using IsColMajor_t = bool_constant<StorageOrder == ColMajor>;
EIGEN_DEVICE_FUNC explicit product_evaluator(const XprType& xpr) : Base(xpr.lhs(), xpr.rhs().diagonal()) {}
EIGEN_DEVICE_FUNC constexpr explicit product_evaluator(const XprType& xpr) : Base(xpr.lhs(), xpr.rhs().diagonal()) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const {
return m_matImpl.coeff(row, col) * m_diagImpl.coeff(col);
}
@@ -1081,8 +1064,8 @@ struct permutation_matrix_product;
template <typename ExpressionType, int Side, bool Transposed>
struct permutation_matrix_product<ExpressionType, Side, Transposed, DenseShape> {
typedef typename nested_eval<ExpressionType, 1>::type MatrixType;
typedef remove_all_t<MatrixType> MatrixTypeCleaned;
using MatrixType = typename nested_eval<ExpressionType, 1>::type;
using MatrixTypeCleaned = remove_all_t<MatrixType>;
template <typename Dest, typename PermutationType>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Dest& dst, const PermutationType& perm,
@@ -1170,7 +1153,7 @@ struct generic_product_impl<Lhs, Inverse<Rhs>, MatrixShape, PermutationShape, Pr
* Products with transpositions matrices
***************************************************************************/
// FIXME could we unify Transpositions and Permutation into a single "shape"??
// FIXME: consider unifying Transpositions and Permutation into a single shape.
/** \internal
* \class transposition_matrix_product
@@ -1178,14 +1161,14 @@ struct generic_product_impl<Lhs, Inverse<Rhs>, MatrixShape, PermutationShape, Pr
*/
template <typename ExpressionType, int Side, bool Transposed, typename ExpressionShape>
struct transposition_matrix_product {
typedef typename nested_eval<ExpressionType, 1>::type MatrixType;
typedef remove_all_t<MatrixType> MatrixTypeCleaned;
using MatrixType = typename nested_eval<ExpressionType, 1>::type;
using MatrixTypeCleaned = remove_all_t<MatrixType>;
template <typename Dest, typename TranspositionType>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Dest& dst, const TranspositionType& tr,
const ExpressionType& xpr) {
MatrixType mat(xpr);
typedef typename TranspositionType::StorageIndex StorageIndex;
using StorageIndex = typename TranspositionType::StorageIndex;
const Index size = tr.size();
StorageIndex j = 0;
@@ -1284,4 +1267,8 @@ struct generic_product_impl<Lhs, Rhs, HomogeneousShape, PermutationShape, Produc
} // end namespace Eigen
#if EIGEN_COMP_MSVC
#pragma warning(pop)
#endif
#endif // EIGEN_PRODUCT_EVALUATORS_H

View File

@@ -19,7 +19,7 @@ namespace internal {
template <typename Scalar>
struct scalar_random_op {
inline const Scalar operator()() const { return random<Scalar>(); }
inline Scalar operator()() const { return random<Scalar>(); }
};
template <typename Scalar>

View File

@@ -56,19 +56,21 @@ struct random_bits_impl {
EIGEN_STATIC_ASSERT(std::is_unsigned<Scalar>::value, SCALAR MUST BE A BUILT - IN UNSIGNED INTEGER)
using RandomDevice = eigen_random_device;
using RandomReturnType = typename RandomDevice::ReturnType;
static constexpr int kEntropy = RandomDevice::Entropy;
static constexpr int kTotalBits = sizeof(Scalar) * CHAR_BIT;
static constexpr int kEntropy = plain_enum_min(kTotalBits, RandomDevice::Entropy);
// return a Scalar filled with numRandomBits beginning from the least significant bit
static EIGEN_DEVICE_FUNC inline Scalar run(int numRandomBits) {
eigen_assert((numRandomBits >= 0) && (numRandomBits <= kTotalBits));
const Scalar mask = Scalar(-1) >> ((kTotalBits - numRandomBits) & (kTotalBits - 1));
Scalar randomBits = 0;
for (int shift = 0; shift < numRandomBits; shift += kEntropy) {
RandomReturnType r = RandomDevice::run();
randomBits |= static_cast<Scalar>(r) << shift;
for (int filledBits = 0; filledBits < numRandomBits; filledBits += kEntropy) {
Scalar r = static_cast<Scalar>(RandomDevice::run());
int remainingBits = numRandomBits - filledBits;
if (remainingBits < kEntropy) {
// clear the excess bits to avoid UB and rounding bias
r >>= kEntropy - remainingBits;
}
randomBits |= r << filledBits;
}
// clear the excess bits
randomBits &= mask;
return randomBits;
}
};
@@ -204,7 +206,8 @@ struct random_int_impl<Scalar, false, true> {
template <typename Scalar>
struct random_int_impl<Scalar, true, true> {
static constexpr int kTotalBits = sizeof(Scalar) * CHAR_BIT;
using BitsType = typename make_unsigned<Scalar>::type;
// avoid implicit integral promotion to `int`
using BitsType = std::conditional_t<(sizeof(Scalar) < sizeof(int)), unsigned int, std::make_unsigned_t<Scalar> >;
static EIGEN_DEVICE_FUNC inline Scalar run(const Scalar& x, const Scalar& y) {
if (y <= x) return x;
// Avoid overflow by representing `range` as an unsigned type

View File

@@ -17,20 +17,16 @@ namespace Eigen {
namespace internal {
// Vectorized assignment to RealView requires array-oriented access to the real and imaginary components.
// Write access and vectorization requires array-oriented access to the real and imaginary components.
// From https://en.cppreference.com/w/cpp/numeric/complex.html:
// For any pointer to an element of an array of std::complex<T> named p and any valid array index i,
// reinterpret_cast<T*>(p)[2 * i] is the real part of the complex number p[i], and
// reinterpret_cast<T*>(p)[2 * i + 1] is the imaginary part of the complex number p[i].
template <typename ComplexScalar>
template <typename T>
struct complex_array_access : std::false_type {};
template <>
struct complex_array_access<std::complex<float>> : std::true_type {};
template <>
struct complex_array_access<std::complex<double>> : std::true_type {};
template <>
struct complex_array_access<std::complex<long double>> : std::true_type {};
template <typename T>
struct complex_array_access<std::complex<T>> : std::true_type {};
template <typename Xpr>
struct traits<RealView<Xpr>> : public traits<Xpr> {
@@ -40,13 +36,17 @@ struct traits<RealView<Xpr>> : public traits<Xpr> {
if (size_as_int == Dynamic) return Dynamic;
return times_two ? (2 * size_as_int) : size_as_int;
}
using Base = traits<Xpr>;
using ComplexScalar = typename Base::Scalar;
using Scalar = typename NumTraits<ComplexScalar>::Real;
static constexpr int ActualDirectAccessBit = complex_array_access<ComplexScalar>::value ? DirectAccessBit : 0;
static constexpr bool ArrayAccess = complex_array_access<ComplexScalar>::value;
static constexpr int ActualDirectAccessBit = ArrayAccess ? DirectAccessBit : 0;
static constexpr int ActualLvaluebit = !std::is_const<Xpr>::value && ArrayAccess ? LvalueBit : 0;
static constexpr int ActualPacketAccessBit = packet_traits<Scalar>::Vectorizable ? PacketAccessBit : 0;
static constexpr int FlagMask =
ActualDirectAccessBit | ActualPacketAccessBit | HereditaryBits | LinearAccessBit | LvalueBit;
ActualDirectAccessBit | ActualLvaluebit | ActualPacketAccessBit | HereditaryBits | LinearAccessBit;
static constexpr int BaseFlags = int(evaluator<Xpr>::Flags) | int(Base::Flags);
static constexpr int Flags = BaseFlags & FlagMask;
static constexpr bool IsRowMajor = Flags & RowMajorBit;
@@ -66,68 +66,84 @@ struct evaluator<RealView<Xpr>> : private evaluator<Xpr> {
using XprType = RealView<Xpr>;
using ExpressionTraits = traits<XprType>;
using ComplexScalar = typename ExpressionTraits::ComplexScalar;
using ComplexCoeffReturnType = typename BaseEvaluator::CoeffReturnType;
using Scalar = typename ExpressionTraits::Scalar;
static constexpr bool IsRowMajor = ExpressionTraits::IsRowMajor;
static constexpr int Flags = ExpressionTraits::Flags;
static constexpr int CoeffReadCost = BaseEvaluator::CoeffReadCost;
static constexpr int Alignment = BaseEvaluator::Alignment;
static constexpr bool IsRowMajor = ExpressionTraits::IsRowMajor;
static constexpr bool DirectAccess = (Flags & DirectAccessBit) != 0;
using ComplexCoeffReturnType = std::conditional_t<DirectAccess, const ComplexScalar&, ComplexScalar>;
using CoeffReturnType = std::conditional_t<DirectAccess, const Scalar&, Scalar>;
EIGEN_DEVICE_FUNC explicit evaluator(XprType realView) : BaseEvaluator(realView.m_xpr) {}
template <bool Enable = std::is_reference<ComplexCoeffReturnType>::value, typename = std::enable_if_t<!Enable>>
template <bool Enable = DirectAccess, std::enable_if_t<!Enable, bool> = true>
constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar coeff(Index row, Index col) const {
ComplexCoeffReturnType cscalar = BaseEvaluator::coeff(IsRowMajor ? row : row / 2, IsRowMajor ? col / 2 : col);
Index p = (IsRowMajor ? col : row) & 1;
return p ? numext::real(cscalar) : numext::imag(cscalar);
Index r = IsRowMajor ? row : row / 2;
Index c = IsRowMajor ? col / 2 : col;
bool p = (IsRowMajor ? col : row) & 1;
ComplexScalar ccoeff = BaseEvaluator::coeff(r, c);
return p ? numext::imag(ccoeff) : numext::real(ccoeff);
}
template <bool Enable = std::is_reference<ComplexCoeffReturnType>::value, typename = std::enable_if_t<Enable>>
constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar& coeff(Index row, Index col) const {
ComplexCoeffReturnType cscalar = BaseEvaluator::coeff(IsRowMajor ? row : row / 2, IsRowMajor ? col / 2 : col);
template <bool Enable = DirectAccess, std::enable_if_t<Enable, bool> = true>
constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const {
Index r = IsRowMajor ? row : row / 2;
Index c = IsRowMajor ? col / 2 : col;
Index p = (IsRowMajor ? col : row) & 1;
return reinterpret_cast<const Scalar(&)[2]>(cscalar)[p];
ComplexCoeffReturnType ccoeff = BaseEvaluator::coeff(r, c);
return reinterpret_cast<const Scalar(&)[2]>(ccoeff)[p];
}
constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& coeffRef(Index row, Index col) {
ComplexScalar& cscalar = BaseEvaluator::coeffRef(IsRowMajor ? row : row / 2, IsRowMajor ? col / 2 : col);
Index p = (IsRowMajor ? col : row) & 1;
return reinterpret_cast<Scalar(&)[2]>(cscalar)[p];
}
template <bool Enable = std::is_reference<ComplexCoeffReturnType>::value, typename = std::enable_if_t<!Enable>>
template <bool Enable = DirectAccess, std::enable_if_t<!Enable, bool> = true>
constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar coeff(Index index) const {
ComplexCoeffReturnType cscalar = BaseEvaluator::coeff(index / 2);
Index p = index & 1;
return p ? numext::real(cscalar) : numext::imag(cscalar);
ComplexScalar ccoeff = BaseEvaluator::coeff(index / 2);
bool p = index & 1;
return p ? numext::imag(ccoeff) : numext::real(ccoeff);
}
template <bool Enable = std::is_reference<ComplexCoeffReturnType>::value, typename = std::enable_if_t<Enable>>
constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar& coeff(Index index) const {
ComplexCoeffReturnType cscalar = BaseEvaluator::coeff(index / 2);
template <bool Enable = DirectAccess, std::enable_if_t<Enable, bool> = true>
constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const {
ComplexCoeffReturnType ccoeff = BaseEvaluator::coeff(index / 2);
Index p = index & 1;
return reinterpret_cast<const Scalar(&)[2]>(cscalar)[p];
return reinterpret_cast<const Scalar(&)[2]>(ccoeff)[p];
}
constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& coeffRef(Index row, Index col) {
Index r = IsRowMajor ? row : row / 2;
Index c = IsRowMajor ? col / 2 : col;
Index p = (IsRowMajor ? col : row) & 1;
ComplexScalar& ccoeffRef = BaseEvaluator::coeffRef(r, c);
return reinterpret_cast<Scalar(&)[2]>(ccoeffRef)[p];
}
constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& coeffRef(Index index) {
ComplexScalar& cscalar = BaseEvaluator::coeffRef(index / 2);
ComplexScalar& ccoeffRef = BaseEvaluator::coeffRef(index / 2);
Index p = index & 1;
return reinterpret_cast<Scalar(&)[2]>(cscalar)[p];
return reinterpret_cast<Scalar(&)[2]>(ccoeffRef)[p];
}
// If the first index is odd (imaginary), discard the first scalar
// in 'result' and assign the missing scalar.
// This operation is safe as the real component of the first scalar must exist.
template <int LoadMode, typename PacketType>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const {
constexpr int RealPacketSize = unpacket_traits<PacketType>::size;
using ComplexPacket = typename find_packet_by_size<ComplexScalar, RealPacketSize / 2>::type;
EIGEN_STATIC_ASSERT((find_packet_by_size<ComplexScalar, RealPacketSize / 2>::value),
MISSING COMPATIBLE COMPLEX PACKET TYPE)
eigen_assert(((IsRowMajor ? col : row) % 2 == 0) && "the inner index must be even");
Index crow = IsRowMajor ? row : row / 2;
Index ccol = IsRowMajor ? col / 2 : col;
ComplexPacket cpacket = BaseEvaluator::template packet<LoadMode, ComplexPacket>(crow, ccol);
return preinterpret<PacketType, ComplexPacket>(cpacket);
Index r = IsRowMajor ? row : row / 2;
Index c = IsRowMajor ? col / 2 : col;
bool p = (IsRowMajor ? col : row) & 1;
ComplexPacket cresult = BaseEvaluator::template packet<LoadMode, ComplexPacket>(r, c);
PacketType result = preinterpret<PacketType>(cresult);
if (p) {
Scalar aux[RealPacketSize + 1];
pstoreu(aux, result);
Index lastr = IsRowMajor ? row : row + RealPacketSize - 1;
Index lastc = IsRowMajor ? col + RealPacketSize - 1 : col;
aux[RealPacketSize] = coeff(lastr, lastc);
result = ploadu<PacketType>(aux + 1);
}
return result;
}
template <int LoadMode, typename PacketType>
@@ -136,28 +152,48 @@ struct evaluator<RealView<Xpr>> : private evaluator<Xpr> {
using ComplexPacket = typename find_packet_by_size<ComplexScalar, RealPacketSize / 2>::type;
EIGEN_STATIC_ASSERT((find_packet_by_size<ComplexScalar, RealPacketSize / 2>::value),
MISSING COMPATIBLE COMPLEX PACKET TYPE)
eigen_assert((index % 2 == 0) && "the index must be even");
Index cindex = index / 2;
ComplexPacket cpacket = BaseEvaluator::template packet<LoadMode, ComplexPacket>(cindex);
return preinterpret<PacketType, ComplexPacket>(cpacket);
ComplexPacket cresult = BaseEvaluator::template packet<LoadMode, ComplexPacket>(index / 2);
PacketType result = preinterpret<PacketType>(cresult);
bool p = index & 1;
if (p) {
Scalar aux[RealPacketSize + 1];
pstoreu(aux, result);
aux[RealPacketSize] = coeff(index + RealPacketSize - 1);
result = ploadu<PacketType>(aux + 1);
}
return result;
}
// The requested real packet segment forms the half-open interval [begin, end), where 'end' = 'begin' + 'count'.
// In order to access the underlying complex array, even indices must be aligned with the real components
// of the complex scalars. 'begin' and 'count' must be modified as follows:
// a) 'begin' must be rounded down to the nearest even number; and
// b) 'end' must be rounded up to the nearest even number.
template <int LoadMode, typename PacketType>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packetSegment(Index row, Index col, Index begin, Index count) const {
constexpr int RealPacketSize = unpacket_traits<PacketType>::size;
using ComplexPacket = typename find_packet_by_size<ComplexScalar, RealPacketSize / 2>::type;
EIGEN_STATIC_ASSERT((find_packet_by_size<ComplexScalar, RealPacketSize / 2>::value),
MISSING COMPATIBLE COMPLEX PACKET TYPE)
eigen_assert(((IsRowMajor ? col : row) % 2 == 0) && "the inner index must be even");
eigen_assert((begin % 2 == 0) && (count % 2 == 0) && "begin and count must be even");
Index crow = IsRowMajor ? row : row / 2;
Index ccol = IsRowMajor ? col / 2 : col;
Index cbegin = begin / 2;
Index ccount = count / 2;
ComplexPacket cpacket = BaseEvaluator::template packetSegment<LoadMode, ComplexPacket>(crow, ccol, cbegin, ccount);
return preinterpret<PacketType, ComplexPacket>(cpacket);
Index actualBegin = numext::round_down(begin, 2);
Index actualEnd = numext::round_down(begin + count + 1, 2);
Index actualCount = actualEnd - actualBegin;
Index r = IsRowMajor ? row : row / 2;
Index c = IsRowMajor ? col / 2 : col;
ComplexPacket cresult =
BaseEvaluator::template packetSegment<LoadMode, ComplexPacket>(r, c, actualBegin / 2, actualCount / 2);
PacketType result = preinterpret<PacketType>(cresult);
bool p = (IsRowMajor ? col : row) & 1;
if (p) {
Scalar aux[RealPacketSize + 1] = {};
pstoreu(aux, result);
Index lastr = IsRowMajor ? row : row + actualEnd - 1;
Index lastc = IsRowMajor ? col + actualEnd - 1 : col;
aux[actualEnd] = coeff(lastr, lastc);
result = ploadu<PacketType>(aux + 1);
}
return result;
}
template <int LoadMode, typename PacketType>
@@ -166,14 +202,20 @@ struct evaluator<RealView<Xpr>> : private evaluator<Xpr> {
using ComplexPacket = typename find_packet_by_size<ComplexScalar, RealPacketSize / 2>::type;
EIGEN_STATIC_ASSERT((find_packet_by_size<ComplexScalar, RealPacketSize / 2>::value),
MISSING COMPATIBLE COMPLEX PACKET TYPE)
eigen_assert((index % 2 == 0) && "the index must be even");
eigen_assert((begin % 2 == 0) && (count % 2 == 0) && "begin and count must be even");
Index cindex = index / 2;
Index cbegin = begin / 2;
Index ccount = count / 2;
ComplexPacket cpacket = BaseEvaluator::template packetSegment<LoadMode, ComplexPacket>(cindex, cbegin, ccount);
return preinterpret<PacketType, ComplexPacket>(cpacket);
Index actualBegin = numext::round_down(begin, 2);
Index actualEnd = numext::round_down(begin + count + 1, 2);
Index actualCount = actualEnd - actualBegin;
ComplexPacket cresult =
BaseEvaluator::template packetSegment<LoadMode, ComplexPacket>(index / 2, actualBegin / 2, actualCount / 2);
PacketType result = preinterpret<PacketType>(cresult);
bool p = index & 1;
if (p) {
Scalar aux[RealPacketSize + 1] = {};
pstoreu(aux, result);
aux[actualEnd] = coeff(index + actualEnd - 1);
result = ploadu<PacketType>(aux + 1);
}
return result;
}
};
@@ -211,7 +253,7 @@ class RealView : public internal::dense_xpr_base<RealView<Xpr>>::type {
EIGEN_DEVICE_FUNC RealView& operator=(const DenseBase<OtherDerived>& other);
protected:
friend struct internal::evaluator<RealView<Xpr>>;
friend struct internal::evaluator<RealView>;
Xpr& m_xpr;
};

View File

@@ -101,7 +101,7 @@ struct redux_novec_unroller {
typedef typename Evaluator::Scalar Scalar;
EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(const Evaluator& eval, const Func& func) {
EIGEN_DEVICE_FUNC static constexpr EIGEN_STRONG_INLINE Scalar run(const Evaluator& eval, const Func& func) {
return func(redux_novec_unroller<Func, Evaluator, Start, HalfLength>::run(eval, func),
redux_novec_unroller<Func, Evaluator, Start + HalfLength, Length - HalfLength>::run(eval, func));
}
@@ -114,7 +114,7 @@ struct redux_novec_unroller<Func, Evaluator, Start, 1> {
typedef typename Evaluator::Scalar Scalar;
EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(const Evaluator& eval, const Func&) {
EIGEN_DEVICE_FUNC static constexpr EIGEN_STRONG_INLINE Scalar run(const Evaluator& eval, const Func&) {
return eval.coeffByOuterInner(outer, inner);
}
};
@@ -125,7 +125,7 @@ struct redux_novec_unroller<Func, Evaluator, Start, 1> {
template <typename Func, typename Evaluator, Index Start>
struct redux_novec_unroller<Func, Evaluator, Start, 0> {
typedef typename Evaluator::Scalar Scalar;
EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(const Evaluator&, const Func&) { return Scalar(); }
EIGEN_DEVICE_FUNC static constexpr EIGEN_STRONG_INLINE Scalar run(const Evaluator&, const Func&) { return Scalar(); }
};
template <typename Func, typename Evaluator, Index Start, Index Length>
@@ -134,7 +134,7 @@ struct redux_novec_linear_unroller {
typedef typename Evaluator::Scalar Scalar;
EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(const Evaluator& eval, const Func& func) {
EIGEN_DEVICE_FUNC static constexpr EIGEN_STRONG_INLINE Scalar run(const Evaluator& eval, const Func& func) {
return func(redux_novec_linear_unroller<Func, Evaluator, Start, HalfLength>::run(eval, func),
redux_novec_linear_unroller<Func, Evaluator, Start + HalfLength, Length - HalfLength>::run(eval, func));
}
@@ -144,7 +144,7 @@ template <typename Func, typename Evaluator, Index Start>
struct redux_novec_linear_unroller<Func, Evaluator, Start, 1> {
typedef typename Evaluator::Scalar Scalar;
EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(const Evaluator& eval, const Func&) {
EIGEN_DEVICE_FUNC static constexpr EIGEN_STRONG_INLINE Scalar run(const Evaluator& eval, const Func&) {
return eval.coeff(Start);
}
};
@@ -155,7 +155,7 @@ struct redux_novec_linear_unroller<Func, Evaluator, Start, 1> {
template <typename Func, typename Evaluator, Index Start>
struct redux_novec_linear_unroller<Func, Evaluator, Start, 0> {
typedef typename Evaluator::Scalar Scalar;
EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(const Evaluator&, const Func&) { return Scalar(); }
EIGEN_DEVICE_FUNC static constexpr EIGEN_STRONG_INLINE Scalar run(const Evaluator&, const Func&) { return Scalar(); }
};
/*** vectorization ***/
@@ -367,7 +367,7 @@ struct redux_impl<Func, Evaluator, LinearVectorizedTraversal, CompleteUnrolling>
template <typename XprType>
EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(const Evaluator& eval, const Func& func, const XprType& xpr) {
EIGEN_ONLY_USED_FOR_DEBUG(xpr)
EIGEN_ONLY_USED_FOR_DEBUG(xpr);
eigen_assert(xpr.rows() > 0 && xpr.cols() > 0 && "you are using an empty matrix");
if (VectorizedSize > 0) {
Scalar res = func.predux(
@@ -398,8 +398,8 @@ class redux_evaluator : public internal::evaluator<XprType_> {
enum {
MaxRowsAtCompileTime = XprType::MaxRowsAtCompileTime,
MaxColsAtCompileTime = XprType::MaxColsAtCompileTime,
// TODO we should not remove DirectAccessBit and rather find an elegant way to query the alignment offset at runtime
// from the evaluator
// TODO: we should not remove DirectAccessBit and rather find an elegant way to query the alignment offset at
// runtime from the evaluator
Flags = Base::Flags & ~DirectAccessBit,
IsRowMajor = XprType::IsRowMajor,
SizeAtCompileTime = XprType::SizeAtCompileTime,

View File

@@ -43,7 +43,7 @@ struct traits<Ref<PlainObjectType_, Options_, StrideType_> >
OuterStrideMatch = IsVectorAtCompileTime || int(OuterStrideAtCompileTime) == int(Dynamic) ||
int(OuterStrideAtCompileTime) == int(Derived::OuterStrideAtCompileTime),
// NOTE, this indirection of evaluator<Derived>::Alignment is needed
// to workaround a very strange bug in MSVC related to the instantiation
// to work around an MSVC bug related to the instantiation
// of has_*ary_operator in evaluator<CwiseNullaryOp>.
// This line is surprisingly very sensitive. For instance, simply adding parenthesis
// as "DerivedAlignment = (int(evaluator<Derived>::Alignment))," will make MSVC fail...
@@ -265,7 +265,7 @@ class Ref : public RefBase<Ref<PlainObjectType, Options, StrideType> > {
private:
typedef internal::traits<Ref> Traits;
template <typename Derived>
EIGEN_DEVICE_FUNC inline Ref(
EIGEN_DEVICE_FUNC constexpr inline Ref(
const PlainObjectBase<Derived>& expr,
std::enable_if_t<bool(Traits::template match<Derived>::MatchAtCompileTime), Derived>* = 0);
@@ -275,17 +275,17 @@ class Ref : public RefBase<Ref<PlainObjectType, Options, StrideType> > {
#ifndef EIGEN_PARSED_BY_DOXYGEN
template <typename Derived>
EIGEN_DEVICE_FUNC inline Ref(
EIGEN_DEVICE_FUNC constexpr inline Ref(
PlainObjectBase<Derived>& expr,
std::enable_if_t<bool(Traits::template match<Derived>::MatchAtCompileTime), Derived>* = 0) {
EIGEN_STATIC_ASSERT(bool(Traits::template match<Derived>::MatchAtCompileTime), STORAGE_LAYOUT_DOES_NOT_MATCH);
// Construction must pass since we will not create temporary storage in the non-const case.
const bool success = Base::construct(expr.derived());
EIGEN_UNUSED_VARIABLE(success)
EIGEN_UNUSED_VARIABLE(success);
eigen_assert(success);
}
template <typename Derived>
EIGEN_DEVICE_FUNC inline Ref(
EIGEN_DEVICE_FUNC constexpr inline Ref(
const DenseBase<Derived>& expr,
std::enable_if_t<bool(Traits::template match<Derived>::MatchAtCompileTime), Derived>* = 0)
#else
@@ -299,7 +299,7 @@ class Ref : public RefBase<Ref<PlainObjectType, Options, StrideType> > {
EIGEN_STATIC_ASSERT(!Derived::IsPlainObjectBase, THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY);
// Construction must pass since we will not create temporary storage in the non-const case.
const bool success = Base::construct(expr.const_cast_derived());
EIGEN_UNUSED_VARIABLE(success)
EIGEN_UNUSED_VARIABLE(success);
eigen_assert(success);
}
@@ -327,8 +327,9 @@ class Ref<const TPlainObjectType, Options, StrideType>
EIGEN_DENSE_PUBLIC_INTERFACE(Ref)
template <typename Derived>
EIGEN_DEVICE_FUNC inline Ref(const DenseBase<Derived>& expr,
std::enable_if_t<bool(Traits::template match<Derived>::ScalarTypeMatch), Derived>* = 0) {
EIGEN_DEVICE_FUNC constexpr inline Ref(
const DenseBase<Derived>& expr,
std::enable_if_t<bool(Traits::template match<Derived>::ScalarTypeMatch), Derived>* = 0) {
// std::cout << match_helper<Derived>::HasDirectAccess << "," << match_helper<Derived>::OuterStrideMatch << ","
// << match_helper<Derived>::InnerStrideMatch << "\n"; std::cout << int(StrideType::OuterStrideAtCompileTime)
// << " - " << int(Derived::OuterStrideAtCompileTime) << "\n"; std::cout <<
@@ -338,11 +339,11 @@ class Ref<const TPlainObjectType, Options, StrideType>
construct(expr.derived(), typename Traits::template match<Derived>::type());
}
EIGEN_DEVICE_FUNC inline Ref(const Ref& other) : Base(other) {
EIGEN_DEVICE_FUNC constexpr inline Ref(const Ref& other) : Base(other) {
// copy constructor shall not copy the m_object, to avoid unnecessary malloc and copy
}
EIGEN_DEVICE_FUNC inline Ref(Ref&& other) {
EIGEN_DEVICE_FUNC constexpr inline Ref(Ref&& other) {
if (other.data() == other.m_object.data()) {
m_object = std::move(other.m_object);
Base::construct(m_object);
@@ -351,7 +352,7 @@ class Ref<const TPlainObjectType, Options, StrideType>
}
template <typename OtherRef>
EIGEN_DEVICE_FUNC inline Ref(const RefBase<OtherRef>& other) {
EIGEN_DEVICE_FUNC constexpr inline Ref(const RefBase<OtherRef>& other) {
EIGEN_STATIC_ASSERT(Traits::template match<OtherRef>::type::value || may_map_m_object_successfully,
STORAGE_LAYOUT_DOES_NOT_MATCH);
construct(other.derived(), typename Traits::template match<OtherRef>::type());
@@ -370,7 +371,7 @@ class Ref<const TPlainObjectType, Options, StrideType>
EIGEN_DEVICE_FUNC void construct(const Expression& expr, internal::false_type) {
internal::call_assignment_no_alias(m_object, expr, internal::assign_op<Scalar, Scalar>());
const bool success = Base::construct(m_object);
EIGEN_ONLY_USED_FOR_DEBUG(success)
EIGEN_ONLY_USED_FOR_DEBUG(success);
eigen_assert(success);
}

View File

@@ -30,7 +30,7 @@ struct traits<Replicate<MatrixType, RowFactor, ColFactor> > : traits<MatrixType>
ColsAtCompileTime = ColFactor == Dynamic || int(MatrixType::ColsAtCompileTime) == Dynamic
? Dynamic
: ColFactor * MatrixType::ColsAtCompileTime,
// FIXME we don't propagate the max sizes !!!
// FIXME: propagate MaxRowsAtCompileTime and MaxColsAtCompileTime.
MaxRowsAtCompileTime = RowsAtCompileTime,
MaxColsAtCompileTime = ColsAtCompileTime,
IsRowMajor = MaxRowsAtCompileTime == 1 && MaxColsAtCompileTime != 1 ? 1
@@ -38,7 +38,7 @@ struct traits<Replicate<MatrixType, RowFactor, ColFactor> > : traits<MatrixType>
: (MatrixType::Flags & RowMajorBit) ? 1
: 0,
// FIXME enable DirectAccess with negative strides?
// FIXME: consider enabling DirectAccess with negative strides.
Flags = IsRowMajor ? RowMajorBit : 0
};
};
@@ -71,7 +71,7 @@ class Replicate : public internal::dense_xpr_base<Replicate<MatrixType, RowFacto
typedef internal::remove_all_t<MatrixType> NestedExpression;
template <typename OriginalMatrixType>
EIGEN_DEVICE_FUNC inline explicit Replicate(const OriginalMatrixType& matrix)
EIGEN_DEVICE_FUNC constexpr inline explicit Replicate(const OriginalMatrixType& matrix)
: m_matrix(matrix), m_rowFactor(RowFactor), m_colFactor(ColFactor) {
EIGEN_STATIC_ASSERT((internal::is_same<std::remove_const_t<MatrixType>, OriginalMatrixType>::value),
THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE)
@@ -79,7 +79,7 @@ class Replicate : public internal::dense_xpr_base<Replicate<MatrixType, RowFacto
}
template <typename OriginalMatrixType>
EIGEN_DEVICE_FUNC inline Replicate(const OriginalMatrixType& matrix, Index rowFactor, Index colFactor)
EIGEN_DEVICE_FUNC constexpr inline Replicate(const OriginalMatrixType& matrix, Index rowFactor, Index colFactor)
: m_matrix(matrix), m_rowFactor(rowFactor), m_colFactor(colFactor) {
EIGEN_STATIC_ASSERT((internal::is_same<std::remove_const_t<MatrixType>, OriginalMatrixType>::value),
THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE)
@@ -88,7 +88,7 @@ class Replicate : public internal::dense_xpr_base<Replicate<MatrixType, RowFacto
EIGEN_DEVICE_FUNC constexpr Index rows() const { return m_matrix.rows() * m_rowFactor.value(); }
EIGEN_DEVICE_FUNC constexpr Index cols() const { return m_matrix.cols() * m_colFactor.value(); }
EIGEN_DEVICE_FUNC const MatrixTypeNested_& nestedExpression() const { return m_matrix; }
EIGEN_DEVICE_FUNC constexpr const MatrixTypeNested_& nestedExpression() const { return m_matrix; }
protected:
MatrixTypeNested m_matrix;

View File

@@ -107,7 +107,7 @@ class Reshaped : public ReshapedImpl<XprType, Rows, Cols, Order, typename intern
/** Fixed-size constructor
*/
EIGEN_DEVICE_FUNC inline Reshaped(XprType& xpr) : Impl(xpr) {
EIGEN_DEVICE_FUNC constexpr inline Reshaped(XprType& xpr) : Impl(xpr) {
EIGEN_STATIC_ASSERT(RowsAtCompileTime != Dynamic && ColsAtCompileTime != Dynamic,
THIS_METHOD_IS_ONLY_FOR_FIXED_SIZE)
eigen_assert(Rows * Cols == xpr.rows() * xpr.cols());
@@ -115,7 +115,7 @@ class Reshaped : public ReshapedImpl<XprType, Rows, Cols, Order, typename intern
/** Dynamic-size constructor
*/
EIGEN_DEVICE_FUNC inline Reshaped(XprType& xpr, Index reshapeRows, Index reshapeCols)
EIGEN_DEVICE_FUNC constexpr inline Reshaped(XprType& xpr, Index reshapeRows, Index reshapeCols)
: Impl(xpr, reshapeRows, reshapeCols) {
eigen_assert((RowsAtCompileTime == Dynamic || RowsAtCompileTime == reshapeRows) &&
(ColsAtCompileTime == Dynamic || ColsAtCompileTime == reshapeCols));
@@ -136,8 +136,8 @@ class ReshapedImpl<XprType, Rows, Cols, Order, Dense>
public:
typedef Impl Base;
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(ReshapedImpl)
EIGEN_DEVICE_FUNC inline ReshapedImpl(XprType& xpr) : Impl(xpr) {}
EIGEN_DEVICE_FUNC inline ReshapedImpl(XprType& xpr, Index reshapeRows, Index reshapeCols)
EIGEN_DEVICE_FUNC constexpr inline ReshapedImpl(XprType& xpr) : Impl(xpr) {}
EIGEN_DEVICE_FUNC constexpr inline ReshapedImpl(XprType& xpr, Index reshapeRows, Index reshapeCols)
: Impl(xpr, reshapeRows, reshapeCols) {}
};
@@ -161,15 +161,15 @@ class ReshapedImpl_dense<XprType, Rows, Cols, Order, false>
/** Fixed-size constructor
*/
EIGEN_DEVICE_FUNC inline ReshapedImpl_dense(XprType& xpr) : m_xpr(xpr), m_rows(Rows), m_cols(Cols) {}
EIGEN_DEVICE_FUNC constexpr inline ReshapedImpl_dense(XprType& xpr) : m_xpr(xpr), m_rows(Rows), m_cols(Cols) {}
/** Dynamic-size constructor
*/
EIGEN_DEVICE_FUNC inline ReshapedImpl_dense(XprType& xpr, Index nRows, Index nCols)
EIGEN_DEVICE_FUNC constexpr inline ReshapedImpl_dense(XprType& xpr, Index nRows, Index nCols)
: m_xpr(xpr), m_rows(nRows), m_cols(nCols) {}
EIGEN_DEVICE_FUNC Index rows() const { return m_rows; }
EIGEN_DEVICE_FUNC Index cols() const { return m_cols; }
EIGEN_DEVICE_FUNC constexpr Index rows() const { return m_rows; }
EIGEN_DEVICE_FUNC constexpr Index cols() const { return m_cols; }
#ifdef EIGEN_PARSED_BY_DOXYGEN
/** \sa MapBase::data() */
@@ -179,10 +179,10 @@ class ReshapedImpl_dense<XprType, Rows, Cols, Order, false>
#endif
/** \returns the nested expression */
EIGEN_DEVICE_FUNC const internal::remove_all_t<XprType>& nestedExpression() const { return m_xpr; }
EIGEN_DEVICE_FUNC constexpr const internal::remove_all_t<XprType>& nestedExpression() const { return m_xpr; }
/** \returns the nested expression */
EIGEN_DEVICE_FUNC std::remove_reference_t<XprType>& nestedExpression() { return m_xpr; }
EIGEN_DEVICE_FUNC constexpr std::remove_reference_t<XprType>& nestedExpression() { return m_xpr; }
protected:
MatrixTypeNested m_xpr;
@@ -203,16 +203,16 @@ class ReshapedImpl_dense<XprType, Rows, Cols, Order, true> : public MapBase<Resh
/** Fixed-size constructor
*/
EIGEN_DEVICE_FUNC inline ReshapedImpl_dense(XprType& xpr) : Base(xpr.data()), m_xpr(xpr) {}
EIGEN_DEVICE_FUNC constexpr inline ReshapedImpl_dense(XprType& xpr) : Base(xpr.data()), m_xpr(xpr) {}
/** Dynamic-size constructor
*/
EIGEN_DEVICE_FUNC inline ReshapedImpl_dense(XprType& xpr, Index nRows, Index nCols)
EIGEN_DEVICE_FUNC constexpr inline ReshapedImpl_dense(XprType& xpr, Index nRows, Index nCols)
: Base(xpr.data(), nRows, nCols), m_xpr(xpr) {}
EIGEN_DEVICE_FUNC const internal::remove_all_t<XprTypeNested>& nestedExpression() const { return m_xpr; }
EIGEN_DEVICE_FUNC constexpr const internal::remove_all_t<XprTypeNested>& nestedExpression() const { return m_xpr; }
EIGEN_DEVICE_FUNC XprType& nestedExpression() { return m_xpr; }
EIGEN_DEVICE_FUNC constexpr XprType& nestedExpression() { return m_xpr; }
/** \sa MapBase::innerStride() */
EIGEN_DEVICE_FUNC constexpr Index innerStride() const { return m_xpr.innerStride(); }
@@ -265,7 +265,7 @@ struct evaluator<Reshaped<ArgType, Rows, Cols, Order> >
Alignment = evaluator<ArgType>::Alignment
};
typedef reshaped_evaluator<ArgType, Rows, Cols, Order, HasDirectAccess> reshaped_evaluator_type;
EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr) : reshaped_evaluator_type(xpr) {
EIGEN_DEVICE_FUNC constexpr explicit evaluator(const XprType& xpr) : reshaped_evaluator_type(xpr) {
EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
}
};
@@ -283,7 +283,8 @@ struct reshaped_evaluator<ArgType, Rows, Cols, Order, /* HasDirectAccess */ fals
Alignment = 0
};
EIGEN_DEVICE_FUNC explicit reshaped_evaluator(const XprType& xpr) : m_argImpl(xpr.nestedExpression()), m_xpr(xpr) {
EIGEN_DEVICE_FUNC constexpr explicit reshaped_evaluator(const XprType& xpr)
: m_argImpl(xpr.nestedExpression()), m_xpr(xpr) {
EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
}
@@ -292,7 +293,7 @@ struct reshaped_evaluator<ArgType, Rows, Cols, Order, /* HasDirectAccess */ fals
typedef std::pair<Index, Index> RowCol;
EIGEN_DEVICE_FUNC inline RowCol index_remap(Index rowId, Index colId) const {
EIGEN_DEVICE_FUNC constexpr inline RowCol index_remap(Index rowId, Index colId) const {
if (Order == ColMajor) {
const Index nth_elem_idx = colId * m_xpr.rows() + rowId;
return RowCol(nth_elem_idx % m_xpr.nestedExpression().rows(), nth_elem_idx / m_xpr.nestedExpression().rows());
@@ -302,74 +303,38 @@ struct reshaped_evaluator<ArgType, Rows, Cols, Order, /* HasDirectAccess */ fals
}
}
EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index rowId, Index colId) {
EIGEN_DEVICE_FUNC constexpr inline Scalar& coeffRef(Index rowId, Index colId) {
EIGEN_STATIC_ASSERT_LVALUE(XprType)
const RowCol row_col = index_remap(rowId, colId);
return m_argImpl.coeffRef(row_col.first, row_col.second);
}
EIGEN_DEVICE_FUNC inline const Scalar& coeffRef(Index rowId, Index colId) const {
EIGEN_DEVICE_FUNC constexpr inline const Scalar& coeffRef(Index rowId, Index colId) const {
const RowCol row_col = index_remap(rowId, colId);
return m_argImpl.coeffRef(row_col.first, row_col.second);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CoeffReturnType coeff(Index rowId, Index colId) const {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const CoeffReturnType coeff(Index rowId, Index colId) const {
const RowCol row_col = index_remap(rowId, colId);
return m_argImpl.coeff(row_col.first, row_col.second);
}
EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index index) {
EIGEN_DEVICE_FUNC constexpr inline Scalar& coeffRef(Index index) {
EIGEN_STATIC_ASSERT_LVALUE(XprType)
const RowCol row_col = index_remap(Rows == 1 ? 0 : index, Rows == 1 ? index : 0);
return m_argImpl.coeffRef(row_col.first, row_col.second);
}
EIGEN_DEVICE_FUNC inline const Scalar& coeffRef(Index index) const {
EIGEN_DEVICE_FUNC constexpr inline const Scalar& coeffRef(Index index) const {
const RowCol row_col = index_remap(Rows == 1 ? 0 : index, Rows == 1 ? index : 0);
return m_argImpl.coeffRef(row_col.first, row_col.second);
}
EIGEN_DEVICE_FUNC inline const CoeffReturnType coeff(Index index) const {
EIGEN_DEVICE_FUNC constexpr inline const CoeffReturnType coeff(Index index) const {
const RowCol row_col = index_remap(Rows == 1 ? 0 : index, Rows == 1 ? index : 0);
return m_argImpl.coeff(row_col.first, row_col.second);
}
#if 0
EIGEN_DEVICE_FUNC
template<int LoadMode>
inline PacketScalar packet(Index rowId, Index colId) const
{
const RowCol row_col = index_remap(rowId, colId);
return m_argImpl.template packet<Unaligned>(row_col.first, row_col.second);
}
template<int LoadMode>
EIGEN_DEVICE_FUNC
inline void writePacket(Index rowId, Index colId, const PacketScalar& val)
{
const RowCol row_col = index_remap(rowId, colId);
m_argImpl.const_cast_derived().template writePacket<Unaligned>
(row_col.first, row_col.second, val);
}
template<int LoadMode>
EIGEN_DEVICE_FUNC
inline PacketScalar packet(Index index) const
{
const RowCol row_col = index_remap(RowsAtCompileTime == 1 ? 0 : index,
RowsAtCompileTime == 1 ? index : 0);
return m_argImpl.template packet<Unaligned>(row_col.first, row_col.second);
}
template<int LoadMode>
EIGEN_DEVICE_FUNC
inline void writePacket(Index index, const PacketScalar& val)
{
const RowCol row_col = index_remap(RowsAtCompileTime == 1 ? 0 : index,
RowsAtCompileTime == 1 ? index : 0);
return m_argImpl.template packet<Unaligned>(row_col.first, row_col.second, val);
}
#endif
protected:
evaluator<ArgType> m_argImpl;
const XprType& m_xpr;
@@ -382,7 +347,7 @@ struct reshaped_evaluator<ArgType, Rows, Cols, Order, /* HasDirectAccess */ true
typedef Reshaped<ArgType, Rows, Cols, Order> XprType;
typedef typename XprType::Scalar Scalar;
EIGEN_DEVICE_FUNC explicit reshaped_evaluator(const XprType& xpr)
EIGEN_DEVICE_FUNC constexpr explicit reshaped_evaluator(const XprType& xpr)
: mapbase_evaluator<XprType, typename XprType::PlainObject>(xpr) {
// TODO: for the 3.4 release, this should be turned to an internal assertion, but let's keep it as is for the beta
// lifetime

View File

@@ -23,7 +23,7 @@ struct traits<ReturnByValue<Derived> > : public traits<typename traits<Derived>:
enum {
// We're disabling the DirectAccess because e.g. the constructor of
// the Block-with-DirectAccess expression requires to have a coeffRef method.
// Also, we don't want to have to implement the stride stuff.
// Also, this avoids having to implement stride support.
Flags = (traits<typename traits<Derived>::ReturnType>::Flags | EvalBeforeNestingBit) & ~DirectAccessBit
};
};
@@ -32,7 +32,7 @@ struct traits<ReturnByValue<Derived> > : public traits<typename traits<Derived>:
* So the only way that nesting it in an expression can work, is by evaluating it into a plain matrix.
* So internal::nested always gives the plain return matrix type.
*
* FIXME: I don't understand why we need this specialization: isn't this taken care of by the EvalBeforeNestingBit ??
* FIXME: this specialization may be redundant with EvalBeforeNestingBit.
* Answer: EvalBeforeNestingBit should be deprecated since we have the evaluators
*/
template <typename Derived, int n, typename PlainObject>

View File

@@ -83,7 +83,7 @@ class Reverse : public internal::dense_xpr_base<Reverse<MatrixType, Direction> >
typedef internal::reverse_packet_cond<PacketScalar, ReversePacket> reverse_packet;
public:
EIGEN_DEVICE_FUNC explicit inline Reverse(const MatrixType& matrix) : m_matrix(matrix) {}
EIGEN_DEVICE_FUNC constexpr explicit inline Reverse(const MatrixType& matrix) : m_matrix(matrix) {}
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Reverse)
@@ -92,7 +92,7 @@ class Reverse : public internal::dense_xpr_base<Reverse<MatrixType, Direction> >
EIGEN_DEVICE_FUNC inline Index innerStride() const { return -m_matrix.innerStride(); }
EIGEN_DEVICE_FUNC const internal::remove_all_t<typename MatrixType::Nested>& nestedExpression() const {
EIGEN_DEVICE_FUNC constexpr const internal::remove_all_t<typename MatrixType::Nested>& nestedExpression() const {
return m_matrix;
}

View File

@@ -45,7 +45,7 @@ using Select = CwiseTernaryOp<internal::scalar_boolean_select_op<typename DenseB
*/
template <typename Derived>
template <typename ThenDerived, typename ElseDerived>
inline EIGEN_DEVICE_FUNC CwiseTernaryOp<
inline EIGEN_DEVICE_FUNC constexpr CwiseTernaryOp<
internal::scalar_boolean_select_op<typename DenseBase<ThenDerived>::Scalar, typename DenseBase<ElseDerived>::Scalar,
typename DenseBase<Derived>::Scalar>,
ThenDerived, ElseDerived, Derived>
@@ -59,7 +59,7 @@ DenseBase<Derived>::select(const DenseBase<ThenDerived>& thenMatrix, const Dense
*/
template <typename Derived>
template <typename ThenDerived>
inline EIGEN_DEVICE_FUNC CwiseTernaryOp<
inline EIGEN_DEVICE_FUNC constexpr CwiseTernaryOp<
internal::scalar_boolean_select_op<typename DenseBase<ThenDerived>::Scalar, typename DenseBase<ThenDerived>::Scalar,
typename DenseBase<Derived>::Scalar>,
ThenDerived, typename DenseBase<ThenDerived>::ConstantReturnType, Derived>
@@ -76,7 +76,7 @@ DenseBase<Derived>::select(const DenseBase<ThenDerived>& thenMatrix,
*/
template <typename Derived>
template <typename ElseDerived>
inline EIGEN_DEVICE_FUNC CwiseTernaryOp<
inline EIGEN_DEVICE_FUNC constexpr CwiseTernaryOp<
internal::scalar_boolean_select_op<typename DenseBase<ElseDerived>::Scalar, typename DenseBase<ElseDerived>::Scalar,
typename DenseBase<Derived>::Scalar>,
typename DenseBase<ElseDerived>::ConstantReturnType, ElseDerived, Derived>

View File

@@ -219,8 +219,8 @@ class SelfAdjointView : public TriangularBase<SelfAdjointView<MatrixType_, UpLo>
/////////// Cholesky module ///////////
const LLT<PlainObject, UpLo> llt() const;
const LDLT<PlainObject, UpLo> ldlt() const;
LLT<PlainObject, UpLo> llt() const;
LDLT<PlainObject, UpLo> ldlt() const;
/////////// Eigenvalue module ///////////
@@ -236,14 +236,6 @@ class SelfAdjointView : public TriangularBase<SelfAdjointView<MatrixType_, UpLo>
MatrixTypeNested m_matrix;
};
// template<typename OtherDerived, typename MatrixType, unsigned int UpLo>
// internal::selfadjoint_matrix_product_returntype<OtherDerived,SelfAdjointView<MatrixType,UpLo> >
// operator*(const MatrixBase<OtherDerived>& lhs, const SelfAdjointView<MatrixType,UpLo>& rhs)
// {
// return internal::matrix_selfadjoint_product_returntype<OtherDerived,SelfAdjointView<MatrixType,UpLo>
// >(lhs.derived(),rhs);
// }
// selfadjoint to dense matrix
namespace internal {
@@ -288,6 +280,14 @@ class triangular_dense_assignment_kernel<UpLo, SelfAdjoint, SetOpposite, DstEval
m_functor.assignCoeff(m_dst.coeffRef(col, row), numext::conj(tmp));
}
// Override to ensure the SelfAdjoint assignCoeff (which mirrors conjugates) is called,
// not the base class version (which is a plain copy).
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignCoeffByOuterInner(Index outer, Index inner) {
Index row = Base::rowIndexByOuterInner(outer, inner);
Index col = Base::colIndexByOuterInner(outer, inner);
assignCoeff(row, col);
}
EIGEN_DEVICE_FUNC void assignDiagonalCoeff(Index id) { Base::assignCoeff(id, id); }
EIGEN_DEVICE_FUNC void assignOppositeCoeff(Index, Index) { eigen_internal_assert(false && "should never be called"); }
@@ -302,7 +302,7 @@ class triangular_dense_assignment_kernel<UpLo, SelfAdjoint, SetOpposite, DstEval
/** This is the const version of MatrixBase::selfadjointView() */
template <typename Derived>
template <unsigned int UpLo>
EIGEN_DEVICE_FUNC typename MatrixBase<Derived>::template ConstSelfAdjointViewReturnType<UpLo>::Type
EIGEN_DEVICE_FUNC constexpr typename MatrixBase<Derived>::template ConstSelfAdjointViewReturnType<UpLo>::Type
MatrixBase<Derived>::selfadjointView() const {
return typename ConstSelfAdjointViewReturnType<UpLo>::Type(derived());
}
@@ -319,7 +319,7 @@ MatrixBase<Derived>::selfadjointView() const {
*/
template <typename Derived>
template <unsigned int UpLo>
EIGEN_DEVICE_FUNC typename MatrixBase<Derived>::template SelfAdjointViewReturnType<UpLo>::Type
EIGEN_DEVICE_FUNC constexpr typename MatrixBase<Derived>::template SelfAdjointViewReturnType<UpLo>::Type
MatrixBase<Derived>::selfadjointView() {
return typename SelfAdjointViewReturnType<UpLo>::Type(derived());
}

View File

@@ -16,7 +16,7 @@
namespace Eigen {
template <typename Derived>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator*=(const Scalar& other) {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator*=(const Scalar& other) {
using ConstantExpr = typename internal::plain_constant_type<Derived, Scalar>::type;
using Op = internal::mul_assign_op<Scalar>;
internal::call_assignment(derived(), ConstantExpr(rows(), cols(), other), Op());
@@ -25,13 +25,13 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator*=(co
template <typename Derived>
template <bool Enable, typename>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator*=(const RealScalar& other) {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator*=(const RealScalar& other) {
realView() *= other;
return derived();
}
template <typename Derived>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator/=(const Scalar& other) {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator/=(const Scalar& other) {
using ConstantExpr = typename internal::plain_constant_type<Derived, Scalar>::type;
using Op = internal::div_assign_op<Scalar>;
internal::call_assignment(derived(), ConstantExpr(rows(), cols(), other), Op());
@@ -40,7 +40,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator/=(co
template <typename Derived>
template <bool Enable, typename>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator/=(const RealScalar& other) {
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator/=(const RealScalar& other) {
realView() /= other;
return derived();
}

View File

@@ -62,7 +62,7 @@ class SkewSymmetricBase : public EigenBase<Derived> {
/**
* Constructs a dense matrix from \c *this. Note, this directly returns a dense matrix type,
* not an expression.
* \returns A dense matrix, with its entries set from the the derived object. */
* \returns A dense matrix, with its entries set from the derived object. */
EIGEN_DEVICE_FUNC DenseMatrixType toDenseMatrix() const { return derived(); }
/** Determinant vanishes */
@@ -308,7 +308,7 @@ class SkewSymmetricWrapper : public SkewSymmetricBase<SkewSymmetricWrapper<SkewS
* \sa class SkewSymmetricWrapper, class SkewSymmetricMatrix3, vector(), isSkewSymmetric()
**/
template <typename Derived>
EIGEN_DEVICE_FUNC inline const SkewSymmetricWrapper<const Derived> MatrixBase<Derived>::asSkewSymmetric() const {
EIGEN_DEVICE_FUNC constexpr const SkewSymmetricWrapper<const Derived> MatrixBase<Derived>::asSkewSymmetric() const {
return SkewSymmetricWrapper<const Derived>(derived());
}

View File

@@ -69,8 +69,8 @@ class Solve : public SolveImpl<Decomposition, RhsType, typename internal::traits
EIGEN_DEVICE_FUNC constexpr Index rows() const noexcept { return m_dec.cols(); }
EIGEN_DEVICE_FUNC constexpr Index cols() const noexcept { return m_rhs.cols(); }
EIGEN_DEVICE_FUNC const Decomposition &dec() const { return m_dec; }
EIGEN_DEVICE_FUNC const RhsType &rhs() const { return m_rhs; }
EIGEN_DEVICE_FUNC constexpr const Decomposition &dec() const { return m_dec; }
EIGEN_DEVICE_FUNC constexpr const RhsType &rhs() const { return m_rhs; }
protected:
const Decomposition &m_dec;

Some files were not shown because too many files have changed in this diff Show More