<commit_before>#include <cstdint>
#include <utility>

#define cimg_display 0
#include "CImg.h"
using namespace cimg_library;

#include "Buddha.h"

Buddha::Buddha(const Params & p, const std::size_t thread_vector_size)
  : thread_vector_size_(thread_vector_size) {
    x_size_ = p.width;
    y_size_ = p.width;
    radius_ = p.radius;
    num_threads_ = p.num_threads;
    max_iterations_ = p.max_iterations;

    if (max_iterations_ > thread_vector_size)
        throw MaxIterationsTooBigException();
}

Buddha::Params Buddha::get_empty_params() {
    Params p;
    p.num_threads = -1;
    return p;
}

void Buddha::run() {
    uint64_t part_size = x_size_ * y_size_ / num_threads_;

    for (std::size_t i = 0; i < num_threads_; ++i)
        threads_.emplace_back(&Buddha::worker, this, i * part_size, (i+1) * part_size);

    for (auto & t : threads_)
        t.join();

    render();<commit_msg>Initialize vector before use.<commit_after>#include <cstdint>
#include <utility>

#define cimg_display 0
#include "CImg.h"
using namespace cimg_library;

#include "Buddha.h"

Buddha::Buddha(const Params & p, const std::size_t thread_vector_size)
  : thread_vector_size_(thread_vector_size) {
    x_size_ = p.width;
    y_size_ = p.width;
    radius_ = p.radius;
    num_threads_ = p.num_threads;
    max_iterations_ = p.max_iterations;

    if (max_iterations_ > thread_vector_size)
        throw MaxIterationsTooBigException();

    data_ = std::vector<uint64_t>(x_size_ * y_size_);
}

Buddha::Params Buddha::get_empty_params() {
    Params p;
    p.num_threads = -1;
    return p;
}

void Buddha::run() {
    uint64_t part_size = x_size_ * y_size_ / num_threads_;

    for (std::size_t i = 0; i < num_threads_; ++i)
        threads_.emplace_back(&Buddha::worker, this, i * part_size, (i+1) * part_size);

    for (auto & t : threads_)
        t.join();

    render();
{'fraction_non_alphanumeric': 0.12533476164970542, 'fraction_numerical': 0.007498660953401178, 'mean_word_length': 3.7052896725440805, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4773729', 'n_tokens_mistral': 721, 'n_tokens_neox': 699, 'n_words': 145}