2522 Commits

Author SHA1 Message Date
Charles Schlosser
25270e35db Fix compiler warnings in 3.4 2023-12-21 00:57:21 +00:00
Antonio Sánchez
b8f894947a Add internal ctz/clz implementation.
(cherry picked from commit 75e273afcc86c4580aae12fb4e6e68c252cc2af0)
2023-12-14 13:37:03 -08:00
Antonio Sánchez
0db5928f00 Eliminate use of _res.
(cherry picked from commit 5bdf58b8df31b0377bc5f57ba63d8479793b7bae)
2023-10-16 13:38:17 -07:00
Antonio Sanchez
89a71f3126 Fix gpu special function tests.
Some checks used incorrect values, partly from copy-paste errors,
partly from the change in behaviour introduced in !398.

Modified results to match scipy, simplified tests by updating
`VERIFY_IS_CWISE_APPROX` to work for scalars.

(cherry picked from commit 701f5d1c91c770e558c7760da14ff3365757e275)
2023-07-10 15:57:08 -07:00
Antonio Sanchez
a605d6b996 Rename EIGEN_CUDA_FLAGS to EIGEN_CUDA_CXX_FLAGS
Also add a missing space for clang.

(cherry picked from commit 846d34384af80b80793d32257a7f917eeece41d4)
2023-07-10 15:30:41 -07:00
Antonio Sanchez
dfcd6de20a Clean up CUDA CMake files.
- Unify test/CMakeLists.txt and unsupported/test/CMakeLists.txt
- Added `EIGEN_CUDA_FLAGS` that are appended to the set of flags passed
to the cuda compiler (nvcc or clang).

The latter is to support passing custom flags (e.g. `-arch=` to nvcc,
or to disable cuda-specific warnings).

(cherry picked from commit 7b00e8b186a7679b0f46be742809a55d07d4efe8)
2023-07-10 15:30:41 -07:00
Antonio Sanchez
a4ecfd8ead Fix boolean bitwise and warning.
(cherry picked from commit 70410310a40bf6f790e8f3c785e78aa2b8f4ca12)
2023-07-10 14:52:08 -07:00
Antonio Sánchez
f5593b4baa Fix reshape strides when input has non-zero inner stride.
(cherry picked from commit 2260e11eb019161cc861ef2b832ce3b8a92efecd)
2023-07-10 14:34:09 -07:00
Antonio Sánchez
26adb0e5af Fix sparseLU solver when destination has a non-unit stride.
(cherry picked from commit ab2b26fbc27cd03c1d75ea8c2cce22fdd2bcc45b)
2023-07-10 14:34:09 -07:00
Antonio Sánchez
5547205092 Correct pnegate for floating-point zero.
(cherry picked from commit 8588d8c74b42eedde578af01605ecc90189bc329)
2023-07-10 14:34:04 -07:00
Antonio Sánchez
11dacc4802 Fix some cmake issues.
(cherry picked from commit f5364331eb4d33a6833e8ff7f2ac3bf1200bce21)
2023-07-07 15:21:18 -07:00
Antonio Sánchez
ab6f39e1e3 Fix mixingtypes tests.
(cherry picked from commit d816044b6edb666ffe5ee7107762a29153f067c0)
2023-07-07 15:21:18 -07:00
Arthur
68f35d76b8 Fix GeneralizedEigenSolver::info() and Asserts
(cherry picked from commit a7c1cac18bfef26ec61a73c1619ccf0f9b734745)
2023-07-07 15:21:18 -07:00
Rasmus Munk Larsen
a9490cd3c5 Fix code and unit test for a few corner cases in vectorized pow()
(cherry picked from commit 7a87ed1b6a49bd0067856dcba9ad9a3a46186220)
2023-07-07 15:21:17 -07:00
Antonio Sánchez
61efca2e90 Use numext::sqrt in ConjugateGradient.
(cherry picked from commit 7896c7dc6bd1bd34dd9636bdd3426e3c28e6a246)
2023-07-07 15:21:17 -07:00
Antonio Sánchez
86d958e8f2 Consider inf/nan in scalar test_isApprox.
(cherry picked from commit 0c859cf35d67fe2abf8bc79810e88732429fc88c)
2023-07-07 15:21:17 -07:00
Antonio Sánchez
8a21df2d9c Disable f16c scalar conversions for MSVC.
(cherry picked from commit 73b2c13bf2d4c8192ce1cdf7ceeb8d098cfe6b71)
2023-07-07 15:21:12 -07:00
Antonio Sánchez
6469fbf93a Work around g++-10 docker issue for geo_orthomethods_4.
(cherry picked from commit 9deaa19121e9c64a5cbd81b14feffdb7632646eb)
2023-07-07 15:06:18 -07:00
Antonio Sánchez
3a4a4e9fde Disable schur non-convergence test.
(cherry picked from commit 01b5bc48ccf9ff24ace0f2074403ef9514c2f442)
2023-07-07 15:06:18 -07:00
Antonio Sánchez
b1f06aac61 Update vectorization_logic tests for all platforms.
(cherry picked from commit 27d8f29be38a7ef9a1d3bfd82f0a8dbf16ac0a7c)
2023-07-07 15:06:08 -07:00
Antonio Sánchez
d259104c8d Fix frexp packetmath tests for MSVC.
(cherry picked from commit 2ed4bee78fc44b37d5e5b9f532f5659f9c978499)
2023-07-07 11:47:09 -07:00
Antonio Sánchez
cd543434bf Fix gcc-5 packetmath_12 bug.
(cherry picked from commit 897071977177ef0fd392861655ba1ad47546a265)
2023-07-07 11:46:15 -07:00
Antonio Sanchez
a1e1612c28 Fix cwise NaN propagation for scalar input.
Was missing a template parameter.  Updated tests.

