21#ifndef levinsonRecursion_hpp
22#define levinsonRecursion_hpp
28template <
typename floatT>
29void levinsonRecursion( floatT *_r, floatT *_x, floatT *_y,
int n )
33 floatT pp, pt1, pt2, qq, qt1, qt2, sd, sgd, sgn, shn, sxn;
40 floatT *g, *
h, *_g, *_h;
44 std::cerr <<
"toeplz-1 singular principal minor" <<
"\n";
63 g[1] = r[n - 1] / r[n];
65 h[1] = r[n + 1] / r[n];
67 for( m = 1; m <= n; ++m )
74 for( j = 1; j <= m; ++j )
76 sxn += r[n + m1 - j] * x[j];
77 sd += r[n + m1 - j] * g[m - j + 1];
82 std::cerr <<
"toeplz-2 singular principal minor" <<
"\n";
91 for( j = 1; j <= m; ++j )
92 x[j] -= x[m1] * g[m - j + 1];
107 for( j = 1; j <= m; ++j )
109 sgn += r[n + j - m1] * g[j];
110 shn += r[n + m1 - j] *
h[j];
111 sgd += r[n + j - m1] *
h[m - j + 1];
114 if( sd == 0.0 || sgd == 0.0 )
116 std::cerr <<
"toeplz-3 singular principal minor" <<
"\n";
130 for( j = 1; j <= m2; ++j )
136 g[j] = pt1 - pp * qt2;
137 g[
k] = pt2 - pp * qt1;
138 h[j] = qt1 - qq * pt2;
139 h[
k--] = qt2 - qq * pt1;
143 std::cerr <<
"toeplz - should not arrive here!" <<
"\n";
constexpr units::realT h()
Planck Constant.
constexpr units::realT k()
Boltzmann Constant.