1 //------------------------------------------------------------------------------
2 // GxB_Matrix_split: split a matrix into an array of matrices
3 //------------------------------------------------------------------------------
4
5 // SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
6 // SPDX-License-Identifier: Apache-2.0
7
8 //------------------------------------------------------------------------------
9
10 // The input matrix A is split into a 2D array of size m-by-n. The Tile{i,j}
11 // matrix has dimension Tile_nrows[i]-by-Tile_ncols[j].
12
13 #include "GB_split.h"
14
GxB_Matrix_split(GrB_Matrix * Tiles,const GrB_Index m,const GrB_Index n,const GrB_Index * Tile_nrows,const GrB_Index * Tile_ncols,const GrB_Matrix A,const GrB_Descriptor desc)15 GrB_Info GxB_Matrix_split // split a matrix into 2D array of matrices
16 (
17 GrB_Matrix *Tiles, // 2D row-major array of size m-by-n
18 const GrB_Index m,
19 const GrB_Index n,
20 const GrB_Index *Tile_nrows, // array of size m
21 const GrB_Index *Tile_ncols, // array of size n
22 const GrB_Matrix A, // input matrix to split
23 const GrB_Descriptor desc // unused, except threading control
24 )
25 {
26
27 //--------------------------------------------------------------------------
28 // check inputs
29 //--------------------------------------------------------------------------
30
31 GB_WHERE1 ("GxB_Matrix_split (Tiles, m, n, Tile_nrows, Tile_ncols, A, "
32 "desc)") ;
33 GB_BURBLE_START ("GxB_Matrix_split") ;
34 GB_RETURN_IF_NULL_OR_FAULTY (A) ;
35 if (m <= 0 || n <= 0)
36 {
37 return (GrB_INVALID_VALUE) ;
38 }
39 GB_RETURN_IF_NULL (Tiles) ;
40 GB_RETURN_IF_NULL (Tile_nrows) ;
41 GB_RETURN_IF_NULL (Tile_ncols) ;
42
43 // get the descriptor
44 GB_GET_DESCRIPTOR (info, desc, xx1, xx2, xx3, xx4, xx5, xx6, xx7) ;
45
46 //--------------------------------------------------------------------------
47 // Tiles = split (A)
48 //--------------------------------------------------------------------------
49
50 info = GB_split (Tiles, m, n, Tile_nrows, Tile_ncols, A, Context) ;
51 GB_BURBLE_END ;
52 return (info) ;
53 }
54
55