1 //------------------------------------------------------------------------------
2 // GrB_Matrix_clear: clears the content of a matrix
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 // The A->x and A->i content is freed and the vector pointers A->p are set to
11 // zero.  This puts the matrix A in the same state it had after GrB_Matrix_new
12 // (&A, ...).  The dimensions and type of A are not changed.
13 
14 #include "GB.h"
15 
GrB_Matrix_clear(GrB_Matrix A)16 GrB_Info GrB_Matrix_clear   // clear a matrix of all entries;
17 (                           // type and dimensions remain unchanged
18     GrB_Matrix A            // matrix to clear
19 )
20 {
21 
22     //--------------------------------------------------------------------------
23     // check inputs
24     //--------------------------------------------------------------------------
25 
26     GB_WHERE (A, "GrB_Matrix_clear (A)") ;
27     GB_RETURN_IF_NULL_OR_FAULTY (A) ;
28 
29     //--------------------------------------------------------------------------
30     // clear the matrix
31     //--------------------------------------------------------------------------
32 
33     return (GB_clear (A, Context)) ;
34 }
35 
36