fast_array_utils.conv¶
Conversion utilities.
- fast_array_utils.conv.to_dense(x: CpuArray | DiskArray | types.sparray | types.spmatrix | types.CSDataset, /, *, order: Literal['K', 'A', 'C', 'F'] = 'K', to_cpu_memory: bool = False) NDArray[Any]¶
- fast_array_utils.conv.to_dense(x: types.DaskArray, /, *, order: Literal['K', 'A', 'C', 'F'] = 'K', to_cpu_memory: Literal[False] = False) types.DaskArray
- fast_array_utils.conv.to_dense(x: types.DaskArray, /, *, order: Literal['K', 'A', 'C', 'F'] = 'K', to_cpu_memory: Literal[True]) NDArray[Any]
- fast_array_utils.conv.to_dense(x: GpuArray | types.CupySpMatrix, /, *, order: Literal['K', 'A', 'C', 'F'] = 'K', to_cpu_memory: Literal[False] = False) types.CupyArray
- fast_array_utils.conv.to_dense(x: GpuArray | types.CupySpMatrix, /, *, order: Literal['K', 'A', 'C', 'F'] = 'K', to_cpu_memory: Literal[True]) NDArray[Any]
Convert x to a dense array.
If
to_cpu_memoryisFalse,dask.array.Arrays andcupy.ndarrays/cupyx.scipy.sparse.spmatrixinstances stay out-of-core and in GPU memory, respecively.- Parameters:
x – Input object to be converted.
order –
The order of the output array:
C(row-major) orF(column-major).KandAderive the order fromx.The default matches numpy, and therefore diverges from the
scipy.sparsematrices’toarray()’s default behavior of always returning aC-contiguous array. Instead, CSC matrices become F-contiguous arrays whenorder="K"(the default).Dask
Arrays concatenation behavior will result inorderhaving no effect on thedask.compute()/to_cpu_memory=Trueresult.to_cpu_memory – Also load data into memory (resulting in a
numpy.ndarray).
- Returns:
Dense form of
x
fast_array_utils.conv.scipy¶
Utilities only for sparse matrices.
- fast_array_utils.conv.scipy.to_dense(x: types.spmatrix | types.sparray, order: Literal['C', 'F'] = 'C') NDArray[Any]¶
Convert a sparse matrix to a dense matrix.
- Parameters:
x – Input matrix.
order – The order of the output matrix.
- Returns:
Dense matrix form of
x