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

Function GrB_Vector_new

deps/GraphBLAS/Source/GrB_Vector_new.c:17–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15#include "GB.h"
16
17GrB_Info GrB_Vector_new // create a new vector with no entries
18(
19 GrB_Vector *v, // handle of vector to create
20 GrB_Type type, // type of vector to create
21 GrB_Index n // dimension is n-by-1
22)
23{
24
25 //--------------------------------------------------------------------------
26 // check inputs
27 //--------------------------------------------------------------------------
28
29 GB_WHERE1 ("GrB_Vector_new (&v, type, n)") ;
30 GB_RETURN_IF_NULL (v) ;
31 (*v) = NULL ;
32 GB_RETURN_IF_NULL_OR_FAULTY (type) ;
33
34 if (n > GB_NMAX)
35 {
36 // problem too large
37 return (GrB_INVALID_VALUE) ;
38 }
39
40 //--------------------------------------------------------------------------
41 // create the vector
42 //--------------------------------------------------------------------------
43
44 GrB_Info info ;
45 int64_t vlen = (int64_t) n ;
46
47 info = GB_new ((GrB_Matrix *) v, // new user header
48 type, vlen, 1, GB_Ap_calloc,
49 true, // a GrB_Vector is always held by-column
50 GxB_SPARSE, GB_Global_hyper_switch_get ( ), 1, Context) ;
51 ASSERT (GB_IMPLIES (info == GrB_SUCCESS, GB_VECTOR_OK (*v))) ;
52 return (info) ;
53}
54

Callers 15

PagerankFunction · 0.85
mexFunctionFunction · 0.85
gb_normFunction · 0.85
mexFunctionFunction · 0.85
mexFunctionFunction · 0.85
mexFunctionFunction · 0.85
mexFunctionFunction · 0.85
mexFunctionFunction · 0.85
mexFunctionFunction · 0.85

Calls 1

Tested by 1