CLA3P v0.3.1
Compact Linear Algebra Parallel Portable Package
Loading...
Searching...
No Matches
Allocators

Memory management utilities for numerical buffers. More...

Functions

void * cla3p::i2malloc (std::size_t size)
 Default allocator for raw byte storage.
void * cla3p::i2calloc (std::size_t nmemb, std::size_t size)
 Default zero-initializing allocator for raw byte storage.
void * cla3p::i2realloc (void *ptr, std::size_t size)
 Resizes a previously allocated memory block.
template<typename T_Elem>
T_Elem * cla3p::i_malloc_t (std::size_t nmemb)
 Type-safe allocator for uninitialized storage.
template<typename T_Elem>
T_Elem * cla3p::i_calloc_t (std::size_t nmemb)
 Type-safe allocator for zero-initialized storage.
template<typename T_Elem>
T_Elem * cla3p::i_realloc_t (T_Elem *ptr, std::size_t nmemb)
 Type-safe reallocator for typed storage.
void cla3p::i_free (void *ptr)
 Default deallocator for cla3p allocations.

Detailed Description

Memory management utilities for numerical buffers.

Contains the internal and user-facing allocation routines used by CLA3P to ensure memory alignment and efficient data handling across different architectures.

Function Documentation

◆ i2malloc()

void * cla3p::i2malloc ( std::size_t size)

Default allocator for raw byte storage.

Allocates size bytes of uninitialized storage.

Parameters
[in]sizeThe requested size in bytes.
Returns
Pointer to the allocated storage on success, otherwise nullptr.

◆ i2calloc()

void * cla3p::i2calloc ( std::size_t nmemb,
std::size_t size )

Default zero-initializing allocator for raw byte storage.

Allocates nmemb objects of size bytes each and zero-initializes the memory.

Parameters
[in]nmembThe number of elements to allocate.
[in]sizeThe size of each element in bytes.
Returns
Pointer to the allocated storage on success, otherwise nullptr.

◆ i2realloc()

void * cla3p::i2realloc ( void * ptr,
std::size_t size )

Resizes a previously allocated memory block.

Reallocates the memory referenced by ptr to size bytes, preserving existing data up to the new size.

Parameters
[in]ptrPointer to the memory block to resize (may be nullptr).
[in]sizeThe new size of the allocation in bytes.
Returns
Pointer to the resized memory on success, otherwise nullptr.

◆ i_malloc_t()

template<typename T_Elem>
T_Elem * cla3p::i_malloc_t ( std::size_t nmemb)

Type-safe allocator for uninitialized storage.

Allocates nmemb elements of type T_Elem without initialization.

Parameters
[in]nmembThe number of elements to allocate.
Returns
Pointer to the allocated storage on success, otherwise nullptr.

◆ i_calloc_t()

template<typename T_Elem>
T_Elem * cla3p::i_calloc_t ( std::size_t nmemb)

Type-safe allocator for zero-initialized storage.

Allocates nmemb elements of type T_Elem and initializes all bits to zero.

Parameters
[in]nmembThe number of elements to allocate.
Returns
Pointer to the allocated storage on success, otherwise nullptr.
Examples
ex01c_dense_vector_create_from_aux_data.cpp, ex02d_dense_matrix_create_from_aux_data.cpp, ex03c_permutation_matrix_create_identity.cpp, ex03d_permutation_matrix_create_random.cpp, and ex06d_sparse_matrix_create_from_aux_data.cpp.

◆ i_realloc_t()

template<typename T_Elem>
T_Elem * cla3p::i_realloc_t ( T_Elem * ptr,
std::size_t nmemb )

Type-safe reallocator for typed storage.

Resizes the memory block referenced by ptr to store nmemb elements of type T_Elem, preserving existing data up to the new size.

Parameters
[in]ptrPointer to the memory block to resize (may be nullptr).
[in]nmembThe new number of elements requested.
Returns
Pointer to the resized storage on success, otherwise nullptr.

◆ i_free()

void cla3p::i_free ( void * ptr)

Default deallocator for cla3p allocations.

Releases memory previously allocated by i_malloc_t(), i_calloc_t(), or i_realloc_t().

Parameters
[in,out]ptrPointer to the memory block to deallocate (may be nullptr).
Examples
ex01c_dense_vector_create_from_aux_data.cpp, ex02d_dense_matrix_create_from_aux_data.cpp, ex03c_permutation_matrix_create_identity.cpp, ex03d_permutation_matrix_create_random.cpp, and ex06d_sparse_matrix_create_from_aux_data.cpp.