Search
Search Results
Search finished, found 108 page(s) matching the search query.
- NumPy internals
...NumPy internals...
- Array iterator API
...2] multi_index is [1, 0] multi_index is [1, 1] multi_index is [1, 2] Iterator data types The iterator layout is an internal detail, and user code only sees an incomplete struct. type NpyIter This is an opaque pointer type for the ite...
- Constants of the
numpy.ma
module...fill_value=999999) numpy.ma.nomask Value indicating that a masked array has no invalid entry. nomask is used internally to speed up computations when the mask is not needed. It is represented internally as np.False_. numpy.ma...
- CPU build options
...r temporary sources that have been used for generating the binary objects of dispatched features. Extra checks: list of internal checks that activate certain functionality or intrinsics related to the enabled features, useful for debugging...
- For downstream package authors
...when using defaults, NumPy 1.25 will expose a C-API compatible with NumPy 1.19. (the exact version is set within NumPy-internal header files). NumPy is also forward compatible for all minor releases, but a major release will require recomp...
- How to extend NumPy
...r an ndarray object (or one of it’s sub-classes). The easiest way to do this doesn’t require you to know much about the internals of NumPy. The method is to Ensure you are dealing with a well-behaved array (aligned, in machine byte-order a...
- Internal organization of NumPy arrays
...NumPy user guide Under-the-hood documentation for developers Internal organization of NumPy arrays...
- Interoperability with NumPy
...o allow subclasses to handle the various ways that new instances get created. This method is called whenever the system internally allocates a new array from an object which is a subclass (subtype) of the ndarray. It can be used to change a...
- Legacy random generation
...ues were incorrect. RandomState is effectively frozen and will only receive updates that are required by changes in the internals of Numpy. More substantial changes, including algorithmic improvements, are reserved for Generator. Parameter...
- Memory management in NumPy
...allocated after creating the python object in __new__. The strides and shape are stored in a piece of memory allocated internally. The data allocation used to store the actual array values (which could be pointers in the case of object arr...
- NumPy 1.10.0 Release Notes
...adcasting rules. The functionality is similar to broadcast_arrays, which in fact has been rewritten to use broadcast_to internally, but only a single array is necessary. New context manager clear_and_catch_warnings for testing warnings Wh...
- NumPy 1.11.0 Release Notes
...ify over which axes the gradient is calculated. np.lexsort now supports arrays with object data-type The function now internally calls the generic npy_amergesort when the type does not implement a merge-sort kind of argsort method. np.m...
- NumPy 1.12.0 Release Notes
...ller footprint is desirable. Changes All array-like methods are now called with keyword arguments in fromnumeric.py Internally, many array-like methods in fromnumeric.py were being called with positional arguments instead of keyword arg...
- NumPy 1.14.0 Release Notes
...PyPy does not use refcounts, they do not function correctly with PyPy. NumPy is in the process of eliminating their use internally and two new C-API functions, PyArray_SetWritebackIfCopyBase PyArray_ResolveWritebackIfCopy, have been added...
- NumPy 1.17.0 Release Notes
...w raise a TypeError instead of the previous ValueError. Deprecate numpy.distutils.exec_command and temp_file_name The internal use of these functions has been refactored and there are better alternatives. Replace exec_command with subproc...
- NumPy 1.19.0 Release Notes
...Python 2 compatibility, multiarray.int_asbuffer was removed. On Python 3, it threw a NotImplementedError and was unused internally. It is expected that there are no downstream use cases for this method with Python 3. (gh-15229) numpy.dist...
- NumPy 1.20.0 Release Notes
...s would cast the coefficients to np.float64. This affected the output dtype of methods which construct poly1d instances internally, such as np.polymul. (gh-17577) The numpy.i file for swig is Python 3 only. Uses of Python 2.7 C-API functi...
- NumPy 1.21.0 Release Notes
...(arr, arr, dtype="m8[ns]") # Now returns "s" (from `arr`) The same applies for functions like np.sum which use these internally. This change is necessary to achieve consistent handling within NumPy. If you run into these, in most cases p...
- NumPy 1.24 Release Notes
...rning assumed length character strings (e.g. character(len=*)) from wrapper functions A hook to support rewriting f2py internal data structures after reading all its input files is introduced. This is required, for instance, for BC of SciP...
- NumPy 1.25.0 Release Notes
...propriate indexed loops have been added to add, subtract, multiply, floor_divide, maximum, minimum, fmax, and fmin. The internal logic is similar to the logic used for regular ufuncs, which also have fast paths. Thanks to the D. E. Shaw gro...
- NumPy 1.26.1 Release Notes
...nBLAS and Accelerate were supported in previous releases. -Dallow-noblas: if set to true, allow NumPy to build with its internal (very slow) fallback routines instead of linking against an external BLAS/LAPACK library. The default for this...
- NumPy 1.3.0 Release Notes
...PY_CPU_S390: S390 NPY_CPU_IA64: ia64 NPY_CPU_PARISC: PARISC New macros for CPU endianness has been added as well (see internal changes below for details): NPY_BYTE_ORDER: integer NPY_LITTLE_ENDIAN/NPY_BIG_ENDIAN defines Those provide...
- NumPy 1.4.0 Release Notes
...ing axis > MAX_DIMS is no longer allowed; Numpy raises now an error instead of behaving similarly as for axis=None. Internal changes Use C99 complex functions when available The numpy complex types are now guaranteed to be ABI compatib...
- NumPy 1.8.0 Release Notes
...ew definition is more accurate, allows for faster code that makes fewer unnecessary copies, and simplifies numpy’s code internally. However, it may also break third-party libraries that make too-strong assumptions about the stride values of...
- NumPy 1.8.1 Release Notes
...g numpy.distutils. Deprecations C-API The utility function npy_PyFile_Dup and npy_PyFile_DupClose are broken by the internal buffering python 3 applies to its file objects. To fix this two new functions npy_PyFile_Dup2 and npy_PyFile_Du...
- NumPy 1.9.0 Release Notes
...- or FutureWarnings at this time. C-API The utility function npy_PyFile_Dup and npy_PyFile_DupClose are broken by the internal buffering python 3 applies to its file objects. To fix this two new functions npy_PyFile_Dup2 and npy_PyFile_Du...
- NumPy 2.0 migration guide
...ill available as np.lib.add_docstring. add_newdoc It’s still available as np.lib.add_newdoc. add_newdoc_ufunc It’s an internal function and doesn’t have a replacement. alltrue Use np.all instead. asfarray Use np.asarray with a float dty...
- NumPy 2.0.0 Release Notes
...I improvements: A new public C API for creating custom dtypes, Many outdated functions and macros removed, and private internals hidden to ease future extensibility, New, easier to use, initialization functions: PyArray_ImportNumPyAPI and...
- NumPy 2.1.0 Release Notes
...ions Scalars and 0D arrays are disallowed for numpy.nonzero and numpy.ndarray.nonzero. (gh-26268) set_string_function internal function was removed and PyArray_SetStringFunction was stubbed out. (gh-26611) C API changes API symbols n...
- NumPy C code explanations
...loop object is a C-structure (that could become a Python object but is not initialized as such because it is only used internally). This loop object has the layout needed to be used with PyArray_Broadcast so that the broadcasting can be ha...
- NumPy internals
...NumPy internals...
- numpy.arange
...than stop. Warning The length of the output might not be numerically stable. Another stability issue is due to the internal implementation of numpy.arange. The actual step value used to populate the array is dtype(start + step) - dtype...
- numpy.argsort
...ed array will maintain the relative order of a values which compare as equal. If False or None, this is not guaranteed. Internally, this option selects kind='stable'. Default: None. New in version 2.0.0. Returns: index_arrayndarray, i...
- numpy.array2string
...ion keyword is ignored for that type. This is a very flexible function; array_repr and array_str are using array2string internally so keywords with the same name should work identically in all three functions. Examples >>> import numpy as n...
- numpy.bitwise_left_shift
...Shift the bits of an integer to the left. Bits are shifted to the left by appending x2 0s at the right of x1. Since the internal representation of numbers is in binary format, this operation is equivalent to multiplying x1 by 2**x2. Parame...
- numpy.bitwise_right_shift
...ure]) = <ufunc 'right_shift'> Shift the bits of an integer to the right. Bits are shifted to the right x2. Because the internal representation of numbers is in binary format, this operation is equivalent to dividing x1 by 2**x2. Parameter...
- numpy.busdaycalendar
...s Once a busdaycalendar object is created, you cannot modify the weekmask or holidays. The attributes return copies of internal data. Examples >>> import numpy as np >>> # Some important days in July ... bdd = np.busdaycalendar( ......
- numpy.fill_diagonal
...trices. See also diag_indices, diag_indices_from Notes This functionality can be obtained via diag_indices, but internally this version uses a much faster implementation that never constructs the indices and uses simple slicing. Exa...
- numpy.i: a SWIG interface file for NumPy
...le) -> double """ where seq would be a NumPy array of double values, and its length n would be extracted from seq internally before being passed to the C routine. Even better, since NumPy supports construction of arrays from arbitrar...
- numpy.interp
...of floatsThe x-coordinates of the data points, must be increasing if argument period is not specified. Otherwise, xp is internally sorted after normalizing the periodic boundaries with xp = xp % period. fp1-D sequence of float or complexTh...
- numpy.left_shift
...Shift the bits of an integer to the left. Bits are shifted to the left by appending x2 0s at the right of x1. Since the internal representation of numbers is in binary format, this operation is equivalent to multiplying x1 by 2**x2. Parame...
- numpy.lib.add_newdoc
...in C The purpose is to allow easier editing of the docstrings without requiring a re-compile. This exists primarily for internal use within numpy itself. Parameters: placestrThe absolute name of the module to import from objstr or NoneTh...
- numpy.lib.array_utils.normalize_axis_index
...the shape of array with ndim dimensions. Raises an AxisError with an appropriate message if this is not possible. Used internally by all axis-checking logic. Parameters: axisintThe un-normalized index of the axis. Can be negative ndimin...
- numpy.lib.array_utils.normalize_axis_tuple
...gative indices covered by normalize_axis_index. By default, this forbids axes from being specified multiple times. Used internally by multi-axis-checking logic. Parameters: axisint, iterable of intThe un-normalized index or indices of the...
- numpy.lib.stride_tricks.as_strided
...ews. Notes as_strided creates a view into the array given the exact strides and shape. This means it manipulates the internal data structure of ndarray and, if done incorrectly, the array elements can point to invalid memory and can corr...
- numpy.ma.arange
...than stop. Warning The length of the output might not be numerically stable. Another stability issue is due to the internal implementation of numpy.arange. The actual step value used to populate the array is dtype(start + step) - dtype...
- numpy.ma.argsort
...atatype, the ordering of these values and the masked values is undefined. fill_valuescalar or None, optionalValue used internally for the masked values. If fill_value is not None, it supersedes endwith. stablebool, optionalOnly for compat...
- numpy.ma.array
...sk with a scalar boolean value is to use True/False rather than np.True_/np.False_. The reason is nomask is represented internally as np.False_. >>> np.False_ is np.ma.nomask True...
- numpy.ma.cumprod
..._frommethod object> Return the cumulative product of the array elements over the given axis. Masked values are set to 1 internally during the computation. However, their position is saved, and the result will be masked at the same locations...
- numpy.ma.cumsum
...ore._frommethod object> Return the cumulative sum of the array elements over the given axis. Masked values are set to 0 internally during the computation. However, their position is saved, and the result will be masked at the same locations...
- numpy.ma.masked_array.argsort
...atatype, the ordering of these values and the masked values is undefined. fill_valuescalar or None, optionalValue used internally for the masked values. If fill_value is not None, it supersedes endwith. stablebool, optionalOnly for compat...
- numpy.ma.masked_array.cumprod
..., out=None)[source] Return the cumulative product of the array elements over the given axis. Masked values are set to 1 internally during the computation. However, their position is saved, and the result will be masked at the same locations...
- numpy.ma.masked_array.cumsum
...None, out=None)[source] Return the cumulative sum of the array elements over the given axis. Masked values are set to 0 internally during the computation. However, their position is saved, and the result will be masked at the same locations...
- numpy.ma.masked_array.prod
...keepdims=<no value>)[source] Return the product of the array elements over the given axis. Masked elements are set to 1 internally for computation. Refer to numpy.prod for full documentation. See also numpy.ndarray.prodcorresponding funct...
- numpy.ma.masked_array.product
...keepdims=<no value>)[source] Return the product of the array elements over the given axis. Masked elements are set to 1 internally for computation. Refer to numpy.prod for full documentation. See also numpy.ndarray.prodcorresponding funct...
- numpy.ma.masked_array.sort
...atatype, the ordering of these values and the masked values is undefined. fill_valuescalar or None, optionalValue used internally for the masked values. If fill_value is not None, it supersedes endwith. stablebool, optionalOnly for compat...
- numpy.ma.masked_array.sum
...ne, keepdims=<no value>)[source] Return the sum of the array elements over the given axis. Masked elements are set to 0 internally. Refer to numpy.sum for full documentation. See also numpy.ndarray.sumcorresponding function for ndarrays...
- numpy.ma.MaskedArray.__getstate__
...numpy.ma.MaskedArray.__getstate__ method ma.MaskedArray.__getstate__()[source] Return the internal state of the masked array, for pickling purposes....
- numpy.ma.MaskedArray.__setstate__
...numpy.ma.MaskedArray.__setstate__ method ma.MaskedArray.__setstate__(state)[source] Restore the internal state of the masked array, for pickling purposes. state is typically the output of the __getstate__ output, an...
- numpy.ma.MaskedArray.argsort
...atatype, the ordering of these values and the masked values is undefined. fill_valuescalar or None, optionalValue used internally for the masked values. If fill_value is not None, it supersedes endwith. stablebool, optionalOnly for compat...
- numpy.ma.MaskedArray.cumprod
..., out=None)[source] Return the cumulative product of the array elements over the given axis. Masked values are set to 1 internally during the computation. However, their position is saved, and the result will be masked at the same locations...
- numpy.ma.MaskedArray.cumsum
...None, out=None)[source] Return the cumulative sum of the array elements over the given axis. Masked values are set to 0 internally during the computation. However, their position is saved, and the result will be masked at the same locations...
- numpy.ma.MaskedArray.prod
...keepdims=<no value>)[source] Return the product of the array elements over the given axis. Masked elements are set to 1 internally for computation. Refer to numpy.prod for full documentation. See also numpy.ndarray.prodcorresponding funct...
- numpy.ma.MaskedArray.product
...keepdims=<no value>)[source] Return the product of the array elements over the given axis. Masked elements are set to 1 internally for computation. Refer to numpy.prod for full documentation. See also numpy.ndarray.prodcorresponding funct...
- numpy.ma.MaskedArray.sort
...atatype, the ordering of these values and the masked values is undefined. fill_valuescalar or None, optionalValue used internally for the masked values. If fill_value is not None, it supersedes endwith. stablebool, optionalOnly for compat...
- numpy.ma.MaskedArray.sum
...ne, keepdims=<no value>)[source] Return the sum of the array elements over the given axis. Masked elements are set to 0 internally. Refer to numpy.sum for full documentation. See also numpy.ndarray.sumcorresponding function for ndarrays...
- numpy.ma.prod
....ma.core._frommethod object> Return the product of the array elements over the given axis. Masked elements are set to 1 internally for computation. Refer to numpy.prod for full documentation. See also numpy.ndarray.prodcorresponding funct...
- numpy.ma.sum
...umpy.ma.core._frommethod object> Return the sum of the array elements over the given axis. Masked elements are set to 0 internally. Refer to numpy.sum for full documentation. See also numpy.ndarray.sumcorresponding function for ndarrays...
- numpy.nditer.iternext
...numpy.nditer.iternext method nditer.iternext() Check whether iterations are left, and perform a single internal iteration without returning the result. Used in the C-style pattern do-while pattern. For an example, see ndi...
- numpy.nditer.remove_multi_index
...lti_index method nditer.remove_multi_index() When the “multi_index” flag was specified, this removes it, allowing the internal iteration structure to be optimized further....
- numpy.random.Generator.multivariate_normal
...nite). Otherwise, the behavior of this method is undefined and backwards compatibility is not guaranteed. This function internally uses linear algebra routines, and thus results may not be identical (even up to precision) across architectur...
- numpy.random.Generator.negative_binomial
...ion of the number of non-“1”s that appear before the third “1” is a negative binomial distribution. Because this method internally calls Generator.poisson with an intermediate random value, a ValueError is raised when the choice of \(n\) a...
- numpy.random.get_state
...numpy.random.get_state random.get_state(legacy=True) Return a tuple representing the internal state of the generator. For more details, see set_state. Parameters: legacybool, optionalFlag indicating to r...
- numpy.random.RandomState.get_state
...numpy.random.RandomState.get_state method random.RandomState.get_state(legacy=True) Return a tuple representing the internal state of the generator. For more details, see set_state. Parameters: legacybool, optionalFlag indicating to r...
- numpy.random.RandomState.set_state
...numpy.random.RandomState.set_state method random.RandomState.set_state(state) Set the internal state of the generator from a tuple. For use if one has reason to manually (re-)set the internal state of the b...
- numpy.random.set_state
...numpy.random.set_state random.set_state(state) Set the internal state of the generator from a tuple. For use if one has reason to manually (re-)set the internal state of the b...
- numpy.right_shift
...ure]) = <ufunc 'right_shift'> Shift the bits of an integer to the right. Bits are shifted to the right x2. Because the internal representation of numbers is in binary format, this operation is equivalent to dividing x1 by 2**x2. Parameter...
- numpy.sort
...ed array will maintain the relative order of a values which compare as equal. If False or None, this is not guaranteed. Internally, this option selects kind='stable'. Default: None. New in version 2.0.0. Returns: sorted_arrayndarrayAr...
- numpy.ufunc.signature
...s and the remaining dimensions are broadcast together, defining the loop dimensions. Notes Generalized ufuncs are used internally in many linalg functions, and in the testing suite; the examples below are taken from these. For ufuncs that...
- NumPy: the absolute basics for beginners
...ter and doesn’t need to be specified.) If you want to learn more about C and Fortran order, you can read more about the internal organization of NumPy arrays here. Essentially, C and Fortran orders have to do with how indices correspond to...
- Python types and C-structures
...m Python, but a few are not exposed due to their limited use. Every new Python type has an associated PyObject* with an internal structure that includes a pointer to a “method table” that defines how the new object behaves in Python. When y...
- Random sampling (
numpy.random
)...supported BitGenerators. default_rng and BitGenerators delegate the conversion of seeds into RNG states to SeedSequence internally. SeedSequence implements a sophisticated algorithm that intermediates between the user’s input and the intern...
- Standard array subclasses
...on for many useful classes. Often whether to sub-class the array object or to simply use the core array component as an internal part of a new class is a difficult decision, and can be simply a matter of choice. NumPy has several tools for...
- Testing guidelines
...heck the array dtype and shape, too. When you need custom assertions, use the Python assert statement. Note that pytest internally rewrites assert statements to give informative output when it fails, so it should be preferred over the legac...
- The N-dimensional array (
ndarray
)...y[selection]. Similar syntax is also used for accessing fields in a structured data type. See also Array Indexing. Internal memory layout of an ndarray An instance of class ndarray consists of a contiguous one-dimensional segment of co...
- Universal functions (
ufunc
) basics...f the input type is an integer (or Boolean) data-type and smaller than the size of the numpy.int_ data type, it will be internally upcast to the int_ (or numpy.uint) data-type. In the previous example: >>> x.dtype dtype('int64') >>> np.mult...
- Using F2PY
...Using F2PY This page contains a reference to all command-line options for the f2py command, as well as a reference to internal functions of the numpy.f2py module. Using f2py as a command-line tool When used as a command-line tool, f2py h...
- Array API
...escr *PyArray_MinScalarType(PyArrayObject *arr) Note With the adoption of NEP 50 in NumPy 2, this function is not used internally. It is currently provided for backwards compatibility, but expected to be eventually deprecated. If arr is...
- Array objects
...en a single element of the array is accessed. The N-dimensional array (ndarray) Constructing arrays Indexing arrays Internal memory layout of an ndarray Array attributes Array methods Arithmetic, matrix multiplication, and comparison op...
- Bit generators
...er, or a list of such integers, as a seed. BitGenerators need to take those inputs and process them into a high-quality internal state for the BitGenerator. All of the BitGenerators in numpy delegate that task to SeedSequence, which uses ha...
- BLAS and LAPACK
...und will be used. In case no suitable library is found, the NumPy build will print a warning and then use (slow!) NumPy-internal fallback routines. In order to disallow use of those slow routines, the allow-noblas build option can be used:...
- C API deprecations
...d follow better practices. Another important role played by deprecation markings in the C API is to move towards hiding internal details of the NumPy implementation. For those needing direct, easy, access to the data of ndarrays, this will...
- Compatibility policy
...gs. There are a few gray areas where we can make minor fixes to keep RandomState working without segfaulting as NumPy’s internals change, and some docstring fixes. However, the previously-mentioned caveats about the variability from machine...
- Copies and views
...Copies and views When operating on NumPy arrays, it is possible to access the internal data buffer directly using a view without copying data around. This ensures good performance but can also cause...
- Datetime API
...Datetime API NumPy represents dates internally using an int64 counter and a unit metadata struct. Time differences are represented similarly using an int64...
- Datetimes and timedeltas
...to create datetimes from an integer by offset relative to the Unix epoch (00:00:00 UTC on 1 January 1970). The unit for internal storage is automatically selected from the form of the string, and can be either a date unit or a time unit. Th...
- Glossary
..., 2, -1, -1]) masked arrayBad or missing data can be cleanly ignored by putting it in a masked array, which has an internal boolean array indicating invalid entries. Operations with masked arrays ignore these entries. >>> a = np.ma.mas...
- Iterating over arrays
...all the examples so far, the elements of a are provided by the iterator one at a time, because all the looping logic is internal to the iterator. While this is simple and convenient, it is not very efficient. A better approach is to move th...
- Parallel random number generation
...}\) iterations away from any other seed. And finally, MT19937 has just an unimaginably huge period. Getting a collision internal to SeedSequence is the way a failure would be observed. Sequence of integer seeds As discussed in the previ...
- Philox counter-based RNG
...lmon, Mark A. Moraes, Ron O. Dror, and David E. Shaw, “Parallel Random Numbers: As Easy as 1, 2, 3,” Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis (SC11), New York, NY: ACM, 201...
- Release notes
...ures Removed features 1.5.0 Highlights New features Changes 1.4.0 Highlights New features Improvements Deprecations Internal changes 1.3.0 Highlights New features Deprecated features Documentation changes New C API Internal changes...
- Scalars
...ta type.) Methods Array scalars have exactly the same methods as arrays. The default behavior of these methods is to internally convert the scalar to an equivalent 0-dimensional array and to call the corresponding array method. In additi...
- Structured arrays
.... As an exception, fields of numpy.object_ type cannot overlap with other fields, because of the risk of clobbering the internal object pointer and then dereferencing it. The optional ‘aligned’ value can be set to True to make the automatic...
- ufunc API
...n. If the input type is an integer (or boolean) data type smaller than the size of the numpy.int_ data type, it will be internally upcast to the numpy.int_ (or numpy.uint) data type. doc – Allows passing in a documentation string to be stor...
- Under-the-hood documentation for developers
...documentation for developers These documents are intended as a low-level look into NumPy; focused towards developers. Internal organization of NumPy arrays NumPy C code explanations Memory alignment Byte-swapping Writing custom array cont...
- Universal functions (
ufunc
)...of these ufuncs are called automatically on arrays when the relevant infix notation is used (e.g., add(a, b) is called internally when a + b is written and a or b is an ndarray). Nevertheless, you may still want to use the ufunc call in or...
- Upgrading
PCG64
withPCG64DXSM
...se” in the 127-bit increment space, so that would be less likely than the negligible chance of colliding in the 128-bit internal SeedSequence pool. The DXSM output function is more computationally intensive than XSL-RR, but some optimizatio...
- Using via
scikit-build
...h call f2py -c. This usage is not recommended since the point of these build system documents are to move away from the internal numpy.distutils methods. For situations where no setuptools replacements are required or wanted (i.e. if wheel...