https://github.com/cran/spatstat
Raw File
Tip revision: 1edbc8cb1dd61fe8a4415f2a8a2a40195916a4b3 authored by Adrian Baddeley on 03 March 2009, 07:53:41 UTC
version 1.15-0
Tip revision: 1edbc8c
utils.c
/* 

   utils.c

   $Revision: 1.2 $  $Date: 2006/10/19 10:22:21 $

   Small utilities

*/

void drevcumsum(double *x, int *nx) {
  int i;
  double sumx;
  double *xp;
  
  i = *nx - 1;
  xp = x + i;
  sumx = *xp;
  while(i > 0) {
    --i;
    --xp;
    sumx += *xp;
    *xp = sumx;
  }
}

void irevcumsum(int *x, int *nx) {
  int i;
  int sumx;
  int *xp;
  
  i = *nx - 1;
  xp = x + i;
  sumx = *xp;
  while(i > 0) {
    --i;
    --xp;
    sumx += *xp;
    *xp = sumx;
  }
}
back to top