00001 // 00002 // author="Tony Kirke" 00003 // Copyright (c) 1993-1998 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 CRDC 00022 #define CRDC 00023 #include <math.h> 00024 #include <complex.h> 00025 namespace SPUC { 00034 00035 00036 00037 00038 00039 00040 00041 00042 class cordic 00043 { 00044 public: 00045 double* arctan_lut; 00046 complex<long>* stage; 00047 int stages; 00048 double vector_angle; 00050 cordic(int n=7); 00052 long vector_mag(complex <long> in) { 00053 vector(in); 00054 } 00056 double vector_arg(complex <long> in) { 00057 vector(in); 00058 return(vector_angle); 00059 } 00060 complex <long> rotate(complex <long> in, double angle); 00061 protected: 00063 complex<long> vector(complex <long> in); 00064 }; 00065 } // namespace SPUC 00066 #endif