1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
|
//------------------------------------------------------------------------------
// GB_new.h: definitions for GB_new and related methods
//------------------------------------------------------------------------------
// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2022, All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
//------------------------------------------------------------------------------
#ifndef GB_NEW_H
#define GB_NEW_H
typedef enum // input parameter to GB_new and GB_new_bix
{
GB_Ap_calloc, // 0: calloc A->p, malloc A->h if hypersparse
GB_Ap_malloc, // 1: malloc A->p, malloc A->h if hypersparse
GB_Ap_null // 2: do not allocate A->p or A->h
}
GB_Ap_code ;
GB_PUBLIC
GrB_Info GB_Matrix_new // create a new matrix with no entries
(
GrB_Matrix *A, // handle of matrix to create
GrB_Type type, // type of matrix to create
GrB_Index nrows, // matrix dimension is nrows-by-ncols
GrB_Index ncols,
GB_Context Context
) ;
GB_PUBLIC
GrB_Info GB_new // create matrix, except for indices & values
(
GrB_Matrix *Ahandle, // handle of matrix to create
const GrB_Type type, // matrix type
const int64_t vlen, // length of each vector
const int64_t vdim, // number of vectors
const GB_Ap_code Ap_option, // allocate A->p and A->h, or leave NULL
const bool is_csc, // true if CSC, false if CSR
const int sparsity, // hyper, sparse, bitmap, full, or
// auto (hyper + sparse)
const float hyper_switch, // A->hyper_switch, ignored if auto
const int64_t plen, // size of A->p and A->h, if A hypersparse.
// Ignored if A is not hypersparse.
GB_Context Context
) ;
GrB_Info GB_new_bix // create a new matrix, incl. A->b, A->i, A->x
(
GrB_Matrix *Ahandle, // output matrix to create
const GrB_Type type, // type of output matrix
const int64_t vlen, // length of each vector
const int64_t vdim, // number of vectors
const GB_Ap_code Ap_option, // allocate A->p and A->h, or leave NULL
const bool is_csc, // true if CSC, false if CSR
const int sparsity, // hyper, sparse, bitmap, full, or auto
const bool bitmap_calloc, // if true, calloc A->b, otherwise use malloc
const float hyper_switch, // A->hyper_switch, unless auto
const int64_t plen, // size of A->p and A->h, if hypersparse
const int64_t nzmax, // number of nonzeros the matrix must hold;
// ignored if A is iso and full
const bool numeric, // if true, allocate A->x, else A->x is NULL
const bool iso, // if true, allocate A as iso
GB_Context Context
) ;
GB_PUBLIC
GrB_Info GB_bix_alloc // allocate A->b, A->i, and A->x space in a matrix
(
GrB_Matrix A, // matrix to allocate space for
const GrB_Index nzmax, // number of entries the matrix can hold;
// ignored if A is iso and full
const int sparsity, // sparse (=hyper/auto) / bitmap / full
const bool bitmap_calloc, // if true, calloc A->b, otherwise use malloc
const bool numeric, // if true, allocate A->x, otherwise A->x is NULL
const bool iso, // if true, allocate A as iso
GB_Context Context
) ;
GB_PUBLIC
GrB_Info GB_ix_realloc // reallocate space in a matrix
(
GrB_Matrix A, // matrix to allocate space for
const int64_t nzmax_new, // new number of entries the matrix can hold
GB_Context Context
) ;
GB_PUBLIC
void GB_bix_free // free A->b, A->i, and A->x of a matrix
(
GrB_Matrix A // matrix with content to free
) ;
GB_PUBLIC
void GB_phy_free // free A->p, A->h, and A->Y of a matrix
(
GrB_Matrix A // matrix with content to free
) ;
GB_PUBLIC
void GB_hyper_hash_free // free the A->Y hyper_hash of a matrix
(
GrB_Matrix A // matrix with content to free
) ;
void GB_phybix_free // free all content of a matrix
(
GrB_Matrix A // matrix with content to free
) ;
void GB_Matrix_free // free a matrix
(
GrB_Matrix *Ahandle // handle of matrix to free
) ;
#endif
|