LADEL main
Sparse LDL factorization package with rank 1 and rowadd/rowdel updates
Macros | Typedefs | Functions
ladel_global.h File Reference

Detailed Description

Memory allocation routines.

Author
Ben Hermans

Definition in file ladel_global.h.

#include "ladel_types.h"
#include "ladel_constants.h"
#include "ladel_copy.h"
#include <stdlib.h>
+ Include dependency graph for ladel_global.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define LADEL_ATTR_PRINTF_LIKE
 
#define ladel_print   ladel_get_print_config_printf()
 Print function. More...
 

Typedefs

typedef void *() calloc_sig(size_t, size_t)
 
typedef void *() malloc_sig(size_t)
 
typedef void *() realloc_sig(void *, size_t)
 
typedef void() free_sig(void *)
 
typedef LADEL_ATTR_PRINTF_LIKE int() printf_sig(const char *,...)
 

Functions

calloc_sigladel_set_alloc_config_calloc (calloc_sig *calloc)
 Set the calloc function used by LADEL. More...
 
malloc_sigladel_set_alloc_config_malloc (malloc_sig *malloc)
 Set the malloc function used by LADEL. More...
 
realloc_sigladel_set_alloc_config_realloc (realloc_sig *realloc)
 Set the realloc function used by LADEL. More...
 
free_sigladel_set_alloc_config_free (free_sig *free)
 Set the free function used by LADEL. More...
 
void * ladel_malloc (ladel_int n, size_t size)
 Version of malloc (for mex or for regular C). More...
 
void * ladel_calloc (ladel_int n, size_t size)
 Version of calloc (for mex or for regular C). More...
 
void * ladel_free (void *p)
 Version of free (for mex or for regular C). More...
 
void * ladel_realloc (void *p, ladel_int n, size_t size, ladel_int *status)
 Version of realloc (for mex or for regular C). More...
 
printf_sigladel_set_print_config_printf (printf_sig *printf)
 Set the printf function used by LADEL. More...
 
printf_sigladel_get_print_config_printf (void)
 Get the printf function used by LADEL. More...
 
ladel_sparse_matrixladel_sparse_free (ladel_sparse_matrix *M)
 Free a sparse matrix (and return NULL). More...
 
ladel_sparse_matrixladel_sparse_alloc (ladel_int nrow, ladel_int ncol, ladel_int nzmax, ladel_int symmetry, ladel_int values, ladel_int nz)
 Allocate a sparse matrix. More...
 
ladel_sparse_matrixladel_sparse_alloc_empty (ladel_int nrow, ladel_int ncol, ladel_int symmetry, ladel_int values, ladel_int nz)
 Allocate a sparse empty matrix (used in special cases). More...
 
ladel_int ladel_sparse_realloc (ladel_sparse_matrix *M, ladel_int nzmax)
 Reallocate a sparse matrix with a new size. More...
 
ladel_symbolicsladel_symbolics_free (ladel_symbolics *sym)
 Free a symbolics struct (and return NULL). More...
 
ladel_symbolicsladel_symbolics_alloc (ladel_int ncol)
 Allocate a symbolics struct. More...
 
ladel_factorladel_factor_free (ladel_factor *LD)
 Free a factor. More...
 
ladel_factorladel_factor_allocate (ladel_symbolics *sym)
 Allocate a factors struct. More...
 
ladel_setladel_set_free (ladel_set *set)
 Free a set. More...
 
ladel_setladel_set_allocate (ladel_int max_size)
 Allocate a set struct. More...
 
void ladel_set_set (ladel_set *set, ladel_int *set_vals, ladel_int size_set, ladel_int max_size_set)
 Fill in the fields of the given set. More...
 
ladel_workladel_workspace_free (ladel_work *work)
 Free a LADEL workspace. More...
 
ladel_workladel_workspace_allocate (ladel_int ncol)
 Allocate a LADEL workspace. More...
 

Macro Definition Documentation

◆ LADEL_ATTR_PRINTF_LIKE

#define LADEL_ATTR_PRINTF_LIKE

