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

Function GB_hyper_shallow

deps/GraphBLAS/Source/GB_hyper_shallow.c:18–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16#include "GB_convert.h"
17
18GrB_Matrix GB_hyper_shallow // return C
19(
20 GrB_Matrix C, // output sparse matrix
21 const GrB_Matrix A // input hypersparse matrix, not modified.
22)
23{
24
25 //--------------------------------------------------------------------------
26 // check inputs
27 //--------------------------------------------------------------------------
28
29 ASSERT_MATRIX_OK (A, "hyper_shallow input", GB0) ;
30 ASSERT (C != NULL && (C->static_header || GBNSTATIC)) ;
31 ASSERT (GB_IS_HYPERSPARSE (A)) ;
32
33 //--------------------------------------------------------------------------
34 // construct the hyper_shallow version
35 //--------------------------------------------------------------------------
36
37 // save the C header status
38 bool C_static_header = C->static_header ;
39 bool C_header_size = C->header_size ;
40
41 // copy the header
42 memcpy (C, A, sizeof (struct GB_Matrix_opaque)) ;
43
44 // restore the C header status
45 C->static_header = C_static_header ;
46 C->header_size = C_header_size ;
47
48 // remove the hyperlist and the hyper_hash
49 C->h = NULL ;
50 C->h_shallow = false ;
51 C->Y = NULL ;
52 C->Y_shallow = false ;
53
54 // flag all content of C as shallow
55 C->p_shallow = true ;
56 C->i_shallow = true ;
57 C->x_shallow = true ;
58
59 // C reduces in dimension to the # of vectors in A
60 C->vdim = C->nvec ;
61 C->plen = C->nvec ;
62 C->nvec_nonempty = C->nvec ;
63
64 //--------------------------------------------------------------------------
65 // return result
66 //--------------------------------------------------------------------------
67
68 ASSERT_MATRIX_OK (C, "hyper_shallow output", GB0) ;
69 ASSERT (GB_IS_SPARSE (C)) ;
70 return (C) ;
71}
72

Callers 1

GB_AxB_dot2Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected