Mir 1.0
Mir application programming interface
Allocation and freeing of objects

Macros

#define mirml_vector_copy_complete(src, dst)   mirml_vector_copy(src, 0, 0, dst, 0)
 Copy complete vector.
 
#define mirml_matrix_copy_complete(src, dst)   mirml_matrix_copy(src, 0, 0, 0, 0, dst, 0, 0)
 Copy complete matrix.
 

Functions

mirkl_error_tmirml_vector_alloc (mirml_vector_t **vec, int dtype, unsigned int flags, mirkl_size_t size)
 Creates a vector. More...
 
mirkl_error_tmirml_vector_realloc (mirml_vector_t **vec, int dtype, unsigned int flags, mirkl_size_t new_size)
 Reallocates vector. More...
 
mirkl_error_tmirml_vector_copy (const mirml_vector_t *src, mirkl_size_t i_src, mirkl_size_t size_src, mirml_vector_t **dst, mirkl_size_t i_dst)
 Copy vector. More...
 
mirkl_error_tmirml_matrix_alloc (mirml_matrix_t **mat, int dtype, unsigned int flags, mirkl_size_t rows, mirkl_size_t cols)
 Creates a matrix. More...
 
mirkl_error_tmirml_matrix_realloc (mirml_matrix_t **mat, int dtype, unsigned int flags, mirkl_size_t new_rows, mirkl_size_t new_cols)
 Reallocates matrix. More...
 
mirkl_error_tmirml_matrix_copy (const mirml_matrix_t *src, mirkl_size_t i_src, mirkl_size_t j_src, mirkl_size_t rows_src, mirkl_size_t cols_src, mirml_matrix_t **dst, mirkl_size_t i_dst, mirkl_size_t j_dst)
 Copy matrix. More...
 

Functions to free objects.

void mirml_vector_free (mirml_vector_t *vec)
 
void mirml_matrix_free (mirml_matrix_t *mat)
 

Macros that set pointers to NULL.

#define MIRML_VECTOR_FREE(vec)   (mirml_vector_free(vec), (vec)=NULL)
 
#define MIRML_MATRIX_FREE(mat)   (mirml_matrix_free(mat), (mat)=NULL)
 

Detailed Description

Function Documentation

◆ mirml_matrix_alloc()

mirkl_error_t * mirml_matrix_alloc ( mirml_matrix_t **  mat,
int  dtype,
unsigned int  flags,
mirkl_size_t  rows,
mirkl_size_t  cols 
)

Creates a matrix.

Parameters
[out]matPointer to the matrix structure.
[in]dtypeData type, one of MIRML_DTYPE_...
[in]flagsMIRML_DTYPEF_...
[in]rowsNumber of rows in the matrix. Can be also zero.
[in]colsNumber of columns in the matrix. Can be also zero.
Note
Elements of the created matrix are initialized to zero.

◆ mirml_matrix_copy()

mirkl_error_t * mirml_matrix_copy ( const mirml_matrix_t src,
mirkl_size_t  i_src,
mirkl_size_t  j_src,
mirkl_size_t  rows_src,
mirkl_size_t  cols_src,
mirml_matrix_t **  dst,
mirkl_size_t  i_dst,
mirkl_size_t  j_dst 
)

Copy matrix.

Parameters
[in]srcSource matrix.
[in]i_srcFirst row in the source matrix to copy.
[in]j_srcFirst column in the source matrix to copy.
[in]rows_srcNumber of rows in the source matrix to copy. If zero, then all rows are copied starting from i_src.
[in]cols_srcNumber of columns in the source matrix to copy. If zero, then all columns are copied starting from j_src.
[out]dstDestination matrix. If NULL, then a new matrix is created.
[in]i_dstFirst row in the destination matrix, to which the first row from the source matrix will be copied.
[in]j_dstFirst column in the destination matrix, to which the first column from the source matrix will be copied.

◆ mirml_matrix_realloc()

mirkl_error_t * mirml_matrix_realloc ( mirml_matrix_t **  mat,
int  dtype,
unsigned int  flags,
mirkl_size_t  new_rows,
mirkl_size_t  new_cols 
)

Reallocates matrix.

Parameters
[in,out]matPointer to the pointer of the matrix structure. If the pointer is NULL, then a new matrix is allocated.
[in]dtypeData type, one of MIRML_DTYPE_... May be 0 if the matrix was already allocated before.
[in]flagsMIRML_DTYPEF_...
[in]new_rowsNew number of rows in the matrix.
[in]new_colsNew number of columns in the matrix.
Note
New elements of the reallocated matrix are initialized to zero.
It is possible to change the data type in the already allocated matrix by defining required dtype and using MIRML_DTYPEF_FORCECHAN flag.

◆ mirml_vector_alloc()

mirkl_error_t * mirml_vector_alloc ( mirml_vector_t **  vec,
int  dtype,
unsigned int  flags,
mirkl_size_t  size 
)

Creates a vector.

Parameters
[out]vecPointer to the pointerr of the vector structure.
[in]dtypeData type, one of MIRML_DTYPE_...
[in]flagsMIRML_DTYPEF_...
[in]sizeNumber of elements in the vector. Can be also zero.
Note
Elements of the created vector are initialized to zero.

◆ mirml_vector_copy()

mirkl_error_t * mirml_vector_copy ( const mirml_vector_t src,
mirkl_size_t  i_src,
mirkl_size_t  size_src,
mirml_vector_t **  dst,
mirkl_size_t  i_dst 
)

Copy vector.

Parameters
[in]srcSource vector.
[in]i_srcFirst element in the source vector to copy.
[in]size_srcNumber of elements in the source vector to copy. If zero, then all elements are copied starting from i_src.
[out]dstDestination vector. If NULL, then a new vector is created.
[in]i_dstFirst element in the destination vector, to which the first element from the source vector will be copied.

◆ mirml_vector_realloc()

mirkl_error_t * mirml_vector_realloc ( mirml_vector_t **  vec,
int  dtype,
unsigned int  flags,
mirkl_size_t  new_size 
)

Reallocates vector.

Parameters
[in,out]vecPointer to the pointer of the vector structure. If the pointer is NULL, then a new vector is allocated.
[in]dtypeData type, one of MIRML_DTYPE_... May be 0 if the vector was already allocated before.
[in]flagsMIRML_DTYPEF_...
[in]new_sizeNew number of elements in the vector.
Note
New elements of the reallocated vector are initialized to zero.
It is possible to change the data type in the already allocated vector by defining required dtype and using MIRML_DTYPEF_FORCECHAN flag.