1function C = GB_spec_concat (Tiles, ctype)
2%GB_SPEC_CONCAT a MATLAB mimic of GxB_Matrix_concat
3%
4% Usage:
5% C = GB_spec_concat (Types, ctype)
6
7% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
8% SPDX-License-Identifier: Apache-2.0
9
10%-------------------------------------------------------------------------------
11% get inputs
12%-------------------------------------------------------------------------------
13
14if (nargout > 1 || nargin ~= 2)
15    error ('usage: C = GB_spec_concat (Tiles, ctype)') ;
16end
17
18% get the tiles and typecast them to the type of C
19if (~iscell (Tiles))
20    error ('Tiles must be a cell array') ;
21end
22[m, n] = size (Tiles) ;
23Tiles_matrix  = cell (m,n) ;
24Tiles_pattern = cell (m,n) ;
25for i = 1:m
26    for j = 1:n
27        A = GB_spec_matrix (Tiles {i,j}) ;
28        A_matrix = A.matrix ;
29        if (~isequal (A.class, ctype))
30            % typecast the tile into ctype
31            A_matrix = GB_mex_cast (A_matrix, ctype) ;
32        end
33        Tiles_matrix  {i,j} = A_matrix ;
34        Tiles_pattern {i,j} = A.pattern ;
35    end
36end
37
38%-------------------------------------------------------------------------------
39% C = concat (Tiles)
40%-------------------------------------------------------------------------------
41
42C.matrix  = cell2mat (Tiles_matrix) ;
43C.pattern = cell2mat (Tiles_pattern) ;
44C.class = ctype ;
45
46