These functions are the miscellaneous functions needed for other functions

To go to the main program click here
To go to the index click here
To go to my page click here


#include 
#include 
#include 
#include "../optimal/globDefs.h"

/* sinc() */

real sinc(real x)
{
	real result;
	if(x==0.0)
	{
		result=sin(x)/x;
	}
	return(result);
}

/* sincSqrd()  */

real sincSqrd(real x)
{
	real result;
	if(x==0.0)
	{
		result=1.0;
	}
	else
	{
		result=sin(x)/x;
		result=result*result;
	}
	return(result);
}

void quantize(int n_coeff, logical type, real q_coeff[])
{
	int num, i;
	int temp;
	printf("\nInput the number of bits to quantize your coefficients to.\n");
	printf("The number of bits will automatically be subtracted by 1 to ensure accuracy\n\n\n");
	scanf("%d",&num);
	if (type)
	{
		for (i=0; i<=(n_coeff-1); i++)
		{
			q_coeff[i]*=pow(2,num);
			temp=q_coeff[i];
			if((q_coeff[i]/temp) >= .5)
				q_coeff[i]=(int)q_coeff[i]+1;
			else
				q_coeff[i] = (int)q_coeff[i];
		}
			

	}
}