Charles Schlosser
d626762e3f
improve random
2024-01-31 08:16:29 +00:00
Tobias Wood
f38e16c193
Apply clang-format
2023-11-29 11:12:48 +00:00
Antonio Sánchez
6e4d5d4832
Add IWYU private pragmas to internal headers.
2023-08-21 16:25:22 +00:00
Yingnan Wu
ba1cb6e45e
Fixes #2703 by adding max_digits10 function
2023-07-26 16:02:52 +00:00
Antonio Sánchez
bc5cdc7a67
Guard use of long double on GPU device.
2023-02-24 21:49:59 +00:00
Chip Kerchner
54459214a1
Fix epsilon and dummy_precision values in long double for double doubles. Prevented some algorithms from converging on PPC.
2023-02-16 23:35:42 +00:00
Charles Schlosser
82b152dbe7
Add signbit function
2022-11-04 00:31:20 +00:00
Rasmus Munk Larsen
afc014f1b5
Allow mixed types for pow(), as long as the exponent is exactly representable in the base type.
2022-09-12 21:55:30 +00:00
Erik Schultheis
421cbf0866
Replace Eigen type metaprogramming with corresponding std types and make use of alias templates
2022-03-16 16:43:40 +00:00
Erik Schultheis
cc11e240ac
Some further cleanup
2021-12-06 18:01:15 +00:00
Antonio Sanchez
b86e013321
Revert bit_cast to use memcpy for CUDA.
...
To elide the memcpy, we need to first load the `src` value into
registers by making a local copy. This avoids the need to resort
to potential UB by using `reinterpret_cast`.
This change doesn't seem to affect CPU (at least not with gcc/clang).
With optimizations on, the copy is also elided.
2021-10-21 08:14:11 -07:00
Antonio Sanchez
45e67a6fda
Use reinterpret_cast on GPU for bit_cast.
...
This seems to be the recommended approach for doing type punning in
CUDA. See for example
- https://stackoverflow.com/questions/47037104/cuda-type-punning-memcpy-vs-ub-union
- https://developer.nvidia.com/blog/faster-parallel-reductions-kepler/
(the latter puns a double to an `int2`).
The issue is that for CUDA, the `memcpy` is not elided, and ends up
being an expensive operation. We already have similar `reintepret_cast`s across
the Eigen codebase for GPU (as does TensorFlow).
2021-10-20 21:34:40 +00:00
Rasmus Munk Larsen
d7d0bf832d
Issue an error in case of direct inclusion of internal headers.
2021-09-10 19:12:26 +00:00
Alexander Karatarakis
4ba872bd75
Avoid leading underscore followed by cap in template identifiers
2021-08-04 22:41:52 +00:00
Rasmus Munk Larsen
f64b2954c7
Fix c++20 warnings about using enums in arithmetic expressions.
2021-06-10 17:17:39 -07:00
Antonio Sanchez
8dfe1029a5
Augment NumTraits with min/max_exponent() again.
...
Replace usage of `std::numeric_limits<...>::min/max_exponent` in
codebase where possible. Also replaced some other `numeric_limits`
usages in affected tests with the `NumTraits` equivalent.
The previous MR !443 failed for c++03 due to lack of `constexpr`.
Because of this, we need to keep around the `std::numeric_limits`
version in enum expressions until the switch to c++11.
Fixes #2148
2021-03-16 20:12:46 -07:00
David Tellenbach
df4bc2731c
Revert "Augment NumTraits with min/max_exponent()."
...
This reverts commit 75ce9cd2a7aefaaea8543e2db14ce4dc149eeb03.
2021-03-17 03:06:08 +01:00
Antonio Sanchez
75ce9cd2a7
Augment NumTraits with min/max_exponent().
...
Replace usage of `std::numeric_limits<...>::min/max_exponent` in
codebase. Also replaced some other `numeric_limits` usages in
affected tests with the `NumTraits` equivalent.
Fixes #2148
2021-03-17 01:00:41 +00:00
David Tellenbach
09f015852b
Replace numext::as_uint with numext::bit_cast<numext::uint32_t>
2020-10-29 07:28:28 +01:00
David Tellenbach
e265f7ed8e
Add support for Armv8.2-a __fp16
...
Armv8.2-a provides a native half-precision floating point (__fp16 aka.
float16_t). This patch introduces
* __fp16 as underlying type of Eigen::half if this type is available
* the packet types Packet4hf and Packet8hf representing float16x4_t and
float16x8_t respectively
* packet-math for the above packets with corresponding scalar type Eigen::half
The packet-math functionality has been implemented by Ashutosh Sharma
<ashutosh.sharma@amperecomputing.com>.
This closes #1940 .
2020-10-28 20:15:09 +00:00
Rasmus Munk Larsen
e55182ac09
Get rid of initialization logic for blueNorm by making the computed constants static const or constexpr.
...
Move macro definition EIGEN_CONSTEXPR to Core and make all methods in NumTraits constexpr when EIGEN_HASH_CONSTEXPR is 1.
2020-09-18 17:38:58 +00:00
Antonio Sanchez
9dda5eb7d2
Missing struct definition in NumTraits
2020-04-07 09:01:11 -07:00
Akshay Naresh Modi
bcc0e9e15c
Add numeric_limits min and max for bool
...
This will allow (among other things) computation of argmax and argmin of bool tensors
2020-04-06 23:38:57 +00:00
Rasmus Munk Larsen
23b958818e
Fix compiler for unsigned integers.
2019-07-09 11:18:25 -07:00
Andrea Bocci
f7124b3e46
Extend CUDA support to matrix inversion and selfadjointeigensolver
2018-06-11 18:33:24 +02:00
Gael Guennebaud
1495b98a8e
Merged in spraetor/eigen (pull request PR-305)
...
Issue with mpreal and std::numeric_limits::digits
2017-11-10 10:28:54 +00:00
Simon Praetorius
511810797e
Issue with mpreal and std::numeric_limits, i.e. digits is not a constant. Added a digits() traits in NumTraits with fallback to static constant. Specialization for mpreal added in MPRealSupport.
2017-03-24 17:45:56 +01:00
Gael Guennebaud
e43d8fe9d7
Fix compilation of streaming nested Array, i.e., cout << Array<Array<>>
2017-06-12 22:26:26 +02:00
Rafael Guglielmetti
8f11df2667
NumTraits.h:
...
For the values 'ReadCost, AddCost and MulCost', information about value Eigen::HugeCost
2016-12-16 09:07:12 +00:00
Gael Guennebaud
471eac5399
bug #1195 : move NumTraits::Div<>::Cost to internal::scalar_div_cost (with some specializations in arch/SSE and arch/AVX)
2016-09-08 08:36:27 +02:00
Gael Guennebaud
85fb517eaf
Generalize ScalarBinaryOpTraits to any complex-real combination as defined by NumTraits (instead of supporting std::complex only).
2016-09-06 17:23:15 +02:00
Gael Guennebaud
9908020d36
Add minimal support for Array<string>, and fix Tensor<string>
2016-07-25 14:25:56 +02:00
Gael Guennebaud
b118bc76eb
Add digits10 overload for complex.
2016-07-25 12:33:21 +02:00
Gael Guennebaud
e1c7c5968a
Update doc.
2016-07-25 11:18:04 +02:00
Gael Guennebaud
8fffc81606
Add NumTraits::digits10() function based on numeric_limits::digits10 and make use of it for printing matrices.
2016-07-25 11:13:01 +02:00
Gael Guennebaud
76faf4a965
Introduce a NumTraits<T>::Literal type to be used for literals, and
...
improve mixing type support in operations between arrays and scalars:
- 2 * ArrayXcf is now optimized in the sense that the integer 2 is properly promoted to a float instead of a complex<float> (fix a regression)
- 2.1 * ArrayXi is now forbiden (previously, 2.1 was converted to 2)
- This mechanism should be applicable to any custom scalar type, assuming NumTraits<T>::Literal is properly defined (it defaults to T)
2016-06-23 14:27:20 +02:00
Benoit Steiner
4c859181da
Made it possible to use the NumTraits for complex and Array in a cuda kernel.
2016-03-31 12:48:38 -07:00
Benoit Steiner
d94f6ba965
Started to model the cost of divisions more accurately.
2016-03-25 11:02:56 -07:00
Eugene Brevdo
73220d2bb0
Resolve bad merge.
2016-03-08 17:28:21 -08:00
Eugene Brevdo
6afea46838
Add infinity() support to numext::numeric_limits, use it in lgamma.
...
This makes the infinity access a __device__ function, removing
nvcc warnings.
2016-03-02 21:35:48 -08:00
Gael Guennebaud
06971223ef
Unify std::numeric_limits and device::numeric_limits within numext namespace
2016-01-22 15:02:21 +01:00
Gael Guennebaud
8b0d1eb0f7
Fix numerous doxygen shortcomings, and workaround some clang -Wdocumentation warnings
2016-01-01 21:45:06 +01:00
Gael Guennebaud
77ff3386b7
Refactoring of the cost model:
...
- Dynamic is now an invalid value
- introduce a HugeCost constant to be used for runtime-cost values or arbitrarily huge cost
- add sanity checks for cost values: must be >=0 and not too large
This change provides several benefits:
- it fixes shortcoming is some cost computation where the Dynamic case was not properly handled.
- it simplifies cost computation logic, and should avoid future similar shortcomings.
- it allows to distinguish between different level of dynamic/huge/infinite cost
- it should enable further simplifications in the computation of costs (save compilation time)
2015-10-28 11:42:14 +01:00
Christoph Hertzberg
78358a7241
Fixed broken commit a09cfe650fe56b181747af04d61548800da1f72b
...
. Missing } and unprotected min/max calls and definitions.
2015-08-22 15:03:16 +02:00
Benoit Steiner
a09cfe650f
std::numeric_limits doesn't work reliably on CUDA devices. Use our own definition of numeric_limit<T>::max() and numeric_limit<T>::min() instead of the stl ones.
2015-08-21 16:01:40 -07:00
Christoph Hertzberg
324e7e8fc9
Removed the deprecated EIGEN2_SUPPORT, as previously announced. A compilation error is raised, if this compile-switch is defined. The documentation references to the corresponding pages from Eigen3.2 now. Also, the Eigen2 testsuite has been removed.
2014-07-01 16:58:11 +02:00
Gael Guennebaud
ddf7753631
Add nvcc support for small eigenvalues decompositions and workaround lack of support for std::swap and std::numeric_limits
2013-08-01 16:26:57 +02:00
Gael Guennebaud
64054ee396
Add nvcc support for normalize, initializers, and fuzzy comparisons
2013-06-05 15:38:33 +02:00
Gael Guennebaud
bff264283d
Add missing epsilon/dummy_precision function in NumTraits<Array>
2013-04-09 09:31:26 +02:00
Benoit Jacob
69124cfca2
Automatic relicensing to MPL2 using Keirs script. Manual fixup follows.
2012-07-13 14:42:47 -04:00