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);
159 codes.set_row(0, mseq1.
shift(N));
160 codes.set_row(1, mseq2.
shift(N));
162 for (
int i = 0;i < N;i++) {
163 codes.set_row(i + 2, codes.get_row(0) +
concat((codes.get_row(1)).right(i), (codes.get_row(1)).left(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))));