primes = 1; % 1 pro generovani souboru prvocisel, jinak generuje pro velikosti 2^sizes

for sizes = 6:26;
    for versions = 1:5;
        primeSizes = [61 127 257 509 1021 2039 4093 8191 16381 32769 65537 131071 262147 524287 1048573 2097143 4194301 8388593 16777213];
        
        if primes == 1
        	SIZE = primeSizes(sizes-5);
            name = strcat('out_prime_', num2str(sizes), '_', num2str(versions), '.txt');
        else
        	SIZE = (2^sizes);
            name = strcat('out_2_', num2str(sizes), '_', num2str(versions), '.txt');
        end
        input = rand(1, SIZE) + 0i;
        out = fft(single(input));
        output = out;
        
        
        fprintf('Writing to file: %s\n', name);

        if exist(name, 'file') == 2
            delete(name);
        end

        fid = fopen(name, 'a');
        fwrite(fid, SIZE, 'int', 0, 'native');
        fprintf('Size written\n');
        fwrite(fid, real(input), 'single', 0, 'native');
        fprintf('Real Input written\n');
        fwrite(fid, imag(input), 'single', 0, 'native');
        fprintf('Imag Input written\n');
        fwrite(fid, real(output), 'single', 0, 'native');
        fprintf('Real Output written\n');
        fwrite(fid, imag(output), 'single', 0, 'native');
        fclose(fid);
    end
end