Fixes #2474.
2022-04-15 22:11:22 -07:00
Minh Quan HO
c379a21191 nestbyvalue test: fix uninitialized matrix
- Doing computation with uninitialized (zero-ed ? but thanks Linux) matrix, or
worse NaN on other non-linux systems.
- This commit fixes it by initializing to Random().


(cherry picked from commit 4284c68fbb81cb069a630ae1bf4a953ee922f6e5)
2021-11-05 18:19:27 +00:00
Maxiwell S. Garcia
962a596d21 test: fix boostmutiprec test to compile with older Boost versions
Eigen boostmultiprec test redefines a symbol that is already defined
inside Boot Math [1]. Boost has fixed it recently [2], but this
patch avoids errors if Boost version was less than 1.77.

https://github.com/boostorg/math/blob/boost-1.76.0/include/boost/math/policies/policy.hpp#L18
6830712302 (diff-c7a8e5911c2e6be4138e1a966d762200f147792ac16ad96fdcc724313d11f839)


(cherry picked from commit 99600bd1a6b133f8684800c855e59d4fd22ac23e)
2021-11-03 23:31:48 +00:00
Xinle Liu
9c193db5c7 Fix BDCSVD's total deflation in branch 3.4, similar to that of master in MR 707.
(cherry picked from commit 4d045eba53f9a32d052eb942448ba62def066529)
2021-11-03 17:58:57 +00:00
Rasmus Munk Larsen
5d918b82a8 Add nan-propagation options to matrix and array plugins. 2021-10-21 13:48:50 -07:00
Antonio Sanchez
943ef50a2d Disable testing of complex compound assignment operators for MSVC.
MSVC does not support specializing compound assignments for
`std::complex`, since it already specializes them (contrary to the
standard).

Trying to use one of these on device will currently lead to a
duplicate definition error.  This is still probably preferable
to no error though.  If we remove the definitions for MSVC, then
it will compile, but the kernel will fail silently.

The only proper solution would be to define our own custom `Complex`
type.

