49 int N = connections.size() - 1;
50 memory.set_size(N,
true);
51 Connections = connections.right(N);
56 bvec temp =
oct2bin(connections);
57 int N = temp.size() - 1;
58 memory.set_size(N,
true);
59 Connections = temp.right(N);
64 it_assert(state.length() == memory.size(),
"LFSR::set_state(): dimension mismatch");
71 it_assert(temp.length() >= memory.size(),
"LFSR::set_state(): dimension mismatch");
72 memory = temp.right(memory.size());
77 it_assert(no_shifts > 0,
"LFSR::shift(): shift must be positive");
79 for (
int i = 0;i < no_shifts;i++) {
88 bvec mseq1_connections, mseq2_connections;
91 mseq1_connections = bvec(
"1 0 1 0 0 1");
92 mseq2_connections = bvec(
"1 0 1 1 1 1");
95 mseq1_connections = bvec(
"1 0 0 1 0 0 0 1");
96 mseq2_connections = bvec(
"1 1 1 1 0 0 0 1");
99 mseq1_connections = bvec(
"1 1 1 0 0 1 1 1 1");
100 mseq2_connections = bvec(
"1 1 0 0 0 0 1 1 1");
103 mseq1_connections = bvec(
"1 0 0 0 1 0 0 0 0 1");
104 mseq2_connections = bvec(
"1 0 0 1 1 0 1 0 0 1");
107 it_error(
"This degree of Gold sequence is not available");
114 Gold::Gold(
const bvec &mseq1_connections,
const bvec &mseq2_connections)
116 it_assert(mseq1_connections.size() == mseq2_connections.size(),
"Gold::Gold(): dimension mismatch");
122 Gold::Gold(
const ivec &mseq1_connections,
const ivec &mseq2_connections)
144 it_assert(no_shifts > 0,
"Gold::shift(): shift must be positive");
145 bvec temp(no_shifts);
146 for (
int i = 0;i < no_shifts;i++) {
154 bmat codes(N + 2, N);
162 for (
int i = 0;i < N;i++) {
170 it_assert((SF == 1) || (SF == 2) || (SF == 4) || (SF == 8) || (SF == 16) || (SF == 32) || (SF == 64) || (SF == 128) || (SF == 256) || (SF == 512),
171 "wcdma_spreading_codes: SF must equal 1, 2, 4, 8, 16, 32, 64, 128, 256, or 512");
174 codes(0, 0) = short(1);
178 smat prev_codes(SF / 2, SF / 2);
180 for (i = 0; i < SF / 2; i++) {
181 codes.set_row(2*i,
concat(prev_codes.get_row(i), prev_codes.get_row(i)));
182 codes.set_row(2*i + 1,
concat(prev_codes.get_row(i), (-prev_codes.get_row(i))));
Vec< Num_T > get_row(int r) const
Get row r.
Definitions of binary sequence classes and functions.
bin shift(void)
Shift one step and output binary symbol.
Gold(int degree)
Class constructor.
#define it_assert(t, s)
Abort if t is not true.
Logarithmic and exponenential functions - header file.
Definitions of converters between different vector and matrix types.
bin shift(void)
Shift one step and output binary symbol.
int pow2i(int x)
Calculate two to the power of x (2^x); x is integer.
void set_row(int r, const Vec< Num_T > &v)
Set row r to vector v.
smat wcdma_spreading_codes(int SF)
Generates the OVSF (orthogonal variable spreading factor) spreading codes used in WCDMA...
ITPP_EXPORT bvec dec2bin(int length, int index)
Convert a decimal int index to bvec using length bits in the representation.
bmat get_family(void)
Returns the code family.
#define it_error(s)
Abort unconditionally.
int get_length(void)
Return length of shift register.
ITPP_EXPORT bvec oct2bin(const ivec &octalindex, short keepzeros=0)
Convert ivec of octal form to bvec.
void set_state(const bvec &state1, const bvec &state2)
Set state (contents in the shift registers) in bvec format.
void set_state(const bvec &state)
Set state (contents in the shift registers) in bvec format.
void set_connections(const bvec &connections)
Input connect_polynomial=1+g1*D+g2*D^2+...+gr*D^r in bvec format [g0,g1,...,gr].
const Array< T > concat(const Array< T > &a, const T &e)
Append element e to the end of the Array a.