@@ -486,6 +486,25 @@ namespace xt
486486 EXPECT_TRUE (allclose (cel_1, std::get<1 >(cres)));
487487 EXPECT_EQ (cel_2, std::get<2 >(cres));
488488 EXPECT_TRUE (allclose (cel_3, std::get<3 >(cres)));
489+
490+ xarray<std::complex <float >> cfarg_0 = {{0 .f , 1 .f }, {1 .f - 3if, 1 .f }, {2 .f , 1 .f }, {3 .f , 1 .f }};
491+ xarray<std::complex <float >> cfarg_1 = {{-1 .f , 0 .2f + 4if, 0 .9f , 2 .1f - 1if}, {2 .f , 3if, 2 .f , 1 .f }};
492+ cfarg_1 = transpose (cfarg_1);
493+ auto cfres = xt::linalg::lstsq (cfarg_0, cfarg_1);
494+
495+ xarray<std::complex <float >, layout_type::column_major> cfel_0 = {
496+ {-0 .40425532f - 0 .38723404if, -0 .61702128f - 0 .44680851if},
497+ {1 .44680851f + 1 .02765957if, 2 .51063830f + 0 .95744681if}
498+ };
499+ xarray<float > cfel_1 = {16 .11787234f , 2 .68085106f };
500+ int cfel_2 = 2 ;
501+ xarray<float > cfel_3 = {5 .01295356f , 1 .36758789f };
502+
503+ EXPECT_TRUE (allclose (imag (cfel_0), imag (std::get<0 >(cfres))));
504+ EXPECT_TRUE (allclose (real (cfel_0), real (std::get<0 >(cfres))));
505+ EXPECT_TRUE (allclose (cfel_1, std::get<1 >(cfres)));
506+ EXPECT_EQ (cfel_2, std::get<2 >(cfres));
507+ EXPECT_TRUE (allclose (cfel_3, std::get<3 >(cfres)));
489508 }
490509
491510 TEST (xlinalg, trace)
0 commit comments