[eigen] Assignment to a TensorRef<Tensor<std::complex<float>, 2>>?

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]



I would like to take a function that takes a TensorRef<Tensor<std::complex<float>, 2>> as an argument (I will be passing in a .chip() from a 3D tensor).


However, this gives me the following error (where `output` is the TensorRef variable):


[build] ../redacted.cpp:XXX:XX: error: no viable overloaded '='

[build]       output(i, j) = other_tensor(x, y, z);

[build]       ~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~

[build] /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/complex:324:28: note: candidate function (the implicit copy assignment operator) not viable: 'this' argument has type 'const Eigen::TensorRef<Eigen::Tensor<std::__1::complex<float>, 2, 0, long> >::Scalar' (aka 'const std::__1::complex<float>'), but method is not marked const

[build] class _LIBCPP_TEMPLATE_VIS complex<float>

[build]                            ^

[build] /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/complex:351:60: note: candidate function template not viable: 'this' argument has type 'const Eigen::TensorRef<Eigen::Tensor<std::__1::complex<float>, 2, 0, long> >::Scalar' (aka 'const std::__1::complex<float>'), but method is not marked const

[build]     template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator= (const complex<_Xp>& __c)

[build]                                                            ^

[build] /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/complex:324:28: note: candidate function (the implicit move assignment operator) not viable: 'this' argument has type 'const Eigen::TensorRef<Eigen::Tensor<std::__1::complex<float>, 2, 0, long> >::Scalar' (aka 'const std::__1::complex<float>'), but method is not marked const

[build] class _LIBCPP_TEMPLATE_VIS complex<float>

[build]                            ^

[build] /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/complex:344:40: note: candidate function not viable: 'this' argument has type 'const Eigen::TensorRef<Eigen::Tensor<std::__1::complex<float>, 2, 0, long> >::Scalar' (aka 'const std::__1::complex<float>'), but method is not marked const

[build]     _LIBCPP_INLINE_VISIBILITY complex& operator= (float __re)


It looks to me like the compiler is only picking up the const version of the coefficient access, rather than the non-const one. Is there something I can do to push it in the right direction?

This is with an up-to-date version of Apple Clang and Eigen master branch.


Best wishes,


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/