BeBOP Optimized Sparse Kernel Interface Library  1.0.1h
Data Structures | Functions
array_util.c File Reference

Some utility functions for the test suite. More...

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "array_util.h"
#include "abort_prog.h"
#include "util/rand_util.h"

Data Structures

struct  indvalpair_t

Functions

oski_value_t * array_Duplicate (const oski_value_t *x0, oski_index_t len)
void array_Destroy (oski_value_t *x)
int array_CompareElems_NoAbort (const char *test_func, const oski_value_t *x, const oski_value_t *y, oski_index_t len)
 If a 'large' difference is detected, this routine prints a message to the user (using the error handler) and returns ERR_WRONG_ANS.
void array_CompareElems (const char *test_func, const oski_value_t *x, const oski_value_t *y, oski_index_t len)
 If a 'large' difference is detected, this routine prints a message to the user (using the error handler) and aborts the program with an exit code of 1.
void array_FillRandom (oski_value_t *x, oski_index_t n)
oski_value_t * array_CreateRandom (oski_index_t n)
oski_value_t * array_Create (oski_index_t n, oski_value_t val)
static int compare_indvalpair (const void *pa, const void *pb)
void array_SortIndValPairs (oski_index_t *ind, oski_value_t *val, oski_index_t n)

Detailed Description

Some utility functions for the test suite.

This module must be compiled with instantiated default types.


Function Documentation

void array_CompareElems ( const char *  test_func,
const oski_value_t *  x,
const oski_value_t *  y,
oski_index_t  len 
)

If a 'large' difference is detected, this routine prints a message to the user (using the error handler) and aborts the program with an exit code of 1.

Parameters:
[in]test_funcName of the calling test function.
[in]xExpected results.
[in]yObserved/computed results.
[in]lenLength of the x and y arrays.

References array_CompareElems_NoAbort().

Referenced by array_CompareElems_NoAbort(), check_MatConjTransMult(), check_MatMult(), and check_MatTransMult().

int array_CompareElems_NoAbort ( const char *  test_func,
const oski_value_t *  x,
const oski_value_t *  y,
oski_index_t  len 
)

If a 'large' difference is detected, this routine prints a message to the user (using the error handler) and returns ERR_WRONG_ANS.

Parameters:
[in]test_funcName of the calling test function.
[in]xExpected results.
[in]yObserved/computed results.
[in]lenLength of the x and y arrays.

References _IM, _RE, array_CompareElems(), ERR_WRONG_ANS, OSKI_ERR_WRONG_ANS_ELEM, OSKI_ERR_WRONG_ANS_ELEM_COMPLEX, oski_PrintDebugMessage(), VAL_DEC, and VAL_EPS.

Referenced by array_CompareElems().

void array_Destroy ( oski_value_t *  x)
Parameters:
[in,out]xArray to destroy.
Postcondition:
x no longer usable.

References oski_Free.

oski_value_t* array_Duplicate ( const oski_value_t *  x0,
oski_index_t  len 
)
Parameters:
[in]x0Array to copy.
[in]lenNumber of elements to copy from x0.
Returns:
A newly allocated copy of x0, or NULL on error.

References oski_CopyMem, and oski_Malloc.

Referenced by check_MatConjTransMult(), check_MatMult(), and check_MatTransMult().