Index: /trunk/SophyaLib/Samba/lambdaBuilder.h
===================================================================
--- /trunk/SophyaLib/Samba/lambdaBuilder.h	(revision 2290)
+++ /trunk/SophyaLib/Samba/lambdaBuilder.h	(revision 2291)
@@ -14,7 +14,7 @@
 
  public :
-Legendre();
 Legendre(r_8 x, int_4 lmax);
- inline r_8 getPl(int_4 l) 
+
+inline r_8 getPl(int_4 l) const
 {
   if (l>lmax_) 
@@ -25,6 +25,10 @@
 }
 
+
  private : 
-  void array_init(int_4 lmax);
+
+Legendre() {;}
+
+void array_init(int_4 lmax);
 
   r_8 x_;
@@ -45,7 +49,13 @@
 
  /*! return the value of the coefficient \f$  \lambda_l^m \f$ */
-inline double lamlm(int l, int m) const { return lambda_(l,m); }
+inline double lamlm(int l, int m) const 
+  {
+    lambda_.CheckRelativeIndices(l,m);
+    return lambda_(l,m); 
+  }
 
-inline double lamlm(int index) const { return lambda_(index); }
+inline double lamlm(int index) const {
+ return lambda_(index); 
+}
 
 
@@ -92,4 +102,8 @@
 inline void lam_wx(int l, int m, r_8& w, r_8& x) const
    {
+  if (m > l ) 
+    {
+      throw RangeCheckError("LambdaWXBuilder::lam_wx : l < m !" );
+    }
      w=lamWlm_(l,m);
      x=lamXlm_(l,m);
@@ -117,4 +131,8 @@
 inline void lam_pm(int l, int m, r_8& lambda_plus, r_8& lambda_moins) const
    {
+  if (m > l ) 
+    {
+      throw RangeCheckError("LambdaPMBuilder::lam_pm : l < m !" );
+    }
       lambda_plus = lamPlm_(l,m);
      lambda_moins = lamMlm_(l,m);
Index: /trunk/SophyaLib/Samba/sphericaltransformserver.cc
===================================================================
--- /trunk/SophyaLib/Samba/sphericaltransformserver.cc	(revision 2290)
+++ /trunk/SophyaLib/Samba/sphericaltransformserver.cc	(revision 2291)
@@ -169,8 +169,8 @@
   // le Resize est suppose mettre a zero
   map.Resize(pixelSizeIndex);
-  char* sphere_type=map.TypeOfMap();
+  string sphere_type=map.TypeOfMap();
       int premiereTranche = 0;
       int derniereTranche = map.NbThetaSlices()-1;
-  if (strncmp(sphere_type,"RING",4) == 0)
+  if (sphere_type.substr(0,4) == "RING")
   {
     nsmax=map.SizeIndex();
@@ -182,5 +182,5 @@
     // en vue de l'application du critere Healpix : nlmax<=3*nsmax-1
     // c'est approximatif ; a raffiner.
-    if (strncmp(sphere_type,"TETAFI",6) == 0)
+    if (sphere_type.substr(0,6) == "TETAFI")
     {
       nsmax=(int_4)sqrt(map.NbPixels()/12.);
@@ -706,6 +706,6 @@
   mapq.Resize(pixelSizeIndex);
   mapu.Resize(pixelSizeIndex);
-  char* sphere_type=mapq.TypeOfMap();
-  if (strncmp(sphere_type,mapu.TypeOfMap(),4) != 0)
+  string sphere_type=mapq.TypeOfMap();
+  if (sphere_type != mapu.TypeOfMap())
     {
       cout <<  " SphericalTransformServer: les deux spheres ne sont pas de meme type" << endl;
@@ -715,5 +715,5 @@
       
     }
-  if (strncmp(sphere_type,"RING",4) == 0)
+  if (sphere_type.substr(0,4) == "RING")
     {
       nsmax=mapq.SizeIndex();
@@ -724,5 +724,5 @@
     // en vue de l'application du critere Healpix : nlmax<=3*nsmax-1
     // c'est approximatif ; a raffiner.
-    if (strncmp(sphere_type,"TETAFI",6) == 0)
+    if (sphere_type.substr(0,6) == "TETAFI")
       {
 	nsmax=(int_4)sqrt(mapq.NbPixels()/12.);
@@ -739,5 +739,5 @@
     {
       cout << "GenerateFromAlm: nlmax should be <= 3*nside-1" << endl;
-      if (strncmp(sphere_type,"TETAFI",6) == 0)
+      if (sphere_type.substr(0,6) == "TETAFI")
 	{
 	  cout << " (for this criterium, nsmax is computed as sqrt(nbPixels/12))" << endl;
@@ -877,6 +877,6 @@
   TVector<int_4> pixNumber;
 
-  char* sphere_type=mapq.TypeOfMap();
-  if (strncmp(sphere_type,mapu.TypeOfMap(),4) != 0)
+  string sphere_type=mapq.TypeOfMap();
+  if (sphere_type != mapu.TypeOfMap())
     {
       cout <<  " SphericalTransformServer: les deux spheres ne sont pas de meme type" << endl;
Index: /trunk/SophyaLib/TArray/triangmtx.h
===================================================================
--- /trunk/SophyaLib/TArray/triangmtx.h	(revision 2290)
+++ /trunk/SophyaLib/TArray/triangmtx.h	(revision 2291)
@@ -109,4 +109,26 @@
   inline int_4 Size() const {return elem_.Size();}
 
+  inline bool CheckRelativeIndices(int_4 l, int_4 m) const 
+   {
+     if ( l < m ) 
+       {
+	 throw RangeCheckError("TriangularMatrix<T>::CheckRelativeIndices: indices out of range " );
+       }
+     return true;
+   }
+  inline bool CheckAbsoluteIndice(int_4 l, int_4 m) const 
+   {
+     if ( indexOfElement(l,m) >= elem_.Size() )
+       {
+	 throw RangeCheckError("TriangularMatrix<T>::CheckAbsoluteIndice: indices out of range " );
+       }
+   }
+  inline bool CheckAbsoluteIndice(int_4 ind) const 
+   {
+     if ( ind >= elem_.Size() )
+       {
+	 throw RangeCheckError("TriangularMatrix<T>::CheckAbsoluteIndice: indices out of range " );
+       }
+   }
 
 void Print(int nbLignes=0)
