IT++
4.3.1
Toggle main menu visibility
itpp
comm
sequence.h
Go to the documentation of this file.
1
28
29
#ifndef SEQUENCE_H
30
#define SEQUENCE_H
31
32
#include <
itpp/base/vec.h
>
33
#include <
itpp/base/mat.h
>
34
#include <itpp/itexports.h>
35
36
namespace
itpp
37
{
38
53
class
ITPP_EXPORT
LFSR
54
{
55
public
:
57
LFSR
(
void
) {};
59
LFSR
(
const
bvec &connections);
61
LFSR
(
const
ivec &connections);
63
void
set_connections(
const
bvec &connections);
65
void
set_connections(
const
ivec &connections);
67
void
set_state(
const
bvec &state);
69
void
set_state(
const
ivec &state);
71
bin
shift(
void
);
73
bvec shift(
int
no_shifts);
75
int
get_length(
void
);
77
bvec get_state(
void
);
78
private
:
79
bvec memory, Connections;
80
};
81
86
class
ITPP_EXPORT
Gold
87
{
88
public
:
96
Gold
(
int
degree);
98
Gold
(
const
bvec &mseq1_connections,
const
bvec &mseq2_connections);
100
Gold
(
const
ivec &mseq1_connections,
const
ivec &mseq2_connections);
102
void
set_state
(
const
bvec &state1,
const
bvec &state2);
104
void
set_state
(
const
ivec &state1,
const
ivec &state2);
106
bin
shift
(
void
);
108
bvec
shift
(
int
no_shifts);
110
int
get_sequence_length
(
void
);
118
bmat
get_family
(
void
);
119
private
:
120
int
N;
121
LFSR
mseq1, mseq2;
122
};
123
124
// --------------- Inlines ---------------------
125
inline
bin
LFSR::shift
(
void
) {
bin
temp = memory * Connections;memory.shift_right(temp);
return
temp;}
126
inline
int
LFSR::get_length
(
void
) {
return
memory.size();}
127
inline
bvec
LFSR::get_state
(
void
) {
return
memory;}
128
129
inline
bin
Gold::shift
(
void
) {
return
(mseq1.shift() + mseq2.shift());}
130
inline
int
Gold::get_sequence_length
(
void
) {
return
N;}
131
132
133
// --------------- Functions ---------------------
134
142
ITPP_EXPORT smat
wcdma_spreading_codes
(
int
SF);
143
144
}
// namespace itpp
145
146
#endif
// #ifndef SEQUENCE_H
itpp::Gold::get_sequence_length
int get_sequence_length(void)
Returns the length (period) of a Gold-sequence.
Definition
sequence.h:130
itpp::Gold::Gold
Gold(int degree)
Class constructor.
Definition
sequence.cpp:86
itpp::Gold::set_state
void set_state(const bvec &state1, const bvec &state2)
Set state (contents in the shift registers) in bvec format.
Definition
sequence.cpp:130
itpp::Gold::shift
bin shift(void)
Shift one step and output binary symbol.
Definition
sequence.h:129
itpp::Gold::get_family
bmat get_family(void)
Returns the code family.
Definition
sequence.cpp:152
itpp::LFSR
Binary Linear Feedback Shift Register (LFSR).
Definition
sequence.h:54
itpp::LFSR::LFSR
LFSR(void)
Constructor.
Definition
sequence.h:57
itpp::LFSR::get_length
int get_length(void)
Return length of shift register.
Definition
sequence.h:126
itpp::LFSR::get_state
bvec get_state(void)
Returns the state of the shift register.
Definition
sequence.h:127
itpp::LFSR::shift
bin shift(void)
Shift one step and output binary symbol.
Definition
sequence.h:125
itpp::bin
Binary arithmetic (boolean) class.
Definition
binary.h:57
itpp::wcdma_spreading_codes
smat wcdma_spreading_codes(int SF)
Generates the OVSF (orthogonal variable spreading factor) spreading codes used in WCDMA.
Definition
sequence.cpp:168
mat.h
Matrix Class Definitions.
bmat
Mat< bin > bmat
bin matrix
Definition
mat.h:508
itpp
itpp namespace
Definition
itmex.h:37
vec.h
Templated Vector Class Definitions.
Generated by
1.17.0