1 //------------------------------------------------------------------------------
2 // GB_build.h: definitions for GB_build
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 #ifndef GB_BUILD_H
11 #define GB_BUILD_H
12 #include "GB.h"
13 
14 GrB_Info GB_matvec_build        // check inputs then build matrix or vector
15 (
16     GrB_Matrix C,               // matrix or vector to build
17     const GrB_Index *I,         // row indices of tuples
18     const GrB_Index *J,         // col indices of tuples (NULL for vector)
19     const void *S,              // array of values of tuples
20     const GrB_Index nvals,      // number of tuples
21     const GrB_BinaryOp dup,     // binary function to assemble duplicates
22     const GB_Type_code scode,   // GB_Type_code of S array
23     const bool is_matrix,       // true if C is a matrix, false if GrB_Vector
24     GB_Context Context
25 ) ;
26 
27 GrB_Info GB_build               // build matrix
28 (
29     GrB_Matrix C,               // matrix to build
30     const GrB_Index *I_input,   // "row" indices of tuples (as if CSC)
31     const GrB_Index *J_input,   // "col" indices of tuples (as if CSC)
32                                 // J_input is NULL for GrB_Vector_build
33     const void *S_input,        // values
34     const GrB_Index nvals,      // number of tuples
35     const GrB_BinaryOp dup,     // binary function to assemble duplicates
36     const GB_Type_code scode,   // GB_Type_code of S_input array
37     const bool is_matrix,       // true if C is a matrix, false if GrB_Vector
38     GB_Context Context
39 ) ;
40 
41 GrB_Info GB_builder                 // build a matrix from tuples
42 (
43     GrB_Matrix T,                   // matrix T to build, with static header
44     const GrB_Type ttype,           // type of output matrix T
45     const int64_t vlen,             // length of each vector of T
46     const int64_t vdim,             // number of vectors in T
47     const bool is_csc,              // true if T is CSC, false if CSR
48     int64_t **I_work_handle,        // for (i,k) or (j,i,k) tuples
49     size_t *I_work_size_handle,
50     int64_t **J_work_handle,        // for (j,i,k) tuples
51     size_t *J_work_size_handle,
52     GB_void **S_work_handle,        // array of values of tuples, size ijslen
53     size_t *S_work_size_handle,
54     bool known_sorted,              // true if tuples known to be sorted
55     bool known_no_duplicates,       // true if tuples known to not have dupl
56     int64_t ijslen,                 // size of I_work and J_work arrays
57     const bool is_matrix,           // true if T a GrB_Matrix, false if vector
58     const int64_t *restrict I_input,// original indices, size nvals
59     const int64_t *restrict J_input,// original indices, size nvals
60     const GB_void *restrict S_input,// array of values of tuples, size nvals
61     const int64_t nvals,            // number of tuples, and size of K_work
62     const GrB_BinaryOp dup,         // binary function to assemble duplicates,
63                                     // if NULL use the SECOND operator to
64                                     // keep the most recent duplicate.
65     const GB_Type_code scode,       // GB_Type_code of S_work or S_input array
66     GB_Context Context
67 ) ;
68 
69 #endif
70