Index: trunk/SophyaLib/TArray/basarr.cc
===================================================================
--- trunk/SophyaLib/TArray/basarr.cc	(revision 1092)
+++ trunk/SophyaLib/TArray/basarr.cc	(revision 1099)
@@ -164,5 +164,4 @@
   }
   else veceli_ = (vt ==  ColumnVector ) ?  marowi_ : macoli_;
-  ck_memo_vt_ = true;   // Check MemMapping and VectorType for CompareSize  
 }
 
@@ -196,5 +195,4 @@
   }
   else veceli_ = (vt ==  ColumnVector ) ?  marowi_ : macoli_;
-  ck_memo_vt_ = true;   // Check MemMapping and VectorType for CompareSize  
 }
 
@@ -224,5 +222,4 @@
   }
   else   veceli_ = (vt ==  ColumnVector ) ?  marowi_ : macoli_;
-  ck_memo_vt_ = true;   // Check MemMapping and VectorType for CompareSize  
 }
 
@@ -243,5 +240,4 @@
   }
   else  veceli_ = (vt ==  ColumnVector ) ?  marowi_ : macoli_;
-  ck_memo_vt_ = true;   // Check MemMapping and VectorType for CompareSize  
 }
 
@@ -268,5 +264,6 @@
   }
   veceli_ = (default_vector_type ==  ColumnVector ) ?  marowi_ : macoli_;
-  ck_memo_vt_ = false;   // Default : Don't Check MemMapping and VectorType for CompareSize  
+  arrtype_ = 0;    // Default Array type, not a Matrix or Vector
+  
 }
 
@@ -277,19 +274,37 @@
 
 
-//! Returns true if dimension and sizes are equal
+//! Returns true if the two arrays have compatible dimensions.
 /*!
   \param a : array to be compared
-  \return true if ndim and sizes[ndim] are equal, false if not
+  \param smo : Return flag = true if the two arrays have the same memory organisation
+  \return true if \c NbDimensions() and \c Size() are equal, false if not
+
+  If the array (on which the operation is being performed, \c this) 
+  is a \b Matrix or a \b Vector, the matrix dimensions \c NRows() \c NCols()
+  are checked. The flag \c smo is returned true if the two arrays, viewed 
+  as a matrix have the same memory organisation.
+  Otherwise, (if the array is of not a Matrix or a Vector) 
+  the size compatibility viewed as a TArray is checked <tt> 
+  (Size(k) == a.Size(k), k=0,...NbDimensions()), </tt> disregard of the memory 
+  organisation and the row and column index. The flag \c smo is returned true 
+  in this case.
 */
-bool BaseArray::CompareSizes(const BaseArray& a)
+bool BaseArray::CompareSizes(const BaseArray& a, bool& smo)
 {
   if (ndim_ != a.ndim_)  return(false);
-  for(uint_4 k=0; k<ndim_; k++) 
-    if (size_[k] != a.size_[k])  return(false);
-  //  $CHECK$   Reza doit-on verifier ca 
-  if (ck_memo_vt_ && a.ck_memo_vt_)
-    if ( (macoli_ != a.macoli_) || (marowi_ != a.marowi_) ||
-         (veceli_ != a.veceli_) )  return(false);
-  return(true);
+  if (arrtype_ == 0) {  // Simple TArray, not a matrix 
+    smo = true;
+    for(uint_4 k=0; k<ndim_; k++) 
+      if (size_[k] != a.size_[k])  return(false);
+    return(true);
+  }
+  else {
+    smo = false;
+    if ( (size_[marowi_] != a.size_[marowi_]) || 
+	 (size_[macoli_] != a.size_[macoli_])  ) return(false);
+    if ( (macoli_ == a.macoli_) && (marowi_ == a.marowi_) ||
+         (veceli_ == a.veceli_) )  smo = true;
+    return(true);
+  }
 }
 
@@ -336,7 +351,7 @@
 
 //! return minimum value for step[ndim]
