Index: /trunk/SophyaLib/TArray/gcc_arrmath_pb.h
===================================================================
--- /trunk/SophyaLib/TArray/gcc_arrmath_pb.h	(revision 882)
+++ /trunk/SophyaLib/TArray/gcc_arrmath_pb.h	(revision 882)
@@ -0,0 +1,93 @@
+// This may look like C code, but it is really -*- C++ -*-
+// g++ (up to 2.95.1) doesn't handle these inline template
+// functions correctly - with math functions defined in math.h
+//                     R. Ansari, C.Magneville   04/2000
+
+// --- This file should not be included directly -----
+//   conditional include only in matharr.h
+
+#ifndef GCCARRMATHPB_SEEN
+#define GCCARRMATHPB_SEEN
+
+inline double _Sqrt_(double x) { return(sqrt(x)) ; } 
+inline double _Fabs_(double x) { return(fabs(x)) ; } 
+inline double _Sin_(double x) { return(sin(x)) ; } 
+inline double _Cos_(double x) { return(cos(x)) ; } 
+inline double _Tan_(double x) { return(tan(x)) ; } 
+inline double _aSin_(double x) { return(asin(x)) ; } 
+inline double _aCos_(double x) { return(acos(x)) ; } 
+inline double _aTan_(double x) { return(atan(x)) ; } 
+inline double _Exp_(double x) { return(exp(x)) ; } 
+inline double _Log_(double x) { return(log(x)) ; } 
+inline double _Log10_(double x) { return(log10(x)) ; } 
+
+// ----- Instantiation pour r_8
+inline TArray<r_8> fabs(const TArray<r_8>& a)
+  { MathArray<r_8> ma;   return( ma.ApplyFunction(a, _Fabs_) ); }
+
+inline TArray<r_8> sqrt(const TArray<r_8>& a)
+  { MathArray<r_8> ma;   return( ma.ApplyFunction(a, _Sqrt_) ); }
+
+inline TArray<r_8> sin(const TArray<r_8>& a)
+  { MathArray<r_8> ma;   return( ma.ApplyFunction(a, _Sin_) ); }
+
+inline TArray<r_8> cos(const TArray<r_8>& a)
+  { MathArray<r_8> ma;   return( ma.ApplyFunction(a, _Cos_) ); }
+
+inline TArray<r_8> tan(const TArray<r_8>& a)
+  { MathArray<r_8> ma;   return( ma.ApplyFunction(a, _Tan_) ); }
+
+inline TArray<r_8> asin(const TArray<r_8>& a)
+  { MathArray<r_8> ma;   return( ma.ApplyFunction(a, _aSin_) ); }
+
+inline TArray<r_8> acos(const TArray<r_8>& a)
+  { MathArray<r_8> ma;   return( ma.ApplyFunction(a, _aCos_) ); }
+
+inline TArray<r_8> atan(const TArray<r_8>& a)
+  { MathArray<r_8> ma;   return( ma.ApplyFunction(a, _aTan_) ); }
+
+inline TArray<r_8> exp(const TArray<r_8>& a)
+  { MathArray<r_8> ma;   return( ma.ApplyFunction(a, _Exp_) ); }
+
+inline TArray<r_8> log(const TArray<r_8>& a)
+  { MathArray<r_8> ma;   return( ma.ApplyFunction(a, _Log_) ); }
+
+inline TArray<r_8> log10(const TArray<r_8>& a)
+  { MathArray<r_8> ma;   return( ma.ApplyFunction(a, _Log10_) ); }
+
+
+// ----- Instantiation pour r_4
+inline TArray<r_4> fabs(const TArray<r_4>& a)
+  { MathArray<r_4> ma;   return( ma.ApplyFunction(a, _Fabs_) ); }
+
+inline TArray<r_4> sqrt(const TArray<r_4>& a)
+  { MathArray<r_4> ma;   return( ma.ApplyFunction(a, _Sqrt_) ); }
+
+inline TArray<r_4> sin(const TArray<r_4>& a)
+  { MathArray<r_4> ma;   return( ma.ApplyFunction(a, _Sin_) ); }
+
+inline TArray<r_4> cos(const TArray<r_4>& a)
+  { MathArray<r_4> ma;   return( ma.ApplyFunction(a, _Cos_) ); }
+
+inline TArray<r_4> tan(const TArray<r_4>& a)
+  { MathArray<r_4> ma;   return( ma.ApplyFunction(a, _Tan_) ); }
+
+inline TArray<r_4> asin(const TArray<r_4>& a)
+  { MathArray<r_4> ma;   return( ma.ApplyFunction(a, _aSin_) ); }
+
+inline TArray<r_4> acos(const TArray<r_4>& a)
+  { MathArray<r_4> ma;   return( ma.ApplyFunction(a, _aCos_) ); }
+
+inline TArray<r_4> atan(const TArray<r_4>& a)
+  { MathArray<r_4> ma;   return( ma.ApplyFunction(a, _aTan_) ); }
+
+inline TArray<r_4> exp(const TArray<r_4>& a)
+  { MathArray<r_4> ma;   return( ma.ApplyFunction(a, _Exp_) ); }
+
+inline TArray<r_4> log(const TArray<r_4>& a)
+  { MathArray<r_4> ma;   return( ma.ApplyFunction(a, _Log_) ); }
+
+inline TArray<r_4> log10(const TArray<r_4>& a)
+  { MathArray<r_4> ma;   return( ma.ApplyFunction(a, _Log10_) ); }
+
+#endif
Index: /trunk/SophyaLib/TArray/matharr.cc
===================================================================
--- /trunk/SophyaLib/TArray/matharr.cc	(revision 881)
+++ /trunk/SophyaLib/TArray/matharr.cc	(revision 882)
@@ -3,5 +3,5 @@
 
 #include "machdefs.h"
