~ubuntu-branches/ubuntu/vivid/grass/vivid-proposed

« back to all changes in this revision

Viewing changes to lib/stats/c_skew.c

  • Committer: Package Import Robot
  • Author(s): Bas Couwenberg
  • Date: 2015-02-20 23:12:08 UTC
  • mfrom: (8.2.6 experimental)
  • Revision ID: package-import@ubuntu.com-20150220231208-1u6qvqm84v430b10
Tags: 7.0.0-1~exp1
* New upstream release.
* Update python-ctypes-ternary.patch to use if/else instead of and/or.
* Drop check4dev patch, rely on upstream check.
* Add build dependency on libpq-dev to grass-dev for libpq-fe.h.
* Drop patches applied upstream, refresh remaining patches.
* Update symlinks for images switched from jpg to png.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#include <math.h>
 
2
 
2
3
#include <grass/gis.h>
 
4
#include <grass/raster.h>
3
5
 
4
6
void c_skew(DCELL * result, DCELL * values, int n, const void *closure)
5
7
{
11
13
    count = 0;
12
14
 
13
15
    for (i = 0; i < n; i++) {
14
 
        if (G_is_d_null_value(&values[i]))
 
16
        if (Rast_is_d_null_value(&values[i]))
15
17
            continue;
16
18
 
17
19
        sum += values[i];
19
21
    }
20
22
 
21
23
    if (count == 0) {
22
 
        G_set_d_null_value(result, 1);
 
24
        Rast_set_d_null_value(result, 1);
23
25
        return;
24
26
    }
25
27
 
30
32
    for (i = 0; i < n; i++) {
31
33
        DCELL d;
32
34
 
33
 
        if (G_is_d_null_value(&values[i]))
 
35
        if (Rast_is_d_null_value(&values[i]))
34
36
            continue;
35
37
 
36
38
        d = values[i] - ave;
53
55
    count = 0;
54
56
 
55
57
    for (i = 0; i < n; i++) {
56
 
        if (G_is_d_null_value(&values[i][0]))
 
58
        if (Rast_is_d_null_value(&values[i][0]))
57
59
            continue;
58
60
 
59
61
        sum += values[i][0] * values[i][1];
61
63
    }
62
64
 
63
65
    if (count == 0) {
64
 
        G_set_d_null_value(result, 1);
 
66
        Rast_set_d_null_value(result, 1);
65
67
        return;
66
68
    }
67
69
 
72
74
    for (i = 0; i < n; i++) {
73
75
        DCELL d;
74
76
 
75
 
        if (G_is_d_null_value(&values[i][0]))
 
77
        if (Rast_is_d_null_value(&values[i][0]))
76
78
            continue;
77
79
 
78
80
        d = values[i][0] - ave;