-uint_4 BaseArray::MinStepKA() const
-{
-  for(uint_4 ka=0; ka<ndim_; ka++)
+int  BaseArray::MinStepKA() const
+{
+  for(int ka=0; ka<ndim_; ka++)
     if (step_[ka] == minstep_) return(ka);
   return(0);
@@ -344,10 +359,10 @@
 
 //! return maximum value for step[ndim]
-uint_4 BaseArray::MaxSizeKA() const
-{
-  uint_4 ka = 0;
+int  BaseArray::MaxSizeKA() const
+{
+  int ka = 0;
   uint_4 mx = size_[0];
-  for(uint_4 k=0; k<ndim_; k++)  
-    if (size_[k] > mx) {  ka = k;  mx = size_[k];  }
+  for(int k=0; k<ndim_; k++)  
+    if (size_[k] > mx) {  ka = k;  mx = size_[k]; } 
   return(ka);
 }
@@ -410,4 +425,27 @@
 }
 
+//! return various parameters for double loop operations on two arrays.
+void BaseArray::GetOpeParams(const BaseArray& a, bool smo, int& ax, int& axa, uint_8& step,
+			     uint_8& stepa, uint_8& gpas, uint_8& naxa)
+{
+  if (smo) { // Same memory organisation
+    ax = axa = MaxSizeKA();
+  }
+  else {
+    if (Size(RowsKA()) >= Size(ColsKA()) ) {
+      ax = RowsKA();
+      axa = a.RowsKA();
+    }
+    else {
+      ax = ColsKA();
+      axa = a.ColsKA();
+    }
+  }
+  step = Step(ax);
+  stepa = a.Step(axa);
+  gpas = Size(ax)*step;
+  naxa = Size()/Size(ax);
+  return;
+}
 
 // ----------------------------------------------------
@@ -505,5 +543,4 @@
   }
   veceli_ = (default_vector_type ==  ColumnVector ) ?  marowi_ : macoli_;
-  ck_memo_vt_ = false;   // Default : Don't Check MemMapping and VectorType for CompareSize  
   // Update OK 
   ndim_ = ndim;
@@ -562,5 +599,4 @@
   }
   veceli_ = (default_vector_type ==  ColumnVector ) ?  marowi_ : macoli_;
-  ck_memo_vt_ = false;   // Default : Don't Check MemMapping and VectorType for CompareSize  
   // Update OK 
   ndim_ = ndim;
@@ -609,5 +645,4 @@
   marowi_ = a.marowi_;
   veceli_ = a.veceli_;
-  ck_memo_vt_ = a.ck_memo_vt_;
   // Update OK 
   ndim_ = a.ndim_;
Index: trunk/SophyaLib/TArray/basarr.h
===================================================================
--- trunk/SophyaLib/TArray/basarr.h	(revision 1092)
+++ trunk/SophyaLib/TArray/basarr.h	(revision 1099)
@@ -62,5 +62,5 @@
 
   // Returns true if ndim and sizes are equal
-  virtual bool CompareSizes(const BaseArray& a);
+  virtual bool CompareSizes(const BaseArray& a, bool& smo);
 
   // Compacts \b size=1 array dimensions
@@ -83,15 +83,15 @@
   inline uint_4 Size(int ka) const { return(size_[CheckDI(ka,1)]); }
 
-  uint_4 MaxSizeKA() const ;
+  int MaxSizeKA() const ;
 
   //! Get memory organization
-  inline short GetMemoryMapping() const 
+  inline short  GetMemoryMapping() const 
          { return ( (marowi_ == 1) ? CMemoryMapping : FortranMemoryMapping) ; }
   //! line index dimension
-  inline uint_4 RowsKA() const {return marowi_; }
+  inline int    RowsKA() const {return marowi_; }
   //! column index dimension
-  inline uint_4 ColsKA() const {return macoli_; }
+  inline int    ColsKA() const {return macoli_; }
   //! Index dimension of the elements of a vector
