dpnp.isfortran¶
- dpnp.isfortran(a)[source]¶
Check if the array is Fortran contiguous but not C contiguous.
For full documentation refer to
numpy.isfortran.- Parameters:
- a{dpnp.ndarray, usm_ndarray}
Input array.
- Returns:
- isfortranbool
Returns
Trueif the array is Fortran contiguous but not C contiguous.
Warning
This function is deprecated and will be removed in a future release. Use
a.flags.fncinstead, ora.flags.f_contiguousif you only need to check for Fortran contiguity.Examples
dpnp.arrayallows 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).>>> import dpnp as np >>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C') >>> a array([[1, 2, 3], [4, 5, 6]]) >>> a.flags.fnc False
>>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F') >>> b array([[1, 2, 3], [4, 5, 6]]) >>> b.flags.fnc 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]]) >>> a.flags.fnc False >>> b = a.T >>> b array([[1, 4], [2, 5], [3, 6]]) >>> b.flags.fnc True
C-ordered arrays evaluate as
Falseeven if they are also FORTRAN-ordered.>>> np.array([1, 2], order='F').flags.fnc False