Dataset

struct DataSet
typedef struct DataSet {
   scalar *data;
   size_t size;
   bool err;
} DataSet;
scalar *data

Object pointer that stores the raw data.

size_t size

Size of the data, that is, the number of elements data can hold.

bool err

Error indicator.

Object creation

DataSet *DataSet_NewEmpty(void)

Create a new, uninitialized DataSet object and return an pointer to it.

DataSet *DataSet_New(size_t n_elem)

Create a new data set for n_elem elements and return a pointer to it.

DataSet *DataSet_NewFromFile(const char *path)

Create a new data set, set it with the values read from path and return a pointer it.

Operations

void DataSet_SetValue(DataSet *restrict this, size_t idx, scalar val)

Set the element with index idx of this to val. Perform bounds checking. Set DataSet.err to true on failure.

void DataSet_GetValue(DataSet *restrict this, size_t idx, scalar *out)

Write the value of the this element with index idx to out. Perform bounds checking. Set DataSet.err to true on failure.

Utilities

void DataSet_Print(DataSet *this)

Print the data set nicely formatted to the standard error stream.