00001 // 00002 // author="Tony Kirke" 00003 // Copyright (c) 2001 Tony Kirke 00004 /* 00005 * SPUC - Signal processing using C++ - A DSP library 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2, or (at your option) 00010 * any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00020 */ 00021 #ifndef MLSD 00022 #define MLSD 00023 #include <complex.h> 00024 #include <delay.h> 00025 #include <fir_adapt.h> 00026 namespace SPUC { 00030 00031 00032 00033 class mlsd { 00034 public: 00035 fir_adapt < complex<double> > cfir; 00036 long num_taps; 00037 long n_states; 00038 long* path; 00039 double* weight; 00040 double* tmp_weight; 00041 long* tmp_path; 00042 00043 public: 00045 mlsd(char inf=3); 00047 ~mlsd() { 00048 delete [] tmp_path; 00049 delete [] tmp_weight; 00050 delete [] path; 00051 delete [] weight; 00052 } 00054 void reset() { 00055 cfir.reset(); 00056 } 00058 void update_taps_lms(complex<double> err) { 00059 cfir.update_lms(err); 00060 } 00061 complex<double> tap0(void) { return(cfir.coeff[0]); } 00063 complex<double> estimate(long seq); 00065 long seq_estimation(complex<double> y); 00066 }; 00067 } // namespace SPUC 00068 #endif