Fix TensorReduction warnings and error bound for sum accuracy test.

The sum accuracy test currently uses the default test precision for
the given scalar type.  However, scalars are generated via a normal
distribution, and given a large enough count and strong enough random
generator, the expected sum is zero.  This causes the test to
periodically fail.

Here we estimate an upper-bound for the error as `sqrt(N) * prec` for
summing N values, with each having an approximate epsilon of `prec`.

Also fixed a few warnings generated by MSVC when compiling the
reduction test.
This commit is contained in:
Antonio Sanchez
2021-10-29 22:03:44 +00:00
committed by Antonio Sanchez
parent b3bea43a2d
commit f6c8cc0e99
3 changed files with 8 additions and 4 deletions

View File

@@ -76,7 +76,7 @@ class Tensor : public TensorBase<Tensor<Scalar_, NumIndices_, Options_, IndexTyp
typedef typename Base::CoeffReturnType CoeffReturnType;
enum {
IsAligned = bool(EIGEN_MAX_ALIGN_BYTES>0) & !(Options_&DontAlign),
IsAligned = (EIGEN_MAX_ALIGN_BYTES>0) && !(Options_&DontAlign),
Layout = Options_ & RowMajor ? RowMajor : ColMajor,
CoordAccess = true,
RawAccess = true