84 sample_count = _sample_count;
85 dict_source = _dict_source;
87 max_scalar_product = 0;
95 max_scalar_product = 0;
107 max_scalar_product = 0;
116 ChirpAtom::ChirpAtom() {}
120 ChirpAtom::~ChirpAtom() {}
126 VectorXd atomValues =
create_real(sample_count, scale, translation, modulation, phase);
127 QStringList atomStringValues;
128 for(qint32 i = 0; i < atomValues.rows(); i++)
129 atomStringValues.append(QString(
"%1").arg(atomValues[i]));
130 return atomStringValues;
137 VectorXd gauss = VectorXd::Zero(sample_count);
139 for(qint32 n = 0; n < sample_count; n++)
141 qreal t = (qreal(n) - translation) / scale;
142 gauss[n] = exp(-PI * pow(t, 2))*pow(sqrt(scale),(-1))*pow(qreal(2),(0.25));
152 VectorXcd complex_atom(sample_count);
157 if(scale == sample_count && translation == floor(sample_count / 2))
158 for(qint32 i = 0; i < sample_count; i++)
159 complex_atom[i] = std::polar(1 / sqrt(qreal(sample_count)), 2 * PI * modulation / qreal(sample_count) * qreal(i));
163 for(qint32 i = 0; i < sample_count; i++)
165 qreal t = (qreal(i) - qreal(translation)) / qreal(scale);
166 complex_atom[i] = std::polar(1 / sqrt(sample_count) * pow(2.0, 0.25) * exp( -PI * pow(t, 2.0))
167 , 2 * PI * modulation / qreal(sample_count) * qreal(i));
171 for(qint32 i = 0; i < sample_count; i++)
172 norm_atom += pow(abs(complex_atom[i]), 2.0);
174 norm_atom = sqrt(norm_atom);
177 for(qint32 i = 0; i < sample_count; i++)
178 complex_atom[i] = complex_atom[i] / norm_atom;
187 VectorXd real_atom(sample_count);
190 if(scale == sample_count)
191 for(qint32 i = 0; i < sample_count; i++)
192 real_atom[i] = 1 / sqrt(sample_count) * cos( 2 * PI * modulation / sample_count * qreal(i) + phase);
196 for(qint32 i = 0; i < sample_count; i++)
197 real_atom[i] = envelope[i] * cos(2 * PI * modulation / sample_count * qreal(i) + phase);
201 norm = real_atom.norm();
202 if(norm != 0) real_atom /= norm;
209 VectorXd ChirpAtom::gauss_function (qint32 sample_count, qreal scale, quint32 translation)
211 VectorXd gauss = VectorXd::Zero(sample_count);
213 for(qint32 n = 0; n < sample_count; n++)
215 qreal t = (qreal(n) - translation) / scale;
216 gauss[n] = exp(-PI * pow(t, 2)) * pow(sqrt(scale), (-1)) * pow(qreal(2),(0.25));
224 VectorXd ChirpAtom::create_real(qint32 sample_count, qreal scale, quint32 translation, qreal modulation, qreal phase, qreal chirp)
226 VectorXd real_atom(sample_count);
230 if(scale == sample_count)
231 for(qint32 i = 0; i < sample_count; i++)
232 real_atom[i] = 1 / sqrt(sample_count) * cos( 2 * PI * modulation / sample_count * qreal(i) +(chirp / (sample_count * qreal(2))) * pow(qreal(i) - qreal(translation), 2) + phase);
236 for(qint32 i = 0; i < sample_count; i++)
237 real_atom[i] = envelope[i] * cos(2 * PI * modulation / sample_count * qreal(i) + (chirp / (sample_count * qreal(2))) * pow(qreal(i) - qreal(translation), 2) + phase);
241 norm = real_atom.norm();
242 if(norm != 0) real_atom /= norm;
249 QStringList ChirpAtom::create_string_values(qint32 sample_count, qreal scale, quint32 translation, qreal modulation, qreal phase, qreal chirp)
251 VectorXd atomValues = create_real(sample_count, scale, translation, modulation, phase, chirp);
252 QStringList atomStringValues;
253 for(qint32 i = 0; i < atomValues.rows(); i++)
254 atomStringValues.append(QString(
"%1").arg(atomValues[i]));
255 return atomStringValues;
static VectorXd gauss_function(qint32 sample_count, qreal scale, quint32 translation)
VectorXcd create_complex(qint32 sample_count, qreal scale, quint32 translation, qreal modulation)
VectorXd create_real(qint32 sample_count, qreal scale, quint32 translation, qreal modulation, qreal phase)
QStringList create_string_values(qint32 sample_count, qreal scale, qint32 translation, qreal modulation, qreal phase)
ATOM class declaration, providing core features and parameters of Atoms used in Matching Pursiut Algo...