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

Function GrB_Col_extract

deps/GraphBLAS/Source/GrB_Col_extract.c:18–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16#include "GB_get_mask.h"
17
18GrB_Info GrB_Col_extract // w<M> = accum (w, A(I,j)) or (A(j,I))'
19(
20 GrB_Vector w, // input/output vector for results
21 const GrB_Vector M_in, // optional mask for w, unused if NULL
22 const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
23 const GrB_Matrix A, // first input: matrix A
24 const GrB_Index *I, // row indices
25 GrB_Index ni, // number of row indices
26 GrB_Index j, // column index
27 const GrB_Descriptor desc // descriptor for w, M, and A
28)
29{
30
31 //--------------------------------------------------------------------------
32 // check inputs
33 //--------------------------------------------------------------------------
34
35 GB_WHERE (w, "GrB_Col_extract (w, M, accum, A, I, ni, j, desc)") ;
36 GB_BURBLE_START ("GrB_extract") ;
37 GB_RETURN_IF_NULL_OR_FAULTY (w) ;
38 GB_RETURN_IF_FAULTY (M_in) ;
39 GB_RETURN_IF_NULL_OR_FAULTY (A) ;
40 ASSERT (GB_VECTOR_OK (w)) ;
41 ASSERT (GB_IMPLIES (M_in != NULL, GB_VECTOR_OK (M_in))) ;
42
43 // get the descriptor
44 GB_GET_DESCRIPTOR (info, desc, C_replace, Mask_comp, Mask_struct,
45 A_transpose, xx1, xx2, xx7) ;
46
47 // get the mask
48 GrB_Matrix M = GB_get_mask ((GrB_Matrix) M_in, &Mask_comp, &Mask_struct) ;
49
50 GrB_Index ancols = (A_transpose ? GB_NROWS (A) : GB_NCOLS (A)) ;
51 if (j >= ancols)
52 {
53 GB_ERROR (GrB_INVALID_INDEX,
54 "Column index j=" GBu " out of bounds; must be < " GBu ,
55 j, ancols) ;
56 }
57
58 //--------------------------------------------------------------------------
59 // extract the jth column (or jth row if A is transposed) using GB_extract
60 //--------------------------------------------------------------------------
61
62 // construct the column index list J = [ j ] of length nj = 1
63 GrB_Index J [1] ;
64 J [0] = j ;
65
66 //--------------------------------------------------------------------------
67 // do the work in GB_extract
68 //--------------------------------------------------------------------------
69
70 info = GB_extract (
71 (GrB_Matrix) w, C_replace, // w as a matrix, and descriptor
72 M, Mask_comp, Mask_struct, // mask and its descriptor
73 accum, // optional accum for z=accum(w,t)
74 A, A_transpose, // A and its descriptor
75 I, ni, // row indices I and length ni

Callers

nothing calls this directly

Calls 2

GB_get_maskFunction · 0.85
GB_extractFunction · 0.85

Tested by

no test coverage detected