#include <oski/common.h>
#include <oski/mangle.h>
Go to the source code of this file.
Defines | |
#define | INC_TESTS_ARRAY_UTIL_H |
util/array_util.h included. | |
Name mangling. | |
#define | array_Duplicate MANGLE_(array_Duplicate) |
#define | array_Destroy MANGLE_(array_Destroy) |
#define | array_CompareElems MANGLE_(array_CompareElems) |
#define | array_CompareElems_NoAbort MANGLE_(array_CompareElems_NoAbort) |
#define | array_FillRandom MANGLE_(array_FillRandom) |
#define | array_CreateRandom MANGLE_(array_CreateRandom) |
#define | array_Create MANGLE_(array_Create) |
#define | array_SortIndValPairs MANGLE_(array_SortIndValPairs) |
Functions | |
oski_value_t * | array_Duplicate (const oski_value_t *x0, oski_index_t len) |
Returns a pointer to a newly allocated copy of the given array, or NULL on error. | |
void | array_Destroy (oski_value_t *x) |
Release previously allocated array. | |
void | array_CompareElems (const char *test_func, const oski_value_t *x, const oski_value_t *y, oski_index_t len) |
Compare elements of two arrays, and exit the program with an error code of 1 if the element-wise difference greater than len*(machine epsilon) is detected. | |
int | array_CompareElems_NoAbort (const char *test_func, const oski_value_t *x, const oski_value_t *y, oski_index_t len) |
Compare elements of two arrays, and exit the program with an error code of 1 if the element-wise difference greater than len*(machine epsilon) detected. | |
void | array_FillRandom (oski_value_t *x, oski_index_t n) |
Initialize an array with random values between -1 and 1. | |
oski_value_t * | array_CreateRandom (oski_index_t n) |
Allocate an array of random values between -1 and 1. | |
oski_value_t * | array_Create (oski_index_t n, oski_value_t val) |
Allocate an array with elements initialized to a particular value. | |
void | array_SortIndValPairs (oski_index_t *ind, oski_value_t *val, oski_index_t n) |
Sorts an (index, value) pair of arrays. |
#define INC_TESTS_ARRAY_UTIL_H |
util/array_util.h included.
void array_CompareElems | ( | const char * | test_func, | |
const oski_value_t * | x, | |||
const oski_value_t * | y, | |||
oski_index_t | len | |||
) |
Compare elements of two arrays, and exit the program with an error code of 1 if the element-wise difference greater than len*(machine epsilon) is detected.
Compare elements of two arrays, and exit the program with an error code of 1 if the element-wise difference greater than len*(machine epsilon) is detected.
[in] | test_func | Name of the calling test function. |
[in] | x | Expected results. |
[in] | y | Observed/computed results. |
[in] | len | Length of the x and y arrays. |
int array_CompareElems_NoAbort | ( | const char * | test_func, | |
const oski_value_t * | x, | |||
const oski_value_t * | y, | |||
oski_index_t | len | |||
) |
Compare elements of two arrays, and exit the program with an error code of 1 if the element-wise difference greater than len*(machine epsilon) detected.
This routine is identical to array_CompareElems(), except that it does not abort the program if x and y are numerically inconsistent. (It does abort on memory errors.)
Compare elements of two arrays, and exit the program with an error code of 1 if the element-wise difference greater than len*(machine epsilon) detected.
[in] | test_func | Name of the calling test function. |
[in] | x | Expected results. |
[in] | y | Observed/computed results. |
[in] | len | Length of the x and y arrays. |
References _IM, _RE, ERR_WRONG_ANS, OSKI_ERR_WRONG_ANS_ELEM, OSKI_ERR_WRONG_ANS_ELEM_COMPLEX, oski_PrintDebugMessage(), VAL_DEC, and VAL_EPS.
void array_Destroy | ( | oski_value_t * | x | ) |
Release previously allocated array.
[in,out] | x | Array to destroy. |
References oski_Free.
oski_value_t* array_Duplicate | ( | const oski_value_t * | x0, | |
oski_index_t | len | |||
) |
Returns a pointer to a newly allocated copy of the given array, or NULL on error.
[in] | x0 | Array to copy. |
[in] | len | Number of elements to copy from x0. |
References oski_CopyMem, and oski_Malloc.