B z `. @sdZddlZddlZddlmZmZddlmZyeWnek rPdZYnXerfej dnyddl m Z Wn ek rd ZeeYnXdd lmZdd lmZd d gZddlmZddlmZddlTddlmZddlmZddlTddlmZddlmZddlmZddlmZddlmZddlmZddlm Z!ddl Tddl"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(ddlm)Z)m*Z*ddlm+Z+m,Z,m-Z-m.Z.ej/0e1ddge1eje1e!je1eje1dd d!d"d#ge2d$e2d%e2d&[3ej4d'd(d)ej4d'd*d)ej4d'd+d)d,Z5d,Z6ej7dd-d.krdd/d0Z8d1d2Z9n dd3l:m;Z;dd4lZ?[=d5d6Z@e@[@d7d8ZAddlZejBd9krejCd:d;NZDeAdjHj>e(eDd>jIZEd?GeEZeJeWdQRX[Ad@dAZKejBdBkr:ejLdCkr:eK[KddlMZMeMjNOdDdZPejBdEkrePdkry@dZPeMQjRSdFdd-ZTeUdGdHeTDZTeTdIkrdZPWneVk rdZWYnXnePdkrdZPne$ePZPejXYePdS)Ja@ 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 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) matrixlib)boolintfloatcomplexobjectstr)longunicode)roundabsmaxmin __version__ show_configrrrrrrr Arrayteratorignoreznumpy.dtype size changed)messageznumpy.ufunc size changedznumpy.ndarray size changedremoved)cCsD|dkrddlm}|S|dkr0ddlm}|Stdt|dS)NtestingrTesterr)r+z!module {!r} has no attribute {!r})Z numpy.testingr*r+AttributeErrorformat__name__)attrr*r+r02/tmp/pip-unpacked-wheel-4iou4664/numpy/__init__.py __getattr__s  r2cCsttddhBS)Nr+r*)listglobalskeysr0r0r0r1__dir__sr6)r+) PytestTestercCsXy,tdtd}t||ddks*tWn&tk rRd}t|tYnXdS)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. r')dtypeg@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)ZonesZfloat32rdotAssertionError RuntimeErrorr-__file__)xmsgr0r0r1 _sanity_checks   r?cCsRy8tdddg}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?rr'T)ZcovN)arrayZlinspaceZpolyvalZpolyfit ValueError)cr=y_r0r0r1 _mac_os_checks  rFdarwinT)recordz{}: {}zPolyfit sanity test emitted a warning, most likely due to using a buggy Accelerate backend. If you compiled yourself, see site.cfg.example for information. Otherwise report this to the vendor that provided NumPy. {} cCsXy*tdtddd}|d}t|Wn(tk rRd}t|tdYnXdS)uU Quick Sanity check for Windows OS: look for fmod bug issue 16744.  )r8 zThe current Numpy installation ({!r}) fails to pass a sanity check due to a bug in the windows runtime. See this issue for more information: https://tinyurl.com/y3dm3h86N) ZarangeZfloat64ZreshaperZeig Exceptionr;r-r<)ar>r0r0r1 _win_os_check!srPwin32lZNUMPY_MADVISE_HUGEPAGElinux.ccs|]}t|VqdS)N)r).0vr0r0r1 CsrV))Z__doc__syswarningsZ_globalsrrrZ__NUMPY_SETUP__ NameErrorstderrwriteZnumpy.__config__rr" ImportErrorr>rrZ__git_revision__r!__all__rIr r r r rrrrrrrZ_matbuiltinsrrrrrrrrrrrr Z getlimitsZ_register_known_typesextendremover#filterwarningsZ oldnumericZnumarray version_infor2r6r*r+Znumpy._pytesttesterr7r.testr?rFplatformcatch_warningsw error_messagelenr-categoryr%r;rPmaxsizeosenvirongetZ use_hugepageunamereleasesplitZkernel_versiontuplerBZ use_hugepagesZ multiarrayZ_set_madvise_hugepager0r0r0r1js