gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master 69a85ec: Collapse by extrema now uses uint8_t


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 69a85ec: Collapse by extrema now uses uint8_t for counter
Date: Sat, 28 Jul 2018 09:58:20 -0400 (EDT)

branch: master
commit 69a85ec7e4f920a7b48cd4f6be26975928acadb7
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>

    Collapse by extrema now uses uint8_t for counter
    
    After its definition, we were using `int32_t' type for the `num' dataset of
    collapsing by extrema. But unlike the average (for example), we don't
    actually need the number of elements, we just need to know that atleast one
    element was present. So like the collapsing by sum, the `num' dataset in
    collapsing by extrema now uses `uint8_t' to simply put a `1' where we have
    data and 0 where we don't. In this way, we won't consume too much memory
    and will be faster.
---
 lib/dimension.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/dimension.c b/lib/dimension.c
index a8740df..ec677cb 100644
--- a/lib/dimension.c
+++ b/lib/dimension.c
@@ -728,7 +728,7 @@ gal_dimension_collapse_number(gal_data_t *in, size_t c_dim)
 gal_data_t *
 gal_dimension_collapse_minmax(gal_data_t *in, size_t c_dim, int max1_min0)
 {
-  int32_t *iarr=NULL;
+  uint8_t *iarr=NULL;
   double *wsumarr=NULL;
   double *warr=NULL, *farr=NULL;
   size_t a, b, i, j, k, w, cnum=0;
@@ -750,7 +750,7 @@ gal_dimension_collapse_minmax(gal_data_t *in, size_t c_dim, 
int max1_min0)
                         0, in->minmapsize, NULL, NULL, NULL);
   if(hasblank)
     {
-      num=gal_data_alloc(NULL, GAL_TYPE_INT32, outndim, outdsize, in->wcs,
+      num=gal_data_alloc(NULL, GAL_TYPE_UINT8, outndim, outdsize, in->wcs,
                          1, in->minmapsize, NULL, NULL, NULL);
       iarr=num->array;
     }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]