Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

sequence.h

Go to the documentation of this file.
00001 // SPUC - Signal processing using C++ - A DSP library
00002 /*---------------------------------------------------------------------------*
00003  *                                   IT++                                    *
00004  *---------------------------------------------------------------------------*
00005  * Copyright (c) 1995-2001 by Tony Ottosson, Thomas Eriksson, Pål Frenger,   *
00006  * Tobias Ringström, and Jonas Samuelsson.                                   *
00007  *                                                                           *
00008  * Permission to use, copy, modify, and distribute this software and its     *
00009  * documentation under the terms of the GNU General Public License is hereby *
00010  * granted. No representations are made about the suitability of this        *
00011  * software for any purpose. It is provided "as is" without expressed or     *
00012  * implied warranty. See the GNU General Public License for more details.    *
00013  *---------------------------------------------------------------------------*/
00014 
00025 #ifndef __sequence_h
00026 #define __sequence_h
00027 
00028 #include <converters.h>
00029 #include <binary.h>
00030 #include <vector.h>
00031 #include <matrix.h>
00032 
00033 namespace SPUC {
00046 class LFSR {
00047 public:
00049     LFSR(void) {};
00051     LFSR(const bvec &connections);
00053     LFSR(const ivec &connections);
00055     void set_connections(const bvec &connections);
00057     void set_connections(const ivec &connections);
00059     void set_state(const bvec &state);
00061     void set_state(const ivec &state);
00063     bin shift(void);
00065     bvec shift(int no_shifts);
00067     int get_length(void);
00069     bvec get_state(void);
00070 private:
00071     bvec memory, Connections;
00072 };
00073 
00077 class Gold {
00078  public:
00085   Gold(int degree);
00087   Gold(const bvec &mseq1_connections, const bvec &mseq2_connections);
00089   Gold(const ivec &mseq1_connections, const ivec &mseq2_connections);
00091   void set_state(const bvec &state1, const bvec &state2);
00093   void set_state(const ivec &state1, const ivec &state2);
00095   bin shift(void);
00097   bvec shift(int no_shifts);
00099   int get_sequence_length(void);
00107   bmat get_family(void);
00108  private:
00109   int N;
00110   LFSR mseq1, mseq2;
00111 };
00112 
00113 // --------------- Inlines ---------------------
00114 inline bin LFSR::shift(void) {bin temp=memory*Connections;memory.shift_right(temp);return temp;}
00115 inline int LFSR::get_length(void) {return memory.size();}
00116 inline bvec LFSR::get_state(void) {return memory;}
00117 
00118 inline bin Gold::shift(void) {return (mseq1.shift()+mseq2.shift());}
00119 inline int Gold::get_sequence_length(void) {return N;}
00120 
00121 
00122 // --------------- Functions ---------------------
00123 
00130 smat wcdma_spreading_codes(int SF);
00131 }
00132 #endif // __sequence_h

Generated on Fri Sep 16 11:02:21 2005 for spuc by  doxygen 1.4.4