12 #include <Eigen/CXX11/Tensor> 23 for (
int i = 0; i < 3; ++i) {
24 data1(i) = std::complex<float>(i, -i);
25 data2(i) = std::complex<float>(i, 7 * i);
29 for (
int i = 0; i < 3; ++i) {
30 VERIFY_IS_EQUAL(
sum(i), std::complex<float>(2*i, 6*i));
44 for (
int i = 0; i < 3; ++i) {
45 VERIFY_IS_APPROX(abs1(i),
std::abs(data1(i)));
63 for (
int i = 0; i < 3; ++i) {
64 VERIFY_IS_APPROX(conj1(i),
std::conj(data1(i)));
65 VERIFY_IS_APPROX(conj2(i),
std::conj(data2(i)));
66 VERIFY_IS_APPROX(conj3(i), data3(i));
79 typedef Map<Matrix<std::complex<float>,
Dynamic, Dynamic>> MapXcf;
80 MapXcf m_left(t_left.
data(), 1500, 248);
81 MapXcf m_right(t_right.
data(), 248, 1400);
82 Matrix<std::complex<float>,
Dynamic, Dynamic> m_result(1500, 1400);
89 t_result = t_left.contract(t_right, dims);
90 m_result = m_left * m_right;
91 for (
int i = 0; i < t_result.
dimensions().TotalSize(); i++) {
92 VERIFY_IS_APPROX(t_result.
data()[i], m_result.data()[i]);
const AutoDiffScalar< DerType > & conj(const AutoDiffScalar< DerType > &x)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor< Scalar_, NumIndices_, Options_, IndexType_ > & setRandom()
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const AbsReturnType abs() const
A tensor expression mapping an existing array of data.
Tensor< float, 1 >::DimensionPair DimPair
static void test_contractions()
const mpreal sum(const mpreal tab[], const unsigned long int n, int &status, mp_rnd_t mode=mpreal::get_default_rnd())
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Abs2ReturnType abs2() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar * data()
static void test_additions()
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions & dimensions() const
static void test_conjugate()
void test_cxx11_tensor_of_complex()