neulab/docprompting-conala huggingface dataset:
numpy.isfortran   numpy.isfortran(a)[source]
 
Check if the array is Fortran contiguous but not C contiguous. This function is obsolete and, because of changes due to relaxed stride checking, its return value for the same array may differ for versions of NumPy >= 1.10.0 and previous versions. If you only want to check if an array is Fortran contiguous use a.flags.f_contiguous instead.  Parameters 
 
andarray


Input array.    Returns 
 
isfortranbool


Returns True if the array is Fortran contiguous but not C contiguous.     Examples np.array allows to specify whether the array is written in C-contiguous order (last index varies the fastest), or FORTRAN-contiguous order in memory (first index varies the fastest). >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C')
>>> a
array([[1, 2, 3],
       [4, 5, 6]])
>>> np.isfortran(a)
False
 >>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F')
>>> b
array([[1, 2, 3],
       [4, 5, 6]])
>>> np.isfortran(b)
True
 The transpose of a C-ordered array is a FORTRAN-ordered array. >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C')
>>> a
array([[1, 2, 3],
       [4, 5, 6]])
>>> np.isfortran(a)
False
>>> b = a.T
>>> b
array([[1, 4],
       [2, 5],
       [3, 6]])
>>> np.isfortran(b)
True
 C-ordered arrays evaluate as False even if they are also FORTRAN-ordered. >>> np.isfortran(np.array([1, 2], order='F'))
False
numpy.isin   numpy.isin(element, test_elements, assume_unique=False, invert=False)[source]
 
Calculates element in test_elements, broadcasting over element only. Returns a boolean array of the same shape as element that is True where an element of element is in test_elements and False otherwise.  Parameters 
 
elementarray_like


Input array.  
test_elementsarray_like


The values against which to test each value of element. This argument is flattened if it is an array or array_like. See notes for behavior with non-array-like parameters.  
assume_uniquebool, optional


If True, the input arrays are both assumed to be unique, which can speed up the calculation. Default is False.  
invertbool, optional


If True, the values in the returned array are inverted, as if calculating element not in test_elements. Default is False. np.isin(a, b, invert=True) is equivalent to (but faster than) np.invert(np.isin(a, b)).    Returns 
 
isinndarray, bool


Has the same shape as element. The values element[isin] are in test_elements.      See also  in1d

Flattened version of this function.  numpy.lib.arraysetops

Module with a number of other functions for performing set operations on arrays.    Notes isin is an element-wise function version of the python keyword in. isin(a, b) is roughly equivalent to np.array([item in b for item in a]) if a and b are 1-D sequences. element and test_elements are converted to arrays if they are not already. If test_elements is a set (or other non-sequence collection) it will be converted to an object array with one element, rather than an array of the values contained in test_elements. This is a consequence of the array constructor’s way of handling non-sequence collections. Converting the set to a list usually gives the desired behavior.  New in version 1.13.0.  Examples >>> element = 2*np.arange(4).reshape((2, 2))
>>> element
array([[0, 2],
       [4, 6]])
>>> test_elements = [1, 2, 4, 8]
>>> mask = np.isin(element, test_elements)
>>> mask
array([[False,  True],
       [ True, False]])
>>> element[mask]
array([2, 4])
 The indices of the matched values can be obtained with nonzero: >>> np.nonzero(mask)
(array([0, 1]), array([1, 0]))
 The test can also be inverted: >>> mask = np.isin(element, test_elements, invert=True)
>>> mask
array([[ True, False],
       [False,  True]])
>>> element[mask]
array([0, 6])
 Because of how array handles sets, the following does not work as expected: >>> test_set = {1, 2, 4, 8}
>>> np.isin(element, test_set)
array([[False, False],
       [False, False]])
 Casting the set to a list gives the expected result: >>> np.isin(element, list(test_set))
array([[False,  True],
       [ True, False]])
numpy.isinf   numpy.isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'isinf'>
 
Test element-wise for positive or negative infinity. Returns a boolean array of the same shape as x, True where x ==
+/-inf, otherwise False.  Parameters 
 
xarray_like


Input values  
outndarray, None, or tuple of ndarray and None, optional


A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs.  
wherearray_like, optional


This condition is broadcast over the input. At locations where the condition is True, the out array will be set to the ufunc result. Elsewhere, the out array will retain its original value. Note that if an uninitialized out array is created via the default out=None, locations within it where the condition is False will remain uninitialized.  **kwargs

For other keyword-only arguments, see the ufunc docs.    Returns 
 
ybool (scalar) or boolean ndarray


True where x is positive or negative infinity, false otherwise. This is a scalar if x is a scalar.      See also  
isneginf, isposinf, isnan, isfinite

  Notes NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic (IEEE 754). Errors result if the second argument is supplied when the first argument is a scalar, or if the first and second arguments have different shapes. Examples >>> np.isinf(np.inf)
True
>>> np.isinf(np.nan)
False
>>> np.isinf(np.NINF)
True
>>> np.isinf([np.inf, -np.inf, 1.0, np.nan])
array([ True,  True, False, False])
 >>> x = np.array([-np.inf, 0., np.inf])
>>> y = np.array([2, 2, 2])
>>> np.isinf(x, y)
array([1, 0, 1])
>>> y
array([1, 0, 1])
numpy.isnan   numpy.isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'isnan'>
 
Test element-wise for NaN and return result as a boolean array.  Parameters 
 
xarray_like


Input array.  
outndarray, None, or tuple of ndarray and None, optional


A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs.  
wherearray_like, optional


This condition is broadcast over the input. At locations where the condition is True, the out array will be set to the ufunc result. Elsewhere, the out array will retain its original value. Note that if an uninitialized out array is created via the default out=None, locations within it where the condition is False will remain uninitialized.  **kwargs

For other keyword-only arguments, see the ufunc docs.    Returns 
 
yndarray or bool


True where x is NaN, false otherwise. This is a scalar if x is a scalar.      See also  
isinf, isneginf, isposinf, isfinite, isnat

  Notes NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic (IEEE 754). This means that Not a Number is not equivalent to infinity. Examples >>> np.isnan(np.nan)
True
>>> np.isnan(np.inf)
False
>>> np.isnan([np.log(-1.),1.,np.log(0)])
array([ True, False, False])
numpy.isnat   numpy.isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'isnat'>
 
Test element-wise for NaT (not a time) and return result as a boolean array.  New in version 1.13.0.   Parameters 
 
xarray_like


Input array with datetime or timedelta data type.  
outndarray, None, or tuple of ndarray and None, optional


A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs.  
wherearray_like, optional


This condition is broadcast over the input. At locations where the condition is True, the out array will be set to the ufunc result. Elsewhere, the out array will retain its original value. Note that if an uninitialized out array is created via the default out=None, locations within it where the condition is False will remain uninitialized.  **kwargs

For other keyword-only arguments, see the ufunc docs.    Returns 
 
yndarray or bool


True where x is NaT, false otherwise. This is a scalar if x is a scalar.      See also  
isnan, isinf, isneginf, isposinf, isfinite

  Examples >>> np.isnat(np.datetime64("NaT"))
True
>>> np.isnat(np.datetime64("2016-01-01"))
False
>>> np.isnat(np.array(["NaT", "2016-01-01"], dtype="datetime64[ns]"))
array([ True, False])
numpy.isneginf   numpy.isneginf(x, out=None)[source]
 
Test element-wise for negative infinity, return result as bool array.  Parameters 
 
xarray_like


The input array.  
outarray_like, optional


A location into which the result is stored. If provided, it must have a shape that the input broadcasts to. If not provided or None, a freshly-allocated boolean array is returned.    Returns 
 
outndarray


A boolean array with the same dimensions as the input. If second argument is not supplied then a numpy boolean array is returned with values True where the corresponding element of the input is negative infinity and values False where the element of the input is not negative infinity. If a second argument is supplied the result is stored there. If the type of that array is a numeric type the result is represented as zeros and ones, if the type is boolean then as False and True. The return value out is then a reference to that array.      See also  
isinf, isposinf, isnan, isfinite

  Notes NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic (IEEE 754). Errors result if the second argument is also supplied when x is a scalar input, if first and second arguments have different shapes, or if the first argument has complex values. Examples >>> np.isneginf(np.NINF)
True
>>> np.isneginf(np.inf)
False
>>> np.isneginf(np.PINF)
False
>>> np.isneginf([-np.inf, 0., np.inf])
array([ True, False, False])
 >>> x = np.array([-np.inf, 0., np.inf])
>>> y = np.array([2, 2, 2])
>>> np.isneginf(x, y)
array([1, 0, 0])
>>> y
array([1, 0, 0])
numpy.isposinf   numpy.isposinf(x, out=None)[source]
 
Test element-wise for positive infinity, return result as bool array.  Parameters 
 
xarray_like


The input array.  
outarray_like, optional


A location into which the result is stored. If provided, it must have a shape that the input broadcasts to. If not provided or None, a freshly-allocated boolean array is returned.    Returns 
 
outndarray


A boolean array with the same dimensions as the input. If second argument is not supplied then a boolean array is returned with values True where the corresponding element of the input is positive infinity and values False where the element of the input is not positive infinity. If a second argument is supplied the result is stored there. If the type of that array is a numeric type the result is represented as zeros and ones, if the type is boolean then as False and True. The return value out is then a reference to that array.      See also  
isinf, isneginf, isfinite, isnan

  Notes NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic (IEEE 754). Errors result if the second argument is also supplied when x is a scalar input, if first and second arguments have different shapes, or if the first argument has complex values Examples >>> np.isposinf(np.PINF)
True
>>> np.isposinf(np.inf)
True
>>> np.isposinf(np.NINF)
False
>>> np.isposinf([-np.inf, 0., np.inf])
array([False, False,  True])
 >>> x = np.array([-np.inf, 0., np.inf])
>>> y = np.array([2, 2, 2])
>>> np.isposinf(x, y)
array([0, 0, 1])
>>> y
array([0, 0, 1])
numpy.isreal   numpy.isreal(x)[source]
 
Returns a bool array, where True if input element is real. If element has complex type with zero complex part, the return value for that element is True.  Parameters 
 
xarray_like


Input array.    Returns 
 
outndarray, bool


Boolean array of same shape as x.      See also  iscomplex
isrealobj

Return True if x is not a complex type.    Notes isreal may behave unexpectedly for string or object arrays (see examples) Examples >>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex)
>>> np.isreal(a)
array([False,  True,  True,  True,  True, False])
 The function does not work on string arrays. >>> a = np.array([2j, "a"], dtype="U")
>>> np.isreal(a)  # Warns about non-elementwise comparison
False
 Returns True for all elements in input array of dtype=object even if any of the elements is complex. >>> a = np.array([1, "2", 3+4j], dtype=object)
>>> np.isreal(a)
array([ True,  True,  True])
 isreal should not be used with object arrays >>> a = np.array([1+2j, 2+1j], dtype=object)
>>> np.isreal(a)
array([ True,  True])
numpy.isrealobj   numpy.isrealobj(x)[source]
 
Return True if x is a not complex type or an array of complex numbers. The type of the input is checked, not the value. So even if the input has an imaginary part equal to zero, isrealobj evaluates to False if the data type is complex.  Parameters 
 
xany


The input can be of any type and shape.    Returns 
 
ybool


The return value, False if x is of a complex type.      See also  
iscomplexobj, isreal

  Notes The function is only meant for arrays with numerical values but it accepts all other objects. Since it assumes array input, the return value of other objects may be True. >>> np.isrealobj('A string')
True
>>> np.isrealobj(False)
True
>>> np.isrealobj(None)
True
 Examples >>> np.isrealobj(1)
True
>>> np.isrealobj(1+0j)
False
>>> np.isrealobj([3, 1+0j, True])
False
numpy.isscalar   numpy.isscalar(element)[source]
 
Returns True if the type of element is a scalar type.  Parameters 
 
elementany


Input argument, can be of any type and shape.    Returns 
 
valbool


True if element is a scalar type, False if it is not.      See also  ndim

Get the number of dimensions of an array    Notes If you need a stricter way to identify a numerical scalar, use isinstance(x, numbers.Number), as that returns False for most non-numerical elements such as strings. In most cases np.ndim(x) == 0 should be used instead of this function, as that will also return true for 0d arrays. This is how numpy overloads functions in the style of the dx arguments to gradient and the bins argument to histogram. Some key differences:   
x isscalar(x) np.ndim(x) == 0   
PEP 3141 numeric objects (including builtins) True True  
builtin string and buffer objects True True  
other builtin objects, like pathlib.Path, Exception, the result of re.compile False True  
third-party objects like matplotlib.figure.Figure False True  
zero-dimensional numpy arrays False True  
other numpy arrays False False  
list, tuple, and other sequence objects False False   Examples >>> np.isscalar(3.1)
True
>>> np.isscalar(np.array(3.1))
False
>>> np.isscalar([3.1])
False
>>> np.isscalar(False)
True
>>> np.isscalar('numpy')
True
 NumPy supports PEP 3141 numbers: >>> from fractions import Fraction
>>> np.isscalar(Fraction(5, 17))
True
>>> from numbers import Number
>>> np.isscalar(Number())
True
numpy.issctype   numpy.issctype(rep)[source]
 
