<commit_before>#ifndef CONVERTERS_HPP_QNX3RWUJ
#define CONVERTERS_HPP_QNX3RWUJ

#include <stdexcept>
#include <memory>

#include <Spark/SparseMatrix.hpp>
#include <Eigen/Sparse>
#include <Spark/SparseMatrix.hpp>
#include <boost/numeric/ublas/io.hpp>

namespace spark {
  namespace converters {

    using EigenSparseMatrix = std::unique_ptr<Eigen::SparseMatrix<double, Eigen::RowMajor, int32_t>>;

    // convert a Spark COO matrix to an Eigen Sparse Matrix
    inline EigenSparseMatrix tripletToEigen(spark::sparse::SparkCooMatrix<double> mat) {
      auto coo = mat.data;
      EigenSparseMatrix m(new Eigen::SparseMatrix<double, Eigen::RowMajor, int32_t>(mat.n, mat.m));
      std::vector<Eigen::Triplet<double>> trips;
      for (size_t i = 0; i < coo.size(); i++)
        trips.push_back(
            Eigen::Triplet<double>(
              std::get<0>(coo[i]),
              std::get<1>(coo[i]),
              std::get<2>(coo[i])));
      m->setFromTriplets(trips.begin(), trips.end());
      return m;
    }

    inline Eigen::VectorXd stdvectorToEigen(std::vector<double> v) {
      Eigen::VectorXd m(v.size());
      for (size_t i = 0; i < v.size(); i++)
        m[i] = v[i];
      return m;
    }<commit_msg>Remove final instance of ublas. Close #2<commit_after>#ifndef CONVERTERS_HPP_QNX3RWUJ
#define CONVERTERS_HPP_QNX3RWUJ

#include <stdexcept>
#include <memory>

#include <Spark/SparseMatrix.hpp>
#include <Eigen/Sparse>
#include <Spark/SparseMatrix.hpp>

namespace spark {
  namespace converters {

    using EigenSparseMatrix = std::unique_ptr<Eigen::SparseMatrix<double, Eigen::RowMajor, int32_t>>;

    // convert a Spark COO matrix to an Eigen Sparse Matrix
    inline EigenSparseMatrix tripletToEigen(spark::sparse::SparkCooMatrix<double> mat) {
      auto coo = mat.data;
      EigenSparseMatrix m(new Eigen::SparseMatrix<double, Eigen::RowMajor, int32_t>(mat.n, mat.m));
      std::vector<Eigen::Triplet<double>> trips;
      for (size_t i = 0; i < coo.size(); i++)
        trips.push_back(
            Eigen::Triplet<double>(
              std::get<0>(coo[i]),
              std::get<1>(coo[i]),
              std::get<2>(coo[i])));
      m->setFromTriplets(trips.begin(), trips.end());
      return m;
    }

    inline Eigen::VectorXd stdvectorToEigen(std::vector<double> v) {
      Eigen::VectorXd m(v.size());
      for (size_t i = 0; i < v.size(); i++)
        m[i] = v[i];
      return m;
    }
{'fraction_non_alphanumeric': 0.14993804213135067, 'fraction_numerical': 0.00950020652622883, 'mean_word_length': 3.4197080291970803, 'pattern_counts': {'":': 0, '<': 40, '<?xml version=': 0, '>': 38, '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': '6691278', 'n_tokens_mistral': 914, 'n_tokens_neox': 870, 'n_words': 170}