<commit_before>#include "catch.hpp"

#include "etl/fast_matrix.hpp"
#include "etl/fast_vector.hpp"

TEST_CASE( "dim/fast_matrix_1", "dim<1>" ) {
    etl::fast_matrix<double, 2, 3> a({1.0, -2.0, 4.0, 3.0, 0.5, -0.1});
    etl::fast_vector<double, 3> b(etl::dim<1>(a, 0));
    etl::fast_vector<double, 3> c(etl::dim<1>(a, 1));

    REQUIRE(etl_traits<remove_cv_t<remove_reference_t<decltype(b)>>>::is_fast);
    REQUIRE(etl_traits<remove_cv_t<remove_reference_t<decltype(c)>>>::is_fast);

    REQUIRE(b[0] == 1.0);
    REQUIRE(b[1] == -2.0);
    REQUIRE(b[2] == 4.0);

    REQUIRE(c[0] == 3.0);
    REQUIRE(c[1] == 0.5);
    REQUIRE(c[2] == -0.1);
}

TEST_CASE( "dim/fast_matrix_2", "dim<2>" ) {
    etl::fast_matrix<double, 2, 3> a({1.0, -2.0, 4.0, 3.0, 0.5, -0.1});
    etl::fast_vector<double, 2> b(etl::dim<2>(a, 0));
    etl::fast_vector<double, 2> c(etl::dim<2>(a, 1));
    etl::fast_vector<double, 2> d(etl::dim<2>(a, 2));

    REQUIRE(etl_traits<remove_cv_t<remove_reference_t<decltype(b)>>>::is_fast);
    REQUIRE(etl_traits<remove_cv_t<remove_reference_t<decltype(c)>>>::is_fast);
    REQUIRE(etl_traits<remove_cv_t<remove_reference_t<decltype(d)>>>::is_fast);

    REQUIRE(b[0] == 1.0);
    REQUIRE(b[1] == 3.0);

    REQUIRE(c[0] == -2.0);
    REQUIRE(c[1] == 0.5);

    REQUIRE(d[0] == 4.0);
    REQUIRE(d[1] == -0.1);
}

TEST_CASE( "dim/fast_matrix_3", "row" ) {
    etl::fast_matrix<double, 2, 3> a({1.0, -2.0, 4.0, 3.0, 0.5, -0.1});
    etl::fast_vector<double, 3> b(etl::row(a, 0));
    etl::fast_vector<double, 3> c(etl::row(a, 1));

    REQUIRE(etl_traits<remove_cv_t<remove_reference_t<decltype(b)>>>::is_fast);
    REQUIRE(etl_traits<remove_cv_t<remove_reference_t<decltype(c)>>>::is_fast);

    REQUIRE(b[0] == 1.0);
    REQUIRE(b[1] == -2.0);
    REQUIRE(b[2] == 4.0);

    REQUIRE(c[0] == 3.0);
    REQUIRE(c[1] == 0.5);
    REQUIRE(c[2] == -0.1);
}

TEST_CASE( "dim/fast_matrix_4", "col" ) {
    etl::fast_matrix<double, 2, 3> a({1.0, -2.0, 4.0, 3.0, 0.5, -0.1});
    etl::fast_vector<double, 2> b(etl::col(a, 0));
    etl::fast_vector<double, 2> c(etl::col(a, 1));
    etl::fast_vector<double, 2> d(etl::col(a, 2));

    REQUIRE(etl_traits<remove_cv_t<remove_reference_t<decltype(b)>>>::is_fast);
    REQUIRE(etl_traits<remove_cv_t<remove_reference_t<decltype(c)>>>::is_fast);
    REQUIRE(etl_traits<remove_cv_t<remove_reference_t<decltype(d)>>>::is_fast);

    REQUIRE(b[0] == 1.0);
    REQUIRE(b[1] == 3.0);

    REQUIRE(c[0] == -2.0);
    REQUIRE(c[1] == 0.5);

    REQUIRE(d[0] == 4.0);
    REQUIRE(d[1] == -0.1);
}<commit_msg>Add test on dyn matrix<commit_after>#include "catch.hpp"

#include "etl/fast_matrix.hpp"
#include "etl/fast_vector.hpp"
#include "etl/dyn_matrix.hpp"
#include "etl/dyn_vector.hpp"

TEST_CASE( "dim/fast_matrix_1", "dim<1>" ) {
    etl::fast_matrix<double, 2, 3> a({1.0, -2.0, 4.0, 3.0, 0.5, -0.1});
    etl::fast_vector<double, 3> b(etl::dim<1>(a, 0));
    etl::fast_vector<double, 3> c(etl::dim<1>(a, 1));

    REQUIRE(etl_traits<remove_cv_t<remove_reference_t<decltype(b)>>>::is_fast);
    REQUIRE(etl_traits<remove_cv_t<remove_reference_t<decltype(c)>>>::is_fast);

    REQUIRE(b[0] == 1.0);
    REQUIRE(b[1] == -2.0);
    REQUIRE(b[2] == 4.0);

    REQUIRE(c[0] == 3.0);
    REQUIRE(c[1] == 0.5);
    REQUIRE(c[2] == -0.1);
}

