GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
c_stddev.c
Go to the documentation of this file.
1 #include <math.h>
2 #include <grass/gis.h>
3 #include <grass/stats.h>
4 
5 void c_stddev(DCELL * result, DCELL * values, int n, const void *closure)
6 {
7  DCELL var;
8 
9  c_var(&var, values, n, closure);
10 
11  if (G_is_d_null_value(&var))
12  G_set_d_null_value(result, 1);
13  else
14  *result = sqrt(var);
15 }
16 
17 void w_stddev(DCELL * result, DCELL(*values)[2], int n, const void *closure)
18 {
19  DCELL var;
20 
21  w_var(&var, values, n, closure);
22 
23  if (G_is_d_null_value(&var))
24  G_set_d_null_value(result, 1);
25  else
26  *result = sqrt(var);
27 }
void w_var(DCELL *result, DCELL(*values)[2], int n, const void *closure)
Definition: c_var.c:42
void G_set_d_null_value(DCELL *dcellVals, int numVals)
Definition: null_val.c:176
void c_var(DCELL *result, DCELL *values, int n, const void *closure)
Definition: c_var.c:3
void w_stddev(DCELL *result, DCELL(*values)[2], int n, const void *closure)
Definition: c_stddev.c:17
void c_stddev(DCELL *result, DCELL *values, int n, const void *closure)
Definition: c_stddev.c:5
int G_is_d_null_value(const DCELL *dcellVal)
Returns 1 if dcell is NULL, 0 otherwise. This will test if the value dcell is a NaN. Same test as in G_is_f_null_value().
Definition: null_val.c:306
int n
Definition: dataquad.c:291