setmemory.h¶
Purpose¶
Memory allocation and deallocation utilities for various array types. Provides type-safe allocation functions for 1D, 2D, and 3D arrays of integers, doubles, and complex doubles.
Source reference: src/setmemory.h
Public Types¶
None.
Public Macros/Constants¶
-
MVMC_SETMEMORY_H¶
Include guard macro.
Public Functions¶
Unsigned Integer Arrays¶
-
unsigned int *ui_1d_allocate(const long unsigned int N)¶
Allocates a 1D array of unsigned integers.
- Parameters:
N – Size of the array
- Returns:
Pointer to allocated array
-
void free_ui_1d_allocate(unsigned int *A)¶
Frees a 1D unsigned integer array.
- Parameters:
A – Pointer to array to free
Long Integer Arrays¶
-
long int *li_1d_allocate(const long unsigned int N)¶
Allocates a 1D array of long integers.
- Parameters:
N – Size of the array
- Returns:
Pointer to allocated array
-
void free_li_1d_allocate(long int *A)¶
Frees a 1D long integer array.
- Parameters:
A – Pointer to array to free
-
long int **li_2d_allocate(const long unsigned int N, const long unsigned int M)¶
Allocates a 2D array of long integers.
- Parameters:
N – First dimension size
M – Second dimension size
- Returns:
Pointer to allocated 2D array
-
void free_li_2d_allocate(long int **A)¶
Frees a 2D long integer array.
- Parameters:
A – Pointer to 2D array to free
Long Unsigned Integer Arrays¶
-
long unsigned int *lui_1d_allocate(const long unsigned int N)¶
Allocates a 1D array of long unsigned integers.
- Parameters:
N – Size of the array
- Returns:
Pointer to allocated array
-
void free_lui_1d_allocate(long unsigned int *A)¶
Frees a 1D long unsigned integer array.
- Parameters:
A – Pointer to array to free
Integer Arrays¶
-
int *i_1d_allocate(const long unsigned int N)¶
Allocates a 1D array of integers.
- Parameters:
N – Size of the array
- Returns:
Pointer to allocated array
-
void free_i_1d_allocate(int *A)¶
Frees a 1D integer array.
- Parameters:
A – Pointer to array to free
-
int **i_2d_allocate(const long unsigned int N, const long unsigned int M)¶
Allocates a 2D array of integers.
- Parameters:
N – First dimension size
M – Second dimension size
- Returns:
Pointer to allocated 2D array
-
void free_i_2d_allocate(int **A)¶
Frees a 2D integer array.
- Parameters:
A – Pointer to 2D array to free
-
int ***i_3d_allocate(const long unsigned int N, const long unsigned int M, const long unsigned int L)¶
Allocates a 3D array of integers.
- Parameters:
N – First dimension size
M – Second dimension size
L – Third dimension size
- Returns:
Pointer to allocated 3D array
-
void free_i_3d_allocate(int ***A)¶
Frees a 3D integer array.
- Parameters:
A – Pointer to 3D array to free
Double Arrays¶
-
double *d_1d_allocate(const long unsigned int N)¶
Allocates a 1D array of doubles.
- Parameters:
N – Size of the array
- Returns:
Pointer to allocated array
-
void free_d_1d_allocate(double *A)¶
Frees a 1D double array.
- Parameters:
A – Pointer to array to free
-
double **d_2d_allocate(const long unsigned int N, const long unsigned int M)¶
Allocates a 2D array of doubles.
- Parameters:
N – First dimension size
M – Second dimension size
- Returns:
Pointer to allocated 2D array
-
void free_d_2d_allocate(double **A)¶
Frees a 2D double array.
- Parameters:
A – Pointer to 2D array to free
Complex Double Arrays¶
-
complex double *cd_1d_allocate(const long unsigned int N)¶
Allocates a 1D array of complex doubles.
- Parameters:
N – Size of the array
- Returns:
Pointer to allocated array
-
void free_cd_1d_allocate(double complex *A)¶
Frees a 1D complex double array.
- Parameters:
A – Pointer to array to free
-
complex double **cd_2d_allocate(const long unsigned int N, const long unsigned int M)¶
Allocates a 2D array of complex doubles.
- Parameters:
N – First dimension size
M – Second dimension size
- Returns:
Pointer to allocated 2D array
-
void free_cd_2d_allocate(double complex **A)¶
Frees a 2D complex double array.
- Parameters:
A – Pointer to 2D array to free
-
double complex ***cd_3d_allocate(const long unsigned int N, const long unsigned int M, const long unsigned int L)¶
Allocates a 3D array of complex doubles.
- Parameters:
N – First dimension size
M – Second dimension size
L – Third dimension size
- Returns:
Pointer to allocated 3D array
-
void free_cd_3d_allocate(double complex ***A)¶
Frees a 3D complex double array.
- Parameters:
A – Pointer to 3D array to free
Ownership and Lifetime Rules¶
Allocation functions return newly allocated memory; caller is responsible for freeing.
Each
*_allocate()function has a correspondingfree_*_allocate()function.Memory is allocated using standard
malloc()/calloc().Passing NULL to free functions is unspecified in the current code.
Error Handling¶
Unspecified in the current code. Allocation failure behavior (e.g., NULL check) is not documented in the header.
Thread / MPI Safety¶
Unspecified in the current code. Uses standard C memory allocation which is typically thread-safe in modern implementations.
Source Reference¶
Header:
src/setmemory.hImplementation:
src/setmemory.cAuthor: Kazuyoshi Yoshimi (University of Tokyo)