/* LPC_and_Polynomial.c */
/* David Weenink, 20000621 */

#include "LPC_and_Polynomial.h"

Polynomial LPC_Frame_to_Polynomial (LPC_Frame me)
{
	Polynomial thee; long i, degree = (long) my nCoefficients;

	if ((thee = Polynomial_create (-1, 1, degree)) == NULL) return NULL;

	for (i=1; i <= degree; i++)
	{
		thy coefficients[i] = my a[degree - i + 1];
	}
	thy coefficients[degree + 1] = 1;
	return thee;
}

Polynomial LPC_to_Polynomial (LPC me, double time)
{
	long iFrame = Sampled_xToIndex (me, time);
	
	if (iFrame < 1 || iFrame > my nx) return NULL;
	return LPC_Frame_to_Polynomial (&my frame[iFrame]);
}

/* End of file LPC_and_Polynomial.c */
