Skip to content

Commit

Permalink
Revert "BENCH: Add benchmarks for special.factorial/factorial2/factor…
Browse files Browse the repository at this point in the history
…ialk (#15664)" (#18853)

This reverts commit ef53758.
  • Loading branch information
h-vetinari committed Jul 10, 2023
1 parent 9302acd commit 0ffff14
Showing 1 changed file with 1 addition and 97 deletions.
98 changes: 1 addition & 97 deletions benchmarks/benchmarks/special.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,7 @@
from .common import Benchmark, with_attributes, safe_import

with safe_import():
from scipy.special import (
ai_zeros,
bi_zeros,
erf,
expn,
factorial,
factorial2,
factorialk,
)
from scipy.special import ai_zeros, bi_zeros, erf, expn
with safe_import():
# wasn't always in scipy.special, so import separately
from scipy.special import comb
Expand Down Expand Up @@ -73,91 +65,3 @@ def setup(self):

def time_expn_large_n(self):
expn(self.n, self.x)


class Factorial(Benchmark):
def setup(self, *args):
self.positive_ints = np.arange(10, 111, step=20, dtype=int)
self.negative_ints = -1 * self.positive_ints
self.positive_floats = np.linspace(100.2, 1000.8, num=10)
self.negative_floats = -1 * self.positive_floats

@with_attributes(params=[(100, 1000, 10000)],
param_names=['n'])
def time_factorial_exact_false_scalar_positive_int(self, n):
factorial(n, exact=False)

def time_factorial_exact_false_scalar_negative_int(self):
factorial(-10000, exact=False)

@with_attributes(params=[(100.8, 1000.3, 10000.5)],
param_names=['n'])
def time_factorial_exact_false_scalar_positive_float(self, n):
factorial(n, exact=False)

def time_factorial_exact_false_scalar_negative_float(self):
factorial(-10000.8, exact=False)

def time_factorial_exact_false_array_positive_int(self):
factorial(self.positive_ints, exact=False)

def time_factorial_exact_false_array_negative_int(self):
factorial(self.negative_ints, exact=False)

def time_factorial_exact_false_array_positive_float(self):
factorial(self.positive_floats, exact=False)

def time_factorial_exact_false_array_negative_float(self):
factorial(self.negative_floats, exact=False)

@with_attributes(params=[(100, 200, 400, 10_000, 20_000)],
param_names=['n'])
def time_factorial_exact_true_scalar_positive_int(self, n):
factorial(n, exact=True)

def time_factorial_exact_true_scalar_negative_int(self):
factorial(-10000, exact=True)

def time_factorial_exact_true_array_positive_int(self):
factorial(self.positive_ints, exact=True)

def time_factorial_exact_true_array_negative_int(self):
factorial(self.negative_ints, exact=True)


class Factorial2(Benchmark):
def setup(self, *args):
self.positive_ints = np.arange(100, 201, step=20, dtype=int)
self.negative_ints = -1 * self.positive_ints

@with_attributes(params=[(100, 200, 400)],
param_names=['n'])
def time_factorial2_exact_false_scalar_positive_int(self, n):
factorial2(n, exact=False)

def time_factorial2_exact_false_scalar_negative_int(self):
factorial2(-10000, exact=False)

def time_factorial2_exact_false_array_positive_int(self):
factorial2(self.positive_ints, exact=False)

def time_factorial2_exact_false_array_negative_int(self):
factorial2(self.negative_ints, exact=False)

@with_attributes(params=[(100, 200, 400, 10_000, 20_000)],
param_names=['n'])
def time_factorial2_exact_true_scalar_positive_int(self, n):
factorial2(n, exact=True)

def time_factorial2_exact_true_scalar_negative_int(self):
factorial2(-10000, exact=True)


class FactorialK(Benchmark):
@with_attributes(params=[(100, 500, 10_000, 20_000), (3, 6, 9)],
param_names=['n', 'k'])
def time_factorialk_exact_true_scalar_positive_int(self, n, k):
factorialk(n, k, exact=True)

def time_factorialk_exact_false_scalar_negative_int(self):
factorialk(-10000, 3, exact=True)

0 comments on commit 0ffff14

Please sign in to comment.