mirror of
https://github.com/pjreddie/darknet.git
synced 2023-08-10 21:13:14 +03:00
hope i didn't break anything
This commit is contained in:
15
src/utils.c
15
src/utils.c
@ -424,6 +424,13 @@ float variance_array(float *a, int n)
|
||||
return variance;
|
||||
}
|
||||
|
||||
int constrain_int(int a, int min, int max)
|
||||
{
|
||||
if (a < min) return min;
|
||||
if (a > max) return max;
|
||||
return a;
|
||||
}
|
||||
|
||||
float constrain(float min, float max, float a)
|
||||
{
|
||||
if (a < min) return min;
|
||||
@ -431,6 +438,14 @@ float constrain(float min, float max, float a)
|
||||
return a;
|
||||
}
|
||||
|
||||
float dist_array(float *a, float *b, int n, int sub)
|
||||
{
|
||||
int i;
|
||||
float sum = 0;
|
||||
for(i = 0; i < n; i += sub) sum += pow(a[i]-b[i], 2);
|
||||
return sqrt(sum);
|
||||
}
|
||||
|
||||
float mse_array(float *a, int n)
|
||||
{
|
||||
int i;
|
||||
|
Reference in New Issue
Block a user