19 lines
379 B
C++
19 lines
379 B
C++
#include "util.h"
|
|
|
|
#include <math.h>
|
|
#include <stdbool.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <time.h>
|
|
|
|
double get_current_time() {
|
|
struct timespec tv;
|
|
clock_gettime(CLOCK_MONOTONIC, &tv);
|
|
return tv.tv_sec + tv.tv_nsec * 1e-9;
|
|
}
|
|
|
|
void rand_vec(double *m, int N) {
|
|
for (int j = 0; j < N; j++) { m[j] = (double) rand() / RAND_MAX - 0.5; }
|
|
}
|