Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

Revision 5371c917259900b4efeffd61260e9ab9f80f2249 authored by Ben Hermans on 25 June 2020, 08:45:07 UTC, committed by Ben Hermans on 25 June 2020, 08:45:07 UTC
Add documentation and change some function signatures
1 parent 97025d4
  • Files
  • Changes
  • 9be602c
  • /
  • include
  • /
  • ladel_global.h
Raw File Download
Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • revision
  • directory
  • content
revision badge
swh:1:rev:5371c917259900b4efeffd61260e9ab9f80f2249
directory badge Iframe embedding
swh:1:dir:d3c1510be47586da317303bf0d52a9da0f013bf2
content badge Iframe embedding
swh:1:cnt:f3c4a34751ee2309c0fccec961b5e11d121a68f8
Citations

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • revision
  • directory
  • content
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
ladel_global.h
/**
 * @file ladel_global.h
 * @author Ben Hermans
 * @brief Memory allocation routines.
 */

#ifndef LADEL_GLOBAL_H
#define LADEL_GLOBAL_H

#include "ladel_types.h"
#include "ladel_constants.h"
#include "ladel_copy.h"
#include <stdlib.h>

/**
 * Version of malloc (for mex or for regular C).
 * 
 * If the malloc fails, this function will return NULL.
 * 
 * @param n     Number of blocks
 * @param size  Size of block
 * @return      Pointer to the allocated memory
 */
void *ladel_malloc( ladel_int   n, 
                    size_t      size);

/**
 * Version of calloc (for mex or for regular C).
 * 
 * If the calloc fails, this function will return NULL.
 * 
 * @param n     Number of blocks
 * @param size  Size of block
 * @return      Pointer to the allocated memory
 */
void *ladel_calloc( ladel_int   n, 
                    size_t      size);

/**
 * Version of free (for mex or for regular C).
 * 
 * @param p  Pointer to the memory to be freed
 * @return   NULL
 */
void *ladel_free(void* p);

/**
 * Version of realloc (for mex or for regular C).
 * 
 * If the realloc fails, this function will return the original pointer.
 * 
 * @param p         Pointer to the memory
 * @param n         Number of blocks
 * @param size      Size of block
 * @param status    Status to indicate success
 * @return          Pointer to the reallocated memory (or the same in case )
 */
void *ladel_realloc(void        *p, 
                    ladel_int   n, 
                    size_t      size, 
                    ladel_int   *status);

#ifdef MATLAB
#include "mex.h"
#define ladel_print mexPrintf
#else
#define ladel_print printf /**< Print function (for mex or for regular C) */
#endif

/**
 * Free a sparse matrix (and return NULL).
 * 
 * @param M     Matrix to be freed
 * @return      NULL
 */
ladel_sparse_matrix *ladel_sparse_free(ladel_sparse_matrix *M);

/**
 * Allocate a sparse matrix.
 * 
 * @param nrow      Number of rows
 * @param ncol      Number of columns
 * @param nzmax     Maximum number of nonzeros
 * @param symmetry  UNSYMMETRIC, or store only UPPER part of a matrix
 * @param values    Indicate value or pattern matrix
 * @param nz        Indicate the use of the nz field to list nonzeros per column
 * @return          Allocated matrix
 */
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 empty matrix (used in special cases).
 * 
 * @param nrow      Number of rows
 * @param ncol      Number of columns
 * @param symmetry  UNSYMMETRIC, or store only UPPER part of a matrix
 * @param values    Indicate value or pattern matrix
 * @param nz        Indicate the use of the nz field to list nonzeros per column
 * @return          Allocated empty matrix
 */
ladel_sparse_matrix *ladel_sparse_alloc_empty(  ladel_int nrow, 
                                                ladel_int ncol, 
                                                ladel_int symmetry, 
                                                ladel_int values, 
                                                ladel_int nz);

/**
 * Reallocate a sparse matrix with a new size.
 * 
 * @note If nzmax <= 0, the matrix is shrinked to fit all the current elements.
 * 
 * @param M         Sparse matrix
 * @param nzmax     New maximum number of nonzeros 
 * @return          Status 
 */
ladel_int ladel_sparse_realloc( ladel_sparse_matrix *M, 
                                ladel_int           nzmax);

/**
 * Free a symbolics struct (and return NULL).
 *  
 * @param sym   Symbolics struct 
 * @return      NULL
 */
ladel_symbolics *ladel_symbolics_free(ladel_symbolics *sym);

/**
 * Allocate a symbolics struct.
 *   
 * @param ncol  Number of columns of matrix to be analyzed 
 * @return      Allocated symbolics struct
 */
ladel_symbolics *ladel_symbolics_alloc(ladel_int ncol);

/**
 * Free a factor.
 *  
 * @param LD    Factors of an @f$LDL^T@f$ factorization
 * @return      NULL
 */
ladel_factor *ladel_factor_free(ladel_factor *LD);

/**
 * Allocate a factors struct.
 *  
 * @param sym   Symbolics struct 
 * @return      Factors struct
 */
ladel_factor *ladel_factor_allocate(ladel_symbolics *sym);

/**
 * Free a set.
 *  
 * @param set   Set to be freed
 * @return      NULL
 */
ladel_set *ladel_set_free(ladel_set *set);

/**
 * Allocate a set struct.
 *   
 * @param max_size  Maximum size of the set 
 * @return          Allocated set
 */
ladel_set *ladel_set_allocate(ladel_int max_size);

/**
 * Fill in the fields of the given set.
 *   
 * @param set           Set to be filled in 
 * @param set_vals      Array that represents the set
 * @param size_set      Current size of the set
 * @param max_size_set  Maximum size of the set
 */
void ladel_set_set( ladel_set *set, 
                    ladel_int *set_vals, 
                    ladel_int size_set, 
                    ladel_int max_size_set);

/**
 * Free a LADEL workspace.
 *  
 * @param work  LADEL workspace to be freed
 * @return      NULL
 */
ladel_work *ladel_workspace_free(ladel_work* work);

/**
 * Allocate a LADEL workspace.
 *  
 * @param ncol  Size of the structures in the workspace (= ncol of matrix to be factorized)
 * @return      Allocated LADEL workspace
 */
ladel_work *ladel_workspace_allocate(ladel_int ncol);


#endif /*LADEL_GLOBAL_H*/
The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Contact— JavaScript license information— Web API

back to top