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

Function print_complex_matrix

deps/GraphBLAS/Demo/Program/complex_demo.c:23–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21// checked later with the *.m file
22
23void print_complex_matrix (GrB_Matrix A, char *name)
24{
25 GrB_Index nrows, ncols, nentries ;
26
27 GrB_Matrix_nvals (&nentries, A) ;
28 GrB_Matrix_nrows (&nrows, A) ;
29 GrB_Matrix_ncols (&ncols, A) ;
30
31 printf (
32 "\n%% GraphBLAS matrix %s: nrows: %.16g ncols %.16g entries: %.16g\n",
33 name, (double) nrows, (double) ncols, (double) nentries) ;
34
35 GrB_Index *I = (GrB_Index *) malloc (MAX (nentries,1) * sizeof (GrB_Index));
36 GrB_Index *J = (GrB_Index *) malloc (MAX (nentries,1) * sizeof (GrB_Index));
37 GxB_FC64_t *X = (GxB_FC64_t *)
38 malloc (MAX (nentries,1) * sizeof (GxB_FC64_t)) ;
39
40 if (Complex == GxB_FC64)
41 {
42 GxB_Matrix_extractTuples_FC64 (I, J, X, &nentries, A) ;
43 }
44 else
45 {
46 GrB_Matrix_extractTuples_UDT (I, J, X, &nentries, A) ;
47 }
48
49 printf ("%s = sparse (%.16g,%.16g) ;\n", name,
50 (double) nrows, (double) ncols) ;
51 for (int64_t k = 0 ; k < nentries ; k++)
52 {
53 printf (" %s (%.16g,%.16g) = (%20.16g) + (%20.16g)*1i ;\n",
54 name, (double) (1 + I [k]), (double) (1 + J [k]),
55 creal (X [k]), cimag (X [k])) ;
56 }
57 printf ("%s\n", name) ;
58
59 free (I) ;
60 free (J) ;
61 free (X) ;
62}
63
64//------------------------------------------------------------------------------
65// C = A*B for complex matrices

Callers 1

mainFunction · 0.85

Calls 3

GrB_Matrix_nvalsFunction · 0.85
GrB_Matrix_nrowsFunction · 0.85
GrB_Matrix_ncolsFunction · 0.85

Tested by

no test coverage detected