<commit_before>from __future__ import absolute_import, division, print_function

import numpy as np

from pymor.discreteoperators import project_operator


class GenericRBReconstructor(object):

    def __init__(self, RB):
        self.RB = RB

    def reconstruct(self, U):
        return np.dot(U, self.RB)


class GenericRBReductor(object):

    def __init__(self, discretization, product=None):
        self.discretization = discretization
        self.product = product

    def reduce(self, RB):
        rd = self.discretization.copy()
        for k, op in rd.operators.iteritems():
            rd.operators[k] = project_operator(op, RB, product=self.product)
        rc = GenericRBReconstructor(RB)
        return rd, rc<commit_msg>[reductors.basic] inherit from BasicInterface<commit_after>from __future__ import absolute_import, division, print_function

import numpy as np

import pymor.core as core
from pymor.discreteoperators import project_operator


class GenericRBReconstructor(core.BasicInterface):

    def __init__(self, RB):
        self.RB = RB

    def reconstruct(self, U):
        return np.dot(U, self.RB)


class GenericRBReductor(core.BasicInterface):

    def __init__(self, discretization, product=None):
        self.discretization = discretization
        self.product = product

    def reduce(self, RB):
        rd = self.discretization.copy()
        for k, op in rd.operators.iteritems():
            rd.operators[k] = project_operator(op, RB, product=self.product)
        rc = GenericRBReconstructor(RB)
        return rd, rc
{'fraction_non_alphanumeric': 0.088348271446863, 'fraction_numerical': 0.0, 'mean_word_length': 3.31767955801105, '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': '96026', 'n_tokens_mistral': 480, 'n_tokens_neox': 448, 'n_words': 118}