Index: trunk/SophyaLib/TArray/basarr.cc
===================================================================
--- trunk/SophyaLib/TArray/basarr.cc	(revision 1101)
+++ trunk/SophyaLib/TArray/basarr.cc	(revision 1103)
@@ -301,6 +301,9 @@
   else {
     smo = false;
-    if ( (size_[marowi_] != a.size_[marowi_]) || 
-	 (size_[macoli_] != a.size_[macoli_])  ) return(false);
+    if ( (size_[marowi_] != a.size_[a.marowi_]) || 
+	 (size_[macoli_] != a.size_[a.macoli_])  ) return(false);
+    if (ndim_ > 2)  
+      for(uint_4 k=2; k<ndim_; k++) 
+	if (size_[k] != a.size_[k])  return(false);
     if ( (macoli_ == a.macoli_) && (marowi_ == a.marowi_) ||
          (veceli_ == a.veceli_) )  smo = true;
@@ -353,6 +356,6 @@
 int  BaseArray::MinStepKA() const
 {
-  for(int ka=0; ka<ndim_; ka++)
-    if (step_[ka] == minstep_) return(ka);
+  for(uint_4 ka=0; ka<ndim_; ka++)
+    if (step_[ka] == minstep_) return((int)ka);
   return(0);
 }
@@ -363,5 +366,5 @@
   int ka = 0;
   uint_4 mx = size_[0];
-  for(int k=0; k<ndim_; k++)  
+  for(uint_4 k=1; k<ndim_; k++)  
     if (size_[k] > mx) {  ka = k;  mx = size_[k]; } 
   return(ka);
@@ -475,5 +478,5 @@
     os << " MemoryMapping=" << GetMemoryMapping() << " VecType= " << GetVectorType()
        << " RowsKA= " << RowsKA() << " ColsKA= " << ColsKA() 
-       << " VectKA=" << VectKA() << endl;
+       << " VectKA=" << VectKA() << " ArrayType=" << arrtype_ << endl;
   }
   if (!si && (prt_lev_ < 2)) return;
Index: trunk/SophyaLib/TArray/tarray.cc
===================================================================
--- trunk/SophyaLib/TArray/tarray.cc	(revision 1101)
+++ trunk/SophyaLib/TArray/tarray.cc	(revision 1103)
@@ -200,6 +200,8 @@
 {
   string exmsg = "TArray<T>::CloneOrShare()";
-  if (!UpdateSizes(a.ndim_, a.size_, a.step_, a.offset_, exmsg))  throw( ParmError(exmsg) );
+  if (!UpdateSizes(a, exmsg))  throw( ParmError(exmsg) );
   mNDBlock.CloneOrShare(a.mNDBlock);
+  if (mInfo) {delete mInfo; mInfo = NULL;}
+  if (a.mInfo) mInfo = new DVList(*(a.mInfo));
 }
 
@@ -209,6 +211,8 @@
 {
   string exmsg = "TArray<T>::Share()";
-  if (!UpdateSizes(a.ndim_, a.size_, a.step_, a.offset_, exmsg))  throw( ParmError(exmsg) );
+  if (!UpdateSizes(a, exmsg))  throw( ParmError(exmsg) );
   mNDBlock.Share(a.mNDBlock);
+  if (mInfo) {delete mInfo; mInfo = NULL;}
+  if (a.mInfo) mInfo = new DVList(*(a.mInfo));
 }
 
@@ -363,25 +367,25 @@
  */
 template <class T>