Definition at line 84 of file ladel_global.h.

◆ ladel_print

#define ladel_print   ladel_get_print_config_printf()

Print function.

Definition at line 97 of file ladel_global.h.

Typedef Documentation

◆ calloc_sig

typedef void *() calloc_sig(size_t, size_t)

Definition at line 19 of file ladel_global.h.

◆ free_sig

typedef void() free_sig(void *)

Definition at line 22 of file ladel_global.h.

◆ malloc_sig

typedef void *() malloc_sig(size_t)

Definition at line 20 of file ladel_global.h.

◆ printf_sig

typedef LADEL_ATTR_PRINTF_LIKE int() printf_sig(const char *,...)

Definition at line 87 of file ladel_global.h.

◆ realloc_sig

typedef void *() realloc_sig(void *, size_t)

Definition at line 21 of file ladel_global.h.

Function Documentation

◆ ladel_calloc()

void * ladel_calloc ( ladel_int  n,
size_t  size 
)

Version of calloc (for mex or for regular C).

If the calloc fails, this function will return NULL.

Parameters
nNumber of blocks
sizeSize of block
Returns
Pointer to the allocated memory

Definition at line 56 of file ladel_global.c.

+ Here is the caller graph for this function:

◆ ladel_factor_allocate()

ladel_factor * ladel_factor_allocate ( ladel_symbolics sym)

Allocate a factors struct.

Parameters
symSymbolics struct
Returns
Factors struct

Definition at line 194 of file ladel_global.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ladel_factor_free()

ladel_factor * ladel_factor_free ( ladel_factor LD)

Free a factor.

Parameters
LDFactors of an \(LDL^T\) factorization
Returns
NULL

Definition at line 183 of file ladel_global.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ladel_free()

void * ladel_free ( void *  p)

Version of free (for mex or for regular C).

Parameters
pPointer to the memory to be freed
Returns
NULL

Definition at line 60 of file ladel_global.c.

+ Here is the caller graph for this function:

◆ ladel_get_print_config_printf()

printf_sig * ladel_get_print_config_printf ( void  )

Get the printf function used by LADEL.

Definition at line 87 of file ladel_global.c.

◆ ladel_malloc()

void * ladel_malloc ( ladel_int  n,
size_t  size 
)

Version of malloc (for mex or for regular C).

If the malloc fails, this function will return NULL.

Parameters
nNumber of blocks
sizeSize of block
Returns
Pointer to the allocated memory

Definition at line 52 of file ladel_global.c.

+ Here is the caller graph for this function:

◆ ladel_realloc()

void * ladel_realloc ( void *  p,
ladel_int  n,
size_t  size,
ladel_int status 
)

Version of realloc (for mex or for regular C).

If the realloc fails, this function will return the original pointer.

Parameters
pPointer to the memory
nNumber of blocks
sizeSize of block
statusStatus to indicate success
Returns
Pointer to the reallocated memory (or the same in case )

Definition at line 66 of file ladel_global.c.

+ Here is the caller graph for this function:

◆ ladel_set_alloc_config_calloc()

calloc_sig * ladel_set_alloc_config_calloc ( calloc_sig calloc)

Set the calloc function used by LADEL.

Definition at line 24 of file ladel_global.c.

◆ ladel_set_alloc_config_free()

free_sig * ladel_set_alloc_config_free ( free_sig free)

Set the free function used by LADEL.

Definition at line 45 of file ladel_global.c.

◆ ladel_set_alloc_config_malloc()

malloc_sig * ladel_set_alloc_config_malloc ( malloc_sig malloc)

Set the malloc function used by LADEL.

Definition at line 31 of file ladel_global.c.

◆ ladel_set_alloc_config_realloc()

realloc_sig * ladel_set_alloc_config_realloc ( realloc_sig realloc)

Set the realloc function used by LADEL.

Definition at line 38 of file ladel_global.c.

◆ ladel_set_allocate()

ladel_set * ladel_set_allocate ( ladel_int  max_size)

Allocate a set struct.

