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/scipy/sparse/linalg/tests/test_onenormest.py
"""Test functions for the sparse.linalg._onenormest module """ import numpy as np from numpy.testing import assert_allclose, assert_equal, assert_ import pytest import scipy.linalg import scipy.sparse.linalg from scipy.sparse.linalg._onenormest import _onenormest_core, _algorithm_2_2 class MatrixProductOperator(scip...
9,227
35.474308
88
py
scipy
scipy-main/scipy/sparse/linalg/tests/test_propack.py
import os import pytest import sys import numpy as np from numpy.testing import assert_allclose from pytest import raises as assert_raises from scipy.sparse.linalg._svdp import _svdp from scipy.sparse import csr_matrix, csc_matrix # dtype_flavour to tolerance TOLS = { np.float32: 1e-4, np.float64: 1e-8, ...
6,284
32.430851
84
py
scipy
scipy-main/scipy/sparse/linalg/tests/__init__.py
0
0
0
py
scipy
scipy-main/scipy/sparse/linalg/tests/test_expm_multiply.py
"""Test functions for the sparse.linalg._expm_multiply module.""" from functools import partial from itertools import product import numpy as np import pytest from numpy.testing import (assert_allclose, assert_, assert_equal, suppress_warnings) from scipy.sparse import SparseEfficiencyWarnin...
13,919
39.231214
79
py
scipy
scipy-main/scipy/sparse/linalg/_isolve/lsqr.py
"""Sparse Equations and Least Squares. The original Fortran code was written by C. C. Paige and M. A. Saunders as described in C. C. Paige and M. A. Saunders, LSQR: An algorithm for sparse linear equations and sparse least squares, TOMS 8(1), 43--71 (1982). C. C. Paige and M. A. Saunders, Algorithm 583; LSQR: Sparse...
21,214
35.079932
84
py
scipy
scipy-main/scipy/sparse/linalg/_isolve/setup.py
def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('_isolve', parent_package, top_path) config.add_data_dir('tests') return config if __name__ == '__main__': from numpy.distutils.core import setup setup(**configurat...
347
25.769231
63
py
scipy
scipy-main/scipy/sparse/linalg/_isolve/iterative.py
import warnings import numpy as np from scipy.sparse.linalg._interface import LinearOperator from .utils import make_system from scipy.linalg import get_lapack_funcs from scipy._lib.deprecation import _NoValue __all__ = ['bicg', 'bicgstab', 'cg', 'cgs', 'gmres', 'qmr'] def _get_atol(name, b, tol=_NoValue, atol=0., r...
34,750
31.660714
78
py
scipy
scipy-main/scipy/sparse/linalg/_isolve/utils.py
__docformat__ = "restructuredtext en" __all__ = [] from numpy import asanyarray, asarray, array, zeros from scipy.sparse.linalg._interface import aslinearoperator, LinearOperator, \ IdentityOperator _coerce_rules = {('f','f'):'f', ('f','d'):'d', ('f','F'):'F', ('f','D'):'D', ('d','f'):'d', ('...
3,598
27.117188
79
py
scipy
scipy-main/scipy/sparse/linalg/_isolve/minres.py
from numpy import inner, zeros, inf, finfo from numpy.linalg import norm from math import sqrt from .utils import make_system __all__ = ['minres'] def minres(A, b, x0=None, shift=0.0, tol=1e-5, maxiter=None, M=None, callback=None, show=False, check=False): """ Use MINimum RESidual iteration to so...
10,878
28.16622
85
py
scipy
scipy-main/scipy/sparse/linalg/_isolve/lgmres.py
# Copyright (C) 2009, Pauli Virtanen <pav@iki.fi> # Distributed under the same license as SciPy. import warnings import numpy as np from numpy.linalg import LinAlgError from scipy.linalg import get_blas_funcs from .utils import make_system from ._gcrotmk import _fgmres __all__ = ['lgmres'] def lgmres(A, b, x0=None...
8,932
36.533613
85
py
scipy
scipy-main/scipy/sparse/linalg/_isolve/__init__.py
"Iterative Solvers for Sparse Linear Systems" #from info import __doc__ from .iterative import * from .minres import minres from .lgmres import lgmres from .lsqr import lsqr from .lsmr import lsmr from ._gcrotmk import gcrotmk from .tfqmr import tfqmr __all__ = [ 'bicg', 'bicgstab', 'cg', 'cgs', 'gcrotmk', 'gmres...
479
21.857143
56
py
scipy
scipy-main/scipy/sparse/linalg/_isolve/lsmr.py
""" Copyright (C) 2010 David Fong and Michael Saunders LSMR uses an iterative method. 07 Jun 2010: Documentation updated 03 Jun 2010: First release version in Python David Chin-lung Fong clfong@stanford.edu Institute for Computational and Mathematical Engineering Stanford University Michael Saunders ...
15,657
31.151951
79
py
scipy
scipy-main/scipy/sparse/linalg/_isolve/tfqmr.py
import numpy as np from .utils import make_system __all__ = ['tfqmr'] def tfqmr(A, b, x0=None, tol=1e-5, maxiter=None, M=None, callback=None, atol=None, show=False): """ Use Transpose-Free Quasi-Minimal Residual iteration to solve ``Ax = b``. Parameters ---------- A : {sparse matrix, ...
6,241
32.740541
85
py
scipy
scipy-main/scipy/sparse/linalg/_isolve/_gcrotmk.py
# Copyright (C) 2015, Pauli Virtanen <pav@iki.fi> # Distributed under the same license as SciPy. import warnings import numpy as np from numpy.linalg import LinAlgError from scipy.linalg import (get_blas_funcs, qr, solve, svd, qr_insert, lstsq) from scipy.sparse.linalg._isolve.utils import make_system __all__ = ['gc...
15,984
30.343137
86
py
scipy
scipy-main/scipy/sparse/linalg/_isolve/tests/test_gcrotmk.py
#!/usr/bin/env python """Tests for the linalg._isolve.gcrotmk module """ from numpy.testing import (assert_, assert_allclose, assert_equal, suppress_warnings) import numpy as np from numpy import zeros, array, allclose from scipy.linalg import norm from scipy.sparse import csr_matrix, eye, ...
5,408
31.584337
81
py
scipy
scipy-main/scipy/sparse/linalg/_isolve/tests/test_lsmr.py
""" Copyright (C) 2010 David Fong and Michael Saunders Distributed under the same license as SciPy Testing Code for LSMR. 03 Jun 2010: First version release with lsmr.py David Chin-lung Fong clfong@stanford.edu Institute for Computational and Mathematical Engineering Stanford University Michael Saunders ...
6,366
33.231183
80
py
scipy
scipy-main/scipy/sparse/linalg/_isolve/tests/test_lgmres.py
"""Tests for the linalg._isolve.lgmres module """ from numpy.testing import (assert_, assert_allclose, assert_equal, suppress_warnings) import pytest from platform import python_implementation import numpy as np from numpy import zeros, array, allclose from scipy.linalg import norm from sc...
7,060
32.306604
79
py
scipy
scipy-main/scipy/sparse/linalg/_isolve/tests/__init__.py
0
0
0
py
scipy
scipy-main/scipy/sparse/linalg/_isolve/tests/test_lsqr.py
import numpy as np from numpy.testing import assert_allclose, assert_array_equal, assert_equal import pytest import scipy.sparse import scipy.sparse.linalg from scipy.sparse.linalg import lsqr # Set up a test problem n = 35 G = np.eye(n) normal = np.random.normal norm = np.linalg.norm for jj in range(5): gg = nor...
3,754
30.033058
80
py
scipy
scipy-main/scipy/sparse/linalg/_isolve/tests/test_iterative.py
""" Test functions for the sparse.linalg._isolve module """ import itertools import platform import sys import pytest import numpy as np from numpy.testing import assert_array_equal, assert_allclose from numpy import zeros, arange, array, ones, eye, iscomplexobj from numpy.linalg import norm from scipy.sparse import...
24,865
31.126615
79
py
scipy
scipy-main/scipy/sparse/linalg/_isolve/tests/test_minres.py
import numpy as np from numpy.testing import assert_equal, assert_allclose, assert_ from scipy.sparse.linalg._isolve import minres from pytest import raises as assert_raises from .test_iterative import assert_normclose def get_sample_problem(): # A random 10 x 10 symmetric matrix np.random.seed(1234) mat...
2,446
23.969388
69
py
scipy
scipy-main/scipy/sparse/linalg/_isolve/tests/test_utils.py
import numpy as np from pytest import raises as assert_raises import scipy.sparse.linalg._isolve.utils as utils def test_make_system_bad_shape(): assert_raises(ValueError, utils.make_system, np.zeros((5,3)), None, np.zeros(4), np.zeros(4))
247
26.555556
97
py
scipy
scipy-main/scipy/sparse/linalg/_propack/setup.py
import pathlib from distutils.sysconfig import get_python_inc import numpy as np def _is_32bit(): return np.intp(0).itemsize < 8 def check_propack_submodule(): if not (pathlib.Path(__file__).parent / 'PROPACK/README').exists(): raise RuntimeError("Missing the `PROPACK` submodule! Run " ...
3,366
36.831461
81
py
scipy
scipy-main/scipy/sparse/linalg/_eigen/_svds.py
import os import numpy as np from .arpack import _arpack # type: ignore[attr-defined] from . import eigsh from scipy._lib._util import check_random_state from scipy.sparse.linalg._interface import LinearOperator, aslinearoperator from scipy.sparse.linalg._eigen.lobpcg import lobpcg # type: ignore[no-redef] if os.en...
20,684
36.136445
79
py
scipy
scipy-main/scipy/sparse/linalg/_eigen/setup.py
def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('_eigen',parent_package,top_path) config.add_subpackage('arpack') config.add_subpackage('lobpcg') config.add_data_dir('tests') return config if __name__ == '__main...
417
23.588235
60
py
scipy
scipy-main/scipy/sparse/linalg/_eigen/__init__.py
""" Sparse Eigenvalue Solvers ------------------------- The submodules of sparse.linalg._eigen: 1. lobpcg: Locally Optimal Block Preconditioned Conjugate Gradient Method """ from .arpack import * from .lobpcg import * from ._svds import svds from . import arpack __all__ = [ 'ArpackError', 'ArpackNoConvergen...
460
19.043478
77
py
scipy
scipy-main/scipy/sparse/linalg/_eigen/_svds_doc.py
def _svds_arpack_doc(A, k=6, ncv=None, tol=0, which='LM', v0=None, maxiter=None, return_singular_vectors=True, solver='arpack', random_state=None): """ Partial singular value decomposition of a sparse matrix using ARPACK. Compute the largest or smallest `k` singula...
15,524
38.007538
79
py
scipy
scipy-main/scipy/sparse/linalg/_eigen/tests/test_svds.py
import os import re import copy import numpy as np from numpy.testing import assert_allclose, assert_equal, assert_array_equal import pytest from scipy.linalg import svd, null_space from scipy.sparse import csc_matrix, issparse, spdiags, random from scipy.sparse.linalg import LinearOperator, aslinearoperator if os.en...
37,553
40.313531
79
py
scipy
scipy-main/scipy/sparse/linalg/_eigen/tests/__init__.py
0
0
0
py
scipy
scipy-main/scipy/sparse/linalg/_eigen/arpack/setup.py
from os.path import join def configuration(parent_package='',top_path=None): from numpy.distutils.system_info import get_info from numpy.distutils.misc_util import Configuration from scipy._build_utils import (get_g77_abi_wrappers, gfortran_legacy_flag_hook, ...
1,842
34.442308
72
py
scipy
scipy-main/scipy/sparse/linalg/_eigen/arpack/__init__.py
""" Eigenvalue solver using iterative methods. Find k eigenvectors and eigenvalues of a matrix A using the Arnoldi/Lanczos iterative methods from ARPACK [1]_,[2]_. These methods are most useful for large sparse matrices. - eigs(A,k) - eigsh(A,k) References ---------- .. [1] ARPACK Software, http://www.caam.rice...
562
25.809524
71
py
scipy
scipy-main/scipy/sparse/linalg/_eigen/arpack/arpack.py
""" Find a few eigenvectors and eigenvalues of a matrix. Uses ARPACK: https://github.com/opencollab/arpack-ng """ # Wrapper implementation notes # # ARPACK Entry Points # ------------------- # The entry points to ARPACK are # - (s,d)seupd : single and double precision symmetric matrix # - (s,d,c,z)neupd: single,doub...
67,273
38.572941
89
py
scipy
scipy-main/scipy/sparse/linalg/_eigen/arpack/tests/test_arpack.py
__usage__ = """ To run tests locally: python tests/test_arpack.py [-l<int>] [-v<int>] """ import threading import itertools import numpy as np from numpy.testing import assert_allclose, assert_equal, suppress_warnings from pytest import raises as assert_raises import pytest from numpy import dot, conj, random fr...
23,750
32.03338
85
py
scipy
scipy-main/scipy/sparse/linalg/_eigen/arpack/tests/__init__.py
0
0
0
py
scipy
scipy-main/scipy/sparse/linalg/_eigen/lobpcg/lobpcg.py
""" Locally Optimal Block Preconditioned Conjugate Gradient Method (LOBPCG). References ---------- .. [1] A. V. Knyazev (2001), Toward the Optimal Preconditioned Eigensolver: Locally Optimal Block Preconditioned Conjugate Gradient Method. SIAM Journal on Scientific Computing 23, no. 2, pp. ...
40,882
36.784658
79
py
scipy
scipy-main/scipy/sparse/linalg/_eigen/lobpcg/setup.py
def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('lobpcg',parent_package,top_path) config.add_data_dir('tests') return config if __name__ == '__main__': from numpy.distutils.core import setup setup(**configuration(...
343
25.461538
60
py
scipy
scipy-main/scipy/sparse/linalg/_eigen/lobpcg/__init__.py
""" Locally Optimal Block Preconditioned Conjugate Gradient Method (LOBPCG) LOBPCG is a preconditioned eigensolver for large symmetric positive definite (SPD) generalized eigenproblems. Call the function lobpcg - see help for lobpcg.lobpcg. """ from .lobpcg import * __all__ = [s for s in dir() if not s.startswith('...
420
23.764706
76
py
scipy
scipy-main/scipy/sparse/linalg/_eigen/lobpcg/tests/test_lobpcg.py
""" Test functions for the sparse.linalg._eigen.lobpcg module """ import itertools import platform import sys import pytest import numpy as np from numpy import ones, r_, diag from numpy.testing import (assert_almost_equal, assert_equal, assert_allclose, assert_array_less) from scipy import...
23,518
35.691108
80
py
scipy
scipy-main/scipy/sparse/linalg/_eigen/lobpcg/tests/__init__.py
0
0
0
py
scipy
scipy-main/scipy/io/mmio.py
# This file is not meant for public use and will be removed in SciPy v2.0.0. # Use the `scipy.io` namespace for importing the functions # included below. import warnings from . import _mmio __all__ = [ # noqa: F822 'mminfo', 'mmread', 'mmwrite', 'MMFile', 'coo_matrix', 'isspmatrix', 'asstr' ] def __dir__()...
779
25.896552
76
py
scipy
scipy-main/scipy/io/_netcdf.py
""" NetCDF reader/writer module. This module is used to read and create NetCDF files. NetCDF files are accessed through the `netcdf_file` object. Data written to and from NetCDF files are contained in `netcdf_variable` objects. Attributes are given as member variables of the `netcdf_file` and `netcdf_variable` objects...
39,085
34.891644
107
py
scipy
scipy-main/scipy/io/_mmio.py
""" Matrix Market I/O in Python. See http://math.nist.gov/MatrixMarket/formats.html for information about the Matrix Market format. """ # # Author: Pearu Peterson <pearu@cens.ioc.ee> # Created: October, 2004 # # References: # http://math.nist.gov/MatrixMarket/ # import os import numpy as np from numpy import (a...
31,900
32.161123
81
py
scipy
scipy-main/scipy/io/setup.py
def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('io', parent_package, top_path) config.add_extension('_test_fortran', sources=['_test_fortran.pyf', '_test_fortran.f']) config.add_data_dir('tests') ...
573
30.888889
74
py
scipy
scipy-main/scipy/io/netcdf.py
# This file is not meant for public use and will be removed in SciPy v2.0.0. # Use the `scipy.io` namespace for importing the functions # included below. import warnings from . import _netcdf __all__ = [ # noqa: F822 'netcdf_file', 'netcdf_variable', 'array', 'LITTLE_ENDIAN', 'IS_PYPY', 'ABSENT', 'ZERO', ...
1,080
30.794118
76
py
scipy
scipy-main/scipy/io/harwell_boeing.py
# This file is not meant for public use and will be removed in SciPy v2.0.0. # Use the `scipy.io` namespace for importing the functions # included below. import warnings from . import _harwell_boeing __all__ = [ # noqa: F822 'MalformedHeader', 'hb_read', 'hb_write', 'HBInfo', 'HBFile', 'HBMatrixType', 'Fortr...
898
28.966667
76
py
scipy
scipy-main/scipy/io/_fortran.py
""" Module to read / write Fortran unformatted sequential files. This is in the spirit of code written by Neil Martinsen-Burrell and Joe Zuntz. """ import warnings import numpy as np __all__ = ['FortranFile', 'FortranEOFError', 'FortranFormattingError'] class FortranEOFError(TypeError, OSError): """Indicates t...
10,891
29.68169
93
py
scipy
scipy-main/scipy/io/wavfile.py
""" Module to read / write wav files using NumPy arrays Functions --------- `read`: Return the sample rate (in samples/sec) and data from a WAV file. `write`: Write a NumPy array as a WAV file. """ import io import sys import numpy import struct import warnings from enum import IntEnum __all__ = [ 'WavFileWarn...
26,642
30.680143
94
py
scipy
scipy-main/scipy/io/idl.py
# This file is not meant for public use and will be removed in SciPy v2.0.0. # Use the `scipy.io` namespace for importing the functions # included below. import warnings from . import _idl __all__ = [ # noqa: F822 'readsav', 'DTYPE_DICT', 'RECTYPE_DICT', 'STRUCT_DICT', 'Pointer', 'ObjectPointer', 'AttrDict'...
794
25.5
76
py
scipy
scipy-main/scipy/io/__init__.py
""" ================================== Input and output (:mod:`scipy.io`) ================================== .. currentmodule:: scipy.io SciPy has many modules, classes, and functions available to read data from and write data to a variety of file formats. .. seealso:: `NumPy IO routines <https://www.numpy.org/devdo...
2,719
22.247863
93
py
scipy
scipy-main/scipy/io/_idl.py
# IDLSave - a python module to read IDL 'save' files # Copyright (c) 2010 Thomas P. Robitaille # Many thanks to Craig Markwardt for publishing the Unofficial Format # Specification for IDL .sav files, without which this Python module would not # exist (http://cow.physics.wisc.edu/~craigm/idl/savefmt). # This code was...
26,898
28.397814
91
py
scipy
scipy-main/scipy/io/matlab/mio5_utils.py
# This file is not meant for public use and will be removed in SciPy v2.0.0. # Use the `scipy.io.matlab` namespace for importing the functions # included below. import warnings from . import _mio5_utils __all__ = [ # noqa: F822 'VarHeader5', 'VarReader5', 'byteswap_u4', 'chars_to_strings', 'csc_matrix', 'mi...
899
30.034483
79
py
scipy
scipy-main/scipy/io/matlab/streams.py
# This file is not meant for public use and will be removed in SciPy v2.0.0. # Use the `scipy.io.matlab` namespace for importing the functions # included below. import warnings from . import _streams __all__ = [ # noqa: F822 'BLOCK_SIZE', 'GenericStream', 'ZlibInputStream', 'make_stream' ] def __dir__(): r...
809
27.928571
79
py
scipy
scipy-main/scipy/io/matlab/_miobase.py
# Authors: Travis Oliphant, Matthew Brett """ Base classes for MATLAB file stream reading. MATLAB is a registered trademark of the Mathworks inc. """ import numpy as np from scipy._lib import doccer from . import _byteordercodes as boc __all__ = [ 'MatFileReader', 'MatReadError', 'MatReadWarning', 'MatVarR...
12,875
29.084112
80
py
scipy
scipy-main/scipy/io/matlab/byteordercodes.py
# This file is not meant for public use and will be removed in SciPy v2.0.0. # Use the `scipy.io.matlab` namespace for importing the functions # included below. import warnings from . import _byteordercodes __all__ = [ # noqa: F822 'aliases', 'native_code', 'swapped_code', 'sys_is_le', 'to_numpy_code' ] d...
849
27.333333
82
py
scipy
scipy-main/scipy/io/matlab/mio5.py
# This file is not meant for public use and will be removed in SciPy v2.0.0. # Use the `scipy.io.matlab` namespace for importing the functions # included below. import warnings from . import _mio5 __all__ = [ # noqa: F822 'mclass_info', 'mxCHAR_CLASS', 'mxSPARSE_CLASS', 'BytesIO', 'native_code', 'swappe...
1,435
36.789474
79
py
scipy
scipy-main/scipy/io/matlab/setup.py
def configuration(parent_package='io',top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('matlab', parent_package, top_path) config.add_extension('_streams', sources=['_streams.c']) config.add_extension('_mio_utils', sources=['_mio_utils.c']) config.add_extens...
538
37.5
66
py
scipy
scipy-main/scipy/io/matlab/_mio4.py
''' Classes for read / write of matlab (TM) 4 files ''' import sys import warnings import numpy as np import scipy.sparse from ._miobase import (MatFileReader, docfiller, matdims, read_dtype, convert_dtypes, arr_to_chars, arr_dtype_number) from ._mio_utils import squeeze_element, chars_to_stri...
20,612
32.033654
80
py
scipy
scipy-main/scipy/io/matlab/mio5_params.py
# This file is not meant for public use and will be removed in SciPy v2.0.0. # Use the `scipy.io.matlab` namespace for importing the functions # included below. import warnings from . import _mio5_params __all__ = [ # noqa: F822 'MDTYPES', 'MatlabFunction', 'MatlabObject', 'MatlabOpaque', 'NP_TO_MTYPES', 'N...
1,526
39.184211
79
py
scipy
scipy-main/scipy/io/matlab/_mio5.py
''' Classes for read / write of matlab (TM) 5 files The matfile specification last found here: https://www.mathworks.com/access/helpdesk/help/pdf_doc/matlab/matfile_format.pdf (as of December 5 2008) ================================= Note on functions and mat files ================================= The document a...
33,584
36.483259
84
py
scipy
scipy-main/scipy/io/matlab/mio.py
# This file is not meant for public use and will be removed in SciPy v2.0.0. # Use the `scipy.io.matlab` namespace for importing the functions # included below. import warnings from . import _mio __all__ = [ # noqa: F822 'mat_reader_factory', 'loadmat', 'savemat', 'whosmat', 'contextmanager', 'docfiller', ...
894
28.833333
79
py
scipy
scipy-main/scipy/io/matlab/mio4.py
# This file is not meant for public use and will be removed in SciPy v2.0.0. # Use the `scipy.io.matlab` namespace for importing the functions # included below. import warnings from . import _mio4 __all__ = [ # noqa: F822 'MatFile4Reader', 'MatFile4Writer', 'SYS_LITTLE_ENDIAN', 'VarHeader4', 'VarReader4', '...
1,201
34.352941
79
py
scipy
scipy-main/scipy/io/matlab/mio_utils.py
# This file is not meant for public use and will be removed in SciPy v2.0.0. # Use the `scipy.io.matlab` namespace for importing the functions # included below. import warnings from . import _mio_utils __all__ = ['squeeze_element', 'chars_to_strings'] # noqa: F822 def __dir__(): return __all__ def __getattr...
786
28.148148
79
py
scipy
scipy-main/scipy/io/matlab/__init__.py
""" MATLAB® file utilies (:mod:`scipy.io.matlab`) ============================================= .. currentmodule:: scipy.io.matlab This submodule is meant to provide lower-level file utilies related to reading and writing MATLAB files. .. autosummary:: :toctree: generated/ matfile_version - Get the MATLAB fil...
2,021
30.59375
78
py
scipy
scipy-main/scipy/io/matlab/miobase.py
# This file is not meant for public use and will be removed in SciPy v2.0.0. # Use the `scipy.io.matlab` namespace for importing the functions # included below. import warnings from . import _miobase __all__ = [ # noqa: F822 'MatFileReader', 'MatReadError', 'MatReadWarning', 'MatVarReader', 'MatWriteError',...
988
29.90625
79
py
scipy
scipy-main/scipy/io/matlab/_mio5_params.py
''' Constants and classes for matlab 5 read and write See also mio5_utils.pyx where these same constants arise as c enums. If you make changes in this file, don't forget to change mio5_utils.pyx ''' import numpy as np from ._miobase import convert_dtypes __all__ = [ 'MDTYPES', 'MatlabFunction', 'MatlabObject',...
8,199
28.181495
98
py
scipy
scipy-main/scipy/io/matlab/_byteordercodes.py
''' Byteorder utilities for system - numpy byteorder encoding Converts a variety of string codes for little endian, big endian, native byte order and swapped byte order to explicit NumPy endian codes - one of '<' (little endian) or '>' (big endian) ''' import sys __all__ = [ 'aliases', 'native_code', 'swapped_co...
1,902
24.716216
74
py
scipy
scipy-main/scipy/io/matlab/_mio.py
""" Module for reading and writing matlab (TM) .mat files """ # Authors: Travis Oliphant, Matthew Brett from contextlib import contextmanager from ._miobase import _get_matfile_version, docfiller from ._mio4 import MatFile4Reader, MatFile4Writer from ._mio5 import MatFile5Reader, MatFile5Writer __all__ = ['mat_reade...
12,799
34.654596
90
py
scipy
scipy-main/scipy/io/matlab/tests/test_byteordercodes.py
''' Tests for byteorder module ''' import sys from numpy.testing import assert_ from pytest import raises as assert_raises import scipy.io.matlab._byteordercodes as sibc def test_native(): native_is_le = sys.byteorder == 'little' assert_(sibc.sys_is_le == native_is_le) def test_to_numpy(): if sys.byt...
938
30.3
68
py
scipy
scipy-main/scipy/io/matlab/tests/test_streams.py
""" Testing """ import os import zlib from io import BytesIO from tempfile import mkstemp from contextlib import contextmanager import numpy as np from numpy.testing import assert_, assert_equal from pytest import raises as assert_raises from scipy.io.matlab._streams import (make_stream, GenericStream, Zlib...
7,319
30.826087
89
py
scipy
scipy-main/scipy/io/matlab/tests/test_miobase.py
""" Testing miobase module """ import numpy as np from numpy.testing import assert_equal from pytest import raises as assert_raises from scipy.io.matlab._miobase import matdims def test_matdims(): # Test matdims dimension finder assert_equal(matdims(np.array(1)), (1, 1)) # NumPy scalar assert_equal(ma...
1,464
43.393939
82
py
scipy
scipy-main/scipy/io/matlab/tests/test_mio_funcs.py
''' Jottings to work out format for __function_workspace__ matrix at end of mat file. ''' import os.path import io from scipy.io.matlab._mio5 import MatFile5Reader test_data_path = os.path.join(os.path.dirname(__file__), 'data') def read_minimat_vars(rdr): rdr.initialize_read() mdict = {'__globals__': []} ...
1,392
25.788462
72
py
scipy
scipy-main/scipy/io/matlab/tests/test_mio_utils.py
""" Testing """ import numpy as np from numpy.testing import assert_array_equal, assert_ from scipy.io.matlab._mio_utils import squeeze_element, chars_to_strings def test_squeeze_element(): a = np.zeros((1,3)) assert_array_equal(np.squeeze(a), squeeze_element(a)) # 0-D output from squeeze gives scalar...
1,594
33.673913
72
py
scipy
scipy-main/scipy/io/matlab/tests/test_mio5_utils.py
""" Testing mio5_utils Cython module """ import sys from io import BytesIO import numpy as np from numpy.testing import assert_array_equal, assert_equal, assert_ from pytest import raises as assert_raises import scipy.io.matlab._byteordercodes as boc import scipy.io.matlab._streams as streams import scipy.io.matla...
5,389
28.944444
75
py
scipy
scipy-main/scipy/io/matlab/tests/test_mio.py
''' Nose test generators Need function load / save / roundtrip tests ''' import os from collections import OrderedDict from os.path import join as pjoin, dirname from glob import glob from io import BytesIO import re from tempfile import mkdtemp import warnings import shutil import gzip from numpy.testing import (a...
44,564
32.532731
80
py
scipy
scipy-main/scipy/io/matlab/tests/test_pathological.py
""" Test reading of files not conforming to matlab specification We try and read any file that matlab reads, these files included """ from os.path import dirname, join as pjoin from numpy.testing import assert_ from pytest import raises as assert_raises from scipy.io.matlab._mio import loadmat TEST_DATA_PATH = pjoi...
1,055
30.058824
73
py
scipy
scipy-main/scipy/io/matlab/tests/__init__.py
0
0
0
py
scipy
scipy-main/scipy/io/arff/arffread.py
# This file is not meant for public use and will be removed in SciPy v2.0.0. # Use the `scipy.io.arff` namespace for importing the functions # included below. import warnings from . import _arffread __all__ = [ # noqa: F822 'MetaData', 'loadarff', 'ArffError', 'ParseArffError', 'r_meta', 'r_comment', 'r_empt...
1,364
35.891892
78
py
scipy
scipy-main/scipy/io/arff/setup.py
def configuration(parent_package='io',top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('arff', parent_package, top_path) config.add_data_dir('tests') return config if __name__ == '__main__': from numpy.distutils.core import setup setup(**configuration(...
343
30.272727
60
py
scipy
scipy-main/scipy/io/arff/__init__.py
""" Module to read ARFF files ========================= ARFF is the standard data format for WEKA. It is a text file format which support numerical, string and data values. The format can also represent missing data and sparse data. Notes ----- The ARFF support in ``scipy.io`` provides file reading functionality only....
805
26.793103
74
py
scipy
scipy-main/scipy/io/arff/_arffread.py
# Last Change: Mon Aug 20 08:00 PM 2007 J import re import datetime import numpy as np import csv import ctypes """A module to read arff files.""" __all__ = ['MetaData', 'loadarff', 'ArffError', 'ParseArffError'] # An Arff file is basically two parts: # - header # - data # # A header has each of its components...
26,359
28.094923
110
py
scipy
scipy-main/scipy/io/arff/tests/test_arffread.py
import datetime import os import sys from os.path import join as pjoin from io import StringIO import numpy as np from numpy.testing import (assert_array_almost_equal, assert_array_equal, assert_equal, assert_) from pytest import raises as assert_raises from scipy.io.arff import loadarff ...
13,084
30.303828
92
py
scipy
scipy-main/scipy/io/arff/tests/__init__.py
0
0
0
py
scipy
scipy-main/scipy/io/_harwell_boeing/setup.py
def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('_harwell_boeing',parent_package,top_path) config.add_data_dir('tests') return config if __name__ == '__main__': from numpy.distutils.core import setup setup(**config...
351
28.333333
69
py
scipy
scipy-main/scipy/io/_harwell_boeing/hb.py
""" Implementation of Harwell-Boeing read/write. At the moment not the full Harwell-Boeing format is supported. Supported features are: - assembled, non-symmetric, real matrices - integer for pointer/indices - exponential format for float values, and int format """ # TODO: # - Add more support (symmetr...
19,148
32.535902
92
py
scipy
scipy-main/scipy/io/_harwell_boeing/_fortran_format_parser.py
""" Preliminary module to handle Fortran formats for IO. Does not use this outside scipy.sparse io for now, until the API is deemed reasonable. The *Format classes handle conversion between Fortran and Python format, and FortranFormatParser can create *Format instances from raw Fortran format strings (e.g. '(3I4)', '(...
8,916
27.764516
83
py
scipy
scipy-main/scipy/io/_harwell_boeing/__init__.py
from .hb import (MalformedHeader, hb_read, hb_write, HBInfo, HBFile, HBMatrixType) from ._fortran_format_parser import (FortranFormatParser, IntFormat, ExpFormat, BadFortranFormat) # Deprecated namespaces, to be removed in v2.0.0 from . import hb __all__ = [ 'Ma...
574
30.944444
68
py
scipy
scipy-main/scipy/io/_harwell_boeing/tests/test_fortran_format.py
import numpy as np from numpy.testing import assert_equal from pytest import raises as assert_raises from scipy.io._harwell_boeing import ( FortranFormatParser, IntFormat, ExpFormat, BadFortranFormat) class TestFortranFormatParser: def setup_method(self): self.parser = FortranFormatParser() ...
2,360
30.48
82
py
scipy
scipy-main/scipy/io/_harwell_boeing/tests/test_hb.py
from io import StringIO import tempfile import numpy as np from numpy.testing import assert_equal, \ assert_array_almost_equal_nulp from scipy.sparse import coo_matrix, csc_matrix, rand from scipy.io import hb_read, hb_write SIMPLE = """\ No Title ...
2,284
33.621212
79
py
scipy
scipy-main/scipy/io/_harwell_boeing/tests/__init__.py
0
0
0
py
scipy
scipy-main/scipy/io/tests/test_paths.py
""" Ensure that we can use pathlib.Path objects in all relevant IO functions. """ from pathlib import Path import numpy as np import scipy.io import scipy.io.wavfile from scipy._lib._tmpdirs import tempdir import scipy.sparse class TestPaths: data = np.arange(5).astype(np.int64) def test_savemat(self): ...
3,178
32.819149
81
py
scipy
scipy-main/scipy/io/tests/test_netcdf.py
''' Tests for netcdf ''' import os from os.path import join as pjoin, dirname import shutil import tempfile import warnings from io import BytesIO from glob import glob from contextlib import contextmanager import numpy as np from numpy.testing import (assert_, assert_allclose, assert_equal, ...
19,313
34.503676
137
py
scipy
scipy-main/scipy/io/tests/test_fortran.py
''' Tests for fortran sequential files ''' import tempfile import shutil from os import path from glob import iglob import re from numpy.testing import assert_equal, assert_allclose import numpy as np import pytest from scipy.io import (FortranFile, _test_fortran, FortranE...
7,572
30.953586
92
py
scipy
scipy-main/scipy/io/tests/test_wavfile.py
import os import sys from io import BytesIO import numpy as np from numpy.testing import (assert_equal, assert_, assert_array_equal, break_cycles, suppress_warnings, IS_PYPY) import pytest from pytest import raises, warns from scipy.io import wavfile def datafile(fn): return os.path.j...
15,303
35.70024
78
py
scipy
scipy-main/scipy/io/tests/__init__.py
0
0
0
py
scipy
scipy-main/scipy/io/tests/test_idl.py
from os import path import warnings import numpy as np from numpy.testing import (assert_equal, assert_array_equal, assert_, suppress_warnings) import pytest from scipy.io import readsav from scipy.io import _idl DATA_PATH = path.join(path.dirname(__file__), 'data') def assert_identical(...
19,680
43.426637
105
py
scipy
scipy-main/scipy/io/tests/test_mmio.py
from tempfile import mkdtemp import os import io import shutil import textwrap import numpy as np from numpy import array, transpose, pi from numpy.testing import (assert_equal, assert_allclose, assert_array_equal, assert_array_almost_equal) import pytest from pytest import raises as assert_...
26,906
33.853627
86
py
scipy
scipy-main/scipy/_build_utils/setup.py
def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('_build_utils', parent_package, top_path) config.add_data_dir('tests') return config if __name__ == '__main__': from numpy.distutils.core import setup setup(**configu...
350
30.909091
68
py
scipy
scipy-main/scipy/_build_utils/tempita.py
import sys import os import argparse from Cython import Tempita as tempita # XXX: If this import ever fails (does it really?), vendor either # cython.tempita or numpy/npy_tempita. def process_tempita(fromfile, outfile=None): """Process tempita templated file and write out the result. The template file is ex...
1,672
29.981481
78
py
scipy
scipy-main/scipy/_build_utils/_fortran.py
import re import os import sys from distutils.util import get_platform import numpy as np from .system_info import combine_dict __all__ = ['needs_g77_abi_wrapper', 'get_g77_abi_wrappers', 'gfortran_legacy_flag_hook', 'blas_ilp64_pre_build_hook', 'get_f2py_int64_options', 'generic_pre_build_hoo...
14,937
32.493274
90
py
scipy
scipy-main/scipy/_build_utils/__init__.py
import os import numpy as np from ._fortran import * from .system_info import combine_dict # Don't use the deprecated NumPy C API. Define this to a fixed version instead of # NPY_API_VERSION in order not to break compilation for released SciPy versions # when NumPy introduces a new deprecation. Use in setup.py:: # #...
1,084
29.138889
81
py