repo
stringlengths
2
99
file
stringlengths
13
225
code
stringlengths
0
18.3M
file_length
int64
0
18.3M
avg_line_length
float64
0
1.36M
max_line_length
int64
0
4.26M
extension_type
stringclasses
1 value
scipy
scipy-main/tools/wheels/check_license.py
#!/usr/bin/env python """ check_license.py [MODULE] Check the presence of a LICENSE.txt in the installed module directory, and that it appears to contain text prevalent for a SciPy binary distribution. """ import os import sys import io import re import argparse def check_text(text): ok = "Copyright (c)" in tex...
1,227
20.54386
79
py
scipy
scipy-main/benchmarks/benchmarks/test_functions.py
import time import numpy as np from numpy import sin, cos, pi, exp, sqrt, abs from scipy.optimize import rosen class SimpleQuadratic: def fun(self, x): return np.dot(x, x) def der(self, x): return 2. * x def hess(self, x): return 2. * np.eye(x.size) class AsymmetricQuadratic:...
8,342
25.235849
79
py
scipy
scipy-main/benchmarks/benchmarks/optimize_lap.py
from concurrent.futures import ThreadPoolExecutor, wait import numpy as np from .common import Benchmark, safe_import with safe_import(): from scipy.optimize import linear_sum_assignment from scipy.spatial.distance import cdist def random_uniform(shape): return np.random.uniform(-20, 20, shape) def ra...
1,956
27.362319
76
py
scipy
scipy-main/benchmarks/benchmarks/cython_special.py
import re import numpy as np from scipy import special from .common import with_attributes, safe_import with safe_import(): from scipy.special import cython_special FUNC_ARGS = { 'airy_d': (1,), 'airy_D': (1,), 'beta_dd': (0.25, 0.75), 'erf_d': (1,), 'erf_D': (1+1j,), 'exprel_d': (1e-6,)...
1,956
26.56338
76
py
scipy
scipy-main/benchmarks/benchmarks/lsq_problems.py
"""Benchmark problems for nonlinear least squares.""" import inspect import sys import numpy as np from numpy.polynomial.chebyshev import Chebyshev from scipy.integrate import odeint class LSQBenchmarkProblem: """Template class for nonlinear least squares benchmark problems. The optimized variable is n-dime...
17,304
34.461066
80
py
scipy
scipy-main/benchmarks/benchmarks/stats_sampling.py
import numpy as np from .common import Benchmark, safe_import with safe_import(): from scipy import stats with safe_import(): from scipy.stats import sampling with safe_import(): from scipy import special # Beta distribution with a = 2, b = 3 class contdist1: def __init__(self): self.mode = 1...
8,743
27.115756
79
py
scipy
scipy-main/benchmarks/benchmarks/fft_basic.py
""" Test functions for fftpack.basic module """ from numpy import arange, asarray, zeros, dot, exp, pi, double, cdouble from numpy.random import rand import numpy as np from concurrent import futures import os import scipy.fftpack import numpy.fft from .common import Benchmark, safe_import with safe_import() as exc: ...
10,009
27.197183
85
py
scipy
scipy-main/benchmarks/benchmarks/special.py
import numpy as np from .common import Benchmark, with_attributes, safe_import with safe_import(): 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 with safe_import(): from scipy.special im...
1,576
22.191176
67
py
scipy
scipy-main/benchmarks/benchmarks/cluster.py
import numpy as np from numpy.testing import suppress_warnings from .common import Benchmark, safe_import with safe_import(): from scipy.cluster.hierarchy import linkage from scipy.cluster.vq import kmeans, kmeans2, vq class HierarchyLinkage(Benchmark): params = ['single', 'complete', 'average', 'weight...
1,784
25.641791
76
py
scipy
scipy-main/benchmarks/benchmarks/sparse_csgraph.py
"""benchmarks for the scipy.sparse.csgraph module""" import numpy as np import scipy.sparse from .common import Benchmark, safe_import with safe_import(): from scipy.sparse.csgraph import laplacian class Laplacian(Benchmark): params = [ [30, 300, 900], ['dense', 'coo', 'csc', 'csr', 'dia'], ...
867
27
78
py
scipy
scipy-main/benchmarks/benchmarks/linalg.py
import math import numpy.linalg as nl import numpy as np from numpy.testing import assert_ from numpy.random import rand from .common import Benchmark, safe_import with safe_import(): import scipy.linalg as sl def random(size): return rand(*size) class Bench(Benchmark): params = [ [20, 100, ...
7,306
28.345382
93
py
scipy
scipy-main/benchmarks/benchmarks/ndimage_interpolation.py
import numpy as np from .common import Benchmark try: from scipy.ndimage import (geometric_transform, affine_transform, rotate, zoom, shift, map_coordinates) except ImportError: pass def shift_func_2d(c): return (c[0] - 0.5, c[1] - 0.5) def shift_func_3d(c): return (...
2,227
31.289855
79
py
scipy
scipy-main/benchmarks/benchmarks/stats.py
import warnings import numpy as np from .common import Benchmark, safe_import, is_xslow with safe_import(): import scipy.stats as stats with safe_import(): from scipy.stats._distr_params import distcont, distdiscrete try: # builtin lib from itertools import compress except ImportError: pass class ...
26,280
34.371467
98
py
scipy
scipy-main/benchmarks/benchmarks/peak_finding.py
"""Benchmarks for peak finding related functions.""" from .common import Benchmark, safe_import with safe_import(): from scipy.signal import find_peaks, peak_prominences, peak_widths from scipy.datasets import electrocardiogram class FindPeaks(Benchmark): """Benchmark `scipy.signal.find_peaks`. Not...
1,523
26.214286
75
py
scipy
scipy-main/benchmarks/benchmarks/optimize_milp.py
import os import numpy as np from numpy.testing import assert_allclose from .common import Benchmark, safe_import with safe_import(): from scipy.optimize import milp with safe_import(): from scipy.optimize.tests.test_linprog import magic_square # MIPLIB 2017 benchmarks included with permission of the auth...
2,427
30.947368
78
py
scipy
scipy-main/benchmarks/benchmarks/linalg_solve_toeplitz.py
"""Benchmark the solve_toeplitz solver (Levinson recursion) """ import numpy as np from .common import Benchmark, safe_import with safe_import(): import scipy.linalg class SolveToeplitz(Benchmark): params = ( ('float64', 'complex128'), (100, 300, 1000), ('toeplitz', 'generic') ) ...
1,102
25.261905
65
py
scipy
scipy-main/benchmarks/benchmarks/sparse.py
""" Simple benchmarks for the sparse module """ import warnings import time import timeit import pickle import numpy import numpy as np from numpy import ones, array, asarray, empty from .common import Benchmark, safe_import with safe_import(): from scipy import sparse from scipy.sparse import (coo_matrix, d...
14,747
29.471074
96
py
scipy
scipy-main/benchmarks/benchmarks/sparse_linalg_onenormest.py
"""Compare the speed of exact one-norm calculation vs. its estimation. """ import numpy as np from .common import Benchmark, safe_import with safe_import(): import scipy.sparse import scipy.special # import cycle workaround for some versions import scipy.sparse.linalg class BenchmarkOneNormEst(Benchmar...
1,883
32.052632
115
py
scipy
scipy-main/benchmarks/benchmarks/sparse_linalg_solve.py
""" Check the speed of the conjugate gradient solver. """ import numpy as np from numpy.testing import assert_equal from .common import Benchmark, safe_import with safe_import(): from scipy import linalg, sparse from scipy.sparse.linalg import cg, minres, gmres, tfqmr, spsolve with safe_import(): from sci...
2,078
27.094595
85
py
scipy
scipy-main/benchmarks/benchmarks/sparse_csgraph_maxflow.py
import numpy as np import scipy.sparse from .common import Benchmark, safe_import with safe_import(): from scipy.sparse.csgraph import maximum_flow class MaximumFlow(Benchmark): params = [[200, 500, 1500], [0.1, 0.3, 0.5]] param_names = ['n', 'density'] def setup(self, n, density): # Create...
714
30.086957
77
py
scipy
scipy-main/benchmarks/benchmarks/signal.py
from itertools import product import numpy as np from .common import Benchmark, safe_import with safe_import(): import scipy.signal as signal class Resample(Benchmark): # Some slow (prime), some fast (in radix) param_names = ['N', 'num'] params = [[977, 9973, 2 ** 14, 2 ** 16]] * 2 def setup(s...
6,839
26.46988
77
py
scipy
scipy-main/benchmarks/benchmarks/cluster_hierarchy_disjoint_set.py
import numpy as np try: from scipy.cluster.hierarchy import DisjointSet except ImportError: pass from .common import Benchmark class Bench(Benchmark): params = [[100, 1000, 10000]] param_names = ['n'] def setup(self, n): # Create random edges rng = np.random.RandomState(seed=0) ...
1,653
26.566667
55
py
scipy
scipy-main/benchmarks/benchmarks/signal_filtering.py
import numpy as np import timeit from concurrent.futures import ThreadPoolExecutor, wait from .common import Benchmark, safe_import with safe_import(): from scipy.signal import (lfilter, firwin, decimate, butter, sosfilt, medfilt2d) class Decimate(Benchmark): param_names = ['q'...
3,044
28
82
py
scipy
scipy-main/benchmarks/benchmarks/sparse_linalg_lobpcg.py
from functools import partial import numpy as np from .common import Benchmark, safe_import with safe_import(): from scipy import array, r_, ones, arange, sort, diag, cos, rand, pi from scipy.linalg import eigh, orth, cho_factor, cho_solve import scipy.sparse from scipy.sparse.linalg import lobpcg ...
3,646
31.5625
93
py
scipy
scipy-main/benchmarks/benchmarks/integrate.py
import numpy as np from .common import Benchmark, safe_import from scipy.integrate import quad with safe_import(): import ctypes import scipy.integrate._test_multivariate as clib_test from scipy._lib import _ccallback_c with safe_import() as exc: from scipy import LowLevelCallable from_cython = L...
3,261
27.365217
90
py
scipy
scipy-main/benchmarks/benchmarks/linalg_sqrtm.py
""" Benchmark linalg.sqrtm for various blocksizes. """ import numpy as np from .common import Benchmark, safe_import with safe_import(): import scipy.linalg class Sqrtm(Benchmark): params = [ ['float64', 'complex128'], [64, 256], [32, 64, 256] ] param_names = ['dtype', 'n', ...
776
21.852941
67
py
scipy
scipy-main/benchmarks/benchmarks/optimize.py
import os import time import inspect import json import traceback from collections import defaultdict import numpy as np from . import test_functions as funcs from . import go_benchmark_functions as gbf from .common import Benchmark, is_xslow, safe_import from .lsq_problems import extract_lsq_problems with safe_impo...
21,806
34.172581
102
py
scipy
scipy-main/benchmarks/benchmarks/io_matlab.py
from .common import set_mem_rlimit, run_monitored, get_mem_info import os import tempfile from io import BytesIO import numpy as np from .common import Benchmark, safe_import with safe_import(): from scipy.io import savemat, loadmat class MemUsage(Benchmark): param_names = ['size', 'compressed'] timeou...
3,221
26.775862
83
py
scipy
scipy-main/benchmarks/benchmarks/common.py
""" Airspeed Velocity benchmark utilities """ import sys import os import re import time import textwrap import subprocess import itertools import random class Benchmark: """ Base class with sensible options """ pass def is_xslow(): try: return int(os.environ.get('SCIPY_XSLOW', '0')) ...
5,643
23.754386
76
py
scipy
scipy-main/benchmarks/benchmarks/sparse_linalg_svds.py
import os import numpy as np from .common import Benchmark, safe_import with safe_import(): from scipy.sparse.linalg import svds class BenchSVDS(Benchmark): # Benchmark SVD using the MatrixMarket test matrices recommended by the # author of PROPACK at http://sun.stanford.edu/~rmunk/PROPACK/ params = ...
1,053
33
75
py
scipy
scipy-main/benchmarks/benchmarks/optimize_qap.py
import numpy as np from .common import Benchmark, safe_import import os with safe_import(): from scipy.optimize import quadratic_assignment # XXX this should probably have an is_xslow with selected tests. # Even with this, it takes ~30 seconds to collect the ones to run # (even if they will all be skipped in the...
2,852
45.016129
78
py
scipy
scipy-main/benchmarks/benchmarks/sparse_csgraph_dijkstra.py
"""benchmarks for the scipy.sparse.csgraph module""" import numpy as np import scipy.sparse from .common import Benchmark, safe_import with safe_import(): from scipy.sparse.csgraph import dijkstra class Dijkstra(Benchmark): params = [ [30, 300, 900], [True, False], ['random', 'star']...
1,452
32.790698
76
py
scipy
scipy-main/benchmarks/benchmarks/__init__.py
import numpy as np import random np.random.seed(1234) random.seed(1234)
73
11.333333
20
py
scipy
scipy-main/benchmarks/benchmarks/spatial.py
import numpy as np from .common import Benchmark, LimitedParamBenchmark, safe_import with safe_import(): from scipy.spatial import cKDTree, KDTree with safe_import(): from scipy.spatial import distance with safe_import(): from scipy.spatial import ConvexHull, Voronoi with safe_import(): from scipy.spa...
16,940
34.29375
108
py
scipy
scipy-main/benchmarks/benchmarks/linalg_logm.py
""" Benchmark linalg.logm for various blocksizes. """ import numpy as np from .common import Benchmark, safe_import with safe_import(): import scipy.linalg class Logm(Benchmark): params = [ ['float64', 'complex128'], [64, 256], ['gen', 'her', 'pos'] ] param_names = ['dtype', ...
785
20.833333
49
py
scipy
scipy-main/benchmarks/benchmarks/optimize_linprog.py
import os import numpy as np from numpy.testing import suppress_warnings from .common import Benchmark, is_xslow, safe_import with safe_import(): from scipy.optimize import linprog, OptimizeWarning with safe_import(): from scipy.optimize.tests.test_linprog import lpgen_2d, magic_square with safe_import(): ...
8,116
34.291304
79
py
scipy
scipy-main/benchmarks/benchmarks/fftpack_pseudo_diffs.py
""" Benchmark functions for fftpack.pseudo_diffs module """ from numpy import arange, sin, cos, pi, exp, tanh, sign from .common import Benchmark, safe_import with safe_import(): from scipy.fftpack import diff, fft, ifft, tilbert, hilbert, shift, fftfreq def direct_diff(x, k=1, period=None): fx = fft(x) ...
2,237
21.836735
79
py
scipy
scipy-main/benchmarks/benchmarks/optimize_zeros.py
from math import sqrt, exp, cos, sin import numpy as np from .common import Benchmark, safe_import # Import testing parameters with safe_import(): from scipy.optimize._tstutils import methods, mstrings, functions, fstrings from scipy.optimize import newton # newton predates benchmarks class Zeros(Benchmark): ...
3,776
31.282051
79
py
scipy
scipy-main/benchmarks/benchmarks/sparse_csgraph_matching.py
import numpy as np import scipy.sparse from scipy.spatial.distance import cdist from .common import Benchmark, safe_import with safe_import(): from scipy.sparse.csgraph import maximum_bipartite_matching,\ min_weight_full_bipartite_matching class MaximumBipartiteMatching(Benchmark): params = [[5000,...
3,047
34.44186
95
py
scipy
scipy-main/benchmarks/benchmarks/sparse_linalg_expm.py
"""benchmarks for the scipy.sparse.linalg._expm_multiply module""" import math import numpy as np from .common import Benchmark, safe_import with safe_import(): import scipy.linalg from scipy.sparse.linalg import expm as sp_expm from scipy.sparse.linalg import expm_multiply def random_sparse_csr(m, n, n...
2,246
29.364865
74
py
scipy
scipy-main/benchmarks/benchmarks/sparse_matrix_power.py
from .common import Benchmark, safe_import with safe_import(): from scipy.sparse import random class BenchMatrixPower(Benchmark): params = [ [0, 1, 2, 3, 8, 9], [1000], [1e-6, 1e-3], ] param_names = ['x', 'N', 'density'] def setup(self, x: int, N: int, density: float): ...
465
22.3
64
py
scipy
scipy-main/benchmarks/benchmarks/blas_lapack.py
import numpy as np from .common import Benchmark, safe_import with safe_import(): import scipy.linalg.blas as bla class GetBlasLapackFuncs(Benchmark): """ Test the speed of grabbing the correct BLAS/LAPACK routine flavor. In particular, upon receiving strange dtype arrays the results shouldn't d...
1,015
29.787879
87
py
scipy
scipy-main/benchmarks/benchmarks/interpolate.py
import numpy as np from .common import run_monitored, set_mem_rlimit, Benchmark, safe_import with safe_import(): from scipy.stats import spearmanr with safe_import(): import scipy.interpolate as interpolate class Leaks(Benchmark): unit = "relative increase with repeats" def track_leaks(self): ...
14,152
31.092971
121
py
scipy
scipy-main/benchmarks/benchmarks/linprog_benchmark_files/__init__.py
# -*- coding: utf-8 -*- """ ============================================================================== `` -- Problems for testing linear programming routines ============================================================================== This module provides a comprehensive set of problems for benchmarking linear ...
671
31
78
py
scipy
scipy-main/benchmarks/benchmarks/tests/test_go_benchmark_functions.py
""" Unit tests for the global optimization benchmark functions """ import numpy as np from .. import go_benchmark_functions as gbf import inspect class TestGoBenchmarkFunctions: def setup_method(self): bench_members = inspect.getmembers(gbf, inspect.isclass) self.benchmark_functions = {it[0]:it[1...
2,650
33.428571
77
py
scipy
scipy-main/benchmarks/benchmarks/tests/__init__.py
0
0
0
py
scipy
scipy-main/benchmarks/benchmarks/go_benchmark_functions/go_funcs_C.py
# -*- coding: utf-8 -*- import numpy as np from numpy import (abs, asarray, cos, exp, floor, pi, sign, sin, sqrt, sum, size, tril, isnan, atleast_2d, repeat) from numpy.testing import assert_almost_equal from .go_benchmark import Benchmark class CarromTable(Benchmark): r""" CarromTable obj...
18,458
30.880829
108
py
scipy
scipy-main/benchmarks/benchmarks/go_benchmark_functions/go_funcs_M.py
# -*- coding: utf-8 -*- from numpy import (abs, asarray, cos, exp, log, arange, pi, prod, sin, sqrt, sum, tan) from .go_benchmark import Benchmark, safe_import with safe_import(): from scipy.special import factorial class Matyas(Benchmark): r""" Matyas objective function. This cl...
20,910
28.043056
82
py
scipy
scipy-main/benchmarks/benchmarks/go_benchmark_functions/go_funcs_B.py
# -*- coding: utf-8 -*- from numpy import abs, cos, exp, log, arange, pi, sin, sqrt, sum from .go_benchmark import Benchmark class BartelsConn(Benchmark): r""" Bartels-Conn objective function. The BartelsConn [1]_ global optimization problem is a multimodal minimization problem defined as follows: ...
21,664
27.506579
80
py
scipy
scipy-main/benchmarks/benchmarks/go_benchmark_functions/go_funcs_Y.py
# -*- coding: utf-8 -*- from numpy import abs, sum, cos, pi from .go_benchmark import Benchmark class YaoLiu04(Benchmark): r""" Yao-Liu 4 objective function. This class defines the Yao-Liu function 4 [1]_ global optimization problem. This is a multimodal minimization problem defined as follows: ...
2,881
29.989247
84
py
scipy
scipy-main/benchmarks/benchmarks/go_benchmark_functions/go_funcs_H.py
# -*- coding: utf-8 -*- import numpy as np from numpy import abs, arctan2, asarray, cos, exp, arange, pi, sin, sqrt, sum from .go_benchmark import Benchmark class Hansen(Benchmark): r""" Hansen objective function. This class defines the Hansen [1]_ global optimization problem. This is a multimodal m...
11,278
28.99734
80
py
scipy
scipy-main/benchmarks/benchmarks/go_benchmark_functions/go_funcs_Q.py
# -*- coding: utf-8 -*- from numpy import abs, sum, arange, sqrt from .go_benchmark import Benchmark class Qing(Benchmark): r""" Qing objective function. This class defines the Qing [1]_ global optimization problem. This is a multimodal minimization problem defined as follows: .. math:: ...
3,859
29.634921
80
py
scipy
scipy-main/benchmarks/benchmarks/go_benchmark_functions/go_funcs_L.py
# -*- coding: utf-8 -*- from numpy import sum, cos, exp, pi, arange, sin from .go_benchmark import Benchmark class Langermann(Benchmark): r""" Langermann objective function. This class defines the Langermann [1]_ global optimization problem. This is a multimodal minimization problem defined as follo...
9,861
28.975684
184
py
scipy
scipy-main/benchmarks/benchmarks/go_benchmark_functions/go_funcs_I.py
# -*- coding: utf-8 -*- from numpy import sin, sum from .go_benchmark import Benchmark class Infinity(Benchmark): r""" Infinity objective function. This class defines the Infinity [1]_ global optimization problem. This is a multimodal minimization problem defined as follows: .. math:: ...
1,115
25.571429
77
py
scipy
scipy-main/benchmarks/benchmarks/go_benchmark_functions/go_funcs_T.py
# -*- coding: utf-8 -*- from numpy import abs, asarray, cos, exp, arange, pi, sin, sum, atleast_2d from .go_benchmark import Benchmark class TestTubeHolder(Benchmark): r""" TestTubeHolder objective function. This class defines the TestTubeHolder [1]_ global optimization problem. This is a multimodal...
12,710
31.592308
82
py
scipy
scipy-main/benchmarks/benchmarks/go_benchmark_functions/go_funcs_G.py
# -*- coding: utf-8 -*- import numpy as np from numpy import abs, sin, cos, exp, floor, log, arange, prod, sqrt, sum from .go_benchmark import Benchmark class Gear(Benchmark): r""" Gear objective function. This class defines the Gear [1]_ global optimization problem. This is a multimodal minimizati...
6,489
28.103139
81
py
scipy
scipy-main/benchmarks/benchmarks/go_benchmark_functions/go_funcs_W.py
# -*- coding: utf-8 -*- from numpy import atleast_2d, arange, sum, cos, exp, pi from .go_benchmark import Benchmark class Watson(Benchmark): r""" Watson objective function. This class defines the Watson [1]_ global optimization problem. This is a unimodal minimization problem defined as follows: ...
9,789
29.216049
79
py
scipy
scipy-main/benchmarks/benchmarks/go_benchmark_functions/go_funcs_univariate.py
# -*- coding: utf-8 -*- from numpy import cos, exp, log, pi, sin, sqrt from .go_benchmark import Benchmark, safe_import with safe_import(): try: from scipy.special import factorial # new except ImportError: from scipy.misc import factorial # old #-------------------------------------------...
16,917
22.175342
104
py
scipy
scipy-main/benchmarks/benchmarks/go_benchmark_functions/go_funcs_R.py
# -*- coding: utf-8 -*- from numpy import abs, sum, sin, cos, asarray, arange, pi, exp, log, sqrt from scipy.optimize import rosen from .go_benchmark import Benchmark class Rana(Benchmark): r""" Rana objective function. This class defines the Rana [1]_ global optimization problem. This is a multimod...
12,436
29.408313
85
py
scipy
scipy-main/benchmarks/benchmarks/go_benchmark_functions/go_funcs_S.py
# -*- coding: utf-8 -*- from numpy import (abs, asarray, cos, floor, arange, pi, prod, roll, sin, sqrt, sum, repeat, atleast_2d, tril) from numpy.random import uniform from .go_benchmark import Benchmark class Salomon(Benchmark): r""" Salomon objective function. This class defines the...
40,893
28.915143
83
py
scipy
scipy-main/benchmarks/benchmarks/go_benchmark_functions/go_funcs_N.py
# -*- coding: utf-8 -*- from numpy import cos, sqrt, sin, abs from .go_benchmark import Benchmark class NeedleEye(Benchmark): r""" NeedleEye objective function. This class defines the Needle-Eye [1]_ global optimization problem. This is a a multimodal minimization problem defined as follows: .....
4,127
26.52
84
py
scipy
scipy-main/benchmarks/benchmarks/go_benchmark_functions/go_funcs_X.py
# -*- coding: utf-8 -*- import numpy as np from numpy import abs, sum, sin, cos, pi, exp, arange, prod, sqrt from .go_benchmark import Benchmark class XinSheYang01(Benchmark): r""" Xin-She Yang 1 objective function. This class defines the Xin-She Yang 1 [1]_ global optimization problem. This is a mu...
7,769
31.107438
79
py
scipy
scipy-main/benchmarks/benchmarks/go_benchmark_functions/go_funcs_E.py
# -*- coding: utf-8 -*- from numpy import abs, asarray, cos, exp, arange, pi, sin, sqrt, sum from .go_benchmark import Benchmark class Easom(Benchmark): r""" Easom objective function. This class defines the Easom [1]_ global optimization problem. This is a a multimodal minimization problem defined a...
9,797
31.12459
97
py
scipy
scipy-main/benchmarks/benchmarks/go_benchmark_functions/go_funcs_V.py
# -*- coding: utf-8 -*- from numpy import sum, cos, sin, log from .go_benchmark import Benchmark class VenterSobiezcczanskiSobieski(Benchmark): r""" Venter Sobiezcczanski-Sobieski objective function. This class defines the Venter Sobiezcczanski-Sobieski [1]_ global optimization problem. This is a mu...
2,709
30.511628
82
py
scipy
scipy-main/benchmarks/benchmarks/go_benchmark_functions/__init__.py
# -*- coding: utf-8 -*- """ ============================================================================== `go_benchmark_functions` -- Problems for testing global optimization routines ============================================================================== This module provides a comprehensive set of problems f...
2,646
35.260274
80
py
scipy
scipy-main/benchmarks/benchmarks/go_benchmark_functions/go_funcs_U.py
# -*- coding: utf-8 -*- from numpy import abs, sin, cos, pi, sqrt from .go_benchmark import Benchmark class Ursem01(Benchmark): r""" Ursem 1 objective function. This class defines the Ursem 1 [1]_ global optimization problem. This is a unimodal minimization problem defined as follows: .. math::...
5,167
29.946108
79
py
scipy
scipy-main/benchmarks/benchmarks/go_benchmark_functions/go_funcs_D.py
# -*- coding: utf-8 -*- import numpy as np from numpy import abs, cos, exp, arange, pi, sin, sqrt, sum, zeros, tanh from numpy.testing import assert_almost_equal from .go_benchmark import Benchmark class Damavandi(Benchmark): r""" Damavandi objective function. This class defines the Damavandi [1]_ global...
17,905
30.414035
95
py
scipy
scipy-main/benchmarks/benchmarks/go_benchmark_functions/go_funcs_Z.py
# -*- coding: utf-8 -*- from numpy import abs, sum, sign, arange from .go_benchmark import Benchmark class Zacharov(Benchmark): r""" Zacharov objective function. This class defines the Zacharov [1]_ global optimization problem. This is a multimodal minimization problem defined as follows: .. ma...
6,737
28.682819
80
py
scipy
scipy-main/benchmarks/benchmarks/go_benchmark_functions/go_funcs_P.py
# -*- coding: utf-8 -*- from numpy import (abs, sum, sin, cos, sqrt, log, prod, where, pi, exp, arange, floor, log10, atleast_2d, zeros) from .go_benchmark import Benchmark class Parsopoulos(Benchmark): r""" Parsopoulos objective function. This class defines the Parsopoulos [1]_ globa...
20,990
27.873453
84
py
scipy
scipy-main/benchmarks/benchmarks/go_benchmark_functions/go_funcs_A.py
# -*- coding: utf-8 -*- from numpy import abs, cos, exp, pi, prod, sin, sqrt, sum from .go_benchmark import Benchmark class Ackley01(Benchmark): r""" Ackley01 objective function. The Ackley01 [1]_ global optimization problem is a multimodal minimization problem defined as follows: .. math:: ...
7,993
27.55
79
py
scipy
scipy-main/benchmarks/benchmarks/go_benchmark_functions/go_funcs_J.py
# -*- coding: utf-8 -*- from numpy import sum, asarray, arange, exp from .go_benchmark import Benchmark class JennrichSampson(Benchmark): r""" Jennrich-Sampson objective function. This class defines the Jennrich-Sampson [1]_ global optimization problem. This is a multimodal minimization problem defin...
3,581
32.166667
82
py
scipy
scipy-main/benchmarks/benchmarks/go_benchmark_functions/go_funcs_O.py
# -*- coding: utf-8 -*- from numpy import sum, cos, exp, pi, asarray from .go_benchmark import Benchmark class OddSquare(Benchmark): r""" Odd Square objective function. This class defines the Odd Square [1]_ global optimization problem. This is a multimodal minimization problem defined as follows: ...
1,919
29.47619
79
py
scipy
scipy-main/benchmarks/benchmarks/go_benchmark_functions/go_benchmark.py
# -*- coding: utf-8 -*- import numpy as np from numpy import abs, asarray from ..common import safe_import with safe_import(): from scipy.special import factorial class Benchmark: """ Defines a global optimization benchmark problem. This abstract class defines the basic structure of a global o...
5,925
27.490385
79
py
scipy
scipy-main/benchmarks/benchmarks/go_benchmark_functions/go_funcs_F.py
# -*- coding: utf-8 -*- from .go_benchmark import Benchmark class FreudensteinRoth(Benchmark): r""" FreudensteinRoth objective function. This class defines the Freudenstein & Roth [1]_ global optimization problem. This is a multimodal minimization problem defined as follows: .. math:: ...
1,329
28.555556
80
py
scipy
scipy-main/benchmarks/benchmarks/go_benchmark_functions/go_funcs_K.py
# -*- coding: utf-8 -*- from numpy import asarray, atleast_2d, arange, sin, sqrt, prod, sum, round from .go_benchmark import Benchmark class Katsuura(Benchmark): r""" Katsuura objective function. This class defines the Katsuura [1]_ global optimization problem. This is a multimodal minimization prob...
4,627
29.853333
79
py
scipy
scipy-main/benchmarks/benchmarks/cutest/calfun.py
# This is a python implementation of calfun.m, # provided at https://github.com/POptUS/BenDFO import numpy as np from .dfovec import dfovec def norm(x, type=2): if type == 1: return np.sum(np.abs(x)) elif type == 2: return np.sqrt(x ** 2) else: # type==np.inf: return max(np.abs(x)...
1,607
25.8
61
py
scipy
scipy-main/benchmarks/benchmarks/cutest/dfovec.py
# This is a python implementation of dfovec.m, # provided at https://github.com/POptUS/BenDFO import numpy as np def dfovec(m, n, x, nprob): # Set lots of constants: c13 = 1.3e1 c14 = 1.4e1 c29 = 2.9e1 c45 = 4.5e1 v = [ 4.0e0, 2.0e0, 1.0e0, 5.0e-1, 2.5e-...
10,188
25.955026
94
py
scipy
scipy-main/benchmarks/benchmarks/cutest/dfoxs.py
# This is a python implementation of dfoxs.m, # provided at https://github.com/POptUS/BenDFO import numpy as np def dfoxs(n, nprob, factor): x = np.zeros(n) if nprob == 1 or nprob == 2 or nprob == 3: # Linear functions. x = np.ones(n) elif nprob == 4: # Rosenbrock function. x[0] = -1.2 ...
2,637
26.768421
74
py
scipy
scipy-main/scipy/conftest.py
# Pytest customization import json import os import warnings import numpy as np import numpy.array_api import numpy.testing as npt import pytest from scipy._lib._fpumode import get_fpu_mode from scipy._lib._testutils import FPUModeChangeWarning from scipy._lib import _pep440 from scipy._lib._array_api import SCIPY_AR...
5,991
33.436782
91
py
scipy
scipy-main/scipy/setup.py
def configuration(parent_package='',top_path=None): from numpy.distutils.system_info import get_info get_info("lapack_opt") from numpy.distutils.misc_util import Configuration config = Configuration('scipy',parent_package,top_path) config.add_subpackage('_lib') config.add_subpackage('cluster') ...
1,182
32.8
59
py
scipy
scipy-main/scipy/_distributor_init.py
""" Distributor init file Distributors: you can add custom code here to support particular distributions of SciPy. For example, this is a good place to put any checks for hardware requirements. The SciPy standard source distribution will not put code in this file, so you can safely replace this file with your own ve...
331
29.181818
78
py
scipy
scipy-main/scipy/__init__.py
""" SciPy: A scientific computing package for Python ================================================ Documentation is available in the docstrings and online at https://docs.scipy.org. Contents -------- SciPy imports all the functions from the NumPy namespace, and in addition provides: Subpackages ----------- Using ...
6,530
32.152284
80
py
scipy
scipy-main/scipy/integrate/lsoda.py
# This file is not meant for public use and will be removed in SciPy v2.0.0. import warnings from . import _lsoda # type: ignore __all__ = ['lsoda'] # noqa: F822 def __dir__(): return __all__ def __getattr__(name): if name not in __all__: raise AttributeError( "scipy.integrate.lsod...
610
22.5
76
py
scipy
scipy-main/scipy/integrate/odepack.py
# This file is not meant for public use and will be removed in SciPy v2.0.0. # Use the `scipy.integrate` namespace for importing the functions # included below. import warnings from . import _odepack_py __all__ = ['odeint', 'ODEintWarning'] # noqa: F822 def __dir__(): return __all__ def __getattr__(name): ...
771
28.692308
79
py
scipy
scipy-main/scipy/integrate/setup.py
import os from os.path import join from scipy._build_utils import numpy_nodepr_api def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration from numpy.distutils.system_info import get_info from scipy._build_utils import (uses_blas64, blas_ilp64_pre_build_hoo...
4,440
37.95614
88
py
scipy
scipy-main/scipy/integrate/_bvp.py
"""Boundary value problem solver.""" from warnings import warn import numpy as np from numpy.linalg import pinv from scipy.sparse import coo_matrix, csc_matrix from scipy.sparse.linalg import splu from scipy.optimize import OptimizeResult EPS = np.finfo(float).eps def estimate_fun_jac(fun, x, y, p, f0=None): ...
41,067
34.403448
88
py
scipy
scipy-main/scipy/integrate/vode.py
# This file is not meant for public use and will be removed in SciPy v2.0.0. import warnings from . import _vode # type: ignore __all__ = [ # noqa: F822 'dvode', 'zvode' ] def __dir__(): return __all__ def __getattr__(name): if name not in __all__: raise AttributeError( "sc...
625
20.586207
76
py
scipy
scipy-main/scipy/integrate/_quadpack_py.py
# Author: Travis Oliphant 2001 # Author: Nathan Woods 2013 (nquad &c) import sys import warnings from functools import partial from . import _quadpack import numpy as np __all__ = ["quad", "dblquad", "tplquad", "nquad", "IntegrationWarning"] error = _quadpack.error class IntegrationWarning(UserWarning): """ ...
52,822
41.190895
468
py
scipy
scipy-main/scipy/integrate/_odepack_py.py
# Author: Travis Oliphant __all__ = ['odeint'] import numpy as np from . import _odepack from copy import copy import warnings class ODEintWarning(Warning): pass _msgs = {2: "Integration successful.", 1: "Nothing was done; the integration time was 0.", -1: "Excess work done on this call (per...
10,769
40.264368
102
py
scipy
scipy-main/scipy/integrate/_quad_vec.py
import sys import copy import heapq import collections import functools import numpy as np from scipy._lib._util import MapWrapper, _FunctionWrapper class LRUDict(collections.OrderedDict): def __init__(self, max_size): self.__max_size = max_size def __setitem__(self, key, value): existing_k...
21,166
31.365443
102
py
scipy
scipy-main/scipy/integrate/_ode.py
# Authors: Pearu Peterson, Pauli Virtanen, John Travers """ First-order ODE integrators. User-friendly interface to various numerical integrators for solving a system of first order ODEs with prescribed initial conditions:: d y(t)[i] --------- = f(t,y(t))[i], d t y(t=0)[i] = y0[i], where:: ...
47,921
33.903132
90
py
scipy
scipy-main/scipy/integrate/dop.py
# This file is not meant for public use and will be removed in SciPy v2.0.0. import warnings from . import _dop # type: ignore __all__ = [ # noqa: F822 'dopri5', 'dop853' ] def __dir__(): return __all__ def __getattr__(name): if name not in __all__: raise AttributeError( "s...
622
20.482759
76
py
scipy
scipy-main/scipy/integrate/__init__.py
""" ============================================= Integration and ODEs (:mod:`scipy.integrate`) ============================================= .. currentmodule:: scipy.integrate Integrating functions, given function object ============================================ .. autosummary:: :toctree: generated/ quad ...
4,074
36.385321
81
py
scipy
scipy-main/scipy/integrate/_quadrature.py
from __future__ import annotations from typing import TYPE_CHECKING, Callable, Any, cast import numpy as np import math import warnings from collections import namedtuple from scipy.special import roots_legendre from scipy.special import gammaln, logsumexp from scipy._lib._util import _rng_spawn from scipy._lib.deprec...
53,017
33.629654
113
py
scipy
scipy-main/scipy/integrate/quadpack.py
# This file is not meant for public use and will be removed in SciPy v2.0.0. # Use the `scipy.integrate` namespace for importing the functions # included below. import warnings from . import _quadpack_py __all__ = [ # noqa: F822 "quad", "dblquad", "tplquad", "nquad", "IntegrationWarning", "er...
845
24.636364
79
py
scipy
scipy-main/scipy/integrate/tests/test_bvp.py
import sys try: from StringIO import StringIO except ImportError: from io import StringIO import numpy as np from numpy.testing import (assert_, assert_array_equal, assert_allclose, assert_equal) from pytest import raises as assert_raises from scipy.sparse import coo_matrix from sc...
20,181
27.345506
80
py
scipy
scipy-main/scipy/integrate/tests/test__quad_vec.py
import pytest import numpy as np from numpy.testing import assert_allclose from scipy.integrate import quad_vec from multiprocessing.dummy import Pool quadrature_params = pytest.mark.parametrize( 'quadrature', [None, "gk15", "gk21", "trapezoid"]) @quadrature_params def test_quad_vec_simple(quadrature): n...
6,286
28.938095
90
py
scipy
scipy-main/scipy/integrate/tests/test_quadpack.py
import sys import math import numpy as np from numpy import sqrt, cos, sin, arctan, exp, log, pi from numpy.testing import (assert_, assert_allclose, assert_array_less, assert_almost_equal) import pytest from scipy.integrate import quad, dblquad, tplquad, nquad from scipy.special import erf, erfc from scipy._l...
27,983
40.274336
84
py
scipy
scipy-main/scipy/integrate/tests/test_quadrature.py
import pytest import numpy as np from numpy import cos, sin, pi from numpy.testing import (assert_equal, assert_almost_equal, assert_allclose, assert_, suppress_warnings) from scipy.integrate import (quadrature, romberg, romb, newton_cotes, cumulative_trapezoid, ...
18,274
37.636364
82
py
scipy
scipy-main/scipy/integrate/tests/test_odeint_jac.py
import numpy as np from numpy.testing import assert_equal, assert_allclose from scipy.integrate import odeint import scipy.integrate._test_odeint_banded as banded5x5 def rhs(y, t): dydt = np.zeros_like(y) banded5x5.banded5x5(t, y, dydt) return dydt def jac(y, t): n = len(y) jac = np.zeros((n, n)...
1,816
23.226667
71
py