<commit_before>#ifndef __COGAPS_MATRIX_ELEMENT_H__
#define __COGAPS_MATRIX_ELEMENT_H__

#include "../utils/GapsAssert.h"
#include "../utils/GapsPrint.h"

#include <sstream>
#include <string>

inline bool containsNumber(const std::string &s)
{
    return !s.empty() && s.find_first_not_of("0123456789.-") == std::string::npos;
}

struct MatrixElement
{
    unsigned row;
    unsigned col;
    float value;

    MatrixElement(unsigned r, unsigned c, float v) // NOLINT
        : row(r), col(c), value(v)
    {}

    MatrixElement(unsigned r, unsigned c, const std::string &s) // NOLINT
        :  row(r), col(c), value(0.f)
    {
        std::stringstream ss(s);
        ss >> value;
        if (!containsNumber(s))
        {
            gaps_printf("\nError: Invalid entry found in input data: %s\n", s.c_str());
            gaps_stop();
        }
    }
};

#endif
<commit_msg>remove implementation from header now that it's in its own file<commit_after>#ifndef __COGAPS_MATRIX_ELEMENT_H__
#define __COGAPS_MATRIX_ELEMENT_H__

#include <string>

struct MatrixElement
{
    unsigned row;
    unsigned col;
    float value;

    MatrixElement(unsigned r, unsigned c, float v);
    MatrixElement(unsigned r, unsigned c, const std::string &s);
};

#endif // __COGAPS_MATRIX_ELEMENT_H__

{'fraction_non_alphanumeric': 0.12134831460674157, 'fraction_numerical': 0.008239700374531835, 'mean_word_length': 2.7954545454545454, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 8, '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': '795698', 'n_tokens_mistral': 479, 'n_tokens_neox': 453, 'n_words': 106}