Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/xtensor/core/xassign.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ namespace xt

static constexpr bool simd_interface()
{
return has_simd_interface<E1, requested_value_type>()
return data_interface_expression<E1> && has_simd_interface<E1, requested_value_type>()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data_interface_expression is orthogonal to simd_interface and should not be required here. What is the current issue with SIMD assignment to xfunctor_view destination?

&& has_simd_interface<E2, requested_value_type>();
}

Expand Down
10 changes: 10 additions & 0 deletions test/test_xcomplex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,16 @@ namespace xt
EXPECT_EQ(a(4, 4), cmplx(-123.321L, -123.321L));
}

TEST(xcomplex, assign_to_real_part)
{
using cpx = std::complex<double>;
xt::xtensor<cpx, 1> a = {cpx(1, 2), cpx(3, 4), cpx(5, 6), cpx(7, 8), cpx(9, 10)};
xt::xtensor<double, 1> wr = {11, 12, 13, 14, 15};
xt::real(a) = wr;
xt::xtensor<cpx, 1> expected = {cpx(11, 2), cpx(12, 4), cpx(13, 6), cpx(14, 8), cpx(15, 10)};
EXPECT_EQ(a, expected);
}

TEST(xcomplex, build_from_double)
{
xt::xarray<double> r = {1., 2., 3.};
Expand Down
Loading