aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/test
diff options
context:
space:
mode:
authorGravatar Eugene Zhulenev <ezhulenev@google.com>2018-08-27 14:34:07 -0700
committerGravatar Eugene Zhulenev <ezhulenev@google.com>2018-08-27 14:34:07 -0700
commitc144bb355b74f4600156284e8202fcf9c0c135d8 (patch)
tree3e35d145c624b544906a25a447e07104960cd77e /unsupported/test
parent35d90e89600ff2524ec8bdd4ef4b95dd7c78b656 (diff)
parent57472886764ff71ad45338c6538649f7a8fa3d0e (diff)
Merge with upstream eigen/default
Diffstat (limited to 'unsupported/test')
-rw-r--r--unsupported/test/EulerAngles.cpp9
-rw-r--r--unsupported/test/cxx11_tensor_block_access.cpp312
-rw-r--r--unsupported/test/cxx11_tensor_concatenation.cpp2
-rw-r--r--unsupported/test/cxx11_tensor_contraction.cpp4
-rw-r--r--unsupported/test/cxx11_tensor_index_list.cpp1
-rw-r--r--unsupported/test/cxx11_tensor_thread_pool.cpp8
-rw-r--r--unsupported/test/kronecker_product.cpp24
-rw-r--r--unsupported/test/matrix_function.cpp12
-rw-r--r--unsupported/test/openglsupport.cpp4
-rw-r--r--unsupported/test/polynomialsolver.cpp1
10 files changed, 186 insertions, 191 deletions
diff --git a/unsupported/test/EulerAngles.cpp b/unsupported/test/EulerAngles.cpp
index 572fc08a3..67533e364 100644
--- a/unsupported/test/EulerAngles.cpp
+++ b/unsupported/test/EulerAngles.cpp
@@ -197,6 +197,7 @@ template<typename Scalar> void check_singular_cases(const Scalar& singularBeta)
template<typename Scalar> void eulerangles_manual()
{
typedef Matrix<Scalar,3,1> Vector3;
+ typedef Matrix<Scalar,Dynamic,1> VectorX;
const Vector3 Zero = Vector3::Zero();
const Scalar PI = Scalar(EIGEN_PI);
@@ -213,13 +214,13 @@ template<typename Scalar> void eulerangles_manual()
check_singular_cases(-PI);
// non-singular cases
- VectorXd alpha = VectorXd::LinSpaced(Eigen::Sequential, 20, Scalar(-0.99) * PI, PI);
- VectorXd beta = VectorXd::LinSpaced(Eigen::Sequential, 20, Scalar(-0.49) * PI, Scalar(0.49) * PI);
- VectorXd gamma = VectorXd::LinSpaced(Eigen::Sequential, 20, Scalar(-0.99) * PI, PI);
+ VectorX alpha = VectorX::LinSpaced(Eigen::Sequential, 20, Scalar(-0.99) * PI, PI);
+ VectorX beta = VectorX::LinSpaced(Eigen::Sequential, 20, Scalar(-0.49) * PI, Scalar(0.49) * PI);
+ VectorX gamma = VectorX::LinSpaced(Eigen::Sequential, 20, Scalar(-0.99) * PI, PI);
for (int i = 0; i < alpha.size(); ++i) {
for (int j = 0; j < beta.size(); ++j) {
for (int k = 0; k < gamma.size(); ++k) {
- check_all_var(Vector3d(alpha(i), beta(j), gamma(k)));
+ check_all_var(Vector3(alpha(i), beta(j), gamma(k)));
}
}
}
diff --git a/unsupported/test/cxx11_tensor_block_access.cpp b/unsupported/test/cxx11_tensor_block_access.cpp
index 746f62511..eec282ba7 100644
--- a/unsupported/test/cxx11_tensor_block_access.cpp
+++ b/unsupported/test/cxx11_tensor_block_access.cpp
@@ -10,6 +10,7 @@
#include "main.h"
+#include <algorithm>
#include <set>
#include <Eigen/CXX11/Tensor>
@@ -19,22 +20,21 @@ using Eigen::Index;
using Eigen::RowMajor;
using Eigen::ColMajor;
-using internal::TensorBlockShapeType;
template<typename T>
static const T& choose(int layout, const T& col, const T& row) {
return layout == ColMajor ? col : row;
}
-static const TensorBlockShapeType RandomShape() {
+static internal::TensorBlockShapeType RandomShape() {
return internal::random<bool>()
- ? internal::TensorBlockShapeType::kUniformAllDims
- : internal::TensorBlockShapeType::kSkewedInnerDims;
+ ? internal::kUniformAllDims
+ : internal::kSkewedInnerDims;
}
template <int NumDims>
-static std::size_t RandomTargetSize(const DSizes<Index, NumDims>& dims) {
- return internal::random<int>(1, dims.TotalSize());
+static Index RandomTargetSize(const DSizes<Index, NumDims>& dims) {
+ return internal::random<Index>(1, dims.TotalSize());
}
template <int NumDims>
@@ -44,12 +44,12 @@ static DSizes<Index, NumDims> RandomDims() {
dims[i] = internal::random<int>(1, 20);
}
return DSizes<Index, NumDims>(dims);
-};
+}
/** Dummy data type to test TensorBlock copy ops. */
struct Data {
- Data() : Data(0) {}
- explicit Data(int v) { value = v; }
+ Data() : value(0) {}
+ explicit Data(int v) : value(v) { }
int value;
};
@@ -91,21 +91,19 @@ static void Debug(DSizes<Index, NumDims> dims) {
template <int Layout>
static void test_block_mapper_sanity()
{
- using T = int;
- using TensorBlock = internal::TensorBlock<T, Index, 2, Layout>;
- using TensorBlockMapper = internal::TensorBlockMapper<T, Index, 2, Layout>;
+ typedef internal::TensorBlockMapper<int, Index, 2, Layout> TensorBlockMapper;
DSizes<Index, 2> tensor_dims(100, 100);
// Test uniform blocks.
TensorBlockMapper uniform_block_mapper(
- tensor_dims, internal::TensorBlockShapeType::kUniformAllDims, 100);
+ tensor_dims, internal::kUniformAllDims, 100);
VERIFY_IS_EQUAL(uniform_block_mapper.total_block_count(), 100);
VERIFY_IS_EQUAL(uniform_block_mapper.block_dims_total_size(), 100);
// 10x10 blocks
- auto uniform_b0 = uniform_block_mapper.GetBlockForIndex(0, nullptr);
+ typename TensorBlockMapper::Block uniform_b0 = uniform_block_mapper.GetBlockForIndex(0, NULL);
VERIFY_IS_EQUAL(uniform_b0.block_sizes().at(0), 10);
VERIFY_IS_EQUAL(uniform_b0.block_sizes().at(1), 10);
// Depending on a layout we stride by cols rows.
@@ -117,13 +115,13 @@ static void test_block_mapper_sanity()
// Test skewed to inner dims blocks.
TensorBlockMapper skewed_block_mapper(
- tensor_dims, internal::TensorBlockShapeType::kSkewedInnerDims, 100);
+ tensor_dims, internal::kSkewedInnerDims, 100);
VERIFY_IS_EQUAL(skewed_block_mapper.total_block_count(), 100);
VERIFY_IS_EQUAL(skewed_block_mapper.block_dims_total_size(), 100);
// 1x100 (100x1) rows/cols depending on a tensor layout.
- auto skewed_b0 = skewed_block_mapper.GetBlockForIndex(0, nullptr);
+ typename TensorBlockMapper::Block skewed_b0 = skewed_block_mapper.GetBlockForIndex(0, NULL);
VERIFY_IS_EQUAL(skewed_b0.block_sizes().at(0), choose(Layout, 100, 1));
VERIFY_IS_EQUAL(skewed_b0.block_sizes().at(1), choose(Layout, 1, 100));
// Depending on a layout we stride by cols rows.
@@ -140,12 +138,13 @@ template <typename T, int Layout, int NumDims>
static void UpdateCoeffSet(
const internal::TensorBlock<T, Index, NumDims, Layout>& block,
Index first_coeff_index, int dim_index, std::set<Index>* visited_coeffs) {
- const DSizes<Index, NumDims> block_sizes = block.block_sizes();
- const DSizes<Index, NumDims> tensor_strides = block.tensor_strides();
+ const DSizes<Index, NumDims>& block_sizes = block.block_sizes();
+ const DSizes<Index, NumDims>& tensor_strides = block.tensor_strides();
for (int i = 0; i < block_sizes[dim_index]; ++i) {
if (tensor_strides[dim_index] == 1) {
- auto inserted = visited_coeffs->insert(first_coeff_index + i);
+ typedef std::pair<std::set<Index>::iterator, bool> ReturnType;
+ ReturnType inserted = visited_coeffs->insert(first_coeff_index + i);
VERIFY_IS_EQUAL(inserted.second, true);
} else {
int next_dim_index = dim_index + choose(Layout, -1, 1);
@@ -158,9 +157,8 @@ static void UpdateCoeffSet(
template <typename T, int NumDims, int Layout>
static void test_block_mapper_maps_every_element() {
- using TensorBlock = internal::TensorBlock<T, Index, NumDims, Layout>;
- using TensorBlockMapper =
- internal::TensorBlockMapper<T, Index, NumDims, Layout>;
+ typedef internal::TensorBlock<T, Index, NumDims, Layout> TensorBlock;
+ typedef internal::TensorBlockMapper<T, Index, NumDims, Layout> TensorBlockMapper;
DSizes<Index, NumDims> dims = RandomDims<NumDims>();
@@ -171,7 +169,7 @@ static void test_block_mapper_maps_every_element() {
TensorBlockMapper block_mapper(dims, RandomShape(), RandomTargetSize(dims));
for (int i = 0; i < block_mapper.total_block_count(); ++i) {
- TensorBlock block = block_mapper.GetBlockForIndex(i, nullptr);
+ TensorBlock block = block_mapper.GetBlockForIndex(i, NULL);
UpdateCoeffSet<T, Layout, NumDims>(block, block.first_coeff_index(),
choose(Layout, NumDims - 1, 0),
&coeff_set);
@@ -180,16 +178,15 @@ static void test_block_mapper_maps_every_element() {
// Verify that every coefficient in the original Tensor is accessible through
// TensorBlock only once.
Index total_coeffs = dims.TotalSize();
- VERIFY_IS_EQUAL(coeff_set.size(), total_coeffs);
+ VERIFY_IS_EQUAL(Index(coeff_set.size()), total_coeffs);
VERIFY_IS_EQUAL(*coeff_set.begin(), 0);
VERIFY_IS_EQUAL(*coeff_set.rbegin(), total_coeffs - 1);
}
template <typename T, int NumDims, int Layout>
static void test_slice_block_mapper_maps_every_element() {
- using TensorBlock = internal::TensorBlock<T, Index, NumDims, Layout>;
- using TensorSliceBlockMapper =
- internal::TensorSliceBlockMapper<T, Index, NumDims, Layout>;
+ typedef internal::TensorBlock<T, Index, NumDims, Layout> TensorBlock;
+ typedef internal::TensorSliceBlockMapper<T, Index, NumDims, Layout> TensorSliceBlockMapper;
DSizes<Index, NumDims> tensor_dims = RandomDims<NumDims>();
DSizes<Index, NumDims> tensor_slice_offsets = RandomDims<NumDims>();
@@ -206,12 +203,12 @@ static void test_slice_block_mapper_maps_every_element() {
// Keep track of elements indices available via block access.
std::set<Index> coeff_set;
- auto total_coeffs = static_cast<int>(tensor_slice_extents.TotalSize());
+ int total_coeffs = static_cast<int>(tensor_slice_extents.TotalSize());
// Pick a random dimension sizes for the tensor blocks.
DSizes<Index, NumDims> block_sizes;
for (int i = 0; i < NumDims; ++i) {
- block_sizes[i] = internal::random<int>(1, tensor_slice_extents[i]);
+ block_sizes[i] = internal::random<Index>(1, tensor_slice_extents[i]);
}
TensorSliceBlockMapper block_mapper(tensor_dims, tensor_slice_offsets,
@@ -219,13 +216,13 @@ static void test_slice_block_mapper_maps_every_element() {
DimensionList<Index, NumDims>());
for (int i = 0; i < block_mapper.total_block_count(); ++i) {
- TensorBlock block = block_mapper.GetBlockForIndex(i, nullptr);
+ TensorBlock block = block_mapper.GetBlockForIndex(i, NULL);
UpdateCoeffSet<T, Layout, NumDims>(block, block.first_coeff_index(),
choose(Layout, NumDims - 1, 0),
&coeff_set);
}
- VERIFY_IS_EQUAL(coeff_set.size(), total_coeffs);
+ VERIFY_IS_EQUAL(Index(coeff_set.size()), total_coeffs);
}
template <typename T, int NumDims, int Layout>
@@ -240,7 +237,7 @@ static void test_block_io_copy_data_from_source_to_target() {
TensorBlockWriter;
DSizes<Index, NumDims> input_tensor_dims = RandomDims<NumDims>();
- const auto input_tensor_size = input_tensor_dims.TotalSize();
+ const Index input_tensor_size = input_tensor_dims.TotalSize();
T* input_data = GenerateRandomData<T>(input_tensor_size);
T* output_data = new T[input_tensor_size];
@@ -265,14 +262,14 @@ static void test_block_io_copy_data_from_source_to_target() {
}
template <int Layout, int NumDims>
-static int GetInputIndex(Index output_index,
+static Index GetInputIndex(Index output_index,
const array<Index, NumDims>& output_to_input_dim_map,
const array<Index, NumDims>& input_strides,
const array<Index, NumDims>& output_strides) {
int input_index = 0;
if (Layout == ColMajor) {
for (int i = NumDims - 1; i > 0; --i) {
- const int idx = output_index / output_strides[i];
+ const Index idx = output_index / output_strides[i];
input_index += idx * input_strides[output_to_input_dim_map[i]];
output_index -= idx * output_strides[i];
}
@@ -280,7 +277,7 @@ static int GetInputIndex(Index output_index,
output_index * input_strides[output_to_input_dim_map[0]];
} else {
for (int i = 0; i < NumDims - 1; ++i) {
- const int idx = output_index / output_strides[i];
+ const Index idx = output_index / output_strides[i];
input_index += idx * input_strides[output_to_input_dim_map[i]];
output_index -= idx * output_strides[i];
}
@@ -319,7 +316,7 @@ static void test_block_io_copy_using_reordered_dimensions() {
TensorBlockWriter;
DSizes<Index, NumDims> input_tensor_dims = RandomDims<NumDims>();
- const auto input_tensor_size = input_tensor_dims.TotalSize();
+ const Index input_tensor_size = input_tensor_dims.TotalSize();
// Create a random input tensor.
T* input_data = GenerateRandomData<T>(input_tensor_size);
@@ -327,7 +324,7 @@ static void test_block_io_copy_using_reordered_dimensions() {
// Create a random dimension re-ordering/shuffle.
std::vector<Index> shuffle;
for (int i = 0; i < NumDims; ++i) shuffle.push_back(i);
- std::shuffle(shuffle.begin(), shuffle.end(), std::mt19937());
+ std::random_shuffle(shuffle.begin(), shuffle.end());
DSizes<Index, NumDims> output_tensor_dims;
array<Index, NumDims> input_to_output_dim_map;
@@ -342,8 +339,8 @@ static void test_block_io_copy_using_reordered_dimensions() {
TensorBlockMapper block_mapper(output_tensor_dims, RandomShape(),
RandomTargetSize(input_tensor_dims));
- auto* block_data = new T[block_mapper.block_dims_total_size()];
- auto* output_data = new T[input_tensor_size];
+ T* block_data = new T[block_mapper.block_dims_total_size()];
+ T* output_data = new T[input_tensor_size];
array<Index, NumDims> input_tensor_strides =
ComputeStrides<Layout, NumDims>(input_tensor_dims);
@@ -370,6 +367,40 @@ static void test_block_io_copy_using_reordered_dimensions() {
delete[] output_data;
}
+template<typename Scalar, typename StorageIndex, int Dim>
+class EqualityChecker
+{
+ const Scalar* input_data;
+ const DSizes<StorageIndex, Dim> &input_dims, &input_strides, &output_dims, &output_strides;
+ void check_recursive(const Scalar* input, const Scalar* output, int depth=0) const
+ {
+ if(depth==Dim)
+ {
+ VERIFY_IS_EQUAL(*input, *output);
+ return;
+ }
+
+ for(int i=0; i<output_dims[depth]; ++i)
+ {
+ check_recursive(input + i % input_dims[depth] * input_strides[depth], output + i*output_strides[depth], depth+1);
+ }
+ }
+public:
+ EqualityChecker(const Scalar* input_data_,
+ const DSizes<StorageIndex, Dim> &input_dims_, const DSizes<StorageIndex, Dim> &input_strides_,
+ const DSizes<StorageIndex, Dim> &output_dims_, const DSizes<StorageIndex, Dim> &output_strides_)
+ : input_data(input_data_)
+ , input_dims(input_dims_), input_strides(input_strides_)
+ , output_dims(output_dims_), output_strides(output_strides_)
+ {}
+
+ void operator()(const Scalar* output_data) const
+ {
+ check_recursive(input_data, output_data);
+ }
+};
+
+
template <int Layout>
static void test_block_io_zero_stride()
{
@@ -385,8 +416,8 @@ static void test_block_io_zero_stride()
input_tensor_dims[0] = 1;
input_tensor_dims[2] = 1;
input_tensor_dims[4] = 1;
- const auto input_tensor_size = input_tensor_dims.TotalSize();
- auto* input_data = GenerateRandomData<float>(input_tensor_size);
+ const Index input_tensor_size = input_tensor_dims.TotalSize();
+ float* input_data = GenerateRandomData<float>(input_tensor_size);
DSizes<Index, 5> output_tensor_dims = rnd_dims;
@@ -401,33 +432,10 @@ static void test_block_io_zero_stride()
input_tensor_strides_with_zeros[4] = 0;
// Verify that data was correctly read/written from/into the block.
- const auto verify_is_equal = [&](const float* output_data) {
- for (int i = 0; i < output_tensor_dims[0]; ++i) {
- for (int j = 0; j < output_tensor_dims[1]; ++j) {
- for (int k = 0; k < output_tensor_dims[2]; ++k) {
- for (int l = 0; l < output_tensor_dims[3]; ++l) {
- for (int m = 0; m < output_tensor_dims[4]; ++m) {
- const Index output_offset =
- i * output_tensor_strides[0] + j * output_tensor_strides[1] +
- k * output_tensor_strides[2] + l * output_tensor_strides[3] +
- m * output_tensor_strides[4];
- const Index input_offset =
- i % input_tensor_dims[0] * input_tensor_strides[0] +
- j % input_tensor_dims[1] * input_tensor_strides[1] +
- k % input_tensor_dims[2] * input_tensor_strides[2] +
- l % input_tensor_dims[3] * input_tensor_strides[3] +
- m % input_tensor_dims[4] * input_tensor_strides[4];
- VERIFY_IS_EQUAL(output_data[output_offset],
- input_data[input_offset]);
- }
- }
- }
- }
- }
- };
+ const EqualityChecker<float, Index, 5> verify_is_equal(input_data, input_tensor_dims, input_tensor_strides, output_tensor_dims, output_tensor_strides);
{
- auto* output_data = new float[output_tensor_dims.TotalSize()];
+ float* output_data = new float[output_tensor_dims.TotalSize()];
TensorBlock read_block(0, output_tensor_dims, output_tensor_strides,
input_tensor_strides_with_zeros, output_data);
TensorBlockReader::Run(&read_block, input_data);
@@ -436,7 +444,7 @@ static void test_block_io_zero_stride()
}
{
- auto* output_data = new float[output_tensor_dims.TotalSize()];
+ float* output_data = new float[output_tensor_dims.TotalSize()];
TensorBlock write_block(0, output_tensor_dims,
input_tensor_strides_with_zeros,
output_tensor_strides, input_data);
@@ -459,14 +467,14 @@ static void test_block_io_squeeze_ones() {
// Total size > 1.
{
DSizes<Index, 5> block_sizes(1, 2, 1, 2, 1);
- const auto total_size = block_sizes.TotalSize();
+ const Index total_size = block_sizes.TotalSize();
// Create a random input tensor.
- auto* input_data = GenerateRandomData<float>(total_size);
+ float* input_data = GenerateRandomData<float>(total_size);
DSizes<Index, 5> strides(ComputeStrides<Layout, 5>(block_sizes));
{
- auto* output_data = new float[block_sizes.TotalSize()];
+ float* output_data = new float[block_sizes.TotalSize()];
TensorBlock read_block(0, block_sizes, strides, strides, output_data);
TensorBlockReader::Run(&read_block, input_data);
for (int i = 0; i < total_size; ++i) {
@@ -476,7 +484,7 @@ static void test_block_io_squeeze_ones() {
}
{
- auto* output_data = new float[block_sizes.TotalSize()];
+ float* output_data = new float[block_sizes.TotalSize()];
TensorBlock write_block(0, block_sizes, strides, strides, input_data);
TensorBlockWriter::Run(write_block, output_data);
for (int i = 0; i < total_size; ++i) {
@@ -489,14 +497,14 @@ static void test_block_io_squeeze_ones() {
// Total size == 1.
{
DSizes<Index, 5> block_sizes(1, 1, 1, 1, 1);
- const auto total_size = block_sizes.TotalSize();
+ const Index total_size = block_sizes.TotalSize();
// Create a random input tensor.
- auto* input_data = GenerateRandomData<float>(total_size);
+ float* input_data = GenerateRandomData<float>(total_size);
DSizes<Index, 5> strides(ComputeStrides<Layout, 5>(block_sizes));
{
- auto* output_data = new float[block_sizes.TotalSize()];
+ float* output_data = new float[block_sizes.TotalSize()];
TensorBlock read_block(0, block_sizes, strides, strides, output_data);
TensorBlockReader::Run(&read_block, input_data);
for (int i = 0; i < total_size; ++i) {
@@ -506,7 +514,7 @@ static void test_block_io_squeeze_ones() {
}
{
- auto* output_data = new float[block_sizes.TotalSize()];
+ float* output_data = new float[block_sizes.TotalSize()];
TensorBlock write_block(0, block_sizes, strides, strides, input_data);
TensorBlockWriter::Run(write_block, output_data);
for (int i = 0; i < total_size; ++i) {
@@ -635,7 +643,7 @@ static void test_block_cwise_binary_io_basic() {
DSizes<Index, NumDims> block_sizes = RandomDims<NumDims>();
DSizes<Index, NumDims> strides(ComputeStrides<Layout, NumDims>(block_sizes));
- const auto total_size = block_sizes.TotalSize();
+ const Index total_size = block_sizes.TotalSize();
// Create a random input tensors.
T* left_data = GenerateRandomData<T>(total_size);
@@ -664,13 +672,13 @@ static void test_block_cwise_binary_io_squeeze_ones() {
DSizes<Index, 5> block_sizes(1, 2, 1, 3, 1);
DSizes<Index, 5> strides(ComputeStrides<Layout, 5>(block_sizes));
- const auto total_size = block_sizes.TotalSize();
+ const Index total_size = block_sizes.TotalSize();
// Create a random input tensors.
- auto* left_data = GenerateRandomData<float>(total_size);
- auto* right_data = GenerateRandomData<float>(total_size);
+ float* left_data = GenerateRandomData<float>(total_size);
+ float* right_data = GenerateRandomData<float>(total_size);
- auto* output_data = new float[total_size];
+ float* output_data = new float[total_size];
BinaryFunctor functor;
TensorBlockCwiseBinaryIO::Run(functor, block_sizes, strides, output_data,
strides, left_data, strides, right_data);
@@ -711,14 +719,14 @@ static void test_block_cwise_binary_io_zero_strides() {
right_strides[3] = 0;
// Generate random data.
- auto* left_data = GenerateRandomData<float>(left_sizes.TotalSize());
- auto* right_data = GenerateRandomData<float>(right_sizes.TotalSize());
+ float* left_data = GenerateRandomData<float>(left_sizes.TotalSize());
+ float* right_data = GenerateRandomData<float>(right_sizes.TotalSize());
DSizes<Index, 5> output_sizes = rnd_dims;
DSizes<Index, 5> output_strides(ComputeStrides<Layout, 5>(output_sizes));
- const auto output_total_size = output_sizes.TotalSize();
- auto* output_data = new float[output_total_size];
+ const Index output_total_size = output_sizes.TotalSize();
+ float* output_data = new float[output_total_size];
BinaryFunctor functor;
TensorBlockCwiseBinaryIO::Run(functor, output_sizes, output_strides,
@@ -755,17 +763,16 @@ static void test_block_cwise_binary_io_zero_strides() {
template <int Layout>
static void test_uniform_block_shape()
{
- using T = int;
- typedef internal::TensorBlock<T, Index, 5, Layout> TensorBlock;
- typedef internal::TensorBlockMapper<T, Index, 5, Layout> TensorBlockMapper;
+ typedef internal::TensorBlock<int, Index, 5, Layout> TensorBlock;
+ typedef internal::TensorBlockMapper<int, Index, 5, Layout> TensorBlockMapper;
{
// Test shape 'UniformAllDims' with uniform 'max_coeff count'.
DSizes<Index, 5> dims(11, 5, 6, 17, 7);
- const size_t max_coeff_count = 5 * 5 * 5 * 5 * 5;
- TensorBlockMapper block_mapper(dims, TensorBlockShapeType::kUniformAllDims,
+ const Index max_coeff_count = 5 * 5 * 5 * 5 * 5;
+ TensorBlockMapper block_mapper(dims, internal::kUniformAllDims,
max_coeff_count);
- TensorBlock block = block_mapper.GetBlockForIndex(0, nullptr);
+ TensorBlock block = block_mapper.GetBlockForIndex(0, NULL);
for (int i = 0; i < 5; ++i) {
VERIFY_IS_EQUAL(5, block.block_sizes()[i]);
}
@@ -776,10 +783,10 @@ static void test_uniform_block_shape()
// partially into first inner-most dimension.
if (Layout == ColMajor) {
DSizes<Index, 5> dims(11, 5, 6, 17, 7);
- const size_t max_coeff_count = 7 * 5 * 5 * 5 * 5;
- TensorBlockMapper block_mapper(dims, TensorBlockShapeType::kUniformAllDims,
+ const Index max_coeff_count = 7 * 5 * 5 * 5 * 5;
+ TensorBlockMapper block_mapper(dims, internal::kUniformAllDims,
max_coeff_count);
- TensorBlock block = block_mapper.GetBlockForIndex(0, nullptr);
+ TensorBlock block = block_mapper.GetBlockForIndex(0, NULL);
VERIFY_IS_EQUAL(7, block.block_sizes()[0]);
for (int i = 1; i < 5; ++i) {
VERIFY_IS_EQUAL(5, block.block_sizes()[i]);
@@ -787,10 +794,10 @@ static void test_uniform_block_shape()
VERIFY(block.block_sizes().TotalSize() <= max_coeff_count);
} else {
DSizes<Index, 5> dims(11, 5, 6, 17, 7);
- const size_t max_coeff_count = 5 * 5 * 5 * 5 * 6;
- TensorBlockMapper block_mapper(dims, TensorBlockShapeType::kUniformAllDims,
+ const Index max_coeff_count = 5 * 5 * 5 * 5 * 6;
+ TensorBlockMapper block_mapper(dims, internal::kUniformAllDims,
max_coeff_count);
- TensorBlock block = block_mapper.GetBlockForIndex(0, nullptr);
+ TensorBlock block = block_mapper.GetBlockForIndex(0, NULL);
VERIFY_IS_EQUAL(6, block.block_sizes()[4]);
for (int i = 3; i >= 0; --i) {
VERIFY_IS_EQUAL(5, block.block_sizes()[i]);
@@ -802,10 +809,10 @@ static void test_uniform_block_shape()
// fully into first inner-most dimension.
if (Layout == ColMajor) {
DSizes<Index, 5> dims(11, 5, 6, 17, 7);
- const size_t max_coeff_count = 11 * 5 * 5 * 5 * 5;
- TensorBlockMapper block_mapper(dims, TensorBlockShapeType::kUniformAllDims,
+ const Index max_coeff_count = 11 * 5 * 5 * 5 * 5;
+ TensorBlockMapper block_mapper(dims, internal::kUniformAllDims,
max_coeff_count);
- TensorBlock block = block_mapper.GetBlockForIndex(0, nullptr);
+ TensorBlock block = block_mapper.GetBlockForIndex(0, NULL);
VERIFY_IS_EQUAL(11, block.block_sizes()[0]);
for (int i = 1; i < 5; ++i) {
VERIFY_IS_EQUAL(5, block.block_sizes()[i]);
@@ -813,10 +820,10 @@ static void test_uniform_block_shape()
VERIFY(block.block_sizes().TotalSize() <= max_coeff_count);
} else {
DSizes<Index, 5> dims(11, 5, 6, 17, 7);
- const size_t max_coeff_count = 5 * 5 * 5 * 5 * 7;
- TensorBlockMapper block_mapper(dims, TensorBlockShapeType::kUniformAllDims,
+ const Index max_coeff_count = 5 * 5 * 5 * 5 * 7;
+ TensorBlockMapper block_mapper(dims, internal::kUniformAllDims,
max_coeff_count);
- TensorBlock block = block_mapper.GetBlockForIndex(0, nullptr);
+ TensorBlock block = block_mapper.GetBlockForIndex(0, NULL);
VERIFY_IS_EQUAL(7, block.block_sizes()[4]);
for (int i = 3; i >= 0; --i) {
VERIFY_IS_EQUAL(5, block.block_sizes()[i]);
@@ -828,10 +835,10 @@ static void test_uniform_block_shape()
// fully into first few inner-most dimensions.
if (Layout == ColMajor) {
DSizes<Index, 5> dims(7, 5, 6, 17, 7);
- const size_t max_coeff_count = 7 * 5 * 6 * 7 * 5;
- TensorBlockMapper block_mapper(dims, TensorBlockShapeType::kUniformAllDims,
+ const Index max_coeff_count = 7 * 5 * 6 * 7 * 5;
+ TensorBlockMapper block_mapper(dims, internal::kUniformAllDims,
max_coeff_count);
- TensorBlock block = block_mapper.GetBlockForIndex(0, nullptr);
+ TensorBlock block = block_mapper.GetBlockForIndex(0, NULL);
VERIFY_IS_EQUAL(7, block.block_sizes()[0]);
VERIFY_IS_EQUAL(5, block.block_sizes()[1]);
VERIFY_IS_EQUAL(6, block.block_sizes()[2]);
@@ -840,10 +847,10 @@ static void test_uniform_block_shape()
VERIFY(block.block_sizes().TotalSize() <= max_coeff_count);
} else {
DSizes<Index, 5> dims(7, 5, 6, 9, 7);
- const size_t max_coeff_count = 5 * 5 * 5 * 6 * 7;
- TensorBlockMapper block_mapper(dims, TensorBlockShapeType::kUniformAllDims,
+ const Index max_coeff_count = 5 * 5 * 5 * 6 * 7;
+ TensorBlockMapper block_mapper(dims, internal::kUniformAllDims,
max_coeff_count);
- TensorBlock block = block_mapper.GetBlockForIndex(0, nullptr);
+ TensorBlock block = block_mapper.GetBlockForIndex(0, NULL);
VERIFY_IS_EQUAL(7, block.block_sizes()[4]);
VERIFY_IS_EQUAL(6, block.block_sizes()[3]);
VERIFY_IS_EQUAL(5, block.block_sizes()[2]);
@@ -855,10 +862,10 @@ static void test_uniform_block_shape()
// Test shape 'UniformAllDims' with full allocation to all dims.
if (Layout == ColMajor) {
DSizes<Index, 5> dims(7, 5, 6, 17, 7);
- const size_t max_coeff_count = 7 * 5 * 6 * 17 * 7;
- TensorBlockMapper block_mapper(dims, TensorBlockShapeType::kUniformAllDims,
+ const Index max_coeff_count = 7 * 5 * 6 * 17 * 7;
+ TensorBlockMapper block_mapper(dims, internal::kUniformAllDims,
max_coeff_count);
- TensorBlock block = block_mapper.GetBlockForIndex(0, nullptr);
+ TensorBlock block = block_mapper.GetBlockForIndex(0, NULL);
VERIFY_IS_EQUAL(7, block.block_sizes()[0]);
VERIFY_IS_EQUAL(5, block.block_sizes()[1]);
VERIFY_IS_EQUAL(6, block.block_sizes()[2]);
@@ -867,10 +874,10 @@ static void test_uniform_block_shape()
VERIFY(block.block_sizes().TotalSize() <= max_coeff_count);
} else {
DSizes<Index, 5> dims(7, 5, 6, 9, 7);
- const size_t max_coeff_count = 7 * 5 * 6 * 9 * 7;
- TensorBlockMapper block_mapper(dims, TensorBlockShapeType::kUniformAllDims,
+ const Index max_coeff_count = 7 * 5 * 6 * 9 * 7;
+ TensorBlockMapper block_mapper(dims, internal::kUniformAllDims,
max_coeff_count);
- TensorBlock block = block_mapper.GetBlockForIndex(0, nullptr);
+ TensorBlock block = block_mapper.GetBlockForIndex(0, NULL);
VERIFY_IS_EQUAL(7, block.block_sizes()[4]);
VERIFY_IS_EQUAL(9, block.block_sizes()[3]);
VERIFY_IS_EQUAL(6, block.block_sizes()[2]);
@@ -883,17 +890,16 @@ static void test_uniform_block_shape()
template <int Layout>
static void test_skewed_inner_dim_block_shape()
{
- using T = int;
- typedef internal::TensorBlock<T, Index, 5, Layout> TensorBlock;
- typedef internal::TensorBlockMapper<T, Index, 5, Layout> TensorBlockMapper;
+ typedef internal::TensorBlock<int, Index, 5, Layout> TensorBlock;
+ typedef internal::TensorBlockMapper<int, Index, 5, Layout> TensorBlockMapper;
// Test shape 'SkewedInnerDims' with partial allocation to inner-most dim.
if (Layout == ColMajor) {
DSizes<Index, 5> dims(11, 5, 6, 17, 7);
- const size_t max_coeff_count = 10 * 1 * 1 * 1 * 1;
- TensorBlockMapper block_mapper(dims, TensorBlockShapeType::kSkewedInnerDims,
+ const Index max_coeff_count = 10 * 1 * 1 * 1 * 1;
+ TensorBlockMapper block_mapper(dims, internal::kSkewedInnerDims,
max_coeff_count);
- TensorBlock block = block_mapper.GetBlockForIndex(0, nullptr);
+ TensorBlock block = block_mapper.GetBlockForIndex(0, NULL);
VERIFY_IS_EQUAL(10, block.block_sizes()[0]);
for (int i = 1; i < 5; ++i) {
VERIFY_IS_EQUAL(1, block.block_sizes()[i]);
@@ -901,10 +907,10 @@ static void test_skewed_inner_dim_block_shape()
VERIFY(block.block_sizes().TotalSize() <= max_coeff_count);
} else {
DSizes<Index, 5> dims(11, 5, 6, 17, 7);
- const size_t max_coeff_count = 1 * 1 * 1 * 1 * 6;
- TensorBlockMapper block_mapper(dims, TensorBlockShapeType::kSkewedInnerDims,
+ const Index max_coeff_count = 1 * 1 * 1 * 1 * 6;
+ TensorBlockMapper block_mapper(dims, internal::kSkewedInnerDims,
max_coeff_count);
- TensorBlock block = block_mapper.GetBlockForIndex(0, nullptr);
+ TensorBlock block = block_mapper.GetBlockForIndex(0, NULL);
VERIFY_IS_EQUAL(6, block.block_sizes()[4]);
for (int i = 3; i >= 0; --i) {
VERIFY_IS_EQUAL(1, block.block_sizes()[i]);
@@ -915,10 +921,10 @@ static void test_skewed_inner_dim_block_shape()
// Test shape 'SkewedInnerDims' with full allocation to inner-most dim.
if (Layout == ColMajor) {
DSizes<Index, 5> dims(11, 5, 6, 17, 7);
- const size_t max_coeff_count = 11 * 1 * 1 * 1 * 1;
- TensorBlockMapper block_mapper(dims, TensorBlockShapeType::kSkewedInnerDims,
+ const Index max_coeff_count = 11 * 1 * 1 * 1 * 1;
+ TensorBlockMapper block_mapper(dims, internal::kSkewedInnerDims,
max_coeff_count);
- TensorBlock block = block_mapper.GetBlockForIndex(0, nullptr);
+ TensorBlock block = block_mapper.GetBlockForIndex(0, NULL);
VERIFY_IS_EQUAL(11, block.block_sizes()[0]);
for (int i = 1; i < 5; ++i) {
VERIFY_IS_EQUAL(1, block.block_sizes()[i]);
@@ -926,10 +932,10 @@ static void test_skewed_inner_dim_block_shape()
VERIFY(block.block_sizes().TotalSize() <= max_coeff_count);
} else {
DSizes<Index, 5> dims(11, 5, 6, 17, 7);
- const size_t max_coeff_count = 1 * 1 * 1 * 1 * 7;
- TensorBlockMapper block_mapper(dims, TensorBlockShapeType::kSkewedInnerDims,
+ const Index max_coeff_count = 1 * 1 * 1 * 1 * 7;
+ TensorBlockMapper block_mapper(dims, internal::kSkewedInnerDims,
max_coeff_count);
- TensorBlock block = block_mapper.GetBlockForIndex(0, nullptr);
+ TensorBlock block = block_mapper.GetBlockForIndex(0, NULL);
VERIFY_IS_EQUAL(7, block.block_sizes()[4]);
for (int i = 3; i >= 0; --i) {
VERIFY_IS_EQUAL(1, block.block_sizes()[i]);
@@ -941,10 +947,10 @@ static void test_skewed_inner_dim_block_shape()
// and partial allocation to second inner-dim.
if (Layout == ColMajor) {
DSizes<Index, 5> dims(11, 5, 6, 17, 7);
- const size_t max_coeff_count = 11 * 3 * 1 * 1 * 1;
- TensorBlockMapper block_mapper(dims, TensorBlockShapeType::kSkewedInnerDims,
+ const Index max_coeff_count = 11 * 3 * 1 * 1 * 1;
+ TensorBlockMapper block_mapper(dims, internal::kSkewedInnerDims,
max_coeff_count);
- TensorBlock block = block_mapper.GetBlockForIndex(0, nullptr);
+ TensorBlock block = block_mapper.GetBlockForIndex(0, NULL);
VERIFY_IS_EQUAL(11, block.block_sizes()[0]);
VERIFY_IS_EQUAL(3, block.block_sizes()[1]);
for (int i = 2; i < 5; ++i) {
@@ -953,10 +959,10 @@ static void test_skewed_inner_dim_block_shape()
VERIFY(block.block_sizes().TotalSize() <= max_coeff_count);
} else {
DSizes<Index, 5> dims(11, 5, 6, 17, 7);
- const size_t max_coeff_count = 1 * 1 * 1 * 15 * 7;
- TensorBlockMapper block_mapper(dims, TensorBlockShapeType::kSkewedInnerDims,
+ const Index max_coeff_count = 1 * 1 * 1 * 15 * 7;
+ TensorBlockMapper block_mapper(dims, internal::kSkewedInnerDims,
max_coeff_count);
- TensorBlock block = block_mapper.GetBlockForIndex(0, nullptr);
+ TensorBlock block = block_mapper.GetBlockForIndex(0, NULL);
VERIFY_IS_EQUAL(7, block.block_sizes()[4]);
VERIFY_IS_EQUAL(15, block.block_sizes()[3]);
for (int i = 2; i >= 0; --i) {
@@ -969,10 +975,10 @@ static void test_skewed_inner_dim_block_shape()
// and partial allocation to third inner-dim.
if (Layout == ColMajor) {
DSizes<Index, 5> dims(11, 5, 6, 17, 7);
- const size_t max_coeff_count = 11 * 5 * 5 * 1 * 1;
- TensorBlockMapper block_mapper(dims, TensorBlockShapeType::kSkewedInnerDims,
+ const Index max_coeff_count = 11 * 5 * 5 * 1 * 1;
+ TensorBlockMapper block_mapper(dims, internal::kSkewedInnerDims,
max_coeff_count);
- TensorBlock block = block_mapper.GetBlockForIndex(0, nullptr);
+ TensorBlock block = block_mapper.GetBlockForIndex(0, NULL);
VERIFY_IS_EQUAL(11, block.block_sizes()[0]);
VERIFY_IS_EQUAL(5, block.block_sizes()[1]);
VERIFY_IS_EQUAL(5, block.block_sizes()[2]);
@@ -982,10 +988,10 @@ static void test_skewed_inner_dim_block_shape()
VERIFY(block.block_sizes().TotalSize() <= max_coeff_count);
} else {
DSizes<Index, 5> dims(11, 5, 6, 17, 7);
- const size_t max_coeff_count = 1 * 1 * 5 * 17 * 7;
- TensorBlockMapper block_mapper(dims, TensorBlockShapeType::kSkewedInnerDims,
+ const Index max_coeff_count = 1 * 1 * 5 * 17 * 7;
+ TensorBlockMapper block_mapper(dims, internal::kSkewedInnerDims,
max_coeff_count);
- TensorBlock block = block_mapper.GetBlockForIndex(0, nullptr);
+ TensorBlock block = block_mapper.GetBlockForIndex(0, NULL);
VERIFY_IS_EQUAL(7, block.block_sizes()[4]);
VERIFY_IS_EQUAL(17, block.block_sizes()[3]);
VERIFY_IS_EQUAL(5, block.block_sizes()[2]);
@@ -998,10 +1004,10 @@ static void test_skewed_inner_dim_block_shape()
// Test shape 'SkewedInnerDims' with full allocation to all dims.
if (Layout == ColMajor) {
DSizes<Index, 5> dims(11, 5, 6, 17, 7);
- const size_t max_coeff_count = 11 * 5 * 6 * 17 * 7;
- TensorBlockMapper block_mapper(dims, TensorBlockShapeType::kSkewedInnerDims,
+ const Index max_coeff_count = 11 * 5 * 6 * 17 * 7;
+ TensorBlockMapper block_mapper(dims, internal::kSkewedInnerDims,
max_coeff_count);
- TensorBlock block = block_mapper.GetBlockForIndex(0, nullptr);
+ TensorBlock block = block_mapper.GetBlockForIndex(0, NULL);
VERIFY_IS_EQUAL(11, block.block_sizes()[0]);
VERIFY_IS_EQUAL(5, block.block_sizes()[1]);
VERIFY_IS_EQUAL(6, block.block_sizes()[2]);
@@ -1010,10 +1016,10 @@ static void test_skewed_inner_dim_block_shape()
VERIFY(block.block_sizes().TotalSize() <= max_coeff_count);
} else {
DSizes<Index, 5> dims(11, 5, 6, 17, 7);
- const size_t max_coeff_count = 11 * 5 * 6 * 17 * 7;
- TensorBlockMapper block_mapper(dims, TensorBlockShapeType::kSkewedInnerDims,
+ const Index max_coeff_count = 11 * 5 * 6 * 17 * 7;
+ TensorBlockMapper block_mapper(dims, internal::kSkewedInnerDims,
max_coeff_count);
- TensorBlock block = block_mapper.GetBlockForIndex(0, nullptr);
+ TensorBlock block = block_mapper.GetBlockForIndex(0, NULL);
VERIFY_IS_EQUAL(7, block.block_sizes()[4]);
VERIFY_IS_EQUAL(17, block.block_sizes()[3]);
VERIFY_IS_EQUAL(6, block.block_sizes()[2]);
@@ -1026,15 +1032,13 @@ static void test_skewed_inner_dim_block_shape()
template <int Layout>
static void test_empty_dims(const internal::TensorBlockShapeType block_shape)
{
- using T = int;
-
// Test blocking of tensors with zero dimensions:
// - we must not crash on asserts and divisions by zero
// - we must not return block with zero dimensions
// (recipe for overflows/underflows, divisions by zero and NaNs later)
// - total block count must be zero
{
- typedef internal::TensorBlockMapper<T, Index, 1, Layout> TensorBlockMapper;
+ typedef internal::TensorBlockMapper<int, Index, 1, Layout> TensorBlockMapper;
DSizes<Index, 1> dims(0);
for (int max_coeff_count = 0; max_coeff_count < 2; ++max_coeff_count) {
TensorBlockMapper block_mapper(dims, block_shape, max_coeff_count);
@@ -1044,7 +1048,7 @@ static void test_empty_dims(const internal::TensorBlockShapeType block_shape)
}
{
- typedef internal::TensorBlockMapper<T, Index, 2, Layout> TensorBlockMapper;
+ typedef internal::TensorBlockMapper<int, Index, 2, Layout> TensorBlockMapper;
for (int dim1 = 0; dim1 < 3; ++dim1) {
for (int dim2 = 0; dim2 < 3; ++dim2) {
DSizes<Index, 2> dims(dim1, dim2);
@@ -1098,9 +1102,9 @@ EIGEN_DECLARE_TEST(cxx11_tensor_block_access) {
TEST_LAYOUTS(test_block_cwise_binary_io_zero_strides);
TEST_LAYOUTS(test_uniform_block_shape);
TEST_LAYOUTS(test_skewed_inner_dim_block_shape);
- TEST_LAYOUTS_WITH_ARG(test_empty_dims, TensorBlockShapeType::kUniformAllDims);
- TEST_LAYOUTS_WITH_ARG(test_empty_dims, TensorBlockShapeType::kSkewedInnerDims);
+ TEST_LAYOUTS_WITH_ARG(test_empty_dims, internal::kUniformAllDims);
+ TEST_LAYOUTS_WITH_ARG(test_empty_dims, internal::kSkewedInnerDims);
}
#undef TEST_LAYOUTS
-#undef TEST_LAYOUTS_WITH_ARG \ No newline at end of file
+#undef TEST_LAYOUTS_WITH_ARG
diff --git a/unsupported/test/cxx11_tensor_concatenation.cpp b/unsupported/test/cxx11_tensor_concatenation.cpp
index f53515b4e..e223d9ffd 100644
--- a/unsupported/test/cxx11_tensor_concatenation.cpp
+++ b/unsupported/test/cxx11_tensor_concatenation.cpp
@@ -56,7 +56,7 @@ static void test_static_dimension_failure()
// either the code should change to
// Tensor<int, 2>::Dimensions{{2, 3}}
// or Tensor<int, 2>::Dimensions{Tensor<int, 2>::Dimensions{{2, 3}}}
- .concatenate(right.reshape(Tensor<int, 2>::Dimensions{{2, 3}}), 0);
+ .concatenate(right.reshape(Tensor<int, 2>::Dimensions(2, 3)), 0);
}
template<int DataLayout>
diff --git a/unsupported/test/cxx11_tensor_contraction.cpp b/unsupported/test/cxx11_tensor_contraction.cpp
index d4cfbd0da..4e5922440 100644
--- a/unsupported/test/cxx11_tensor_contraction.cpp
+++ b/unsupported/test/cxx11_tensor_contraction.cpp
@@ -514,7 +514,7 @@ static void test_const_inputs()
struct SqrtOutputKernel {
template <typename Index, typename Scalar>
EIGEN_ALWAYS_INLINE void operator()(
- const OutputKernel::OutputMapper<Index, Scalar>& output_mapper,
+ const internal::blas_data_mapper<Scalar, Index, ColMajor>& output_mapper,
const TensorContractionParams&, Index, Index, Index num_rows,
Index num_cols) const {
for (int i = 0; i < num_rows; ++i) {
@@ -553,7 +553,7 @@ static void test_large_contraction_with_output_kernel() {
m_result = m_left * m_right;
- for (size_t i = 0; i < t_result.dimensions().TotalSize(); i++) {
+ for (std::ptrdiff_t i = 0; i < t_result.dimensions().TotalSize(); i++) {
VERIFY(&t_result.data()[i] != &m_result.data()[i]);
VERIFY_IS_APPROX(t_result.data()[i], std::sqrt(m_result.data()[i]));
}
diff --git a/unsupported/test/cxx11_tensor_index_list.cpp b/unsupported/test/cxx11_tensor_index_list.cpp
index e81fa5e40..294677a4d 100644
--- a/unsupported/test/cxx11_tensor_index_list.cpp
+++ b/unsupported/test/cxx11_tensor_index_list.cpp
@@ -170,7 +170,6 @@ static void test_type2indexpair_list()
typedef Eigen::IndexPairList<Eigen::type2indexpair<0,10>, Eigen::IndexPair<DenseIndex>, Eigen::type2indexpair<2,12>> Dims2_b;
typedef Eigen::IndexPairList<Eigen::IndexPair<DenseIndex>, Eigen::type2indexpair<1,11>, Eigen::IndexPair<DenseIndex>> Dims2_c;
- Dims0 d0;
Dims2_a d2_a;
Dims2_b d2_b;
diff --git a/unsupported/test/cxx11_tensor_thread_pool.cpp b/unsupported/test/cxx11_tensor_thread_pool.cpp
index 5c3aae482..6d8e58214 100644
--- a/unsupported/test/cxx11_tensor_thread_pool.cpp
+++ b/unsupported/test/cxx11_tensor_thread_pool.cpp
@@ -255,7 +255,7 @@ void test_multithread_contraction_agrees_with_singlethread() {
struct SqrtOutputKernel {
template <typename Index, typename Scalar>
EIGEN_ALWAYS_INLINE void operator()(
- const OutputKernel::OutputMapper<Index, Scalar>& output_mapper,
+ const internal::blas_data_mapper<Scalar, Index, ColMajor>& output_mapper,
const TensorContractionParams&, Index, Index, Index num_rows,
Index num_cols) const {
for (int i = 0; i < num_rows; ++i) {
@@ -300,7 +300,7 @@ static void test_multithread_contraction_with_output_kernel() {
m_result = m_left * m_right;
- for (size_t i = 0; i < t_result.dimensions().TotalSize(); i++) {
+ for (Index i = 0; i < t_result.dimensions().TotalSize(); i++) {
VERIFY(&t_result.data()[i] != &m_result.data()[i]);
VERIFY_IS_APPROX(t_result.data()[i], std::sqrt(m_result.data()[i]));
}
@@ -428,7 +428,7 @@ void test_threadpool_allocate(TestAllocator* allocator)
void* ptr = device.allocate(512);
device.deallocate(ptr);
}
- VERIFY(allocator != nullptr);
+ VERIFY(allocator != NULL);
VERIFY_IS_EQUAL(allocator->alloc_count(), num_allocs);
VERIFY_IS_EQUAL(allocator->dealloc_count(), num_allocs);
}
@@ -460,7 +460,7 @@ EIGEN_DECLARE_TEST(cxx11_tensor_thread_pool)
CALL_SUBTEST_6(test_multithread_random());
TestAllocator test_allocator;
- CALL_SUBTEST_6(test_multithread_shuffle<ColMajor>(nullptr));
+ CALL_SUBTEST_6(test_multithread_shuffle<ColMajor>(NULL));
CALL_SUBTEST_6(test_multithread_shuffle<RowMajor>(&test_allocator));
CALL_SUBTEST_6(test_threadpool_allocate(&test_allocator));
}
diff --git a/unsupported/test/kronecker_product.cpp b/unsupported/test/kronecker_product.cpp
index 4f143b6de..b5b764c65 100644
--- a/unsupported/test/kronecker_product.cpp
+++ b/unsupported/test/kronecker_product.cpp
@@ -9,6 +9,7 @@
// 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/.
+
#ifdef EIGEN_TEST_PART_1
#include "sparse.h"
@@ -95,7 +96,7 @@ EIGEN_DECLARE_TEST(kronecker_product)
SM_a.insert(1,0) = DM_a.coeffRef(1,0) = -0.9076572187376921;
SM_a.insert(1,1) = DM_a.coeffRef(1,1) = 0.6469156566545853;
SM_a.insert(1,2) = DM_a.coeffRef(1,2) = -0.3658010398782789;
-
+
MatrixXd DM_b(3,2);
SparseMatrix<double> SM_b(3,2);
SM_b.insert(0,0) = DM_b.coeffRef(0,0) = 0.9004440976767099;
@@ -165,7 +166,7 @@ EIGEN_DECLARE_TEST(kronecker_product)
SM_a.insert(0,3) = -0.2;
SM_a.insert(2,4) = 0.3;
SM_a.finalize();
-
+
SM_b.insert(0,0) = 0.4;
SM_b.insert(2,1) = -0.5;
SM_b.finalize();
@@ -183,7 +184,7 @@ EIGEN_DECLARE_TEST(kronecker_product)
DM_b2.resize(4,8);
DM_ab2 = kroneckerProduct(DM_a2,DM_b2);
CALL_SUBTEST(check_dimension(DM_ab2,10*4,9*8));
-
+
for(int i = 0; i < g_repeat; i++)
{
double density = Eigen::internal::random<double>(0.01,0.5);
@@ -196,35 +197,35 @@ EIGEN_DECLARE_TEST(kronecker_product)
MatrixXf dA(ra,ca), dB(rb,cb), dC;
initSparse(density, dA, sA);
initSparse(density, dB, sB);
-
+
sC = kroneckerProduct(sA,sB);
dC = kroneckerProduct(dA,dB);
VERIFY_IS_APPROX(MatrixXf(sC),dC);
-
+
sC = kroneckerProduct(sA.transpose(),sB);
dC = kroneckerProduct(dA.transpose(),dB);
VERIFY_IS_APPROX(MatrixXf(sC),dC);
-
+
sC = kroneckerProduct(sA.transpose(),sB.transpose());
dC = kroneckerProduct(dA.transpose(),dB.transpose());
VERIFY_IS_APPROX(MatrixXf(sC),dC);
-
+
sC = kroneckerProduct(sA,sB.transpose());
dC = kroneckerProduct(dA,dB.transpose());
VERIFY_IS_APPROX(MatrixXf(sC),dC);
-
+
sC2 = kroneckerProduct(sA,sB);
dC = kroneckerProduct(dA,dB);
VERIFY_IS_APPROX(MatrixXf(sC2),dC);
-
+
sC2 = kroneckerProduct(dA,sB);
dC = kroneckerProduct(dA,dB);
VERIFY_IS_APPROX(MatrixXf(sC2),dC);
-
+
sC2 = kroneckerProduct(sA,dB);
dC = kroneckerProduct(dA,dB);
VERIFY_IS_APPROX(MatrixXf(sC2),dC);
-
+
sC2 = kroneckerProduct(2*sA,sB);
dC = kroneckerProduct(2*dA,dB);
VERIFY_IS_APPROX(MatrixXf(sC2),dC);
@@ -236,7 +237,6 @@ EIGEN_DECLARE_TEST(kronecker_product)
#ifdef EIGEN_TEST_PART_2
// simply check that for a dense kronecker product, sparse module is not needed
-
#include "main.h"
#include <Eigen/KroneckerProduct>
diff --git a/unsupported/test/matrix_function.cpp b/unsupported/test/matrix_function.cpp
index 93fb71430..2049b8ba0 100644
--- a/unsupported/test/matrix_function.cpp
+++ b/unsupported/test/matrix_function.cpp
@@ -23,9 +23,8 @@ inline bool test_isApprox_abs(const Type1& a, const Type2& b)
// Returns a matrix with eigenvalues clustered around 0, 1 and 2.
template<typename MatrixType>
-MatrixType randomMatrixWithRealEivals(const typename MatrixType::Index size)
+MatrixType randomMatrixWithRealEivals(const Index size)
{
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
typedef typename MatrixType::RealScalar RealScalar;
MatrixType diag = MatrixType::Zero(size, size);
@@ -42,16 +41,15 @@ template <typename MatrixType, int IsComplex = NumTraits<typename internal::trai
struct randomMatrixWithImagEivals
{
// Returns a matrix with eigenvalues clustered around 0 and +/- i.
- static MatrixType run(const typename MatrixType::Index size);
+ static MatrixType run(const Index size);
};
// Partial specialization for real matrices
template<typename MatrixType>
struct randomMatrixWithImagEivals<MatrixType, 0>
{
- static MatrixType run(const typename MatrixType::Index size)
+ static MatrixType run(const Index size)
{
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
MatrixType diag = MatrixType::Zero(size, size);
Index i = 0;
@@ -77,9 +75,8 @@ struct randomMatrixWithImagEivals<MatrixType, 0>
template<typename MatrixType>
struct randomMatrixWithImagEivals<MatrixType, 1>
{
- static MatrixType run(const typename MatrixType::Index size)
+ static MatrixType run(const Index size)
{
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
typedef typename MatrixType::RealScalar RealScalar;
const Scalar imagUnit(0, 1);
@@ -171,7 +168,6 @@ void testMatrixType(const MatrixType& m)
{
// Matrices with clustered eigenvalue lead to different code paths
// in MatrixFunction.h and are thus useful for testing.
- typedef typename MatrixType::Index Index;
const Index size = m.rows();
for (int i = 0; i < g_repeat; i++) {
diff --git a/unsupported/test/openglsupport.cpp b/unsupported/test/openglsupport.cpp
index 460830086..eadd7f985 100644
--- a/unsupported/test/openglsupport.cpp
+++ b/unsupported/test/openglsupport.cpp
@@ -318,10 +318,6 @@ EIGEN_DECLARE_TEST(openglsupport)
GLint prg_id = createShader(vtx,frg);
- typedef Vector2d Vector2d;
- typedef Vector3d Vector3d;
- typedef Vector4d Vector4d;
-
VERIFY_UNIFORM(dv,v2d, Vector2d);
VERIFY_UNIFORM(dv,v3d, Vector3d);
VERIFY_UNIFORM(dv,v4d, Vector4d);
diff --git a/unsupported/test/polynomialsolver.cpp b/unsupported/test/polynomialsolver.cpp
index 65efea0cb..50c74f797 100644
--- a/unsupported/test/polynomialsolver.cpp
+++ b/unsupported/test/polynomialsolver.cpp
@@ -30,7 +30,6 @@ struct increment_if_fixed_size
template<int Deg, typename POLYNOMIAL, typename SOLVER>
bool aux_evalSolver( const POLYNOMIAL& pols, SOLVER& psolve )
{
- typedef typename POLYNOMIAL::Index Index;
typedef typename POLYNOMIAL::Scalar Scalar;
typedef typename POLYNOMIAL::RealScalar RealScalar;