-#include <stdlib.h>
+#include <math.h>
 #include "matharr.h"
 
@@ -116,5 +116,11 @@
   mean /= dsz;
   sig = sig/dsz - mean*mean;
+#if !defined(OS_LINUX) && !defined (__KCC__)  
   if (sig >= 0.) sig = sqrt(sig);
+#else
+  // va comprendre pourquoi g++ (sur Linux) veut ca pour faire la generation
+  // de template !!!! 
+  if (sig >= 0.) sig = _Sqrt_(sig);
+#endif
   return(mean);
 }
Index: /trunk/SophyaLib/TArray/matharr.h
===================================================================
--- /trunk/SophyaLib/TArray/matharr.h	(revision 881)
+++ /trunk/SophyaLib/TArray/matharr.h	(revision 882)
@@ -7,6 +7,6 @@
 
 #include "machdefs.h"
+#include <math.h>
 #include "tarray.h"
-#include <math.h>
 
 namespace SOPHYA {
@@ -31,4 +31,15 @@
 ////////////////////////////////////////////////
 //  Calcul de fonctions usuelles 
+
+#if !defined(OS_LINUX) && !defined (__KCC__)
+// see below for g++  on Linux 
+template <class T>
+inline TArray<T> fabs(const TArray<T>& a)
+  { MathArray<T> ma;   return( ma.ApplyFunction(a, fabs) ); }
+
+template <class T>
+inline TArray<T> sqrt(const TArray<T>& a)
+  { MathArray<T> ma;   return( ma.ApplyFunction(a, sqrt) ); }
+
 template <class T>
 inline TArray<T> sin(const TArray<T>& a)
@@ -67,4 +78,10 @@
   { MathArray<T> ma;   return( ma.ApplyFunction(a, log10) ); }
 
+#else
+// g++ (up to 2.95.1) doesn't handle these inline template
+// functions correctly - with math functions defined in math.h
+#include "gcc_arrmath_pb.h"
+#endif
+
 template <class T>
 inline double MeanSigma(const TArray<T>& a, double & mean, double & sig)
@@ -75,5 +92,4 @@
   { MathArray<T> ma;  double mean, sig;  return( ma.MeanSigma(a, mean, sig) ); }
 
-
 } // Fin du namespace
 