Determines whether the given object represents a scalar data-type.  Parameters 
 
repany


If rep is an instance of a scalar dtype, True is returned. If not, False is returned.    Returns 
 
outbool


Boolean result of check whether rep is a scalar dtype.      See also  
issubsctype, issubdtype, obj2sctype, sctype2char

  Examples >>> np.issctype(np.int32)
True
>>> np.issctype(list)
False
>>> np.issctype(1.1)
False
 Strings are also a scalar type: >>> np.issctype(np.dtype('str'))
True
numpy.issubclass_   numpy.issubclass_(arg1, arg2)[source]
 
Determine if a class is a subclass of a second class. issubclass_ is equivalent to the Python built-in issubclass, except that it returns False instead of raising a TypeError if one of the arguments is not a class.  Parameters 
 
arg1class


Input class. True is returned if arg1 is a subclass of arg2.  
arg2class or tuple of classes.


Input class. If a tuple of classes, True is returned if arg1 is a subclass of any of the tuple elements.    Returns 
 
outbool


Whether arg1 is a subclass of arg2 or not.      See also  
issubsctype, issubdtype, issctype

  Examples >>> np.issubclass_(np.int32, int)
False
>>> np.issubclass_(np.int32, float)
False
>>> np.issubclass_(np.float64, float)
True
numpy.issubdtype   numpy.issubdtype(arg1, arg2)[source]
 
Returns True if first argument is a typecode lower/equal in type hierarchy. This is like the builtin issubclass, but for dtypes.  Parameters 
 
arg1, arg2dtype_like


dtype or object coercible to one    Returns 
 
outbool

    See also  Scalars

Overview of the numpy type hierarchy.  
issubsctype, issubclass_

  Examples issubdtype can be used to check the type of arrays: >>> ints = np.array([1, 2, 3], dtype=np.int32)
>>> np.issubdtype(ints.dtype, np.integer)
True
>>> np.issubdtype(ints.dtype, np.floating)
False
 >>> floats = np.array([1, 2, 3], dtype=np.float32)
>>> np.issubdtype(floats.dtype, np.integer)
False
>>> np.issubdtype(floats.dtype, np.floating)
True
 Similar types of different sizes are not subdtypes of each other: >>> np.issubdtype(np.float64, np.float32)
False
>>> np.issubdtype(np.float32, np.float64)
False
 but both are subtypes of floating: >>> np.issubdtype(np.float64, np.floating)
True
>>> np.issubdtype(np.float32, np.floating)
True
 For convenience, dtype-like objects are allowed too: >>> np.issubdtype('S1', np.string_)
True
>>> np.issubdtype('i4', np.signedinteger)
True
numpy.issubsctype   numpy.issubsctype(arg1, arg2)[source]
 
Determine if the first argument is a subclass of the second argument.  Parameters 
 
arg1, arg2dtype or dtype specifier


Data-types.    Returns 
 
outbool


The result.      See also  
issctype, issubdtype, obj2sctype

  Examples >>> np.issubsctype('S8', str)
False
>>> np.issubsctype(np.array([1]), int)
True
>>> np.issubsctype(np.array([1]), float)
False
numpy.ix_   numpy.ix_(*args)[source]
 
Construct an open mesh from multiple sequences. This function takes N 1-D sequences and returns N outputs with N dimensions each, such that the shape is 1 in all but one dimension and the dimension with the non-unit shape value cycles through all N dimensions. Using ix_ one can quickly construct index arrays that will index the cross product. a[np.ix_([1,3],[2,5])] returns the array [[a[1,2] a[1,5]], [a[3,2] a[3,5]]].  Parameters 
 
args1-D sequences


Each sequence should be of integer or boolean type. Boolean sequences will be interpreted as boolean masks for the corresponding dimension (equivalent to passing in np.nonzero(boolean_sequence)).    Returns 
 
outtuple of ndarrays


N arrays with N dimensions each, with N the number of input sequences. Together these arrays form an open mesh.      See also  
ogrid, mgrid, meshgrid

  Examples >>> a = np.arange(10).reshape(2, 5)
>>> a
array([[0, 1, 2, 3, 4],
       [5, 6, 7, 8, 9]])
>>> ixgrid = np.ix_([0, 1], [2, 4])
>>> ixgrid
(array([[0],
       [1]]), array([[2, 4]]))