-  inline uint_4 VectKA() const {return veceli_; }
+  inline int    VectKA() const {return veceli_; }
   void          SetMemoryMapping(short mm=AutoMemoryMapping);
 
@@ -126,5 +126,5 @@
   inline uint_4 Step(int ka) const { return(step_[CheckDI(ka,3)]); }
 
-  uint_4 MinStepKA() const ;
+  int MinStepKA() const ;
 
   // Offset of element ip
@@ -137,5 +137,8 @@
   virtual MuTyV & ValueAtPosition(uint_8 ip) const = 0;
 
- // Impression, I/O, ...
+  // Pour recuperer pas et numero d'axe pour operations sur deux arrays
+  void   GetOpeParams(const BaseArray& a, bool smo, int& ax, int& axa, uint_8& step,
+		      uint_8& stepa, uint_8& gpas, uint_8& naxa);
+  // Impression, I/O, ...
   void           Show(ostream& os, bool si=false) const;
   //! Show information on \b cout
@@ -166,13 +169,13 @@
   uint_4 size_[BASEARRAY_MAXNDIMS]; //!< array of the size in each dimension
   uint_8 totsize_; //!< Total number of elements
+  uint_8 offset_;  //!< global offset -\> position of elem[0] in DataBlock
   //! two consecutive elements distance in a given dimension 
   uint_4 step_[BASEARRAY_MAXNDIMS];
   uint_4 minstep_; //!< minimal step (in any axes)
   uint_4 moystep_; //!< mean step, if == 0 --\> non regular steps
-  uint_8 offset_;  //!< global offset -\> position of elem[0] in DataBlock
-  uint_4 marowi_; //!< For matrices, Row index in dimensions
-  uint_4 macoli_; //!< For matrices, Column index in dimensions
-  uint_4 veceli_; //!< For vectors, dimension index = marowi_/macoli_ (Row/Col vectors)
-  bool ck_memo_vt_; //!< if true, check MemoryOrg./VectorType for CompareSize
+  int_2  marowi_; //!< For matrices, Row index in dimensions
+  int_2  macoli_; //!< For matrices, Column index in dimensions
+  int_2  veceli_; //!< For vectors, dimension index = marowi_/macoli_ (Row/Col vectors)
+  int_2 arrtype_; //!< 0 a TArray, 1 TMatrix , 2 TVector
   DVList* mInfo;    //!< Infos (variables) attached to the array
 
Index: trunk/SophyaLib/TArray/matharr.cc
===================================================================
--- trunk/SophyaLib/TArray/matharr.cc	(revision 1092)
+++ trunk/SophyaLib/TArray/matharr.cc	(revision 1099)
@@ -148,5 +148,4 @@
   mean /= dsz;
   sig = sig/dsz - mean*mean;
-//   #if !defined(OS_LINUX) && !defined (__KCC__)  
 #if !defined(__GNUG__) && !defined (__MWERKS__)
   if (sig >= 0.) sig = sqrt(sig);
