00001 /* 00002 * SPUC - Signal processing using C++ - A DSP library 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2, or (at your option) 00007 * any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00017 */ 00018 namespace SPUC { 00021 // 00023 //: <font color="red"><i>Under construction!</i></font> 00024 template <class T> T levdur(T* R) 00025 { 00026 T a(R); 00027 T Pe; 00028 T q, at; 00029 int N = R.size(); 00030 int j,k,l; 00031 00032 a[0]=1.0; 00033 a[1]=-R[1]/R[0]; 00034 Pe=R[0]*(1-a[1]*a[1]); 00035 for (j=2;j<=N;j++){ 00036 for (q=R[j],l=1;l<=j-1;l++) q += a[l]*R[j-1]; 00037 q=-q/Pe; 00038 for (k=1;k<=j/2;k++){ 00039 at=a[k]+q*a[j-k]; 00040 a[j-k]+=q*a[k]; 00041 a[k]=at; 00042 } 00043 a[j]=q; 00044 Pe*=(1-q*q); 00045 } 00046 return(a); 00047 } 00048 } 00049