@@ -13,14 +13,12 @@ TEST_CASE("lqmn TestLegendreFunctions.test_lqmn", "[lqmn][lqn][real][smoketest]"
1313 constexpr int m = 0 ;
1414 constexpr int n = 2 ;
1515 constexpr double x = 0.5 ;
16-
17- constexpr int m1p = m + 1 ;
18- constexpr int n1p = n + 1 ;
19- // lqmn requires buffer space for at least 2x2
20- constexpr int bufsize = std::max (2 , m1p) * std::max (2 , n1p);
16+ // `xsf::lqmn` requires the matrices to be at least 2x2
17+ constexpr int m1p = std::max (2 , m + 1 );
18+ constexpr int n1p = std::max (2 , n + 1 );
2119
2220 // lqmnf = special.lqmn(0, 2, .5)
23- double lqmnf0_data[bufsize ], lqmnf1_data[bufsize ];
21+ double lqmnf0_data[m1p * n1p ], lqmnf1_data[m1p * n1p ];
2422 auto lqmnf0 = std::mdspan (lqmnf0_data, m1p, n1p);
2523 auto lqmnf1 = std::mdspan (lqmnf1_data, m1p, n1p);
2624 xsf::lqmn (x, lqmnf0, lqmnf1);
@@ -95,21 +93,25 @@ TEST_CASE("lqmn TestLegendreFunctions.test_lqmn_gt1", "[lqmn][real][smoketest]")
9593TEST_CASE (" lqmn complex" , " [lqmn][complex][smoketest]" ) {
9694 constexpr double atol = 1e-16 ;
9795 constexpr double x = 0.5 ;
98- // lqmn requires buffer space for at least 2x2
99- constexpr int bufsize = 2 * 2 ;
96+
97+ constexpr int m = 0 ;
98+ constexpr int n = 0 ;
99+ // `xsf::lqmn` requires the matrices to be at least 2x2
100+ constexpr int m1p = std::max (2 , m + 1 );
101+ constexpr int n1p = std::max (2 , n + 1 );
100102
101103 // (q_mn, qp_mn) = lqmn(0, 0, 0.5)
102- double q_data[bufsize ], qp_data[bufsize ];
103- auto q_mn = std::mdspan (q_data, 1 , 1 );
104- auto qp_mn = std::mdspan (qp_data, 1 , 1 );
104+ double q_data[m1p * n1p ], qp_data[m1p * n1p ];
105+ auto q_mn = std::mdspan (q_data, m1p, n1p );
106+ auto qp_mn = std::mdspan (qp_data, m1p, n1p );
105107 xsf::lqmn (x, q_mn, qp_mn);
106108 auto q = q_mn (0 , 0 );
107109 auto qp = qp_mn (0 , 0 );
108110
109111 // (cq_mn, cqp_mn) = lqmn(0, 0, 0.5 + 0j)
110- std::complex <double > cq_data[bufsize ], cqp_data[bufsize ];
111- auto cq_mn = std::mdspan (cq_data, 1 , 1 );
112- auto cqp_mn = std::mdspan (cqp_data, 1 , 1 );
112+ std::complex <double > cq_data[m1p * n1p ], cqp_data[m1p * n1p ];
113+ auto cq_mn = std::mdspan (cq_data, m1p, n1p );
114+ auto cqp_mn = std::mdspan (cqp_data, m1p, n1p );
113115 xsf::lqmn (std::complex <double >(x, 0.0 ), cq_mn, cqp_mn);
114116 auto cq = cq_mn (0 , 0 );
115117 auto cqp = cqp_mn (0 , 0 );
0 commit comments