26 lines
558 B
C
26 lines
558 B
C
|
#include <time.h>
|
||
|
#include <stdio.h>
|
||
|
#include "vector_stack.h"
|
||
|
#include "benchmark.h"
|
||
|
|
||
|
int main(int argv, char** argc) {
|
||
|
clock_t before, after;
|
||
|
|
||
|
before = clock();
|
||
|
|
||
|
Vector v1, v2, v3;
|
||
|
|
||
|
vec_init(&v1, 10, 20, 30);
|
||
|
vec_init(&v2, -20, 99, 38);
|
||
|
|
||
|
for (long long i = 0; i < RUNS; i++) {
|
||
|
vec_mul_cross(&v3, v1, v2);
|
||
|
vec_mul_dot(v3, v2);
|
||
|
vec_mul_scalar(&v3, v3, 10.0);
|
||
|
vec_mul_scalar(&v3, v3, 0.1);
|
||
|
}
|
||
|
|
||
|
after = clock();
|
||
|
|
||
|
printf("Runtime: %.3f seconds\n", (after - before) / (double) CLOCKS_PER_SEC);
|
||
|
}
|