[Genabel-commits] r1486 - in pkg/OmicABEL/src: . float2double

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Dec 19 16:08:02 CET 2013


Author: dfabregat
Date: 2013-12-19 16:08:01 +0100 (Thu, 19 Dec 2013)
New Revision: 1486

Modified:
   pkg/OmicABEL/src/float2double/float2double.c
   pkg/OmicABEL/src/statistics.c
   pkg/OmicABEL/src/statistics.h
   pkg/OmicABEL/src/utils.c
Log:
Minor fix in utils.c (threading)
Added a function in statistics.[ch]
Added debugging code in f2d.c


Modified: pkg/OmicABEL/src/float2double/float2double.c
===================================================================
--- pkg/OmicABEL/src/float2double/float2double.c	2013-12-19 10:47:49 UTC (rev 1485)
+++ pkg/OmicABEL/src/float2double/float2double.c	2013-12-19 15:08:01 UTC (rev 1486)
@@ -25,6 +25,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <math.h>
 
 #include "../wrappers.h"
 #include "../databel.h"
@@ -124,7 +125,17 @@
 			exit( EXIT_FAILURE );
 		}
 		for ( j = 0; j < nelems_to_write; j++ )
+		{
+#if 0
+			if (isnan( datain[j] ))
+				printf("Nan in input:  %lld\n", datain[j]);
+#endif
 			dataout[j] = (double)datain[j];
+#if 0
+			if (isnan( dataout[j] ))
+				printf("Nan in output: %lld\n", dataout[j]);
+#endif
+		}
 		if ( fwrite( dataout, sizeof(double), nelems_to_write, fout ) != nelems_to_write )
 		{
 			fprintf( stderr, "Error writing data to %s\n", fout_path_fvd );

Modified: pkg/OmicABEL/src/statistics.c
===================================================================
--- pkg/OmicABEL/src/statistics.c	2013-12-19 10:47:49 UTC (rev 1485)
+++ pkg/OmicABEL/src/statistics.c	2013-12-19 15:08:01 UTC (rev 1486)
@@ -54,3 +54,18 @@
 
 	return var;
 }
+
+double _variance( double *v, int n )
+{
+	int i;
+	double m, var = 0.0;
+
+	assert( n > 1 );
+
+	m = mean( v, n );
+	for ( i = 0; i < n; i++ )
+		var += (m - v[i]) * (m - v[i]);
+	var /= n;
+
+	return var;
+}

Modified: pkg/OmicABEL/src/statistics.h
===================================================================
--- pkg/OmicABEL/src/statistics.h	2013-12-19 10:47:49 UTC (rev 1485)
+++ pkg/OmicABEL/src/statistics.h	2013-12-19 15:08:01 UTC (rev 1486)
@@ -30,5 +30,6 @@
 double mean( double *v, int n );
 
 double variance( double *v, int n );
+double _variance( double *v, int n );
 
 #endif // STATISTICS_H

Modified: pkg/OmicABEL/src/utils.c
===================================================================
--- pkg/OmicABEL/src/utils.c	2013-12-19 10:47:49 UTC (rev 1485)
+++ pkg/OmicABEL/src/utils.c	2013-12-19 15:08:01 UTC (rev 1486)
@@ -52,8 +52,8 @@
     setenv("GOTO_NUM_THREADS", nths_str, 1);
     setenv("OMP_NUM_THREADS", "1", 1);
 #elif defined MKL
-	mkl_set_num_threads(nths); // Set MKL to use nths for multithreaded BLAS
-	omp_set_num_threads(nths); // Set OMP to use nths for the openmp parallel directives
+	mkl_set_num_threads(nths);
+	omp_set_num_threads(1);
 #else
     setenv("OMP_NUM_THREADS", nths_str, 1);
 #endif
@@ -63,6 +63,7 @@
 {
 #if defined GOTO
     setenv("GOTO_NUM_THREADS", "1", 1);
+    setenv("OMP_NUM_THREADS",  "1", 1);
 #elif defined MKL
 	mkl_set_num_threads(1);
 	omp_set_num_threads(1);



More information about the Genabel-commits mailing list