From 14303717dcddae43cdc55beb0685dae86f566fd8 Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Sat, 25 Oct 2014 18:57:26 +0000
Subject: [PATCH] Fast, needs to be faster
---
src/utils.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/utils.c b/src/utils.c
index 67a9ba1..a883ad8 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -4,6 +4,11 @@
#include <string.h>
#include <math.h>
+float sec(clock_t clocks)
+{
+ return (float)clocks/CLOCKS_PER_SEC;
+}
+
void error(char *s)
{
fprintf(stderr, "Error: %s\n", s);
@@ -143,12 +148,17 @@
return field;
}
-float mean_array(float *a, int n)
+float sum_array(float *a, int n)
{
int i;
float sum = 0;
for(i = 0; i < n; ++i) sum += a[i];
- return sum/n;
+ return sum;
+}
+
+float mean_array(float *a, int n)
+{
+ return sum_array(a,n)/n;
}
float variance_array(float *a, int n)
--
Gitblit v1.10.0