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ematical 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. Available subpackages --------------------- 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 distutils Enhancements to distutils with support for Fortran compilers support and more (for Python <= 3.11) Utilities --------- test Run numpy unittests show_config Show numpy build configuration __version__ NumPy version string Viewing documentation using IPython ----------------------------------- Start IPython and import `numpy` usually under the alias ``np``: `import numpy as np`. Then, directly past or use the ``%cpaste`` magic 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)_NoValue _CopyMode)__expired_attributes__)version) __version__Fz%Running from numpy source directory. )_distributor_init)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.)_core(AFalse_ ScalarTypeTrue__get_promotion_state_no_nep50_warning_set_promotion_stateabsabsoluteacosacoshaddallallcloseamaxaminanyarangearccosarccosharcsinarcsinharctanarctan2arctanhargmaxargmin argpartitionargsortargwherearoundarray array2string array_equal array_equiv array_repr array_str asanyarrayasarrayascontiguousarrayasfortranarrayasinasinhatanatanhatan2astype atleast_1d atleast_2d atleast_3d base_repr binary_repr bitwise_and bitwise_countbitwise_invertbitwise_left_shift bitwise_not bitwise_orbitwise_right_shift bitwise_xorblockboolbool_ broadcast busday_count busday_offsetbusdaycalendarbytebytes_can_castcbrtcdoubleceil characterchooseclip clongdouble complex128 complex64complexfloatingcompressconcat concatenateconj conjugateconvolvecopysigncopyto correlatecoscosh count_nonzerocrosscsinglecumprodcumsum datetime64datetime_as_string datetime_datadeg2raddegreesdiagonaldividedivmoddotdoubledtypeeeinsum einsum_pathempty empty_likeequalerrstate euler_gammaexpexp2expm1fabsfinfoflatiter flatnonzeroflexiblefloat16float32float64 float_powerfloatingfloor floor_dividefmaxfminfmodformat_float_positionalformat_float_scientificfrexp from_dlpack frombufferfromfile fromfunctionfromiter frompyfunc fromstringfull full_likegcdgeneric geomspaceget_printoptions getbufsizegeterr geterrcallgreater greater_equalhalf heavisidehstackhypotidentityiinforindicesinexactinfinnerint16int32int64int8int_intcintegerintpinvert is_busdayiscloseisdtypeisfinite isfortranisinfisnanisnatisscalar issubdtypelcmldexp left_shiftless less_equallexsortlinspace little_endianloglog10log1plog2 logaddexp logaddexp2 logical_and logical_not logical_or logical_xorlogspacelong longdoublelonglongmatmulmatrix_transposemaxmaximummay_share_memorymeanmemmapminmin_scalar_typeminimummodmodfmoveaxismultiplynanndarrayndimnditernegative nested_itersnewaxis nextafternonzero not_equalnumberobject_ones ones_likeouter partition permute_dimspipositivepowpower printoptionsprod promote_typesptpputputmaskrad2degradiansravelrecarray reciprocalrecord remainderrepeatrequirereshaperesize result_type right_shiftrintrollrollaxisround sctypeDict searchsortedset_printoptions setbufsizeseterr seterrcallshape shares_memoryshortsignsignbit signedintegersinsinglesinhsizesortspacingsqrtsquaresqueezestackstdstr_subtractsumswapaxestaketantanh tensordot timedelta64trace transpose true_dividetrunc typecodesubyteufuncuintuint16uint32uint64uint8uintcuintpulong ulonglongunsignedintegerushortvarvdotvecdotvoidvstackwherezeros zeros_like)Zfloat96Zfloat128Z complex192Z complex256)lib)scimath) histogramhistogram_bin_edges histogramdd) nanargmax nanargmin nancumprod nancumsumnanmaxnanmean nanmediannanmin nanpercentilenanprod nanquantilenanstdnansumnanvar)&select piecewise trim_zeroscopyiterable percentilediffgradientangleunwrap sort_complexfliprot90extractplace vectorizeasarray_chkfiniteaveragebincountdigitizecovcorrcoefmediansinchamminghanningbartlettblackmankaiser trapezoidtrapzi0meshgriddeleteinsertappendinterpquantile)diagdiagflateyefliplrflipudtritriutrilvander histogram2d mask_indices tril_indicestril_indices_from triu_indicestriu_indices_from)apply_over_axesapply_along_axis array_split column_stackdsplitdstack expand_dimshsplitkronput_along_axis row_stacksplittake_along_axistilevsplit) iscomplexobj isrealobjimag iscomplexisreal nan_to_numreal real_if_closetypename mintypecode common_type) ediff1din1d intersect1disin setdiff1dsetxor1dunion1dunique unique_all unique_countsunique_inverse unique_values)fixisneginfisposinf)pad) show_runtime get_includeinfo)broadcast_arraysbroadcast_shapes broadcast_to) polypolyintpolyderpolyaddpolysubpolymulpolydivpolyvalpolyfitpoly1droots) savetxtloadtxt genfromtxtloadsavesavezpackbitssavez_compressed unpackbits fromregex)diag_indices_from diag_indices fill_diagonalndindex ndenumerateix_c_r_s_ogridmgrid unravel_indexravel_multi_index index_exp) matrixlib)asmatrixbmatmatrix>testtyping ctypesliblinalgma polynomial exceptionstestingstringsrandomrecfftrKcharcoref2pydtypesamodule 'numpy' has no attribute '{n}'. `np.{n}` was a deprecated alias for the builtin `{n}`. To avoid this error in existing code, use `{n}` by itself. Doing this will not modify any behavior and is safe. {extended_msg} The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: 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.)objectfloatrcomplexrWstrr(intcCs i|]\}}|tj||dqS))n extended_msg)_msgformat).0rrr8/usr/local/lib/python3.9/site-packages/numpy/__init__.py sr>rrbytesz2022.12>emath show_configrignoreznumpy.dtype size changed)messageznumpy.ufunc size changedznumpy.ndarray size changedcCsrddl}|dkr ddlm}|S|dkr8ddlm}|S|dkrPddlm}|S|dkrhddlm}|S|dkrddl m }|S|dkrddl m }|S|dkrddl m}|S|d krddlm} | S|d krddlm} | S|d krddlm} | S|d krddlm} | S|d kr0ddlm} | S|dkrJddlm}|S|dkrdddlm}|S|dkrxtdn`|dkrddlm}|S|dkrddl m!}|S|dkrdt"vrddl#m$}|Std|t%vr|j&d|dt'dd|t(vrtt(||t)vr2td|dt)||dkr^|j&dt*ddddlm}|j+Std,t-|dS)Nrrrrrrrrrrmatlibrrrr array_apiz9`numpy.array_api` is not available from numpy 2.0 onwardsrr distutilsz;`numpy.distutils` is not available from Python 3.12 onwardszIn the future `np.z4` will be defined as the corresponding NumPy scalar.) stacklevelz`np.z(` was removed in the NumPy 2.0 release. chararrayz`np.chararray` is deprecated and will be removed from the main namespace in the future. Use an array with a string or bytes dtype instead.z!module {!r} has no attribute {!r}).warningsZ numpy.linalgrZ numpy.fftrZ numpy.dtypesrZ numpy.randomrZnumpy.polynomialrZnumpy.marZnumpy.ctypeslibrZnumpy.exceptionsrZ numpy.testingrZ numpy.matlibr Z numpy.f2pyrZ numpy.typingrZ numpy.recrZ numpy.charrAttributeErrorZ numpy.corerZ numpy.stringsr__numpy_submodules__Znumpy.distutilsr__future_scalars__warn FutureWarning__former_attrs__rDeprecationWarningrr__name__)attrrrrrrrrrrrr rrrrrrrrrr __getattr__Cs                                    rcCs"ttB}|hd8}t|S)N>rrcompatZtestsZconftestrr r)globalskeysrlist)Zpublic_symbolsrrr__dir__s  r") PytestTestercCs\z0tdtd}t||tddks.tWn&tyVd}t|tdYn0dS)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)rt@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)rrrrrAssertionError RuntimeErrorr__file__)xmsgrrr _sanity_checks    r*cCsNz6tgd}tddd}t||}t||ddd}WntyHYn0dS)z Quick Sanity check for Mac OS look for accelerate build bugs. Testing numpy polyfit calls init_dgelsd(LAPACK) )g@r$g?rrT)rrN)r)rrr ValueError)cr(y_rrr _mac_os_checks    r0darwin)rT)rz: aPolyfit 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/devdocs/building/index.html Otherwise report this to the vendor that provided NumPy. {} cCstjdd}tjdkrx|durxz>d}tjddd}tdd|D}|d kr\d }Wqt ytd }Yq0n|durd}nt |}|S) a+ We usually use madvise hugepages support, but on some old kernels it is slow and thus better avoided. Specifically kernel version 4.6 had a bug fix which probably fixed this: https://github.com/torvalds/linux/commit/7cf91a98e607c2f935dbcc177d70011e95b8faff ZNUMPY_MADVISE_HUGEPAGENlinuxr.rcss|]}t|VqdS)N)r)rvrrr z!hugepage_setup..)r) osenvirongetsysplatformunamereleasertupler,r)Z use_hugepageZkernel_versionrrrhugepage_setups  rAZNPY_PROMOTION_STATEZweakcCs$ddlm}t|tdgS)NrPathZ _pyinstaller)pathlibrCrr' with_nameresolverBrrr_pyinstaller_hooks_dirs rG(C__doc__r9r<rZ_globalsrrZ_expired_attrs_2_0rrrrZ__NUMPY_SETUP__ NameErrorstderrwriterZnumpy.__config__r r  ImportErrorrur)r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJtagetattrrrrKrLr Zlib._histograms_implrMrNrOZlib._nanfunctions_implrPrQrRrSrTrUrVrWrXrYrZr[r\r]Zlib._function_base_implr^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrZlib._twodim_base_implrrrrrrrrrrrrrrrZlib._shape_base_implrrrrrrrrrrrrrrrZlib._type_check_implrrrrrrrrrrrZlib._arraysetops_implrrrrrrrrrrrrZlib._ufunclike_implrrrZlib._arraypad_implrZlib._utils_implrrrZlib._stride_tricks_implrrrZlib._polynomial_implrrrrrrrrrrrZlib._npyio_implrrrrrrrrrrZlib._index_tricks_implrrrrrrrrrrrrrrrZ_matrrrrrZ _specific_msgZ_int_extended_msgrZ _type_inforrZ__array_api_version__Z getlimitsZ_register_known_typesr!set__all__Z_histograms_implZ_nanfunctions_implZ_function_base_implZ_twodim_base_implZ_shape_base_implZ_type_check_implZ_arraysetops_implZ_ufunclike_implZ_arraypad_implZ _utils_implZ_stride_tricks_implZ_polynomial_implZ _npyio_implZ_index_tricks_implfilterwarningsrr"Znumpy._pytesttesterr#rrr*r0r=rcatch_warningswlenZ_wncategoryZ RankWarningrr  error_messager&rAZ multiarrayZ_set_madvise_hugepageZ_multiarray_umathZ _reload_guardr:r;rGrrrrs"W        n4  "z;bj"""bZz"          Z    &$