Index: trunk/SophyaLib/Samba/lambdaBuilder.cc
===================================================================
--- trunk/SophyaLib/Samba/lambdaBuilder.cc	(revision 1683)
+++ trunk/SophyaLib/Samba/lambdaBuilder.cc	(revision 1756)
@@ -40,6 +40,6 @@
 }
 
-TriangularMatrix<r_8>* LambdaLMBuilder::a_recurrence_ = NULL;
-TriangularMatrix<r_8>* LambdaLMBuilder::lam_fact_     = NULL;
+TriangularMatrix<r_8> LambdaLMBuilder::a_recurrence_ = TriangularMatrix<r_8>();
+TriangularMatrix<r_8> LambdaLMBuilder::lam_fact_     = TriangularMatrix<r_8>();
 TVector<r_8>* LambdaLMBuilder::normal_l_     = NULL;
 
@@ -81,14 +81,14 @@
 void LambdaLMBuilder::array_init(int lmax, int mmax)
    {
-     if (a_recurrence_ == NULL)
-       {
-	 a_recurrence_ = new TriangularMatrix<r_8>;
+     if (a_recurrence_.Size() == 0)
+       {
+	 //	 a_recurrence_ = new TriangularMatrix<r_8>;
 	 updateArrayRecurrence(lmax);
        }
      else
-       if ( lmax > (*a_recurrence_).rowNumber()-1     )
+       if ( lmax > (a_recurrence_).rowNumber()-1     )
 	 {
 	   cout << " WARNING : The classes LambdaXXBuilder will be more efficient if instanciated with parameter lmax = maximum value of l index which will be needed in the whole application (arrays not recomputed) " << endl;
-	   cout << "lmax= " << lmax << " previous instanciation with lmax= " <<  (*a_recurrence_).rowNumber() << endl;
+	   cout << "lmax= " << lmax << " previous instanciation with lmax= " <<  (a_recurrence_).rowNumber() << endl;
 	 updateArrayRecurrence(lmax);
 	 }
@@ -110,5 +110,5 @@
 	 r_8 lam_1=1. /bignorm2 ;
 	 //	 r_8 a_rec = LWK->a_recurr(m,m);
-	 r_8 a_rec = (*a_recurrence_)(m,m);
+	 r_8 a_rec = a_recurrence_(m,m);
 	 r_8 b_rec = 0.;
 	 for (int l=m+1; l<=lmax_; l++)
@@ -118,5 +118,5 @@
 	   b_rec=1./a_rec;
 	   //	   a_rec= LWK->a_recurr(l,m);
-	   a_rec= (*a_recurrence_)(l,m);
+	   a_rec= a_recurrence_(l,m);
 	   lam_0 = lam_1;
 	   lam_1 = lam_2;
@@ -135,12 +135,12 @@
 void  LambdaLMBuilder::updateArrayRecurrence(int_4 lmax)
    {
-     (*a_recurrence_).ReSizeRow(lmax+1);
+     a_recurrence_.ReSizeRow(lmax+1);
      for (int m=0; m<=lmax;m++)
      {
-       (*a_recurrence_)(m,m) = sqrt( 2.*m +3.);
+       a_recurrence_(m,m) = sqrt( 2.*m +3.);
        for (int l=m+1; l<=lmax; l++)
 	 {
 	   r_8 fl2 = (l+1.)*(l+1.);
-	   (*a_recurrence_)(l,m)=sqrt( (4.*fl2-1.)/(fl2-m*m) );
+	   a_recurrence_(l,m)=sqrt( (4.*fl2-1.)/(fl2-m*m) );
 	 }
      }
@@ -153,10 +153,10 @@
 void  LambdaLMBuilder::updateArrayLamNorm()
      {
-       (*lam_fact_).ReSizeRow(lmax_+1);
+       lam_fact_.ReSizeRow(lmax_+1);
        for(int m = 0;m<= lmax_; m++)
 	 {
 	   for (int l=m; l<=lmax_; l++)
 	     {
-	       (*lam_fact_)(l,m) =2.*(r_8)sqrt( (2.*l+1)*(l+m)*(l-m)/(2.*l-1)  );
+	       lam_fact_(l,m) =2.*(r_8)sqrt( (2.*l+1)*(l+m)*(l-m)/(2.*l-1)  );
 	     }
 	 }
@@ -214,12 +214,12 @@
 void LambdaWXBuilder::array_init()
    {
-     if (lam_fact_ == NULL || normal_l_ == NULL)
-       {
-	 lam_fact_ = new  TriangularMatrix<r_8>;
+     if (lam_fact_.Size() < 1 || normal_l_ == NULL)
+       {
+	 //	 lam_fact_ = new  TriangularMatrix<r_8>;
 	 normal_l_ = new TVector<r_8>;
 	 updateArrayLamNorm();
        }
      else
-       if ( lmax_ > (*lam_fact_).rowNumber()-1  || lmax_ >  (*normal_l_).NElts()-1 )
+       if ( lmax_ > lam_fact_.rowNumber()-1  || lmax_ >  (*normal_l_).NElts()-1 )
 	 {
 	   updateArrayLamNorm();
@@ -247,5 +247,5 @@
 	  r_8 lam_lm1m = LambdaLMBuilder::lamlm(l-1,m);
 	  r_8 lam_lm = LambdaLMBuilder::lamlm(l,m);
-	  r_8 lam_fact_l_m = (*lam_fact_)(l,m);
+	  r_8 lam_fact_l_m = lam_fact_(l,m);
 	  r_8  a_w =  2. * (l - m*m) * one_on_s2 + l*(l-1.);
 	  r_8  b_w =  c_on_s2 * lam_fact_l_m;
@@ -284,12 +284,12 @@
 void LambdaPMBuilder::array_init()
    {
-     if (lam_fact_ == NULL || normal_l_ == NULL)
-       {
-	 lam_fact_ = new  TriangularMatrix<r_8>;
+     if (lam_fact_.Size() < 1 || normal_l_ == NULL)
+       {
+	 //	 lam_fact_ = new  TriangularMatrix<r_8>;
 	 normal_l_ = new TVector<r_8>;
 	 updateArrayLamNorm();
        }
      else
-       if ( lmax_ > (*lam_fact_).rowNumber()-1  || lmax_ >  (*normal_l_).NElts()-1 )
+       if ( lmax_ > lam_fact_.rowNumber()-1  || lmax_ >  (*normal_l_).NElts()-1 )
 	 {
 	   updateArrayLamNorm();
@@ -318,5 +318,5 @@
 	     r_8 lam_lm1m = LambdaLMBuilder::lamlm(l-1,m);
 	     r_8 lam_lm = LambdaLMBuilder::lamlm(l,m);
-	     r_8 lam_fact_l_m = (*lam_fact_)(l,m);
+	     r_8 lam_fact_l_m = lam_fact_(l,m);
 	     r_8  a_w =  2. * (l - m*m) * one_on_s2 + l*(l-1.);
 	     r_8 f_w =  lam_fact_l_m/(sth_*sth_);
