B @`; @sdZddlZddlZddlmZmZddlmZyeWnek rPdZYnXerfej dnDyddl m Z Wn0ek rZzd ZeeeWddZ[XYnXdd lmZdd lmZd d gZiZddlmZddlmZddlTddlmZddlmZddlTddlmZddlmZddlmZddlmZddlm Z ddlm!Z!ddlm"Z#ddl"Tddl$Z%dZ&dZ'dZ(dde')dfd e')d!fd"e')d#fd$e')d%fd&e()d&fgZ*e+d'd(e*Dd)Z&e,ed*e&j)d*d&e()d*d+fed*<e,ed*e&j)d,d$e')d%d+fed-<[&['[([*[%dd.lm-Z-m.Z.m/Z/m0Z0ej12e3d/d0ge3eje3e#je3eje3d1d2d3d4d5g[4[5e6d*e6d-e6d6[7d7d8d9d:d;dd?d@g Z8dAd(e8DZ9ej:dBdCdDej:dBdEdDej:dBdFdDdGZ;dGZdLdMZ?n&ddNl@mAZAeB+dOd(eCDddPlDmEZEeEeFZG[EdQdRZHeH[HdSdTZIddlZejJdUkrejKdVdWNZLeIdXZMeNeLdkrdY)eLdZjOjFePeLdZjQZMd[)eMZeReWdQRX[IddlSZSeSjTUd\dZVejJd]kreVdkry@dZVeSWjXYd^ddHZZe[d_d`eZDZZeZdakrfdZVWne\k rdZ]YnXneVdkrdZVne^eVZVej_`eVdS)ba NumPy ===== Provides 1. An array object of arbitrary homogeneous items 2. Fast mathematical operations over arrays 3. Linear Algebra, Fourier Transforms, Random Number Generation How to use the documentation ---------------------------- Documentation is available in two forms: docstrings provided with the code, and a loose standing reference guide, available from `the NumPy homepage `_. We recommend exploring the docstrings using `IPython `_, an advanced Python shell with TAB-completion and introspection capabilities. See below for further instructions. The docstring examples assume that `numpy` has been imported as `np`:: >>> import numpy as np Code snippets are indicated by three greater-than signs:: >>> x = 42 >>> x = x + 1 Use the built-in ``help`` function to view a function's docstring:: >>> help(np.sort) ... # doctest: +SKIP For some objects, ``np.info(obj)`` may provide additional help. This is particularly true if you see the line "Help on ufunc object:" at the top of the help() page. Ufuncs are implemented in C, not Python, for speed. The native Python help() does not know how to view their help, but our np.info() function does. To search for documents containing a keyword, do:: >>> np.lookfor('keyword') ... # doctest: +SKIP General-purpose documents like a glossary and help on the basic concepts of numpy are available under the ``doc`` sub-module:: >>> from numpy import doc >>> help(doc) ... # doctest: +SKIP Available subpackages --------------------- doc Topical documentation on broadcasting, indexing, etc. lib Basic functions used by several sub-packages. random Core Random Tools linalg Core Linear Algebra Tools fft Core FFT routines polynomial Polynomial tools testing NumPy testing tools f2py Fortran to Python Interface Generator. distutils Enhancements to distutils with support for Fortran compilers support and more. Utilities --------- test Run numpy unittests show_config Show numpy build configuration dual Overwrite certain functions with high-performance SciPy tools. Note: `numpy.dual` is deprecated. Use the functions from NumPy or Scipy directly instead of importing them from `numpy.dual`. matlib Make everything matrices. __version__ NumPy version string Viewing documentation using IPython ----------------------------------- Start IPython with the NumPy profile (``ipython -p numpy``), which will import `numpy` under the alias `np`. Then, use the ``cpaste`` command to paste examples into the shell. To see which functions are available in `numpy`, type ``np.`` (where ```` refers to the TAB key), or use ``np.*cos*?`` (where ```` refers to the ENTER key) to narrow down the list. To view the docstring for a function, use ``np.cos?`` (to view the docstring) and ``np.cos??`` (to view the source code). Copies vs. in-place operation ----------------------------- Most of the functions in `numpy` return a copy of the array argument (e.g., `np.sort`). In-place versions of these functions are often available as array methods, i.e. ``x = np.array([1,2,3]); x.sort()``. Exceptions to this rule are documented. N)ModuleDeprecationWarningVisibleDeprecationWarning)_NoValueFz%Running from numpy source directory. )showzError importing numpy: you should not try to import numpy from its source directory; please exit the numpy source tree, and relaunch your python interpreter from there.) git_revision)versionrr)_distributor_init)core)*)compat)lib)linalg)fft) polynomial)random) ctypeslib)ma) matrixliba!`np.{n}` is a deprecated alias for the builtin `{n}`. To silence this warning, use `{n}` by itself. Doing this will not modify any behavior and is safe. {extended_msg} Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecationszCIf you specifically wanted the numpy scalar type, use `np.{}` here.zWhen replacing `np.{}`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.)objectboolZbool_floatZfloat64complexZ complex128strZstr_intcCs*i|]"\}}tt|tj||df|qS))n extended_msg)getattr _builtins_msgformat).0rrr#2/tmp/pip-unpacked-wheel-ecq9wray/numpy/__init__.py sr%a`np.{n}` is a deprecated alias for `np.compat.{n}`. To silence this warning, use `np.compat.{n}` by itself. In the likely event your code does not need to work on Python 2 you can use the builtin `{n2}` for which `np.compat.{n}` is itself an alias. Doing this will not modify any behaviour and is safe. {extended_msg} Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecationslong)rZn2rZunciodeunicode)roundabsmaxmin __version__ show_configrrrrr ArrayteratorZfvZipmtZirrZmirrZnperZnpvZpmtZppmtpvZratecCsi|]}d|d|qS)z(In accordance with NEP 32, the function z was removed from NumPy version 1.20. A replacement for this function is available in the numpy_financial library: https://pypi.org/project/numpy-financialr#)r"namer#r#r$r%signoreznumpy.dtype size changed)messageznumpy.ufunc size changedznumpy.ndarray size changedremoved)csy t|Wntk r Yn"Xtjtddfdd}|Syt|\}Wntk rfYnXtjtdd|S|dkrddlm}|S|dkrdd lm}|St d t |dS) Nr4) stacklevelcs tdS)N) RuntimeError)argskwds)msgr#r$_expiredsz__getattr__.._expiredtestingrTesterr)r>z!module {!r} has no attribute {!r}) __expired_functions__KeyErrorwarningswarnDeprecationWarning__deprecated_attrs__Z numpy.testingr=r>AttributeErrorr!__name__)attrr<valr=r>r#)r;r$ __getattr__ s*    rIcCsttddhBS)Nr>r=)listglobalskeysr#r#r#r$__dir__2srM)r>cCsi|]\}\}}||qSr#r#)r"kvr;r#r#r$r%;s) PytestTestercCsZy,tdtd}t||ddks*tWn(tk rTd}t|tdYnXdS)a Quick sanity checks for common bugs caused by environment. There are some cases e.g. with wrong BLAS ABI that cause wrong results under specific runtime conditions that are not necessarily achieved during test suite runs, and it is useful to catch those early. See https://github.com/numpy/numpy/issues/8577 and other similar bug reports. r4)Zdtypeg@gh㈵>zThe current Numpy installation ({!r}) fails to pass simple sanity checks. This can be caused for example by incorrect BLAS library being linked in, or by mixing package managers (pip, conda, apt, ...). Search closed numpy issues for similar problems.N)ZonesZfloat32r)dotAssertionErrorr8r!__file__)xr;r#r#r$ _sanity_checkGs   rUcCsRy8tdddg}tddd}t||}t||ddd}Wntk rLYnXd S) z Quick Sanity check for Mac OS look for accelerate build bugs. Testing numpy polyfit calls init_dgelsd(LAPACK) g@g@g?rr4T)ZcovN)arrayZlinspaceZpolyvalZpolyfit ValueError)crTy_r#r#r$ _mac_os_checkas  r\darwinT)recordrz{}: {}a%Polyfit sanity test emitted a warning, most likely due to using a buggy Accelerate backend. If you compiled yourself, more information is available at https://numpy.org/doc/stable/user/building.html#accelerated-blas-lapack-libraries Otherwise report this to the vendor that provided NumPy. {} ZNUMPY_MADVISE_HUGEPAGElinux.ccs|]}t|VqdS)N)r)r"rOr#r#r$ srb))a__doc__sysrAZ_globalsrrrZ__NUMPY_SETUP__ NameErrorstderrwriteZnumpy.__config__rr- ImportErrorer;rrZ__git_revision__r,__all__rDrr r r r rrrrrrrZ_matbuiltinsrr Z _specific_msgZ_int_extended_msgr!Z _type_infoupdaterr(r)r*r+Z getlimitsZ_register_known_typesextendr&r'remover.Z_financial_namesr?filterwarningsZ oldnumericZnumarray version_inforIrMr=r>rKitemsZnumpy._pytesttesterrPrFtestrUr\platformcatch_warningsw error_messagelencategoryrr2r8osenvirongetZ use_hugepageunamereleasesplitZkernel_versiontuplerXZ use_hugepagesrZ multiarrayZ_set_madvise_hugepager#r#r#r$ls                               (