www.pudn.com > lpc.zip > invert_i.c
/*****************************************************************
*
* INVERT Version 45G
*
*****************************************************************
*
* Invert a covariance matrix using Choleski decomposition method
*
* Inputs:
* ORDER - Analysis ORDER
* PHI(ORDER,ORDER) - Covariance matrix
* PSI(ORDER) - Column vector to be predicted
* Outputs:
* RC(ORDER) - Pseudo reflection coefficients
* Internal:
* V(ORDER,ORDER) - Temporary matrix
* X(ORDER) - Column scaling factors
*
* NOTE: Temporary matrix V is not needed and may be replaced
* by PHI if the original PHI values do not need to be preserved.
*/
#include "config.ch"
#include "lpcdefs.h"
#include "ourstuff.h"
invert_i(phi, psi, rc)
int_type phi[MAXORD][MAXORD], psi[];
int_type rc[MAXORD][AF];
{
int_type i, j, k;
static int_type save;
/* Decompose PHI into V * D * V' where V is a triangular matrix whose
* main diagonal elements are all 1, V' is the transpose of V, and
* D is a vector. Here D(n) is stored in location V(n,n). */
for(j=0;j>11)*save>>8);*/
/*printf("i:%d j:%d %d * %d= %x\n",i,j, phi[i][k], save, phi[i][k]*save);*/
/* printf("temp:%d %d phi:%d\n",temp, temp<<11, phi[i][j]);*/
phi[i][j] -= (((long_type)phi[i][k]*(long_type)save)>>8);
}
}
/* Compute intermediate results, which are similar to RC's */
if((int_type)phi[j][j] == 0 ) break;
rc[j][AF-1] = psi[j];
for(k=0;k>14);
/*printf("result: %d\n", rc[j][AF-1]<<14);*/
}
/*printf("\n");*/
/*printf("int j:%d rc:%d phi:%d ",j, rc[j][AF-1]<<14,phi[j][j]<<14);*/
rc[j][AF-1] = (rc[j][AF-1]<<14)/phi[j][j];
/*printf("result: %f\n", rc[j][AF-1]/4096.0);*/
rc[j][AF-1] = mmax(mmin(rc[j][AF-1],16367),-16367);
/*printf("rc: %f\n", rc[j][AF-1]/4096.0);*/
}
if(phi[j][j] == 0 ) {
/* Zero out higher order RC's if algorithm terminated early */
for(i=j;i