(cherry picked from commit f0f1d7938b7083800ff75fe88e15092f08a4e67e)
2021-10-11 10:00:29 -07:00
Ryan Pavlik
3335e0767c Fix typos in copyright dates 2021-09-15 13:26:50 -05:00
Antonio Sanchez
7aee90b8d3 Fix fix<N> when variable templates are not supported.
There were some typos that checked `EIGEN_HAS_CXX14` that should have
checked `EIGEN_HAS_CXX14_VARIABLE_TEMPLATES`, causing a mismatch
in some of the `Eigen::fix<N>` assumptions.

Also fixed the `symbolic_index` test when
`EIGEN_HAS_CXX14_VARIABLE_TEMPLATES` is 0.

Fixes #2308


(cherry picked from commit 5db9e5c77958997856ddbccfa4a52ff22e83bef9)
2021-08-30 16:23:35 +00:00
Antonio Sanchez
fd100138dd Remove unaligned assert tests.
Manually constructing an unaligned object declared as aligned
invokes UB, so we cannot technically check for alignment from
within the constructor.  Newer versions of clang optimize away
this check.

Removing the affected tests.


(cherry picked from commit 0c4ae56e3797cc6719a8d08a0dafad0a5139a5f9)
2021-08-18 18:39:04 +00:00
Antonio Sanchez
aef926abf6 Renamed shift_left/shift_right to shiftLeft/shiftRight.
For naming consistency.  Also moved to ArrayCwiseUnaryOps, and added
test.


(cherry picked from commit fc9d352432b81210f73d71caecbd7dc5505d6ab8)
2021-08-18 14:44:31 +00:00
Nikolay Tverdokhleb
cb44a003de Do not set AnnoyingScalar::dont_throw if not defined EIGEN_TEST_ANNOYING_SCALAR_DONT_THROW.
- Because that member is not declared if the macro is defined.


(cherry picked from commit f1b899eef7461e1475469b733346c6ebbfae8818)
2021-08-11 16:39:44 +00:00
Gauri Deshpande
93bff85a42 remove denormal flushing in fp32tobf16 for avx & avx512
(cherry picked from commit e6a5a594a7f3cbe2f9843d4ef57a10d478cbb818)
2021-08-09 22:15:42 +00:00
Antonio Sanchez
237c59a2aa Modify scalar pzero, ptrue, pselect, and p<binary> operations to avoid memset.
The `memset` function and bitwise manipulation only apply to POD types
that do not require initialization, otherwise resulting in UB. We currently
violate this in `ptrue` and `pzero`, we assume bitmasks for `pselect`, and
bitwise operations are applied byte-by-byte in the generic implementations.

