csci5451/assignments/01/common.h

39 lines
756 B
C
Raw Normal View History

2023-09-23 05:04:06 +00:00
#ifndef COMMON_H_
#define COMMON_H_
2023-10-06 06:21:15 +00:00
#include <stdint.h>
2023-10-08 00:49:58 +00:00
#include <time.h>
#define FLOAT float
#define FLOAT_FORMAT "%f"
2023-10-06 06:21:15 +00:00
2023-09-23 05:04:06 +00:00
/**
* @brief Output the seconds elapsed while execution.
*
* @param seconds Seconds spent on execution, excluding IO.
*/
void print_time(double const seconds);
/**
* @brief Return the number of seconds since an unspecified time (e.g., Unix
* epoch). This is accomplished with a high-resolution monotonic timer,
* suitable for performance timing.
*
* @return The number of seconds.
*/
2023-10-08 01:37:18 +00:00
double monotonic_seconds();
2023-09-23 05:04:06 +00:00
2023-10-06 06:21:15 +00:00
struct data {
uint32_t rows, dimensions;
2023-10-08 00:49:58 +00:00
FLOAT *buf;
2023-10-06 06:21:15 +00:00
};
struct labels {
uint32_t rows;
2023-10-08 00:49:58 +00:00
FLOAT *buf;
2023-10-06 06:21:15 +00:00
};
struct data *read_data(char *path);
struct labels *read_labels(char *path);
2023-09-23 05:04:06 +00:00
#endif