From 1077fa4d772832f77a677ce7fb7c2d513b959e3f Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Thu, 10 May 2001 00:40:28 +0000 Subject: uClibc now has a math library. muahahahaha! -Erik --- libm/double/levnsn.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 libm/double/levnsn.c (limited to 'libm/double/levnsn.c') diff --git a/libm/double/levnsn.c b/libm/double/levnsn.c new file mode 100644 index 000000000..3fda5d6bd --- /dev/null +++ b/libm/double/levnsn.c @@ -0,0 +1,82 @@ +/* Levnsn.c */ +/* Levinson-Durbin LPC + * + * | R0 R1 R2 ... RN-1 | | A1 | | -R1 | + * | R1 R0 R1 ... RN-2 | | A2 | | -R2 | + * | R2 R1 R0 ... RN-3 | | A3 | = | -R3 | + * | ... | | ...| | ... | + * | RN-1 RN-2... R0 | | AN | | -RN | + * + * Ref: John Makhoul, "Linear Prediction, A Tutorial Review" + * Proc. IEEE Vol. 63, PP 561-580 April, 1975. + * + * R is the input autocorrelation function. R0 is the zero lag + * term. A is the output array of predictor coefficients. Note + * that a filter impulse response has a coefficient of 1.0 preceding + * A1. E is an array of mean square error for each prediction order + * 1 to N. REFL is an output array of the reflection coefficients. + */ + +#define abs(x) ( (x) < 0 ? -(x) : (x) ) + +int levnsn( n, r, a, e, refl ) +int n; +double r[], a[], e[], refl[]; +{ +int k, km1, i, kmi, j; +double ai, akk, err, err1, r0, t, akmi; +double *pa, *pr; + +for( i=0; i= err) )*/ + if( err1 < 1.0e-2 ) + return 0; + err = err1; + } + return 0; +} -- cgit v1.2.3