1 //------------------------------------------------------------------------------ 2 // GB_transpose.h: definitions for GB_transpose 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_TRANSPOSE_H 11 #define GB_TRANSPOSE_H 12 #include "GB.h" 13 #include "GB_atomics.h" 14 15 bool GB_transpose_method // if true: use GB_builder, false: use bucket 16 ( 17 const GrB_Matrix A, // matrix to transpose 18 int *nworkspaces_bucket, // # of slices of A for the bucket method 19 int *nthreads_bucket, // # of threads to use for the bucket method 20 GB_Context Context 21 ) ; 22 23 GB_PUBLIC // accessed by the MATLAB tests in GraphBLAS/Test only 24 GrB_Info GB_transpose // C=A', C=(ctype)A or C=op(A') 25 ( 26 GrB_Matrix *Chandle, // output matrix C, possibly modified in-place 27 GrB_Type ctype, // desired type of C; if NULL use A->type. 28 // ignored if op is present (cast to op->ztype) 29 const bool C_is_csc, // desired CSR/CSC format of C 30 const GrB_Matrix A_in, // input matrix 31 // no operator is applied if both op1 and op2 are NULL 32 const GrB_UnaryOp op1, // unary operator to apply 33 const GrB_BinaryOp op2, // binary operator to apply 34 const GxB_Scalar scalar, // scalar to bind to binary operator 35 bool binop_bind1st, // if true, binop(x,A) else binop(A,y) 36 GB_Context Context 37 ) ; 38 39 GrB_Info GB_transpose_bucket // bucket transpose; typecast and apply op 40 ( 41 GrB_Matrix C, // output matrix (static header) 42 const GrB_Type ctype, // type of output matrix C 43 const bool C_is_csc, // format of output matrix C 44 const GrB_Matrix A, // input matrix 45 // no operator is applied if both op1 and op2 are NULL 46 const GrB_UnaryOp op1, // unary operator to apply 47 const GrB_BinaryOp op2, // binary operator to apply 48 const GxB_Scalar scalar, // scalar to bind to binary operator 49 bool binop_bind1st, // if true, binop(x,A) else binop(A,y) 50 const int nworkspaces, // # of workspaces to use 51 const int nthreads, // # of threads to use 52 GB_Context Context 53 ) ; 54 55 void GB_transpose_ix // transpose the pattern and values of a matrix 56 ( 57 GrB_Matrix C, // output matrix 58 const GrB_Matrix A, // input matrix 59 // for sparse case: 60 int64_t *restrict *Workspaces, // Workspaces, size nworkspaces 61 const int64_t *restrict A_slice, // how A is sliced, size nthreads+1 62 int nworkspaces, // # of workspaces to use 63 // for all cases: 64 int nthreads // # of threads to use 65 ) ; 66 67 void GB_transpose_op // transpose, typecast, and apply operator to a matrix 68 ( 69 GrB_Matrix C, // output matrix 70 // no operator is applied if both op1 and op2 are NULL 71 const GrB_UnaryOp op1, // unary operator to apply 72 const GrB_BinaryOp op2, // binary operator to apply 73 const GxB_Scalar scalar, // scalar to bind to binary operator 74 bool binop_bind1st, // if true, binop(x,A) else binop(A,y) 75 const GrB_Matrix A, // input matrix 76 // for sparse or hypersparse case: 77 int64_t *restrict *Workspaces, // Workspaces, size nworkspaces 78 const int64_t *restrict A_slice, // how A is sliced, size nthreads+1 79 int nworkspaces, // # of workspaces to use 80 // for all cases: 81 int nthreads // # of threads to use 82 ) ; 83 84 GB_PUBLIC // used by GraphBLAS MATLAB interface 85 GrB_Info GB_shallow_copy // create a purely shallow matrix 86 ( 87 GrB_Matrix C, // output matrix C, with a static header 88 const bool C_is_csc, // desired CSR/CSC format of C 89 const GrB_Matrix A, // input matrix 90 GB_Context Context 91 ) ; 92 93 #endif 94 95