<commit_before>"""
Check the speed of the sparse solver.

"""
from __future__ import division, print_function, absolute_import

import time

import numpy as np
from numpy.testing import Tester, TestCase, assert_allclose, assert_equal

from scipy import linalg, sparse
from scipy.sparse.linalg import spsolve


def _create_sparse_poisson1d(n):
    # Make Gilbert Strang's favorite matrix
    # http://www-math.mit.edu/~gs/PIX/cupcakematrix.jpg
    P1d = sparse.diags([[-1]*(n-1), [2]*n, [-1]*(n-1)], [-1, 0, 1])
    assert_equal(P1d.shape, (n, n))
    return P1d


def _create_sparse_poisson2d(n):
    P1d = _create_sparse_poisson1d(n)
    P2d = sparse.kronsum(P1d, P1d)
    assert_equal(P2d.shape, (n*n, n*n))
    return P2d


class BenchmarkConjuateGradientSolver(TestCase):<commit_msg>MAINT: fix copypaste error in class name<commit_after>"""
Check the speed of the sparse solver.

"""
from __future__ import division, print_function, absolute_import

import time

import numpy as np
from numpy.testing import Tester, TestCase, assert_allclose, assert_equal

from scipy import linalg, sparse
from scipy.sparse.linalg import spsolve


def _create_sparse_poisson1d(n):
    # Make Gilbert Strang's favorite matrix
    # http://www-math.mit.edu/~gs/PIX/cupcakematrix.jpg
    P1d = sparse.diags([[-1]*(n-1), [2]*n, [-1]*(n-1)], [-1, 0, 1])
    assert_equal(P1d.shape, (n, n))
    return P1d


def _create_sparse_poisson2d(n):
    P1d = _create_sparse_poisson1d(n)
    P2d = sparse.kronsum(P1d, P1d)
    assert_equal(P2d.shape, (n*n, n*n))
    return P2d


class BenchmarkSparseLinearSolver(TestCase):
{'fraction_non_alphanumeric': 0.12210394489668128, 'fraction_numerical': 0.025046963055729492, 'mean_word_length': 4.453924914675768, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4149430', 'n_tokens_mistral': 645, 'n_tokens_neox': 614, 'n_words': 145}