<commit_before>
#include "vexcl.h"
#include "tests.h"
vex::Context* VexCLTest::CreateContext() {
  ctx = new vex::Context(vex::Filter::Env && vex::Filter::DoublePrecision);
  return ctx;
}

 vex::vector<double> VexCLTest::ConvertVector(blaze::DynamicVector<double>& blaze_vec) {
   unsigned int num_rows = blaze_vec.size();

  std::vector<double> temp(num_rows);

  for (int i = 0; i < num_rows; i++) {
    temp[i] = blaze_vec[i];
  }

  vex::vector<double> vex_vec(*ctx, num_rows);
  vex::copy(temp, vex_vec);

  return vex_vec;
}

 vex::SpMat<double> VexCLTest::ConvertMatrix(CSR& data) {
   unsigned int & num_rows = data.num_rows;
   unsigned int & num_cols = data.num_cols;

  std::vector<size_t>& row = data.row;
  std::vector<size_t>& col = data.col;
  std::vector<double>& val = data.val;

  vex::SpMat<double> mat(*ctx, num_rows, num_cols, row.data(), col.data(), val.data());

  return mat;<commit_msg>Defined the WarmUp function with a simple vector addition code taken from a VexCL example<commit_after>
#include "vexcl.h"
#include "tests.h"
vex::Context* VexCLTest::CreateContext() {
  ctx = new vex::Context(vex::Filter::Env && vex::Filter::DoublePrecision);
  return ctx;
}

void VexCLTest::WarmUp(){

 // This code is taken from the VexCL demo
 const size_t N = 1024 * 1024;
 const size_t M = 1024;
 std::vector<double> A(N, 0);
 std::vector<double> B = random_vector<double>(N);
 std::vector<double> C = random_vector<double>(N);
 std::vector<double> D = random_vector<double>(N);
 vex::vector<double> a(*ctx, A);
 vex::vector<double> b(*ctx, B);
 vex::vector<double> c(*ctx, C);
 vex::vector<double> d(*ctx, D);
 a += b + c * d;

}

 vex::vector<double> VexCLTest::ConvertVector(blaze::DynamicVector<double>& blaze_vec) {
   unsigned int num_rows = blaze_vec.size();

  std::vector<double> temp(num_rows);

  for (int i = 0; i < num_rows; i++) {
    temp[i] = blaze_vec[i];
  }

  vex::vector<double> vex_vec(*ctx, num_rows);
  vex::copy(temp, vex_vec);

  return vex_vec;
}

 vex::SpMat<double> VexCLTest::ConvertMatrix(CSR& data) {
   unsigned int & num_rows = data.num_rows;
   unsigned int & num_cols = data.num_cols;

  std::vector<size_t>& row = data.row;
  std::vector<size_t>& col = data.col;
  std::vector<double>& val = data.val;

  vex::SpMat<double> mat(*ctx, num_rows, num_cols, row.data(), col.data(), val.data());

  return mat;
{'fraction_non_alphanumeric': 0.17534942820838628, 'fraction_numerical': 0.0063532401524777635, 'mean_word_length': 5.151041666666667, 'pattern_counts': {'":': 0, '<': 34, '<?xml version=': 0, '>': 32, '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': '1935625', 'n_tokens_mistral': 932, 'n_tokens_neox': 863, 'n_words': 194}