-TArray<T>& TArray<T>::SetSeq(Sequence seq)
+TArray<T>& TArray<T>::SetSeq(Sequence const & seq)
 {
   if (NbDimensions() < 1) 
     throw RangeCheckError("TArray<T>::SetSeq(Sequence ) - Not Allocated Array ! ");
+  
   T * pe;
   uint_8 j,k;
-  if (AvgStep() > 0)   {  // regularly spaced elements
-    uint_8 step = AvgStep();
-    pe = Data();
-    for(k=0; k<totsize_; k++ )  pe[k*step] = (T) seq(k);
-  }
-  else {    // Non regular data spacing ...
-    //    uint_4 ka = MaxSizeKA();
-    uint_4 ka = 0;
-    uint_8 step = Step(ka);
-    uint_8 gpas = Size(ka);
-    uint_8 naxa = Size()/Size(ka);
-    for(j=0; j<naxa; j++)  {
-      pe = mNDBlock.Begin()+Offset(ka,j);
-      for(k=0; k<gpas; k++)  pe[k*step] = (T) seq(j*gpas+k);
-    }
+  int ka;
+  if (arrtype_ == 0)  ka = 0;
+  else ka = macoli_;
+  uint_8 step = Step(ka);
+  uint_8 gpas = Size(ka);
+  uint_8 naxa = Size()/Size(ka);
+  for(j=0; j<naxa; j++)  {
+    pe = mNDBlock.Begin()+Offset(ka,j);
+#if !defined(__GNUG__)
+    for(k=0; k<gpas; k++)  pe[k*step] = (T) seq(j*gpas+k);
+#else
+    // g++ (up to 2.95.1) se melange les pinceaux  s'il y a le cast (T) pour l'instanciation des complexes 
+    for(k=0; k<gpas; k++)  pe[k*step] = seq(j*gpas+k);
+#endif
   }
   return(*this);
Index: trunk/SophyaLib/TArray/tarray.h
===================================================================
--- trunk/SophyaLib/TArray/tarray.h	(revision 1101)
+++ trunk/SophyaLib/TArray/tarray.h	(revision 1103)
@@ -122,7 +122,7 @@
   inline T toScalar();
 // Met les elements a une suite de valeurs
-  virtual TArray<T>&  SetSeq(Sequence seq);
+  virtual TArray<T>&  SetSeq(Sequence const & seq);
   //! Fill TArray with Sequence \b seq
-  inline  TArray<T>&  operator = (Sequence seq)    { return SetSeq(seq); }
+  inline  TArray<T>&  operator = (Sequence const & seq)    { return SetSeq(seq); }
 // A = x (tous les elements a x)
   virtual TArray<T>&  SetT(T x);
Index: trunk/SophyaLib/TArray/tmatrix.cc
===================================================================
--- trunk/SophyaLib/TArray/tmatrix.cc	(revision 1101)
+++ trunk/SophyaLib/TArray/tmatrix.cc	(revision 1103)
@@ -1,3 +1,3 @@
-// $Id: tmatrix.cc,v 1.14 2000-07-26 16:29:45 ansari Exp $
+// $Id: tmatrix.cc,v 1.15 2000-07-27 00:00:09 ansari Exp $
 //                         C.Magneville          04/99
 #include "machdefs.h"
@@ -54,4 +54,5 @@
 {
   arrtype_ = 1;   // Type = Matrix
+  UpdateMemoryMapping(a, SameMemoryMapping);
 }
 
@@ -66,4 +67,5 @@
 {
   arrtype_ = 1;   // Type = Matrix
+  UpdateMemoryMapping(a, SameMemoryMapping);
 }
 
@@ -111,4 +113,5 @@
 {
   arrtype_ = 1;   // Type = Matrix
+  UpdateMemoryMapping(a, SameMemoryMapping);
   SetBA(a);
 }
Index: trunk/SophyaLib/TArray/tmatrix.h
===================================================================
--- trunk/SophyaLib/TArray/tmatrix.h	(revision 1101)
+++ trunk/SophyaLib/TArray/tmatrix.h	(revision 1103)
@@ -82,5 +82,5 @@
 
   // = : fill matrix with a Sequence \b seq
-  inline  TMatrix<T>&  operator = (Sequence seq)    { SetSeq(seq); return(*this); }
+  inline  TMatrix<T>&  operator = (Sequence const & seq)    { SetSeq(seq); return(*this); }
 
   // Operations diverses  avec une constante
@@ -137,4 +137,55 @@
 	      r*step_[marowi_] + c*step_[macoli_] ) );
 }
+////////////////////////////////////////////////////////////////
+// Surcharge d'operateurs A (+,-,*,/) (T) x
+
+/*! \ingroup TMatrix \fn operator+(const TMatrix<T>&,T)
+  \brief Operator TMatrix = TMatrix + constant */
+template <class T> inline TMatrix<T> operator + (const TMatrix<T>& a, T b)
+    {TMatrix<T> result; result.CloneOrShare(a); result.SetTemp(true); 
+    result.Add(b); return result;}
+
+/*! \ingroup TMatrix \fn operator+(T,const TMatrix<T>&)
+  \brief Operator TMatrix = constant + TMatrix */
+template <class T> inline TMatrix<T> operator + (T b,const TMatrix<T>& a)
+    {TMatrix<T> result; result.CloneOrShare(a); result.SetTemp(true); 
+    result.Add(b); return result;}
+
+/*! \ingroup TMatrix \fn operator-(const TMatrix<T>&,T)
+  \brief Operator TMatrix = TMatrix - constant */
+template <class T> inline TMatrix<T> operator - (const TMatrix<T>& a, T b)
+    {TMatrix<T> result; result.CloneOrShare(a); result.SetTemp(true); 
+    result.Sub(b); return result;}
+
+/*! \ingroup TMatrix \fn operator-(T,const TMatrix<T>&)
+  \brief Operator TMatrix = constant - TMatrix */
+template <class T> inline TMatrix<T> operator - (T b,const TMatrix<T>& a)
+    {TMatrix<T> result; result.CloneOrShare(a); result.SetTemp(true); 
+    result.Sub(b,true); return result;}
+
+/*! \ingroup TMatrix \fn operator*(const TMatrix<T>&,T)
+  \brief Operator TMatrix = TMatrix * constant */
+template <class T> inline TMatrix<T> operator * (const TMatrix<T>& a, T b)
+    {TMatrix<T> result; result.CloneOrShare(a); result.SetTemp(true); 
+    result.Mul(b); return result;}
+
+/*! \ingroup TMatrix \fn operator*(T,const TMatrix<T>&)
+  \brief Operator TMatrix = constant * TMatrix */
+template <class T> inline TMatrix<T> operator * (T b,const TMatrix<T>& a)
+    {TMatrix<T> result; result.CloneOrShare(a); result.SetTemp(true); 
+    result.Mul(b); return result;}
+
+/*! \ingroup TMatrix \fn operator/(const TMatrix<T>&,T)
+  \brief Operator TMatrix = TMatrix / constant */
+template <class T> inline TMatrix<T> operator / (const TMatrix<T>& a, T b)
+    {TMatrix<T> result; result.CloneOrShare(a); result.SetTemp(true); 
+    result.Div(b); return result;}
+
+/*! \ingroup TMatrix \fn operator/(T,const TMatrix<T>&)
+  \brief Operator TMatrix = constant / TMatrix  */
+template <class T> inline TMatrix<T> operator / (T b, const TMatrix<T>& a)
+    {TMatrix<T> result; result.CloneOrShare(a); result.SetTemp(true); 
+    result.Div(b, true); return result;}
+
 
 // Surcharge d'operateurs C = A (+,-) B
