#include <array.h>
Public Member Functions | |
Array * | array_new () |
Create a new array: just the structure, without allocating data and size. More... | |
Array * | array_new_with_dim (uint16_t dim) |
Create a new array: structure and space for size, without allocating data and defining sizes. | |
Array * | array_new_with_size (uint16_t dim, uint32_t *size) |
Create a new array with size (sizeof(char) bytes) and allocated data, without value. | |
Array * | array_new_with_size_type (uint16_t dim, uint32_t *size, DataType type) |
Create a new array with size and allocated data, without value. | |
Array * | array_new_1D (uint32_t size1) |
Create a 1D array. | |
Array * | array_new_2D (uint32_t size1, uint32_t size2) |
Create a 2D array. | |
Array * | array_new_3D (uint32_t size1, uint32_t size2, uint32_t size3) |
Create a 3D array. | |
Array * | array_new_4D (uint32_t size1, uint32_t size2, uint32_t size3, uint32_t size4) |
Create a 4D array. | |
Array * | array_new_1D_type (uint32_t size1, DataType type) |
Create a 1D array (each elem: sizeof(elementsize) bytes) | |
Array * | array_new_2D_type (uint32_t size1, uint32_t size2, DataType type) |
Create a 2D array (each elem: sizeof(elementsize) bytes) | |
Array * | array_new_3D_type (uint32_t size1, uint32_t size2, uint32_t size3, DataType type) |
Create a 3D array (each elem: sizeof(elementsize) bytes) | |
Array * | array_new_4D_type (uint32_t size1, uint32_t size2, uint32_t size3, uint32_t size4, DataType type) |
Create a 4D array (each elem: sizeof(elementsize) bytes) | |
void | array_fill (Array *array, double value) |
void | array_free (Array *array) |
Free array memory. | |
uint64_t | array_get_num_elements (Array *array) |
Get total number of elements of an array. | |
DataType | array_get_type (Array *array) |
Get data type of the array. | |
uint16_t | array_get_dim (Array *array) |
Get number of dimensions of an array. | |
uint32_t * | array_get_size (Array *array) |
Get vector of sizes of each dimension of the array. | |
void * | array_get_data (Array *array) |
Get data vector of array. | |
Public Attributes | |
uint16_t | dim |
uint32_t * | size |
uint64_t | num_elements |
size_t | num_bytes |
DataType | type |
union { | |
void * data | |
unsigned char * data_uint8 | |
uint16_t * data_uint16 | |
uint32_t * data_uint32 | |
uint64_t * data_uint64 | |
char * data_int8 | |
int16_t * data_int16 | |
int32_t * data_int32 | |
int64_t * data_int64 | |
float * data_float | |
double * data_double | |
unsigned int * data_int | |
}; | |
Array Structure: Each array will have its own data Each array will have its own size vector Support multidimensional arrays (dim > 2) TODO 0.2: make different arrays have same data
void array_fill | ( | Array * | array, |
double | value | ||
) |
Fill existing array with a value
Array * array_new | ( | ) |
Create a new array: just the structure, without allocating data and size.
$$\sum_{i=1}^{N}\frac{1}{i}$$
uint16_t Array::dim |
number of dimensions
size_t Array::num_bytes |
total number of bytes
uint64_t Array::num_elements |
number of elements of the array
uint32_t* Array::size |
number of elements in each dimension
DataType Array::type |
data type of each element