UCFD_SPARSE  v1.0
Documentation
Loading...
Searching...
No Matches
arrays.c File Reference

Array allocation functions for C example files. More...

#include <stdio.h>
#include <stdlib.h>
#include "arrays.h"
Include dependency graph for arrays.c:

Go to the source code of this file.

Functions

void ** malloc_2d (const size_t rows, const size_t cols, const size_t T)
 Allocate 2D array. More...
 
void *** malloc_3d (const size_t rows, const size_t cols, const size_t depth, const size_t T)
 Allocate 3D array. More...
 
void **** malloc_4d (const size_t rows, const size_t cols, const size_t depth, const size_t dims, const size_t T)
 
void dealloc_2d (void **mat)
 Deallocate 2D array. More...
 
void dealloc_3d (void ***mat)
 Deallocate 3D array. More...
 
void dealloc_4d (void ****mat)
 

Detailed Description

Array allocation functions for C example files.

======================================================================================================================

This file defines some functions for allocating multi-dimensional array. Each function needs shape of array and size of data type. One-dimensional array can be allocated simply with malloc or calloc function in <stdlib.h>.

Author
Date
July 2024
Version
1.0
Copyright
Copyright (c) 2024, Namhyoung Kim and Jin Seok Park, Inha University, All rights reserved.
License
This project is release under the terms of the MIT License (see LICENSE file).

Definition in file arrays.c.

Function Documentation

◆ dealloc_2d()

void dealloc_2d ( void **  mat)

Deallocate 2D array.

Parameters
mat2D array

Definition at line 93 of file arrays.c.

Here is the caller graph for this function:

◆ dealloc_3d()

void dealloc_3d ( void ***  mat)

Deallocate 3D array.

Parameters
mat3D array

Definition at line 104 of file arrays.c.

Here is the caller graph for this function:

◆ dealloc_4d()

void dealloc_4d ( void ****  mat)

Definition at line 111 of file arrays.c.

◆ malloc_2d()

void ** malloc_2d ( const size_t  rows,
const size_t  cols,
const size_t  T 
)

Allocate 2D array.

Parameters
rowsnumber of rows
colsnumber of columns
Tsize of data

Definition at line 33 of file arrays.c.

Here is the caller graph for this function:

◆ malloc_3d()

void *** malloc_3d ( const size_t  rows,
const size_t  cols,
const size_t  depth,
const size_t  T 
)

Allocate 3D array.

Parameters
rowsnumber of rows
colsnumber of columns
depthdepth length, equals with z-direction elements
Tsize of data

Definition at line 52 of file arrays.c.

Here is the caller graph for this function:

◆ malloc_4d()

void **** malloc_4d ( const size_t  rows,
const size_t  cols,
const size_t  depth,
const size_t  dims,
const size_t  T 
)

Definition at line 69 of file arrays.c.