Index: trunk/SophyaLib/TArray/tvector.cc
===================================================================
--- trunk/SophyaLib/TArray/tvector.cc	(revision 1101)
+++ trunk/SophyaLib/TArray/tvector.cc	(revision 1103)
@@ -1,3 +1,3 @@
-// $Id: tvector.cc,v 1.9 2000-07-26 16:29:46 ansari Exp $
+// $Id: tvector.cc,v 1.10 2000-07-27 00:00:10 ansari Exp $
 //                         C.Magneville          04/99
 #include "machdefs.h"
@@ -101,8 +101,9 @@
 template <class T>
 TVector<T>::TVector(const BaseArray& a)
-: TMatrix<T>()
-{
-  arrtype_ = 2;   // Type = Vector
-  SetBA(a);
+: TMatrix<T>(a)
+{
+  if ( (size_[0] != 1) && (size_[1] != 1) )
+    throw SzMismatchError("TVector<T>::TVector(const BaseArray& a) NRows()!=1 && NCols()!=1 ");
+  arrtype_ = 2;   // Type = Vector
 }
 
Index: trunk/SophyaLib/TArray/tvector.h
===================================================================
--- trunk/SophyaLib/TArray/tvector.h	(revision 1101)
+++ trunk/SophyaLib/TArray/tvector.h	(revision 1103)
@@ -58,5 +58,5 @@
   // Operateur d'affectation
   //! Fill the vector with Sequence \b seq
-  inline  TVector<T>&  operator = (Sequence seq) { SetSeq(seq); return(*this); }
+  inline  TVector<T>&  operator = (Sequence const & seq) { SetSeq(seq); return(*this); }
 
   // Operations diverses  avec une constante
Index: trunk/SophyaLib/TArray/utilarr.cc
===================================================================
--- trunk/SophyaLib/TArray/utilarr.cc	(revision 1101)
+++ trunk/SophyaLib/TArray/utilarr.cc	(revision 1103)
@@ -7,4 +7,8 @@
 
 // Classe utilitaires
+
+Sequence::~Sequence()
+{
+}
 
 //////////////////////////////////////////////////////////
@@ -27,4 +31,7 @@
   sig_ = s;
 }
+RandomSequence::~RandomSequence()
+{
+}
 
 //! Return random sequence values.
@@ -41,8 +48,15 @@
 }
 
+MuTyV & RandomSequence::Value(uint_8 k) const 
+{
+  if (typ_ == Flat) retv_ = drandpm1()*sig_ + mean_;
+  else retv_ = GauRnd(mean_, sig_);
+  return retv_;
+}
+
 
 //////////////////////////////////////////////////////////
 /*!
-  \class SOPHYA::Sequence
+  \class SOPHYA::RegularSequence
   \ingroup TArray
   Class to generate a sequence of values
@@ -55,28 +69,15 @@
   \param f : pointer to the sequence function
 
-  See \ref SequenceOperat "operator()"
+  See \ref RegularSequenceOperat "operator()"
  */
-Sequence::Sequence(double start, double step, Arr_DoubleFunctionOfX f)
-  : rseq_(RandomSequence::Gaussian)
+RegularSequence::RegularSequence(double start, double step, Arr_DoubleFunctionOfX f)
 {
   start_ = start;
   step_ = step;
   myf_ = f;
-  fgrseq_ = false;
 }
 