Index: trunk/SophyaLib/TArray/tarray.cc
===================================================================
--- trunk/SophyaLib/TArray/tarray.cc	(revision 1092)
+++ trunk/SophyaLib/TArray/tarray.cc	(revision 1099)
@@ -223,4 +223,10 @@
 void TArray<T>::ReSize(uint_4 ndim, uint_4 * siz, uint_4 step)
 {
+  if (arrtype_ != 0) {
+    if (ndim != 2) 
+       throw( ParmError("TArray<T>::ReSize(ndim!=2,...) for Matrix" ) ); 
+    if ((arrtype_ == 2) && (siz[0] > 1) && (siz[1] > 1)) 
+       throw( ParmError("TArray<T>::ReSize(,siz[0]>1 && size[1]>1) for Vector" ) ); 
+  }
   string exmsg = "TArray<T>::ReSize()";
   if (!UpdateSizes(ndim, siz, step, 0, exmsg))  throw( ParmError(exmsg) );
@@ -239,4 +245,10 @@
 void TArray<T>::Realloc(uint_4 ndim, uint_4 * siz, uint_4 step, bool force)
 {
+  if (arrtype_ != 0) {
+    if (ndim != 2) 
+       throw( ParmError("TArray<T>::Realloc(ndim!=2,...) for Matrix" ) ); 
+    if ((arrtype_ == 2) && (siz[0] > 1) && (siz[1] > 1)) 
+       throw( ParmError("TArray<T>::Realloc(,siz[0]>1 && size[1]>1) for Vector" ) ); 
+  }
   string exmsg = "TArray<T>::Realloc()";
   if (!UpdateSizes(ndim, siz, step, 0, exmsg))  throw( ParmError(exmsg) );
@@ -545,5 +557,6 @@
   if (NbDimensions() < 1) 
     throw RangeCheckError("TArray<T>::AddElt(const TArray<T>& )  - Not Allocated Array ! ");
-  if (!CompareSizes(a)) 
+  bool smo;
+  if (!CompareSizes(a, smo)) 
     throw(SzMismatchError("TArray<T>::AddElt(const TArray<T>&) SizeMismatch")) ;
 
@@ -551,5 +564,5 @@
   const T * pea;
   uint_8 j,k,ka;
-  if ((AvgStep() > 0) && (a.AvgStep() > 0) )   {  // regularly spaced elements
+  if (smo && (AvgStep() > 0) && (a.AvgStep() > 0))   {  // regularly spaced elements
     uint_8 step = AvgStep();
     uint_8 stepa = a.AvgStep();
@@ -560,12 +573,11 @@
   }
   else {    // Non regular data spacing ...
-    uint_4 ax = MaxSizeKA();
-    uint_8 step = Step(ax);
-    uint_8 stepa = a.Step(ax);
-    uint_8 gpas = Size(ax)*step;
-    uint_8 naxa = Size()/Size(ax);
+    int ax,axa;
+    uint_8 step, stepa;
+    uint_8 gpas, naxa;
+    GetOpeParams(a, smo, ax, axa, step, stepa, gpas, naxa);
     for(j=0; j<naxa; j++)  {
       pe = mNDBlock.Begin()+Offset(ax,j);
-      pea = a.DataBlock().Begin()+a.Offset(ax,j);
+      pea = a.DataBlock().Begin()+a.Offset(axa,j);
       for(k=0, ka=0;  k<gpas;  k+=step, ka+=stepa)  pe[k] += pea[ka]; 
     }
@@ -584,5 +596,6 @@
   if (NbDimensions() < 1) 
     throw RangeCheckError("TArray<T>::SubElt(const TArray<T>& )  - Not Allocated Array ! ");
-  if (!CompareSizes(a)) 
+  bool smo;
+  if (!CompareSizes(a, smo)) 
     throw(SzMismatchError("TArray<T>::SubElt(const TArray<T>&) SizeMismatch")) ;
 
@@ -590,5 +603,5 @@
   const T * pea;
   uint_8 j,k,ka;
-  if ((AvgStep() > 0) && (a.AvgStep() > 0) )   {  // regularly spaced elements
+  if (smo && (AvgStep() > 0) && (a.AvgStep() > 0) )   {  // regularly spaced elements
     uint_8 step = AvgStep();
     uint_8 stepa = a.AvgStep();
@@ -602,12 +615,11 @@
   }
   else {    // Non regular data spacing ...
-    uint_4 ax = MaxSizeKA();
-    uint_8 step = Step(ax);
-    uint_8 stepa = a.Step(ax);
-    uint_8 gpas = Size(ax)*step;
-    uint_8 naxa = Size()/Size(ax);
+    int ax,axa;
+    uint_8 step, stepa;
+    uint_8 gpas, naxa;
+    GetOpeParams(a, smo, ax, axa, step, stepa, gpas, naxa);
     for(j=0; j<naxa; j++)  {
       pe = mNDBlock.Begin()+Offset(ax,j);
-      pea = a.DataBlock().Begin()+a.Offset(ax,j);
+      pea = a.DataBlock().Begin()+a.Offset(axa,j);
       if (fginv) 
 	for(k=0, ka=0;  k<gpas;  k+=step, ka+=stepa)  pe[k] = pea[ka]-pe[k] ;
@@ -626,5 +638,6 @@
   if (NbDimensions() < 1) 
     throw RangeCheckError("TArray<T>::MulElt(const TArray<T>& )  - Not Allocated Array ! ");
-  if (!CompareSizes(a)) 
+  bool smo;
+  if (!CompareSizes(a, smo)) 
     throw(SzMismatchError("TArray<T>::MulElt(const TArray<T>&) SizeMismatch")) ;
 
@@ -632,5 +645,5 @@
   const T * pea;
   uint_8 j,k,ka;
-  if ((AvgStep() > 0) && (a.AvgStep() > 0) )   {  // regularly spaced elements
+  if (smo && (AvgStep() > 0) && (a.AvgStep() > 0) )   {  // regularly spaced elements
     uint_8 step = AvgStep();
     uint_8 stepa = a.AvgStep();
@@ -641,12 +654,11 @@
   }
   else {    // Non regular data spacing ...
-    uint_4 ax = MaxSizeKA();
-    uint_8 step = Step(ax);
-    uint_8 stepa = a.Step(ax);
-    uint_8 gpas = Size(ax)*step;
-    uint_8 naxa = Size()/Size(ax);
-    for(j=0; j<naxa; j++)  {
-      pe = mNDBlock.Begin()+Offset(ax,j);
-      pea = a.DataBlock().Begin()+a.Offset(ax,j);
+    int ax,axa;
+    uint_8 step, stepa;
+    uint_8 gpas, naxa;
+    GetOpeParams(a, smo, ax, axa, step, stepa, gpas, naxa);
+    for(j=0; j<naxa; j++)  {
+      pe = mNDBlock.Begin()+Offset(axa,j);
+      pea = a.DataBlock().Begin()+a.Offset(axa,j);
       for(k=0, ka=0;  k<gpas;  k+=step, ka+=stepa)  pe[k] *= pea[ka]; 
     }
@@ -667,5 +679,6 @@
   if (NbDimensions() < 1) 
     throw RangeCheckError("TArray<T>::DivElt(const TArray<T>& )  - Not Allocated Array ! ");
-  if (!CompareSizes(a)) 
+  bool smo;
+  if (!CompareSizes(a, smo)) 
     throw(SzMismatchError("TArray<T>::DivElt(const TArray<T>&) SizeMismatch")) ;
 
@@ -673,5 +686,5 @@
   const T * pea;
   uint_8 j,k,ka;
-  if ((AvgStep() > 0) && (a.AvgStep() > 0) )   {  // regularly spaced elements
+  if (smo && (AvgStep() > 0) && (a.AvgStep() > 0) )   {  // regularly spaced elements
     uint_8 step = AvgStep();
     uint_8 stepa = a.AvgStep();
@@ -694,12 +707,11 @@
   }
   else {    // Non regular data spacing ...
-    uint_4 ax = MaxSizeKA();
-    uint_8 step = Step(ax);
-    uint_8 stepa = a.Step(ax);
-    uint_8 gpas = Size(ax)*step;
-    uint_8 naxa = Size()/Size(ax);
+    int ax,axa;
+    uint_8 step, stepa;
+    uint_8 gpas, naxa;
+    GetOpeParams(a, smo, ax, axa, step, stepa, gpas, naxa);
     for(j=0; j<naxa; j++)  {
       pe = mNDBlock.Begin()+Offset(ax,j);
-      pea = a.DataBlock().Begin()+a.Offset(ax,j);
+      pea = a.DataBlock().Begin()+a.Offset(axa,j);
       if(divzero) {
         if (fginv) 
@@ -726,5 +738,6 @@
   if (NbDimensions() < 1) 
     throw RangeCheckError("TArray<T>::CopyElt(const TArray<T>& )  - Not Allocated Array ! ");
-  if (!CompareSizes(a)) 
+  bool smo;
+  if (!CompareSizes(a, smo)) 
     throw(SzMismatchError("TArray<T>::CopyElt(const TArray<T>&) SizeMismatch")) ;
 
@@ -732,5 +745,5 @@
   const T * pea;
   uint_8 j,k,ka;
-  if ((AvgStep() > 0) && (a.AvgStep() > 0) )   {  // regularly spaced elements
+  if (smo && (AvgStep() > 0) && (a.AvgStep() > 0) )   {  // regularly spaced elements
     uint_8 step = AvgStep();
     uint_8 stepa = a.AvgStep();
@@ -741,12 +754,11 @@
   }
   else {    // Non regular data spacing ...
-    uint_4 ax = MaxSizeKA();
-    uint_8 step = Step(ax);
-    uint_8 stepa = a.Step(ax);
-    uint_8 gpas = Size(ax)*step;
-    uint_8 naxa = Size()/Size(ax);
+    int ax,axa;
+    uint_8 step, stepa;
+    uint_8 gpas, naxa;
+    GetOpeParams(a, smo, ax, axa, step, stepa, gpas, naxa);
     for(j=0; j<naxa; j++)  {
       pe = mNDBlock.Begin()+Offset(ax,j);
-      pea = a.DataBlock().Begin()+a.Offset(ax,j);
+      pea = a.DataBlock().Begin()+a.Offset(axa,j);
       for(k=0, ka=0;  k<gpas;  k+=step, ka+=stepa)  pe[k] = pea[ka]; 
     }
@@ -761,5 +773,6 @@
   if (NbDimensions() < 1) 
     throw RangeCheckError("TArray<T>::ConvertAndCopyElt(const TArray<T>& )  - Not Allocated Array ! ");
-  if (!CompareSizes(a)) 
+  bool smo;
+  if (!CompareSizes(a, smo)) 
     throw(SzMismatchError("TArray<T>::ConvertAndCopyElt(const TArray<T>&) SizeMismatch")) ;
 
@@ -768,12 +781,11 @@
   uint_8 offa;
   // Non regular data spacing ...
-  uint_4 ax = MaxSizeKA();
-  uint_8 step = Step(ax);
-  uint_8 stepa = a.Step(ax);
-  uint_8 gpas = Size(ax)*step;
-  uint_8 naxa = Size()/Size(ax);
+  int ax,axa;
+  uint_8 step, stepa;
+  uint_8 gpas, naxa;
+  GetOpeParams(a, smo, ax, axa, step, stepa, gpas, naxa);
   for(j=0; j<naxa; j++)  {
     pe = mNDBlock.Begin()+Offset(ax,j);
-    offa = a.Offset(ax,j);
+    offa = a.Offset(axa,j);
 #if !defined(__GNUG__)
     for(k=0, ka=0;  k<gpas;  k+=step, ka+=stepa)  pe[k] = (T)a.ValueAtPosition(offa+ka); 
Index: trunk/SophyaLib/TArray/tmatrix.cc
===================================================================
--- trunk/SophyaLib/TArray/tmatrix.cc	(revision 1092)
+++ trunk/SophyaLib/TArray/tmatrix.cc	(revision 1099)
@@ -1,3 +1,3 @@
-// $Id: tmatrix.cc,v 1.13 2000-07-24 12:51:27 ansari Exp $
+// $Id: tmatrix.cc,v 1.14 2000-07-26 16:29:45 ansari Exp $
 //                         C.Magneville          04/99
 #include "machdefs.h"
@@ -22,5 +22,5 @@
   : TArray<T>()
 {
-  ck_memo_vt_ = true;
+  arrtype_ = 1;   // Type = Matrix
 }
 
@@ -39,4 +39,5 @@
   if ( (r == 0) || (c == 0) )
     throw ParmError("TMatrix<T>::TMatrix(uint_4 r,uint_4 c) NRows or NCols = 0");
+  arrtype_ = 1;   // Type = Matrix
   ReSize(r, c, mm);
 }
@@ -52,4 +53,5 @@
   : TArray<T>(a)
 {
+  arrtype_ = 1;   // Type = Matrix
 }
 
@@ -63,4 +65,5 @@
 : TArray<T>(a, share)
 {
+  arrtype_ = 1;   // Type = Matrix
 }
 
@@ -77,4 +80,5 @@
     ndim_ = 2;
   }
+  arrtype_ = 1;   // Type = Matrix
   UpdateMemoryMapping(a, SameMemoryMapping);
 }
@@ -97,11 +101,14 @@
     ndim_ = 2;
   }
+  arrtype_ = 1;   // Type = Matrix
   UpdateMemoryMapping(a, mm);
 }
 
+//! Constructor of a matrix from a TArray \b a , with a different data type
 template <class T>
 TMatrix<T>::TMatrix(const BaseArray& a)
 : TArray<T>()
 {
+  arrtype_ = 1;   // Type = Matrix
   SetBA(a);
 }
@@ -125,4 +132,6 @@
   if (a.NbDimensions() > 2) 
     throw SzMismatchError("TMatrix<T>::Set(const TArray<T>& a) a.NbDimensions() > 2");
+  if ((arrtype_ == 2) && (a.NbDimensions() > 1) && (a.Size(0) > 1) && (a.Size(1) > 1) )
+    throw SzMismatchError("TMatrix<T>::Set(const TArray<T>& a) Size(0,1)>1 for Vector");
   TArray<T>::Set(a);
   if (NbDimensions() == 1) {
@@ -140,4 +149,6 @@
   if (a.NbDimensions() > 2) 
     throw SzMismatchError("TMatrix<T>::SetBA(const BaseArray& a) a.NbDimensions() > 2");
+  if ((arrtype_ == 2) && (a.NbDimensions() > 1) && (a.Size(0) > 1) && (a.Size(1) > 1) )
+    throw SzMismatchError("TMatrix<T>::Set(const TArray<T>& a) Size(0,1)>1 for Vector");
   TArray<T>::SetBA(a);
   if (NbDimensions() == 1) {
@@ -165,4 +176,6 @@
   if(r==0||c==0) 
     throw(SzMismatchError("TMatrix::ReSize r or c==0 "));
+  if ((arrtype_ == 2) && (r > 1) && (c > 1))
+    throw(SzMismatchError("TMatrix::ReSize r>1&&c>1 for Vector "));
   uint_4 size[BASEARRAY_MAXNDIMS];
   for(int kk=0; kk<BASEARRAY_MAXNDIMS; kk++)  size[kk] = 0;
@@ -194,4 +207,6 @@
   if(r==0||c==0) 
     throw(SzMismatchError("TMatrix::Realloc r or c==0 "));
+  if ((arrtype_ == 2) && (r > 1) && (c > 1))
+    throw(SzMismatchError("TMatrix::Realloc r>1&&c>1 for Vector "));
   uint_4 size[BASEARRAY_MAXNDIMS];
   for(int kk=0; kk<BASEARRAY_MAXNDIMS; kk++)  size[kk] = 0;
Index: trunk/SophyaLib/TArray/tmatrix.h
===================================================================
--- trunk/SophyaLib/TArray/tmatrix.h	(revision 1092)
+++ trunk/SophyaLib/TArray/tmatrix.h	(revision 1099)
@@ -31,6 +31,10 @@
   inline  TMatrix<T>& operator = (const TMatrix<T>& a)
                      { Set(a);  return(*this); }
+  //! Operator = between a matrix and an array 
+  inline  TMatrix<T>& operator = (const TArray<T>& a)
+                     { Set(a);  return(*this); }
 
   virtual TArray<T>& SetBA(const BaseArray& a);
+  //! Operator = between matrices with different types
   inline  TMatrix<T>& operator = (const BaseArray& a)
                      { SetBA(a);  return(*this); }
Index: trunk/SophyaLib/TArray/tvector.cc
===================================================================
--- trunk/SophyaLib/TArray/tvector.cc	(revision 1092)
+++ trunk/SophyaLib/TArray/tvector.cc	(revision 1099)
@@ -1,3 +1,3 @@
-// $Id: tvector.cc,v 1.8 2000-04-27 17:53:52 ansari Exp $
+// $Id: tvector.cc,v 1.9 2000-07-26 16:29:46 ansari Exp $
 //                         C.Magneville          04/99
 #include "machdefs.h"
@@ -35,4 +35,5 @@
   : TMatrix<T>(1,1,mm)
 {
+  arrtype_ = 2;   // Type = Vector
   lcv = SelectVectorType(lcv);
   ReSize(n,lcv);
@@ -49,4 +50,5 @@
   : TMatrix<T>(a)
 {
+  arrtype_ = 2;   // Type = Vector
 }
 
@@ -60,4 +62,5 @@
 : TMatrix<T>(a, share)
 {
+  arrtype_ = 2;   // Type = Vector
 }
 
@@ -69,4 +72,5 @@
   if ( (size_[0] != 1) && (size_[1] != 1) )
     throw SzMismatchError("TVector<T>::TVector(const TArray<T>& a) NRows()!=1 && NCols()!=1 ");
+  arrtype_ = 2;   // Type = Vector
 }
 
@@ -86,4 +90,5 @@
   if ( (size_[0] != 1) && (size_[1] != 1) )
     throw SzMismatchError("TVector<T>::TVector(const TArray<T>& a) NRows()!=1 && NCols()!=1 ");
+  arrtype_ = 2;   // Type = Vector
   if ( (size_[0] == 1) && (size_[1] == 1) ) {
     if (lcv == SameVectorType) lcv = a.GetVectorType();
@@ -91,4 +96,13 @@
     veceli_ = (lcv ==  ColumnVector ) ?  marowi_ : macoli_;
   }
+}
+
+//! Constructor of a vector from a TArray \b a , with a different data type
+template <class T>
+TVector<T>::TVector(const BaseArray& a)
+: TMatrix<T>()
+{
+  arrtype_ = 2;   // Type = Vector
+  SetBA(a);
 }
 
Index: trunk/SophyaLib/TArray/tvector.h
===================================================================
--- trunk/SophyaLib/TArray/tvector.h	(revision 1092)
+++ trunk/SophyaLib/TArray/tvector.h	(revision 1099)
@@ -19,4 +19,5 @@
   TVector(const TArray<T>& a);
   TVector(const TArray<T>& a,  bool share, short lcv=AutoVectorType, short mm=AutoMemoryMapping);
+  TVector(const BaseArray& a);
 
   virtual ~TVector();
@@ -27,5 +28,14 @@
   inline  TVector<T>& operator = (const TVector<T>& a)
                        { Set(a);  return(*this); }
-
+  //! Operator = between a vector and a matrix 
+  inline  TVector<T>& operator = (const TMatrix<T>& a)
+                       { Set(a);  return(*this); }
+  //! Operator = between a vector and an array 
+  inline  TVector<T>& operator = (const TArray<T>& a)
+                       { Set(a);  return(*this); }
+  //! Operator = between Vectors with different types
+  inline  TVector<T>& operator = (const BaseArray& a)
+                       { SetBA(a);  return(*this); }
+    
   // Gestion taille/Remplissage
   void ReSize(uint_4 n, short lcv=SameVectorType ); 
