1 //------------------------------------------------------------------------------
2 // GxB_Vector_export_Full: export a full vector
3 //------------------------------------------------------------------------------
4
5 // SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
6 // SPDX-License-Identifier: Apache-2.0
7
8 //------------------------------------------------------------------------------
9
10 #include "GB_export.h"
11
12 #define GB_FREE_ALL ;
13
GxB_Vector_export_Full(GrB_Vector * v,GrB_Type * type,GrB_Index * n,void ** vx,GrB_Index * vx_size,bool * is_uniform,const GrB_Descriptor desc)14 GrB_Info GxB_Vector_export_Full // export and free a full vector
15 (
16 GrB_Vector *v, // handle of vector to export and free
17 GrB_Type *type, // type of vector exported
18 GrB_Index *n, // length of the vector
19
20 void **vx, // values
21 GrB_Index *vx_size, // size of vx in bytes
22 bool *is_uniform, // if true, v has uniform values (TODO:::unsupported)
23
24 const GrB_Descriptor desc
25 )
26 {
27
28 //--------------------------------------------------------------------------
29 // check inputs
30 //--------------------------------------------------------------------------
31
32 GB_WHERE1 ("GxB_Vector_export_Full (&v, &type, &n, "
33 "&vx, &vx_size, &is_uniform, desc)") ;
34 GB_BURBLE_START ("GxB_Vector_export_Full") ;
35 GB_RETURN_IF_NULL (v) ;
36 GB_RETURN_IF_NULL_OR_FAULTY (*v) ;
37 GB_GET_DESCRIPTOR (info, desc, xx1, xx2, xx3, xx4, xx5, xx6, xx7) ;
38
39 //--------------------------------------------------------------------------
40 // finish any pending work
41 //--------------------------------------------------------------------------
42
43 GB_MATRIX_WAIT (*v) ;
44 if (!GB_is_dense ((GrB_Matrix) (*v)))
45 {
46 // v must be dense or full
47 return (GrB_INVALID_VALUE) ;
48 }
49
50 //--------------------------------------------------------------------------
51 // ensure the vector is full CSC
52 //--------------------------------------------------------------------------
53
54 ASSERT ((*v)->is_csc) ;
55 GB_convert_any_to_full ((GrB_Matrix) *v) ;
56
57 //--------------------------------------------------------------------------
58 // export the vector
59 //--------------------------------------------------------------------------
60
61 ASSERT (GB_IS_FULL (*v)) ;
62 ASSERT ((*v)->is_csc) ;
63 ASSERT (!GB_ZOMBIES (*v)) ;
64 ASSERT (!GB_JUMBLED (*v)) ;
65 ASSERT (!GB_PENDING (*v)) ;
66
67 int sparsity ;
68 bool is_csc ;
69 GrB_Index vdim ;
70
71 info = GB_export ((GrB_Matrix *) v, type, n, &vdim, false,
72 NULL, NULL, // Ap
73 NULL, NULL, // Ah
74 NULL, NULL, // Ab
75 NULL, NULL, // Ai
76 vx, vx_size, // Ax
77 NULL, NULL, NULL,
78 &sparsity, &is_csc, // full by col
79 is_uniform, Context) ;
80
81 if (info == GrB_SUCCESS)
82 {
83 ASSERT (sparsity == GxB_FULL) ;
84 ASSERT (is_csc) ;
85 ASSERT (vdim == 1) ;
86 }
87 GB_BURBLE_END ;
88 return (info) ;
89 }
90
91