cxx11_tensor_io.cpp File Reference
#include "main.h"
#include <sstream>
#include <Eigen/CXX11/Tensor>

Classes

struct  test_tensor_ostream_impl< Scalar, rank, Layout >
 
struct  test_tensor_ostream_impl< Scalar, 0, Layout >
 
struct  test_tensor_ostream_impl< Scalar, 1, Layout >
 
struct  test_tensor_ostream_impl< Scalar, 2, Layout >
 
struct  test_tensor_ostream_impl< Scalar, 3, Layout >
 
struct  test_tensor_ostream_impl< bool, 2, Layout >
 
struct  test_tensor_ostream_impl< std::complex< Scalar >, 2, Layout >
 

Functions

template<typename Scalar , int rank, int Layout>
void test_tensor_ostream ()
 
void test_const_tensor_ostream ()
 
 EIGEN_DECLARE_TEST (cxx11_tensor_io)
 

Function Documentation

◆ EIGEN_DECLARE_TEST()

EIGEN_DECLARE_TEST ( cxx11_tensor_io  )
113  {
114  CALL_SUBTEST((test_tensor_ostream<float, 0, Eigen::ColMajor>()));
115  CALL_SUBTEST((test_tensor_ostream<float, 1, Eigen::ColMajor>()));
116  CALL_SUBTEST((test_tensor_ostream<float, 2, Eigen::ColMajor>()));
117  CALL_SUBTEST((test_tensor_ostream<float, 3, Eigen::ColMajor>()));
118 
119  CALL_SUBTEST((test_tensor_ostream<double, 0, Eigen::ColMajor>()));
120  CALL_SUBTEST((test_tensor_ostream<double, 1, Eigen::ColMajor>()));
121  CALL_SUBTEST((test_tensor_ostream<double, 2, Eigen::ColMajor>()));
122  CALL_SUBTEST((test_tensor_ostream<double, 3, Eigen::ColMajor>()));
123 
124  CALL_SUBTEST((test_tensor_ostream<int, 0, Eigen::ColMajor>()));
125  CALL_SUBTEST((test_tensor_ostream<int, 1, Eigen::ColMajor>()));
126  CALL_SUBTEST((test_tensor_ostream<int, 2, Eigen::ColMajor>()));
127  CALL_SUBTEST((test_tensor_ostream<int, 3, Eigen::ColMajor>()));
128 
129  CALL_SUBTEST((test_tensor_ostream<float, 0, Eigen::RowMajor>()));
130  CALL_SUBTEST((test_tensor_ostream<float, 1, Eigen::RowMajor>()));
131  CALL_SUBTEST((test_tensor_ostream<float, 2, Eigen::RowMajor>()));
132  CALL_SUBTEST((test_tensor_ostream<float, 3, Eigen::RowMajor>()));
133 
134  CALL_SUBTEST((test_tensor_ostream<double, 0, Eigen::RowMajor>()));
135  CALL_SUBTEST((test_tensor_ostream<double, 1, Eigen::RowMajor>()));
136  CALL_SUBTEST((test_tensor_ostream<double, 2, Eigen::RowMajor>()));
137  CALL_SUBTEST((test_tensor_ostream<double, 3, Eigen::RowMajor>()));
138 
139  CALL_SUBTEST((test_tensor_ostream<int, 0, Eigen::RowMajor>()));
140  CALL_SUBTEST((test_tensor_ostream<int, 1, Eigen::RowMajor>()));
141  CALL_SUBTEST((test_tensor_ostream<int, 2, Eigen::RowMajor>()));
142  CALL_SUBTEST((test_tensor_ostream<int, 3, Eigen::RowMajor>()));
143 
144  CALL_SUBTEST((test_tensor_ostream<bool, 2, Eigen::ColMajor>()));
145  CALL_SUBTEST((test_tensor_ostream<bool, 2, Eigen::RowMajor>()));
146 
147  CALL_SUBTEST((test_tensor_ostream<std::complex<double>, 2, Eigen::ColMajor>()));
148  CALL_SUBTEST((test_tensor_ostream<std::complex<float>, 2, Eigen::ColMajor>()));
149 
150  // Test printing TensorMap with const elements.
152 }
void test_const_tensor_ostream()
Definition: cxx11_tensor_io.cpp:103
void test_tensor_ostream()
Definition: cxx11_tensor_io.cpp:99
@ ColMajor
Definition: Constants.h:318
#define CALL_SUBTEST(FUNC)
Definition: main.h:382

References CALL_SUBTEST, Eigen::ColMajor, test_const_tensor_ostream(), and test_tensor_ostream().

◆ test_const_tensor_ostream()

void test_const_tensor_ostream ( )
103  {
105  t.setValues(1);
108  std::ostringstream os;
109  os << t_const.format(Eigen::TensorIOFormat::Plain());
110  VERIFY(os.str() == "1");
111 }
A tensor expression mapping an existing array of data.
Definition: TensorMap.h:33
The tensor class.
Definition: Tensor.h:68
@ Unaligned
Definition: Constants.h:235
#define VERIFY(a)
Definition: main.h:362
t
Definition: plotPSD.py:36
Definition: TensorDimensions.h:161
static const TensorIOFormatPlain Plain()
Definition: TensorIO.h:109

References Eigen::TensorIOFormat::Plain(), plotPSD::t, Eigen::Unaligned, and VERIFY.

Referenced by EIGEN_DECLARE_TEST().

◆ test_tensor_ostream()

template<typename Scalar , int rank, int Layout>
void test_tensor_ostream ( )
99  {
101 }
void run(const string &dir_name, LinearSolver *linear_solver_pt, const unsigned nel_1d, bool mess_up_order)
Definition: two_d_poisson_compare_solvers.cc:317

References run().

Referenced by EIGEN_DECLARE_TEST().