Index: trunk/SophyaLib/TArray/tvector.h
===================================================================
--- trunk/SophyaLib/TArray/tvector.h	(revision 772)
+++ trunk/SophyaLib/TArray/tvector.h	(revision 804)
@@ -11,79 +11,75 @@
 class TVector : public TMatrix<T> {
 public:
+  enum {SameTypeVector=0, ColumnVector=1, LineVector=2};
+  // Creation / destruction 
+  TVector();
+  TVector(uint_4 n, short lcv=ColumnVector, short mm=AutoMemoryMapping);
+  TVector(const TVector<T>& v);
+  TVector(const TVector<T>& v, bool share);
+  TVector(const TArray<T>& a);
+  TVector(const TArray<T>& a,  bool share, short lcv=ColumnVector, short mm=CMemoryMapping);
 
-  // Creation / destruction 
-  TVector(uint_4 n=1);
-  TVector(uint_4 n, T* values,Bridge* br=NULL);
-  TVector(const TVector<T>& v);
-  TVector(const TVector<T>& v,bool share);
-  TVector(const TMatrix<T>& a);
+  virtual ~TVector();
+
+  inline  TVector<T>& operator = (const TVector<T>& a)
+                       { Set(a);  return(*this); }
+
+  // Vector type   Line or Column vector
+  inline short GetVectorType() const 
+               { return((marowi_ == veceli_) ? ColumnVector : LineVector); }
 
   // Gestion taille/Remplissage
-  inline void ReSize(uint_4 n) {TMatrix<T>::ReSize(n,1);} // Reallocation de place
-  inline void Realloc(uint_4 n,bool force=false) {TMatrix<T>::Realloc(n,1,force);}
+  void ReSize(uint_4 n, short lcv=SameTypeVector ); 
+  void Realloc(uint_4 n, short lcv=SameTypeVector, bool force=false);
+
+  // Sub-Vector extraction $CHECK$ Reza 03/2000  Doit-on declarer cette methode const ?
+  TVector<T> operator () (Range relt) const ;
 
   // Informations pointeur/data
-  inline uint_4 NElts() const {return NRows();}
+  inline uint_4 NElts() const {return Size(); }
   
-  // Acces aux elements
-  inline T& operator()(uint_4 n) {return (*this)[n];}
-  inline T const& operator()(uint_4 n) const {return (*this)[n];}
-  inline T& Element(uint_4 n) {return (*this)[n];}
-  inline T const& Element(uint_4 n) const {return (*this)[n];}
+  // Inline element acces methods 
+  inline T const& operator()(uint_4 n) const;
+  inline T&       operator()(uint_4 n);
 
-  // Operateur d'affectation
-  inline TVector& operator = (const TVector& v)
-                  {TMatrix<T>::operator =(v); return *this;}
-  inline TVector& operator = (T x)
-                  {for(uint_4 i=0;i<NRows();i++) (*this)(i)=x; return *this;}
+  // Operations diverses  avec une constante
+  inline  TVector<T>&  operator = (T x)             { Set(x); return(*this); }
+  inline  TVector<T>&  operator += (T x)            { Add(x); return(*this); }
+  inline  TVector<T>&  operator -= (T x)            { Sub(x); return(*this); }
+  inline  TVector<T>&  operator *= (T x)            { Mul(x); return(*this); }
+  inline  TVector<T>&  operator /= (T x)            { Div(x); return(*this); }
 
+  //  operations avec matrices 
+  inline  TVector<T>&  operator += (const TVector<T>& a)  { AddElt(a); return(*this); }
+  inline  TVector<T>&  operator -= (const TVector<T>& a)  { SubElt(a); return(*this); }
 
+  // Norme(^2) 
+  T Norm2() const ;
 };
 
-// produit scalaire, matrice*vecteur
+//  ---- inline acces methods ------
 template <class T>
-inline T operator* (const TVector<T>& v1, const TVector<T>& v2)
-  {if(v1.NRows() != v2.NRows())
-     throw(SzMismatchError("TVector::operator*(TVector& v1,TVector v2) size mismatch"));
-   T *p = const_cast<T *>(v1.Data()), *pEnd = p+v1.NElts(),
-     *q = const_cast<T *>(v2.Data()), r = 0;
-   while (p<pEnd) r += *p++ * *q++;
-   return r;}
+inline T const& TVector<T>::operator()(uint_4 n) const
+{
+#ifdef SO_BOUNDCHECKING
+  if (veceli__ == 0)   CheckBound(n, 0, 0, 0, 0, 4);
+  else   CheckBound(0, n, 0, 0, 0, 4);
+#endif
+  return ( *( mNDBlock.Begin()+ offset_ + n*step_[veceli_] ) );
+}
 
 template <class T>
-inline TVector<T> operator* (const TMatrix<T>& a, const TVector<T>& b)
-   {return TVector<T>(a * ((TMatrix<T> const&)(b)));}
-
+inline T & TVector<T>::operator()(uint_4 n) 
+{
+#ifdef SO_BOUNDCHECKING
+  if (veceli__ == 0)   CheckBound(n, 0, 0, 0, 0, 4);
+  else   CheckBound(0, n, 0, 0, 0, 4);
+#endif
+  return ( *( mNDBlock.Begin()+ offset_ + n*step_[veceli_] ) );
+}
 
 // Typedef pour simplifier et compatibilite Peida
 typedef TVector<r_8> Vector;
 
-/////////////////////////////////////////////////////////////////////////
-// Classe pour la gestion de persistance
-template <class T>
-class FIO_TVector : public  PPersist  {
-public:
-  FIO_TVector();
-  FIO_TVector(string const & filename); 
-  FIO_TVector(const TVector<T> & obj);
-  FIO_TVector(TVector<T> * obj);
-  virtual ~FIO_TVector();
-  virtual AnyDataObj* DataObj();
-  virtual void        SetDataObj(AnyDataObj & o);
-  inline operator TVector<T>() { return(*dobj); }
-protected :
-  virtual void ReadSelf(PInPersist&);           
-  virtual void WriteSelf(POutPersist&) const;  
-  TVector<T> * dobj;
-  bool ownobj;
-};
-
-template <class T>
-inline POutPersist& operator << (POutPersist& os, TVector<T> & obj)
-{ FIO_TVector<T> fio(&obj);  fio.Write(os);  return(os); }
-template <class T>
-inline PInPersist& operator >> (PInPersist& is, TVector<T> & obj)
-{ FIO_TVector<T> fio(&obj);  fio.Read(is);  return(is); }
-
 } // Fin du namespace
 
