public static double[] lprefc2lpc(double[] k){
  int p=k.length;
  double[][] A=new double[p][];
  int i, j;
  for (i=1; i <= p; i++) {
    A[i - 1]=new double[i];
    A[i - 1][i - 1]=k[i - 1];
    for (j=1; j < i; j++)     A[i - 1][j - 1]=A[i - 2][j - 1] - k[i - 1] * A[i - 2][i - j - 1];
  }
  double[] oneMinusA=new double[p + 1];
  oneMinusA[0]=1.0;
  System.arraycopy(A[p - 1],0,oneMinusA,1,p);
  return oneMinusA;
}

public static double [ ] lprefc2lpc ( double [ ] k ) { int p = k . length ; double [ ] [ ] A = new double [ p ] [ ] ; int i , j ; for ( i = 1 ; i <= p ; i ++ ) { A [ i - 1 ] = new double [ i ] ; A [ i - 1 ] [ i - 1 ] = k [ i - 1 ] ; for ( j = 1 ; j < i ; j ++ ) A [ i - 1 ] [ j - 1 ] = A [ i - 2 ] [ j - 1 ] - k [ i - 1 ] * A [ i - 2 ] [ i - j - 1 ] ; } double [ ] oneMinusA = new double [ p + 1 ] ; oneMinusA [ 0 ] = 1.0 ; System . arraycopy ( A [ p - 1 ] , 0 , oneMinusA , 1 , p ) ; return oneMinusA ; }
converts from the reflection coefficients to the corresponding lpc coefficients .
