aboutsummaryrefslogtreecommitdiff
path: root/src/utils.c
diff options
context:
space:
mode:
authortaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-03-31 13:28:25 +0000
committertaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-03-31 13:28:25 +0000
commit9f50a7efb9e16373c8f1d03abf6ad96235045139 (patch)
treef3b0c8c8fbe34a607216bfd2cf2a96853c5900b9 /src/utils.c
parentf71566444f92e4db9c93f222f77971484659ff08 (diff)
Fix namespace in itrans-stat,{c,h}
git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@18 bf6ca9ba-c028-0410-8290-897cf20841d1
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c
index 1c7ecfb..fdc245f 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -9,6 +9,7 @@
*/
#include <math.h>
+#include <gsl/gsl_matrix.h>
/* Return the MOST POSITIVE of two numbers */
unsigned int biggest(signed int a, signed int b) {
@@ -54,3 +55,15 @@ double lambda(double V) {
return h / sqrt(2*m*e*V*(1+((e*V) / (2*m*c*c))));
}
+
+/* Renormalise a gsl_matrix to 0->1
+ * Re-written to use gsl_matrix native functions */
+void matrix_renormalise(gsl_matrix *m) {
+
+ double max,min;
+
+ gsl_matrix_minmax(m,&min,&max);
+ gsl_matrix_add_constant(m,0.-min);
+ gsl_matrix_scale(m,1./(max-min));
+
+}