2023-02-09 01:28:51 +09:00
|
|
|
#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) {
|
2023-02-14 01:23:28 +09:00
|
|
|
for (int j = 0; j < N; j++) { m[j] = (double) rand() / RAND_MAX - 0.5; }
|
2023-02-09 01:28:51 +09:00
|
|
|
}
|