numpy.cumprod()

numpy.cumprod(a, axis=None, dtype=None, out=None) [source] Return the cumulative product of elements along a given axis. Parameters: a : array_like Input array. axis : int, optional Axis along which the cumulative product is computed. By default the input is flattened. dtype : dtype, optional Type of the returned array, as well as of the accumulator in which the elements are multiplied. If dtype is not specified, it defaults to the dtype of a, unless a has an integer dtype with a prec

MaskedArray.max()

MaskedArray.max(axis=None, out=None, fill_value=None) [source] Return the maximum along a given axis. Parameters: axis : {None, int}, optional Axis along which to operate. By default, axis is None and the flattened input is used. out : array_like, optional Alternative output array in which to place the result. Must be of the same shape and buffer length as the expected output. fill_value : {var}, optional Value used to fill in the masked values. If None, use the output of maximum_fill

MaskedArray.strides

MaskedArray.strides Tuple of bytes to step in each dimension when traversing an array. The byte offset of element (i[0], i[1], ..., i[n]) in an array a is: offset = sum(np.array(i) * a.strides) A more detailed explanation of strides can be found in the ?ndarray.rst? file in the NumPy reference guide. See also numpy.lib.stride_tricks.as_strided Notes Imagine an array of 32-bit integers (each 4 bytes): x = np.array([[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]], dtype=np.int32) This arr

numpy.bitwise_and()

numpy.bitwise_and(x1, x2[, out]) = Compute the bit-wise AND of two arrays element-wise. Computes the bit-wise AND of the underlying binary representation of the integers in the input arrays. This ufunc implements the C/Python operator &. Parameters: x1, x2 : array_like Only integer and boolean types are handled. Returns: out : array_like Result. See also logical_and, bitwise_or, bitwise_xor binary_repr Return the binary representation of the input number as a string. Examp

Legendre.cutdeg()

Legendre.cutdeg(deg) [source] Truncate series to the given degree. Reduce the degree of the series to deg by discarding the high order terms. If deg is greater than the current degree a copy of the current series is returned. This can be useful in least squares where the coefficients of the high degree terms may be very small. New in version 1.5.0. Parameters: deg : non-negative int The series is reduced to degree deg by discarding the high order terms. The value of deg must be a non-ne

numpy.ma.ravel()

numpy.ma.ravel(self, order='C') = Returns a 1D version of self, as a view. Parameters: order : {?C?, ?F?, ?A?, ?K?}, optional The elements of a are read using this index order. ?C? means to index the elements in C-like order, with the last axis index changing fastest, back to the first axis index changing slowest. ?F? means to index the elements in Fortran-like index order, with the first index changing fastest, and the last index changing slowest. Note that the ?C? and ?F? options take

numpy.modf()

numpy.modf(x[, out1, out2]) = Return the fractional and integral parts of an array, element-wise. The fractional and integral parts are negative if the given number is negative. Parameters: x : array_like Input array. Returns: y1 : ndarray Fractional part of x. y2 : ndarray Integral part of x. Notes For integer input the return values are floats. Examples >>> np.modf([0, 3.5]) (array([ 0. , 0.5]), array([ 0., 3.])) >>> np.modf(-0.5) (-0.5, -0)

Iterating Over Arrays

The iterator object nditer, introduced in NumPy 1.6, provides many flexible ways to visit all the elements of one or more arrays in a systematic fashion. This page introduces some basic ways to use the object for computations on arrays in Python, then concludes with how one can accelerate the inner loop in Cython. Since the Python exposure of nditer is a relatively straightforward mapping of the C array iterator API, these ideas will also provide help working with array iteration from C or C++

numpy.diag_indices()

numpy.diag_indices(n, ndim=2) [source] Return the indices to access the main diagonal of an array. This returns a tuple of indices that can be used to access the main diagonal of an array a with a.ndim >= 2 dimensions and shape (n, n, ..., n). For a.ndim = 2 this is the usual diagonal, for a.ndim > 2 this is the set of indices to access a[i, i, ..., i] for i = [0..n-1]. Parameters: n : int The size, along each dimension, of the arrays for which the returned indices can be used. ndi

numpy.random.laplace()

numpy.random.laplace(loc=0.0, scale=1.0, size=None) Draw samples from the Laplace or double exponential distribution with specified location (or mean) and scale (decay). The Laplace distribution is similar to the Gaussian/normal distribution, but is sharper at the peak and has fatter tails. It represents the difference between two independent, identically distributed exponential random variables. Parameters: loc : float, optional The position, , of the distribution peak. scale : float, o