Parameters
max_sizeMaximum size of the set
Returns
Allocated set

Definition at line 233 of file ladel_global.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ladel_set_free()

ladel_set * ladel_set_free ( ladel_set set)

Free a set.

Parameters
setSet to be freed
Returns
NULL

Definition at line 226 of file ladel_global.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ladel_set_print_config_printf()

printf_sig * ladel_set_print_config_printf ( printf_sig printf)

Set the printf function used by LADEL.

Definition at line 80 of file ladel_global.c.

◆ ladel_set_set()

void ladel_set_set ( ladel_set set,
ladel_int set_vals,
ladel_int  size_set,
ladel_int  max_size_set 
)

Fill in the fields of the given set.

Parameters
setSet to be filled in
set_valsArray that represents the set
size_setCurrent size of the set
max_size_setMaximum size of the set

Definition at line 247 of file ladel_global.c.

+ Here is the caller graph for this function:

◆ ladel_sparse_alloc()

ladel_sparse_matrix * ladel_sparse_alloc ( ladel_int  nrow,
ladel_int  ncol,
ladel_int  nzmax,
ladel_int  symmetry,
ladel_int  values,
ladel_int  nz 
)

Allocate a sparse matrix.

Parameters
nrowNumber of rows
ncolNumber of columns
nzmaxMaximum number of nonzeros
symmetryUNSYMMETRIC, or store only UPPER part of a matrix
valuesIndicate value or pattern matrix
nzIndicate the use of the nz field to list nonzeros per column
Returns
Allocated matrix

Definition at line 101 of file ladel_global.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ladel_sparse_alloc_empty()

ladel_sparse_matrix * ladel_sparse_alloc_empty ( ladel_int  nrow,
ladel_int  ncol,
ladel_int  symmetry,
ladel_int  values,
ladel_int  nz 
)

Allocate a sparse empty matrix (used in special cases).

Parameters
nrowNumber of rows
ncolNumber of columns
symmetryUNSYMMETRIC, or store only UPPER part of a matrix
valuesIndicate value or pattern matrix
nzIndicate the use of the nz field to list nonzeros per column
Returns
Allocated empty matrix

Definition at line 122 of file ladel_global.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ladel_sparse_free()

ladel_sparse_matrix * ladel_sparse_free ( ladel_sparse_matrix M)

Free a sparse matrix (and return NULL).

Parameters
MMatrix to be freed
Returns
NULL

Definition at line 91 of file ladel_global.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ladel_sparse_realloc()

ladel_int ladel_sparse_realloc ( ladel_sparse_matrix M,
ladel_int  nzmax 
)

Reallocate a sparse matrix with a new size.

Note
If nzmax <= 0, the matrix is shrinked to fit all the current elements.
Parameters
MSparse matrix
nzmaxNew maximum number of nonzeros
Returns
Status

Definition at line 141 of file ladel_global.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ladel_symbolics_alloc()

ladel_symbolics * ladel_symbolics_alloc ( ladel_int  ncol)

Allocate a symbolics struct.

Parameters
ncolNumber of columns of matrix to be analyzed
Returns
Allocated symbolics struct

Definition at line 166 of file ladel_global.c.

+ Here is the call graph for this function:

◆ ladel_symbolics_free()

ladel_symbolics * ladel_symbolics_free ( ladel_symbolics sym)

Free a symbolics struct (and return NULL).

Parameters
symSymbolics struct
Returns
NULL

Definition at line 153 of file ladel_global.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ladel_workspace_allocate()

ladel_work * ladel_workspace_allocate ( ladel_int  ncol)

Allocate a LADEL workspace.

Parameters
ncolSize of the structures in the workspace (= ncol of matrix to be factorized)
Returns
Allocated LADEL workspace

Definition at line 273 of file ladel_global.c.

+ Here is the call graph for this function:

◆ ladel_workspace_free()

ladel_work * ladel_workspace_free ( ladel_work work)

Free a LADEL workspace.

Parameters
workLADEL workspace to be freed
Returns
NULL

Definition at line 254 of file ladel_global.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function: