Exemplo n.º 1
0
void ExperimentInput::process(std::vector<int> delays)
{
    chrono->start("Input");
    
    findNeededSamples(delays);

    generateNonZeroFrequencies();
    
    // if the problem is not off-grid, generate the signal using FFT
    if ( config->getSignalLengthOriginal() != config->getSignalLength() )
    {
        frequencyToTime();
    }
    else
    {
        frequencyToTimeUsingFFT(delays);
    }
    

    if (config->isNoisy())
    {
        addNoise();
    }
    for (auto t = neededSamples.cbegin(); t != neededSamples.cend(); ++t)
    {
        timeSignal[*t] /= sqrt((ffast_complex)config->getSignalLengthOriginal());
    }
    
    chrono->stop("Input");
}
Exemplo n.º 2
0
// This function generates the whole signal, it is not limited to the needed samples
void ExperimentInput::process()
{
    chrono->start("Input");

    for (int k = 0; k < config->getSignalLength(); k++)
    {
	   neededSamples.insert(k);
    }

    generateNonZeroFrequencies();

    frequencyToTime();

    if (config->isNoisy())
    {
        addNoise();
    }

    // scale the Fourier transform
    for (auto t = neededSamples.cbegin(); t != neededSamples.cend(); ++t)
    {
        timeSignal[*t] /= sqrt((ffast_complex)config->getSignalLengthOriginal());
    }

    if (config->isQuantized())
    {
        applyQuantization(config->getQuantizationBitsNb());
    }

    chrono->stop("Input");
}