<commit_before># -*- coding: utf-8 -*-
#
import math
import numpy
import sympy


def check_degree_1d(
        quadrature, exact, exponents_creator, max_degree, tol=1.0e-14
        ):
    for degree in range(max_degree+1):
        val = quadrature(lambda x: x**degree)
        exact_val = exact(degree)
        # check relative error
        eps = numpy.finfo(float).eps
        # Allow 1e2 over machine precision.
        alpha = abs(exact_val) * tol + (1e2+tol+exact_val)*eps
        if abs(exact_val - val) > alpha:
            return degree - 1
    return max_degree


def check_degree(
        quadrature, exact, exponents_creator, max_degree, tol=1.0e-14
        ):
    for degree in range(max_degree+1):
        for k in exponents_creator(degree):
            val = quadrature(
                lambda x: sympy.prod([x[i]**k[i] for i in range(len(k))])
                )
            exact_val = exact(k)
            # check relative error
            # The allowance is quite large here, 1e5 over machine precision.
            # Some test fail if lowered, though.
            # TODO increase precision
            eps = numpy.finfo(float).eps
            alpha = abs(exact_val) * tol + (1.0e5+tol+exact_val)*eps
            if abs(exact_val - val) > alpha:<commit_msg>Revert "loosen tolerance on 1D a little bit"<commit_after># -*- coding: utf-8 -*-
#
import math
import numpy
import sympy


def check_degree_1d(
        quadrature, exact, exponents_creator, max_degree, tol=1.0e-14
        ):
    for degree in range(max_degree+1):
        val = quadrature(lambda x: x**degree)
        exact_val = exact(degree)
        # check relative error
        eps = numpy.finfo(float).eps
        # Allow 1e1 over machine precision.
        alpha = abs(exact_val) * tol + (1e1+tol+exact_val)*eps
        if abs(exact_val - val) > alpha:
            return degree - 1
    return max_degree


def check_degree(
        quadrature, exact, exponents_creator, max_degree, tol=1.0e-14
        ):
    for degree in range(max_degree+1):
        for k in exponents_creator(degree):
            val = quadrature(
                lambda x: sympy.prod([x[i]**k[i] for i in range(len(k))])
                )
            exact_val = exact(k)
            # check relative error
            # The allowance is quite large here, 1e5 over machine precision.
            # Some test fail if lowered, though.
            # TODO increase precision
            eps = numpy.finfo(float).eps
            alpha = abs(exact_val) * tol + (1.0e5+tol+exact_val)*eps
            if abs(exact_val - val) > alpha:
{'fraction_non_alphanumeric': 0.10003877471888328, 'fraction_numerical': 0.017448623497479644, 'mean_word_length': 2.042452830188679, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '2706621', 'n_tokens_mistral': 831, 'n_tokens_neox': 791, 'n_words': 220}