This is causing issues for scalar types that do require initialization
or that contain non-POD info such as pointers (#2201). We either break
them, or force specializations of these functions for custom scalars,
even if they are not vectorized.

Here we modify these functions for scalars only - instead using only
scalar operations:
- `pzero`: `Scalar(0)` for all scalars.
- `ptrue`: `Scalar(1)` for non-trivial scalars, bitset to one bits for trivial scalars.
- `pselect`: ternary select comparing mask to `Scalar(0)` for all scalars
- `pand`, `por`, `pxor`, `pnot`: use operators `&`, `|`, `^`, `~` for all integer or non-trivial scalars, otherwise apply bytewise.

For non-scalar types, the original implementations are used to maintain
compatibility and minimize the number of changes.

Fixes #2201.


(cherry picked from commit 3d98a6ef5ce0ba85acaee4ffffc53f0f21bd8fd2)
2021-08-03 16:32:59 +00:00
Antonio Sanchez
3dc42eeaec Enable equality comparisons on GPU.
Since `std::equal_to::operator()` is not a device function, it
fails on GPU.  On my device, I seem to get a silent crash in the
kernel (no reported error, but the kernel does not complete).

Replacing this with a portable version enables comparisons on device.

Addresses #2292 - would need to be cherry-picked.  The 3.3 branch
also requires adding `EIGEN_DEVICE_FUNC` in `BooleanRedux.h` to get
fully working.


(cherry picked from commit 7880f10526a11dc5544426c54c5763de576bf285)
2021-08-03 16:15:44 +00:00
arthurfeeney
9c90d5d832 Fixes #1387 for compilation error in JacobiSVD with HouseholderQRPreconditioner that occurs when input is a compile-time row vector.
(cherry picked from commit a77638387dd1aa2d07d2dae240cc30b303b4ef38)
2021-07-22 18:01:55 +00:00
Antonio Sanchez
b6db013435 Fix inverse nullptr/asan errors for LU.
For empty or single-column matrices, the current `PartialPivLU`
currently dereferences a `nullptr` or accesses memory out-of-bounds.
Here we adjust the checks to avoid this.


(cherry picked from commit 154f00e9eacaec5667215784c7601b55024e2f61)
2021-07-01 22:57:25 +00:00
Alexander Karatarakis
517294d6e1 Make DenseStorage<> trivially_copyable
(cherry picked from commit 60400334a92268272c6bf525da89eec5e99c3e5a)
2021-07-01 20:48:47 +00:00
Rasmus Munk Larsen
47722a66f2 Fix more enum arithmetic.
(cherry picked from commit 13fb5ab92c3226f7b9be20882b0418d53516d35a)
2021-06-15 16:40:35 +00:00
Rasmus Munk Larsen
4b502a7215 Fix c++20 warnings about using enums in arithmetic expressions.
(cherry picked from commit f64b2954c711b7846ae6ae228c5f14bd8dd56ec4)
2021-06-11 02:35:19 +00:00
Antonio Sanchez
98cf1e076f Add missing NEON ptranspose implementations.
Unified implementation using only `vzip`.


(cherry picked from commit dba753a986b527a17c8cc62474d0487aec7c2b36)
2021-05-25 19:09:50 +00:00
Jakub Lichman
3835046309 predux_half_dowto4 test extended to all applicable packets
(cherry picked from commit 12471fcb5d59f969c60a9b78727624dc91e5c04e)
2021-05-21 16:58:16 +00:00
Niall Murphy
a883a8797c Use derived object type in conservative_resize_like_impl
When calling conservativeResize() on a matrix with DontAlign flag, the
temporary variable used to perform the resize should have the same
Options as the original matrix to ensure that the correct override of
swap is called (i.e. PlainObjectBase::swap(DenseBase<OtherDerived> &
other). Calling the base class swap (i.e in DenseBase) results in
assertions errors or memory corruption.


(cherry picked from commit 391094c50743f28f9174f455661f650bf07e0177)
2021-05-20 23:43:57 +00:00
Jakub Lichman
0bd9e9bc45 ptranpose test for non-square kernels added
(cherry picked from commit 8877f8d9b2631301ba070d645cdc3fc9b9f764f5)
2021-05-20 19:27:20 +00:00
Guoqiang QI
77c66e368c Ensure all generated matrices for inverse_4x4 testes are invertible, this fix #2248 .
(cherry picked from commit 3e006bfd31e4389e8c5718c30409cddb65a73b04)
2021-05-13 15:03:47 +00:00
Antonio Sanchez
42acbd5700 Fix numext::arg return type.
The cxx11 path for `numext::arg` incorrectly returned the complex type
instead of the real type, leading to compile errors. Fixed this and
added tests.

Related to !477, which uncovered the issue.


(cherry picked from commit 90e9a33e1ce3e4e7663dd67e6c1f225afaf5c206)
2021-05-07 17:52:07 +00:00
Theo Fletcher
83df5df61b Added complex matrix unit tests for SelfAdjointEigenSolve
(cherry picked from commit 2ced0cc233fff6ef16c4d098b03aeeb69ff7c509)
2021-04-26 19:18:53 +00:00
Jakub Lichman
ac3c5aad31 Tests added and AVX512 bug fixed for pcmp_lt_or_nan
(cherry picked from commit d87648a6bea315645b893c3815ca8c6bb00ec5d2)
2021-04-26 18:07:55 +00:00
Jakub Lichman
63abb10000 Tests for pcmp_lt and pcmp_le added
(cherry picked from commit 1115f5462ecaa84d3c60479f7e23a530a1a415d2)
2021-04-23 19:52:23 +00:00