>>> ixgrid[0].shape, ixgrid[1].shape
((2, 1), (1, 2))
>>> a[ixgrid]
array([[2, 4],
       [7, 9]])
 >>> ixgrid = np.ix_([True, True], [2, 4])
>>> a[ixgrid]
array([[2, 4],
       [7, 9]])
>>> ixgrid = np.ix_([True, True], [False, False, True, False, True])
>>> a[ixgrid]
array([[2, 4],
       [7, 9]])
numpy.kron   numpy.kron(a, b)[source]
 
Kronecker product of two arrays. Computes the Kronecker product, a composite array made of blocks of the second array scaled by the first.  Parameters 
 
a, barray_like

  Returns 
 
outndarray

    See also  outer

The outer product    Notes The function assumes that the number of dimensions of a and b are the same, if necessary prepending the smallest with ones. If a.shape = (r0,r1,..,rN) and b.shape = (s0,s1,...,sN), the Kronecker product has shape (r0*s0, r1*s1, ..., rN*SN). The elements are products of elements from a and b, organized explicitly by: kron(a,b)[k0,k1,...,kN] = a[i0,i1,...,iN] * b[j0,j1,...,jN]
 where: kt = it * st + jt,  t = 0,...,N
 In the common 2-D case (N=1), the block structure can be visualized: [[ a[0,0]*b,   a[0,1]*b,  ... , a[0,-1]*b  ],
 [  ...                              ...   ],
 [ a[-1,0]*b,  a[-1,1]*b, ... , a[-1,-1]*b ]]
 Examples >>> np.kron([1,10,100], [5,6,7])
array([  5,   6,   7, ..., 500, 600, 700])
>>> np.kron([5,6,7], [1,10,100])
array([  5,  50, 500, ...,   7,  70, 700])
 >>> np.kron(np.eye(2), np.ones((2,2)))
array([[1.,  1.,  0.,  0.],
       [1.,  1.,  0.,  0.],
       [0.,  0.,  1.,  1.],
       [0.,  0.,  1.,  1.]])
 >>> a = np.arange(100).reshape((2,5,2,5))
>>> b = np.arange(24).reshape((2,3,4))
>>> c = np.kron(a,b)
>>> c.shape
(2, 10, 6, 20)
>>> I = (1,3,0,2)
>>> J = (0,2,1)
>>> J1 = (0,) + J             # extend to ndim=4
>>> S1 = (1,) + b.shape
>>> K = tuple(np.array(I) * np.array(S1) + np.array(J1))
>>> c[K] == a[I]*b[J]
True
numpy.lcm   numpy.lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'lcm'>
 
Returns the lowest common multiple of |x1| and |x2|  Parameters 
 
x1, x2array_like, int


Arrays of values. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).    Returns 
 
yndarray or scalar


The lowest common multiple of the absolute value of the inputs This is a scalar if both x1 and x2 are scalars.      See also  gcd

The greatest common divisor    Examples >>> np.lcm(12, 20)
60
>>> np.lcm.reduce([3, 12, 20])
60
>>> np.lcm.reduce([40, 12, 20])
120
>>> np.lcm(np.arange(6), 20)
array([ 0, 20, 20, 60, 20, 20])
numpy.ldexp   numpy.ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'ldexp'>
 
Returns x1 * 2**x2, element-wise. The mantissas x1 and twos exponents x2 are used to construct floating point numbers x1 * 2**x2.  Parameters 
 
x1array_like


Array of multipliers.  
x2array_like, int


Array of twos exponents. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).  
outndarray, None, or tuple of ndarray and None, optional


A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs.  
wherearray_like, optional


This condition is broadcast over the input. At locations where the condition is True, the out array will be set to the ufunc result. Elsewhere, the out array will retain its original value. Note that if an uninitialized out array is created via the default out=None, locations within it where the condition is False will remain uninitialized.  **kwargs

For other keyword-only arguments, see the ufunc docs.    Returns 
 
yndarray or scalar


The result of x1 * 2**x2. This is a scalar if both x1 and x2 are scalars.      See also  frexp

Return (y1, y2) from x = y1 * 2**y2, inverse to ldexp.    Notes Complex dtypes are not supported, they will raise a TypeError. ldexp is useful as the inverse of frexp, if used by itself it is more clear to simply use the expression x1 * 2**x2. Examples >>> np.ldexp(5, np.arange(4))
array([ 5., 10., 20., 40.], dtype=float16)
 >>> x = np.arange(6)
>>> np.ldexp(*np.frexp(x))
array([ 0.,  1.,  2.,  3.,  4.,  5.])