MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / GrB_transpose

Function GrB_transpose

deps/GraphBLAS/Source/GrB_transpose.c:18–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16#include "GB_get_mask.h"
17
18GrB_Info GrB_transpose // C<M> = accum(C,A') or accum(C,A)
19(
20 GrB_Matrix C, // input/output matrix for results
21 const GrB_Matrix M_in, // optional mask for C, unused if NULL
22 const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
23 const GrB_Matrix A, // first input: matrix A
24 const GrB_Descriptor desc // descriptor for C, M, and A
25)
26{
27
28 //--------------------------------------------------------------------------
29 // check inputs
30 //--------------------------------------------------------------------------
31
32 struct GB_Matrix_opaque T_header ;
33 GrB_Matrix T = NULL ;
34
35 // C may be aliased with M and/or A
36
37 GB_WHERE (C, "GrB_transpose (C, M, accum, A, desc)") ;
38 GB_BURBLE_START ("GrB_transpose") ;
39 GB_RETURN_IF_NULL_OR_FAULTY (C) ;
40 GB_RETURN_IF_FAULTY (M_in) ;
41 GB_RETURN_IF_FAULTY_OR_POSITIONAL (accum) ;
42 GB_RETURN_IF_NULL_OR_FAULTY (A) ;
43
44 ASSERT_MATRIX_OK (C, "C input for GrB_transpose", GB0) ;
45 ASSERT_MATRIX_OK_OR_NULL (M_in, "M for GrB_transpose", GB0) ;
46 ASSERT_BINARYOP_OK_OR_NULL (accum, "accum for GrB_transpose", GB0) ;
47 ASSERT_MATRIX_OK (A, "A input for GrB_transpose", GB0) ;
48
49 // get the descriptor
50 GB_GET_DESCRIPTOR (info, desc, C_replace, Mask_comp, Mask_struct,
51 A_transpose, xx1, xx2, xx7) ;
52
53 // get the mask
54 GrB_Matrix M = GB_get_mask (M_in, &Mask_comp, &Mask_struct) ;
55
56 // check domains and dimensions for C<M> = accum (C,T)
57 GB_OK (GB_compatible (C->type, C, M, Mask_struct, accum, A->type, Context));
58
59 // check the dimensions
60 int64_t tnrows = (!A_transpose) ? GB_NCOLS (A) : GB_NROWS (A) ;
61 int64_t tncols = (!A_transpose) ? GB_NROWS (A) : GB_NCOLS (A) ;
62 if (GB_NROWS (C) != tnrows || GB_NCOLS (C) != tncols)
63 {
64 GB_ERROR (GrB_DIMENSION_MISMATCH,
65 "Dimensions not compatible:\n"
66 "output is " GBd "-by-" GBd "\n"
67 "input is " GBd "-by-" GBd "%s",
68 GB_NROWS (C), GB_NCOLS (C),
69 tnrows, tncols, (!A_transpose) ? " (transposed)" : "") ;
70 }
71
72 // quick return if an empty mask is complemented
73 GB_RETURN_IF_QUICK_MASK (C, C_replace, M, Mask_comp, Mask_struct) ;
74
75 //--------------------------------------------------------------------------

Callers 14

RG_Matrix_sync_deletionsFunction · 0.85
RG_Matrix_exportFunction · 0.85
PagerankFunction · 0.85
test_RGMatrix_fuzzyFunction · 0.85
mexFunctionFunction · 0.85
mexFunctionFunction · 0.85
get_matrixFunction · 0.85
mainFunction · 0.85
mexFunctionFunction · 0.85
GB_mex_transpose.cFile · 0.85
mexFunctionFunction · 0.85

Calls 5

GB_get_maskFunction · 0.85
GB_compatibleFunction · 0.85
GB_transpose_castFunction · 0.85
GB_shallow_copyFunction · 0.85
GB_accum_maskFunction · 0.85

Tested by 1

test_RGMatrix_fuzzyFunction · 0.68