<commit_before>from Constants import QUADRATIC_FORWARD_RMS, CUBIC_FORWARD_RMS, DATA_EXT, DATA_PREC, EXACT_CUBIC_CONSTANT
from LoewnerRunFactory import LoewnerRunFactory
from numpy import square, mean, array, savetxt, absolute
from math import sqrt

class RootMeanSquaredError:

    def __init__(self, start_time, final_time, outer_points, inner_points, resolutions):

        # Set the time parameters for the root mean squared comparisons
        self.start_time = start_time
        self.final_time = final_time

        # Set the resolution for the root mean sqaured comparisons
        self.outer_points = outer_points
        self.inner_points = inner_points

        # Set the different resolutions that will be used to calculate the RMS
        self.resolutions = resolutions

        # Prevent the individual runs from compiling and saving plots and data
        dont_compile = False
        dont_save_data = False
        dont_save_plot = False

        # Create a LoewneRun factory for generaring LoewnerRuns that can be used to determine RMS
        self.rms_factory = LoewnerRunFactory(start_time,final_time,outer_points,inner_points,dont_compile,dont_save_plot,dont_save_data)

    def calculate_rms(self, array_a, array_b):

        diff = array_a - array_b
        return sqrt(mean(absolute(square(diff))))

    def quadratic_forward_error(self, points=None):

        # Create a list of driving functions that have an exact solution for the quadratic forward case
        exact_solutions = self.rms_factory.create_exact_quadratic_forward()

        # Use the resolutions that were created during class initialisation if no others are given
        if points == None:
            points = self.resolutions

        # Iterate through the exact solutions<commit_msg>slight change in root-mean-square error calculation<commit_after>from Constants import QUADRATIC_FORWARD_RMS, CUBIC_FORWARD_RMS, DATA_EXT, DATA_PREC, EXACT_CUBIC_CONSTANT
from LoewnerRunFactory import LoewnerRunFactory
from numpy import square, mean, array, savetxt, absolute
from math import sqrt

class RootMeanSquaredError:

    def __init__(self, start_time, final_time, outer_points, inner_points, resolutions):

        # Set the time parameters for the root mean squared comparisons
        self.start_time = start_time
        self.final_time = final_time

        # Set the resolution for the root mean sqaured comparisons
        self.outer_points = outer_points
        self.inner_points = inner_points

        # Set the different resolutions that will be used to calculate the RMS
        self.resolutions = resolutions

        # Prevent the individual runs from compiling and saving plots and data
        dont_compile = False
        dont_save_data = False
        dont_save_plot = False

        # Create a LoewneRun factory for generaring LoewnerRuns that can be used to determine RMS
        self.rms_factory = LoewnerRunFactory(start_time,final_time,outer_points,inner_points,dont_compile,dont_save_plot,dont_save_data)

    def calculate_rms(self, array_a, array_b):

        diff = array_a - array_b
        return sqrt(mean(square(absolute(diff))))

    def quadratic_forward_error(self, points=None):

        # Create a list of driving functions that have an exact solution for the quadratic forward case
        exact_solutions = self.rms_factory.create_exact_quadratic_forward()

        # Use the resolutions that were created during class initialisation if no others are given
        if points == None:
            points = self.resolutions

        # Iterate through the exact solutions
{'fraction_non_alphanumeric': 0.04560622914349277, 'fraction_numerical': 0.0, 'mean_word_length': 3.4850374064837903, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5923735', 'n_tokens_mistral': 1027, 'n_tokens_neox': 964, 'n_words': 326}