TEST_CASE( "dim/fast_matrix_2", "dim<2>" ) {
    etl::fast_matrix<double, 2, 3> a({1.0, -2.0, 4.0, 3.0, 0.5, -0.1});
    etl::fast_vector<double, 2> b(etl::dim<2>(a, 0));
    etl::fast_vector<double, 2> c(etl::dim<2>(a, 1));
    etl::fast_vector<double, 2> d(etl::dim<2>(a, 2));

    REQUIRE(etl_traits<remove_cv_t<remove_reference_t<decltype(b)>>>::is_fast);
    REQUIRE(etl_traits<remove_cv_t<remove_reference_t<decltype(c)>>>::is_fast);
    REQUIRE(etl_traits<remove_cv_t<remove_reference_t<decltype(d)>>>::is_fast);

    REQUIRE(b[0] == 1.0);
    REQUIRE(b[1] == 3.0);

    REQUIRE(c[0] == -2.0);
    REQUIRE(c[1] == 0.5);

    REQUIRE(d[0] == 4.0);
    REQUIRE(d[1] == -0.1);
}

TEST_CASE( "dim/fast_matrix_3", "row" ) {
    etl::fast_matrix<double, 2, 3> a({1.0, -2.0, 4.0, 3.0, 0.5, -0.1});
    etl::fast_vector<double, 3> b(etl::row(a, 0));
    etl::fast_vector<double, 3> c(etl::row(a, 1));

    REQUIRE(etl_traits<remove_cv_t<remove_reference_t<decltype(b)>>>::is_fast);
    REQUIRE(etl_traits<remove_cv_t<remove_reference_t<decltype(c)>>>::is_fast);

    REQUIRE(b[0] == 1.0);
    REQUIRE(b[1] == -2.0);
    REQUIRE(b[2] == 4.0);

    REQUIRE(c[0] == 3.0);
    REQUIRE(c[1] == 0.5);
    REQUIRE(c[2] == -0.1);
}

TEST_CASE( "dim/fast_matrix_4", "col" ) {
    etl::fast_matrix<double, 2, 3> a({1.0, -2.0, 4.0, 3.0, 0.5, -0.1});
    etl::fast_vector<double, 2> b(etl::col(a, 0));
    etl::fast_vector<double, 2> c(etl::col(a, 1));
    etl::fast_vector<double, 2> d(etl::col(a, 2));

    REQUIRE(etl_traits<remove_cv_t<remove_reference_t<decltype(b)>>>::is_fast);
    REQUIRE(etl_traits<remove_cv_t<remove_reference_t<decltype(c)>>>::is_fast);
    REQUIRE(etl_traits<remove_cv_t<remove_reference_t<decltype(d)>>>::is_fast);

    REQUIRE(b[0] == 1.0);
    REQUIRE(b[1] == 3.0);

    REQUIRE(c[0] == -2.0);
    REQUIRE(c[1] == 0.5);

    REQUIRE(d[0] == 4.0);
    REQUIRE(d[1] == -0.1);
}

TEST_CASE( "dim/dyn_matrix_1", "dim<1>" ) {
    etl::dyn_matrix<double> a(2, 3, {1.0, -2.0, 4.0, 3.0, 0.5, -0.1});
    etl::dyn_vector<double> b(etl::dim<1>(a, 0));
    etl::dyn_vector<double> c(etl::dim<1>(a, 1));

    REQUIRE(!etl_traits<remove_cv_t<remove_reference_t<decltype(b)>>>::is_fast);
    REQUIRE(!etl_traits<remove_cv_t<remove_reference_t<decltype(c)>>>::is_fast);

    REQUIRE(b[0] == 1.0);
    REQUIRE(b[1] == -2.0);
    REQUIRE(b[2] == 4.0);

    REQUIRE(c[0] == 3.0);
    REQUIRE(c[1] == 0.5);
    REQUIRE(c[2] == -0.1);
}

TEST_CASE( "dim/dyn_matrix_2", "dim<2>" ) {
    etl::dyn_matrix<double> a(2, 3, {1.0, -2.0, 4.0, 3.0, 0.5, -0.1});
    etl::dyn_vector<double> b(etl::dim<2>(a, 0));
    etl::dyn_vector<double> c(etl::dim<2>(a, 1));
    etl::dyn_vector<double> d(etl::dim<2>(a, 2));

    REQUIRE(!etl_traits<remove_cv_t<remove_reference_t<decltype(b)>>>::is_fast);
    REQUIRE(!etl_traits<remove_cv_t<remove_reference_t<decltype(c)>>>::is_fast);
    REQUIRE(!etl_traits<remove_cv_t<remove_reference_t<decltype(d)>>>::is_fast);

    REQUIRE(b[0] == 1.0);
    REQUIRE(b[1] == 3.0);

    REQUIRE(c[0] == -2.0);
    REQUIRE(c[1] == 0.5);

    REQUIRE(d[0] == 4.0);
    REQUIRE(d[1] == -0.1);
}
{'fraction_non_alphanumeric': 0.24651963084623807, 'fraction_numerical': 0.06194274988268419, 'mean_word_length': 4.418644067796611, 'pattern_counts': {'":': 0, '<': 134, '<?xml version=': 0, '>': 134, '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': '1250250', 'n_tokens_mistral': 3447, 'n_tokens_neox': 3167, 'n_words': 380}