xtensor-stack / xtensor-blas

BLAS extension to xtensor
BSD 3-Clause "New" or "Revised" License
155 stars 54 forks source link

`linalg::norm` not working (does not compile) for `std::complex<float>` #206

Closed hansenms closed 2 years ago

hansenms commented 2 years ago

The linalg::norm(...) function does not build with with std::complex<float>. It does work with std::complex<double>,

To repro, add the following test:

TEST(xblas, normCplxFloat) {
  xt::xarray<std::complex<float>> a = {std::complex<float>({1., 2.}), std::complex<float>({3., 4.})};
  auto res = linalg::norm(a);

  EXPECT_NEAR(res.real(), 5.4772, 1e-3);
  EXPECT_NEAR(res.imag(), 0.0, 1e-3);
}

with double instead of the float it does build (and pass). This is similar to #128, but I think that one was fixed.

SylvainCorlay commented 2 years ago

Thank you for the report. Looking into it!

DerThorsten commented 2 years ago

The issue seems to be a wrong signature in FLENS cxxlapack. https://github.com/xtensor-stack/xtensor-blas/pull/207 fixes this by patching the xtensor-blas shipped flens

hansenms commented 2 years ago

I can confirm that this works now. Thanks!