-//! Constructor
-/*!
-  \param rseq : RandomSequence
-
-  See \ref SequenceOperat "operator()"
- */
-Sequence::Sequence(RandomSequence rseq)
+RegularSequence::~RegularSequence()
 {
-  start_ = 0.;
-  step_ = 1.;
-  myf_ = NULL;  
-  rseq_ = rseq;
-  fgrseq_ = true;
 }
 
@@ -84,5 +85,5 @@
 /*!
   \param k : index of the value
-  \anchor SequenceOperat
+  \anchor RegularSequenceOperat
 
   If the constructor was done with RandomSequence, return a RandomSequence
@@ -94,12 +95,28 @@
   \return the \b k th value
  */
-double Sequence::operator () (uint_4 k)
+
+MuTyV & RegularSequence::Value (uint_8 k) const 
 {
-  if (fgrseq_) return(rseq_.Rand());
-  else {
-    double x = start_+(double)k*step_;
-    if (myf_)  return(myf_(x));
-    else return x;
-  }
+  double x = start_+(double)k*step_;
+  if (myf_)  x = myf_(x);
+  retv_ = x;
+  return(retv_);
+}
+
+EnumeratedSequence::~EnumeratedSequence()
+{
+}
+
+MuTyV & EnumeratedSequence::Value (uint_8 k) const 
+{
+  if (k >= vecv_.size())  retv_ = 0;
+  else retv_ = vecv_[k];
+  return(retv_);
+}
+
+EnumeratedSequence & EnumeratedSequence::operator , (MuTyV const & v)
+{
+  vecv_.push_back(v);
+  return(*this);
 }
 
Index: trunk/SophyaLib/TArray/utilarr.h
===================================================================
--- trunk/SophyaLib/TArray/utilarr.h	(revision 1101)
+++ trunk/SophyaLib/TArray/utilarr.h	(revision 1103)
@@ -7,5 +7,8 @@
 
 #include "machdefs.h"
+#include "mutyv.h"
+
 #include <stdlib.h>
+#include <vector>
 
 namespace SOPHYA {   
@@ -26,5 +29,12 @@
 //////////////////////////////////////////////////////////
 //! Class to generate a random sequence of values
-class RandomSequence {
+class Sequence {
+public:
+  virtual ~Sequence();
+  virtual MuTyV & Value(uint_8 k) const = 0;
+  inline MuTyV & operator () (uint_8 k) const { return(Value(k)) ; }
+};
+
+class RandomSequence : public Sequence {
 public:
   //! to define the generator type
@@ -34,9 +44,13 @@
     };
 
-  RandomSequence(int typ = RandomSequence::Gaussian, double m=0., double s=1.);
-  double Rand();
+  explicit RandomSequence(int typ = RandomSequence::Gaussian, double m=0., double s=1.);
+  virtual  ~RandomSequence();
+  virtual MuTyV & Value(uint_8 k) const ;
+  double   Rand();
+
 protected:
   int typ_;            //!< random generation type
   double mean_, sig_;  //!< generation parameters mean and sigma (if needed)
+  mutable MuTyV retv_;
 };
 
@@ -44,8 +58,8 @@
 //////////////////////////////////////////////////////////
 //! Class to generate a sequence of values
-class Sequence {
+class RegularSequence : public Sequence {
 public:
-  explicit Sequence (double start=0., double step=1., Arr_DoubleFunctionOfX f=NULL);
-  explicit Sequence (RandomSequence rseq);
+  explicit RegularSequence (double start=0., double step=1., Arr_DoubleFunctionOfX f=NULL);
+  virtual  ~RegularSequence();
 
   //! return start value of the sequence
@@ -53,12 +67,26 @@
   //! return step value of the sequence
   inline double & Step() { return step_; }
-  double operator () (uint_4 k);
+
+  virtual MuTyV & Value(uint_8 k) const ;
+
 protected:
   double start_;              //!< start value of the sequence
   double step_;               //!< step value of the sequence
   Arr_DoubleFunctionOfX myf_; //!< pointer to the sequence function
-  bool fgrseq_;               //!< true if RandomSequence is used
-  RandomSequence rseq_;       //!< RandomSequence
+  mutable MuTyV retv_;
 };
+
+class EnumeratedSequence : public Sequence  {
+public:
+  virtual ~EnumeratedSequence();
+  virtual MuTyV & Value(uint_8 k) const ;
+  EnumeratedSequence & operator , (MuTyV const & v);
+private:
+  vector<MuTyV> vecv_;
+  mutable MuTyV retv_;
+};
+
+inline EnumeratedSequence operator , (MuTyV const & a, MuTyV const & b)
+{ EnumeratedSequence seq;   return ((seq,a),b) ; }
 
 //////////////////////////////////////////////////////////
