Index: /trunk/SophyaLib/TArray/basarr.cc
===================================================================
--- /trunk/SophyaLib/TArray/basarr.cc	(revision 1155)
+++ /trunk/SophyaLib/TArray/basarr.cc	(revision 1156)
@@ -21,9 +21,9 @@
      {"???", "Size(int )", "IsPacked(int )"
      ,"Stride(int )", "ElemCheckBound()", "operator()" };
-uint_4 BaseArray::max_nprt_ = 50;
-uint_4 BaseArray::prt_lev_ = 0;
+int_4  BaseArray::max_nprt_ = 50;
+int_4  BaseArray::prt_lev_ = 0;
 short  BaseArray::default_memory_mapping = CMemoryMapping;
 short  BaseArray::default_vector_type = ColumnVector;
-uint_8 BaseArray::openmp_size_threshold = 200000;
+sa_size_t BaseArray::openmp_size_threshold = 200000;
 
 // ------ Methodes statiques globales --------
@@ -34,5 +34,5 @@
   \param lev  : print level
 */
-void BaseArray::SetMaxPrint(uint_4 nprt, uint_4 lev)
+void BaseArray::SetMaxPrint(int_4 nprt, int_4 lev)
 {
   max_nprt_ = nprt;
@@ -44,5 +44,5 @@
   \param thr : thresold value
 */
-void BaseArray::SetOpenMPSizeThreshold(uint_8 thr)
+void BaseArray::SetOpenMPSizeThreshold(sa_size_t thr)
 {
   openmp_size_threshold = thr;
@@ -58,8 +58,8 @@
   \return Total size of the array
 */
-uint_8 BaseArray::ComputeTotalSize(uint_4 ndim, const uint_4 * siz, uint_4 step, uint_8 offset)
-{
-  uint_8 rs = step;
-  for(uint_4 k=0; k<ndim; k++) rs *= siz[k];
+sa_size_t BaseArray::ComputeTotalSize(int_4 ndim, const sa_size_t * siz, sa_size_t step, sa_size_t offset)
+{
+  sa_size_t rs = step;
+  for(sa_size_t k=0; k<ndim; k++) rs *= siz[k];
   return(rs+offset);
 }
@@ -251,5 +251,5 @@
 {
   ndim_ = 0;
-  for(int k=0; k<BASEARRAY_MAXNDIMS; k++) step_[k] = size_[k] = 0;
+  for(int_4 k=0; k<BASEARRAY_MAXNDIMS; k++) step_[k] = size_[k] = 0;
   totsize_ = 0;
   minstep_ = 0;
@@ -295,5 +295,5 @@
   if (arrtype_ == 0) {  // Simple TArray, not a matrix 
     smo = true;
-    for(uint_4 k=0; k<ndim_; k++) 
+    for(int_4 k=0; k<ndim_; k++) 
       if (size_[k] != a.size_[k])  return(false);
     return(true);
@@ -304,5 +304,5 @@
 	 (size_[macoli_] != a.size_[a.macoli_])  ) return(false);
     if (ndim_ > 2)  
-      for(uint_4 k=2; k<ndim_; k++) 
+      for(int_4 k=2; k<ndim_; k++) 
 	if (size_[k] != a.size_[k])  return(false);
     if ( (macoli_ == a.macoli_) && (marowi_ == a.marowi_) ||
@@ -316,8 +316,8 @@
 {
   if (ndim_ < 2)  return;
-  uint_4 ndim = 0;
-  uint_4 size[BASEARRAY_MAXNDIMS];
-  uint_4 step[BASEARRAY_MAXNDIMS];
-  for(uint_4 k=0; k<ndim_; k++) {
+  int_4 ndim = 0;
+  sa_size_t size[BASEARRAY_MAXNDIMS];
+  sa_size_t step[BASEARRAY_MAXNDIMS];
+  for(int_4 k=0; k<ndim_; k++) {
     if (size_[k] < 2)  continue;
     size[ndim] = size_[k];
@@ -339,8 +339,8 @@
 {
   if (ndim_ < 2)  return;
-  uint_4 ndim = 0;
-  uint_4 size[BASEARRAY_MAXNDIMS];
-  uint_4 step[BASEARRAY_MAXNDIMS];
-  for(uint_4 k=0; k<ndim_; k++) {
+  int_4 ndim = 0;
+  sa_size_t size[BASEARRAY_MAXNDIMS];
+  sa_size_t step[BASEARRAY_MAXNDIMS];
+  for(int_4 k=0; k<ndim_; k++) {
     size[ndim] = size_[k];
     step[ndim] = step_[k];
@@ -354,7 +354,7 @@
 
 //! return minimum value for step[ndim]
-int  BaseArray::MinStepKA() const
-{
-  for(uint_4 ka=0; ka<ndim_; ka++)
+int_4  BaseArray::MinStepKA() const
+{
+  for(int_4 ka=0; ka<ndim_; ka++)
     if (step_[ka] == minstep_) return((int)ka);
   return(0);
@@ -362,9 +362,9 @@
 
 //! return maximum value for step[ndim]
-int  BaseArray::MaxSizeKA() const
-{
-  int ka = 0;
-  uint_4 mx = size_[0];
-  for(uint_4 k=1; k<ndim_; k++)  
+int_4  BaseArray::MaxSizeKA() const
+{
+  int_4 ka = 0;
+  sa_size_t mx = size_[0];
+  for(int_4 k=1; k<ndim_; k++)  
     if (size_[k] > mx) {  ka = k;  mx = size_[k]; } 
   return(ka);
@@ -377,5 +377,5 @@
 // --------------------------------------------------
 //! return position of first element for vector \b i alond \b ka th axe.
-uint_8 BaseArray::Offset(uint_4 ka, uint_8 i) const
+sa_size_t BaseArray::Offset(int_4 ka, sa_size_t i) const
 {
 
@@ -383,11 +383,11 @@
   //#ifdef SO_BOUNDCHECKING
   if (ka >= ndim_) 
-    throw RangeCheckError("BaseArray::Offset(uint_4 ka, uint_8 i) Axe KA Error");
+    throw RangeCheckError("BaseArray::Offset(int_4 ka, sa_size_t i) Axe KA Error");
   if ( i*size_[ka] >= totsize_ )  
-    throw RangeCheckError("BaseArray::Offset(uint_4 ka, uint_8 i) Index Error");
+    throw RangeCheckError("BaseArray::Offset(int_4 ka, sa_size_t i) Index Error");
   //#endif
-  uint_4 idx[BASEARRAY_MAXNDIMS];
-  uint_4 k;
-  uint_8 rest = i;
+  sa_size_t idx[BASEARRAY_MAXNDIMS];
+  int_4 k;
+  sa_size_t rest = i;
   idx[ka] = 0;
   for(k=0; k<ndim_; k++) {
@@ -395,5 +395,5 @@
     idx[k] = rest%size_[k];   rest /= size_[k];
   }
-  uint_8 off = offset_;
+  sa_size_t off = offset_;
   for(k=0; k<ndim_; k++)  off += idx[k]*step_[k];
   return (off);
@@ -401,15 +401,15 @@
 
 //! return position of element \b ip.
-uint_8 BaseArray::Offset(uint_8 ip) const
+sa_size_t BaseArray::Offset(sa_size_t ip) const
 {
   if ( (ndim_ < 1) || (ip == 0) )  return(offset_);
   //#ifdef SO_BOUNDCHECKING
   if (ip >= totsize_)
-    throw RangeCheckError("BaseArray::Offset(uint_8 ip) Out of range index ip");
+    throw RangeCheckError("BaseArray::Offset(sa_size_t ip) Out of range index ip");
   //#endif
 
-  uint_4 idx[BASEARRAY_MAXNDIMS];
-  uint_4 k;
-  uint_8 rest = ip;
+  sa_size_t idx[BASEARRAY_MAXNDIMS];
+  int_4 k;
+  sa_size_t rest = ip;
   for(k=0; k<ndim_; k++) {
     idx[k] = rest%size_[k];   rest /= size_[k];
@@ -417,5 +417,5 @@
   //#ifdef SO_BOUNDCHECKING
   if (rest != 0) 
-    throw PError("BaseArray::Offset(uint_8 ip) GUG !!! rest != 0");
+    throw PError("BaseArray::Offset(sa_size_t ip) GUG !!! rest != 0");
   //#endif
 //   if (rest != 0) cerr << " BUG ---- BaseArray::Offset( " << ip << " )" << rest << endl;
@@ -423,5 +423,5 @@
 //   for(k=0; k<ndim_; k++) cerr << idx[k] << "," ;
 //   cerr << " ZZZZ " << endl;
-  uint_8 off = offset_;
+  sa_size_t off = offset_;
   for(k=0; k<ndim_; k++)  off += idx[k]*step_[k];
   return (off);
@@ -429,6 +429,6 @@
 
 //! 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)
+void BaseArray::GetOpeParams(const BaseArray& a, bool smo, int_4& ax, int_4& axa, sa_size_t& step,
+			     sa_size_t& stepa, sa_size_t& gpas, sa_size_t& naxa)
 {
   if (smo) { // Same memory organisation
@@ -465,5 +465,5 @@
   os << "\n--- " << InfoString() ; 
   os << " ND=" << ndim_ << " SizeX*Y*...= " ;
-  for(uint_4 k=0; k<ndim_; k++) { 
+  for(int_4 k=0; k<ndim_; k++) { 
     os << size_[k];
     if (k<ndim_-1)  os << "x";
@@ -472,5 +472,5 @@
   if (prt_lev_ > 0) {
     os <<  " TotSize= " << totsize_ << " Step(X Y ...)="  ;
-    for(uint_4 k=0; k<ndim_; k++)     os << step_[k] << "  " ;
+    for(int_4 k=0; k<ndim_; k++)     os << step_[k] << "  " ;
     os << " Offset= " << offset_  << endl;
   }
@@ -509,5 +509,5 @@
   \return string \b exmsg for explanation in case of problems
  */
-bool BaseArray::UpdateSizes(uint_4 ndim, const uint_4 * siz, uint_4 step, uint_8 offset, string & exmsg)
+bool BaseArray::UpdateSizes(int_4 ndim, const sa_size_t * siz, sa_size_t step, sa_size_t offset, string & exmsg)
 {
   if (ndim >= BASEARRAY_MAXNDIMS) {
@@ -524,5 +524,5 @@
 
   totsize_ = 1;
-  uint_4 k;
+  int_4 k;
   for(k=0; k<BASEARRAY_MAXNDIMS; k++) {
     size_[k] = 1;
@@ -560,5 +560,5 @@
   \return string \b exmsg for explanation in case of problems
  */
-bool BaseArray::UpdateSizes(uint_4 ndim, const uint_4 * siz, const uint_4 * step, uint_8 offset, string & exmsg)
+bool BaseArray::UpdateSizes(int_4 ndim, const sa_size_t * siz, const sa_size_t * step, sa_size_t offset, string & exmsg)
 {
   if (ndim >= BASEARRAY_MAXNDIMS) {
@@ -570,10 +570,10 @@
 
   totsize_ = 1;
-  uint_4 k;
+  int_4 k;
   for(k=0; k<BASEARRAY_MAXNDIMS; k++) {
     size_[k] = 1;
     step_[k] = 0;
   }
-  uint_4 minstep = step[0];
+  sa_size_t minstep = step[0];
   for(k=0; k<ndim; k++) {
     size_[k] = siz[k] ;
@@ -588,5 +588,5 @@
     exmsg += " Size Error";  return false;
   }
-  uint_8 plast = 0;
+  sa_size_t plast = 0;
   for(k=0; k<ndim; k++)   plast += (siz[k]-1)*step[k];
   if (plast == minstep*totsize_ )  moystep_ = minstep;
@@ -623,10 +623,10 @@
 
   totsize_ = 1;
-  uint_4 k;
+  int_4 k;
   for(k=0; k<BASEARRAY_MAXNDIMS; k++) {
     size_[k] = 1;
     step_[k] = 0;
   }
-  uint_4 minstep = a.step_[0];
+  sa_size_t minstep = a.step_[0];
   for(k=0; k<a.ndim_; k++) {
     size_[k] = a.size_[k] ;
@@ -663,13 +663,13 @@
   \return string \b exmsg for explanation in case of problems
  */
-void BaseArray::UpdateSubArraySizes(BaseArray & ra, uint_4 ndim, uint_4 * siz, uint_4 * pos, uint_4 * step) const
+void BaseArray::UpdateSubArraySizes(BaseArray & ra, int_4 ndim, sa_size_t * siz, sa_size_t * pos, sa_size_t * step) const
 {
   if ( (ndim > ndim_) || (ndim < 1) ) 
     throw(SzMismatchError("BaseArray::UpdateSubArraySizes( ... ) NDim Error") );
-  uint_4 k;
+  int_4 k;
   for(k=0; k<ndim; k++) 
     if ( (siz[k]*step[k]+pos[k]) > size_[k] )  
       throw(SzMismatchError("BaseArray::UpdateSubArraySizes( ... ) Size/Pos Error") );
-  uint_8 offset = offset_;
+  sa_size_t offset = offset_;
   for(k=0; k<ndim_; k++) { 
     offset += pos[k]*step_[k]; 
Index: /trunk/SophyaLib/TArray/basarr.h
===================================================================
--- /trunk/SophyaLib/TArray/basarr.h	(revision 1155)
+++ /trunk/SophyaLib/TArray/basarr.h	(revision 1156)
@@ -40,13 +40,13 @@
 
   // threshold for parallel routine call
-  static void	 SetOpenMPSizeThreshold(uint_8 thr=200000);
+  static void	 SetOpenMPSizeThreshold(sa_size_t thr=200000);
   //! Get Size threshold for parallel routine call
-  static inline uint_8 GetOpenMPSizeThreshold() { return openmp_size_threshold; }
-
-  static void    SetMaxPrint(uint_4 nprt=50, uint_4 lev=0);   
+  static inline sa_size_t GetOpenMPSizeThreshold() { return openmp_size_threshold; }
+
+  static void    SetMaxPrint(int_4 nprt=50, int_4 lev=0);   
   //! Get maximum number of printed elements
-  static inline uint_4 GetMaxPrint() { return max_nprt_; }
-  //! Maximum number of printed elements arint level
-  static inline uint_4 GetPrintLevel() { return prt_lev_; }
+  static inline int_4 GetMaxPrint() { return max_nprt_; }
+  //! Get print  level
+  static inline int_4 GetPrintLevel() { return prt_lev_; }
 
   static short   SetDefaultMemoryMapping(short mm=CMemoryMapping);
@@ -70,18 +70,18 @@
   // Array dimensions
   //! Return number of dimensions
-  inline uint_4 NbDimensions() const { return( ndim_ ); }
+  inline int_4 NbDimensions() const { return( ndim_ ); }
 
   //! Return total size of the array
-  inline uint_8 Size() const { return(totsize_); }
+  inline sa_size_t Size() const { return(totsize_); }
   //! Return size along the first dimension
-  inline uint_4 SizeX() const { return(size_[0]); }
+  inline sa_size_t SizeX() const { return(size_[0]); }
   //! Return size along the second dimension
-  inline uint_4 SizeY() const { return(size_[1]); }
+  inline sa_size_t SizeY() const { return(size_[1]); }
   //! Return size along the third dimension
-  inline uint_4 SizeZ() const { return(size_[2]); }
+  inline sa_size_t SizeZ() const { return(size_[2]); }
   //! Return size along the \b ka th dimension
-  inline uint_4 Size(int ka) const { return(size_[CheckDI(ka,1)]); }
-
-  int MaxSizeKA() const ;
+  inline sa_size_t Size(int_4 ka) const { return(size_[CheckDI(ka,1)]); }
+
+  int_4 MaxSizeKA() const ;
 
   //! Get memory organization
@@ -89,9 +89,9 @@
          { return ( (marowi_ == 1) ? CMemoryMapping : FortranMemoryMapping) ; }
   //! line index dimension
-  inline int    RowsKA() const {return marowi_; }
+  inline int_4    RowsKA() const {return marowi_; }
   //! column index dimension
-  inline int    ColsKA() const {return macoli_; }
+  inline int_4    ColsKA() const {return macoli_; }
   //! Index dimension of the elements of a vector
-  inline int    VectKA() const {return veceli_; }
+  inline int_4    VectKA() const {return veceli_; }
   void          SetMemoryMapping(short mm=AutoMemoryMapping);
 
@@ -111,33 +111,33 @@
   inline bool   IsPackedZ() const { return(step_[2] == 1); }
   //! return true if array is packed along the \b ka th dimension
-  inline bool   IsPacked(int ka) const { return(step_[CheckDI(ka,2)] == 1); }
+  inline bool   IsPacked(int_4 ka) const { return(step_[CheckDI(ka,2)] == 1); }
 
   //! return the minimum step value along all the dimensions
-  inline uint_4 MinStep() const  { return(minstep_); }
+  inline sa_size_t MinStep() const  { return(minstep_); }
   //! return the average step value along all the dimensions
-  inline uint_4 AvgStep() const  { return(moystep_); }
+  inline sa_size_t AvgStep() const  { return(moystep_); }
   //! return the step along the first dimension
-  inline uint_4 StepX() const { return(step_[0]); }
+  inline sa_size_t StepX() const { return(step_[0]); }
   //! return the step along the second dimension
-  inline uint_4 StepY() const { return(step_[1]); }
+  inline sa_size_t StepY() const { return(step_[1]); }
   //! return the step along the third dimension
-  inline uint_4 StepZ() const { return(step_[2]); }
+  inline sa_size_t StepZ() const { return(step_[2]); }
   //! return the step along the \b ka th dimension
-  inline uint_4 Step(int ka) const { return(step_[CheckDI(ka,3)]); }
-
-  int MinStepKA() const ;
+  inline sa_size_t Step(int_4 ka) const { return(step_[CheckDI(ka,3)]); }
+
+  int_4 MinStepKA() const ;
 
   // Offset of element ip
-  uint_8 Offset(uint_8 ip=0) const ;
+  sa_size_t Offset(sa_size_t ip=0) const ;
   // Offset of the i'th vector along axe ka 
-  uint_8  Offset(uint_4 ka, uint_8 i) const ;
-  inline uint_8  Offset(uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it=0, uint_4 iu=0) const;  
+  sa_size_t Offset(int_4 ka, sa_size_t i) const ;
+  inline sa_size_t  Offset(sa_size_t ix, sa_size_t iy, sa_size_t iz, sa_size_t it=0, sa_size_t iu=0) const;  
 
   // an abstract element acces methode
-  virtual MuTyV & ValueAtPosition(uint_8 ip) const = 0;
+  virtual MuTyV & ValueAtPosition(sa_size_t ip) const = 0;
 
   // 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);
+  void   GetOpeParams(const BaseArray& a, bool smo, int_4& ax, int_4& axa, sa_size_t& step,
+		      sa_size_t& stepa, sa_size_t& gpas, sa_size_t& naxa);
   // Impression, I/O, ...
   void           Show(ostream& os, bool si=false) const;
@@ -150,11 +150,11 @@
 
 protected:
-  inline int CheckDI(int ka, int msg) const ;
-  inline void CheckBound(uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it, uint_4 iu, int msg) const ;
+  inline int_4 CheckDI(int_4 ka, int msg) const ;
+  inline void CheckBound(sa_size_t ix, sa_size_t iy, sa_size_t iz, sa_size_t it, sa_size_t iu, int msg) const ;
   // Changing Sizes/NDim ... return true if OK
-  bool UpdateSizes(uint_4 ndim, const uint_4 * siz, uint_4 step, uint_8 offset, string & exmsg);
-  bool UpdateSizes(uint_4 ndim, const uint_4 * siz, const uint_4 * step, uint_8 offset, string & exmsg);
+  bool UpdateSizes(sa_size_t ndim, const sa_size_t * siz, sa_size_t step, sa_size_t offset, string & exmsg);
+  bool UpdateSizes(sa_size_t ndim, const sa_size_t * siz, const sa_size_t * step, sa_size_t offset, string & exmsg);
   bool UpdateSizes(const BaseArray& a, string & exmsg);
-  static uint_8 ComputeTotalSize(uint_4 ndim, const uint_4 * siz, uint_4 step, uint_8 offset) ;
+  static sa_size_t ComputeTotalSize(sa_size_t ndim, const sa_size_t * siz, sa_size_t step, sa_size_t offset) ;
   //  Organisation memoire
   static short SelectMemoryMapping(short mm);
@@ -164,14 +164,14 @@
 
   // Pour Extraction de sous-tableau 
-  virtual void UpdateSubArraySizes(BaseArray & ra, uint_4 ndim, uint_4 * siz, uint_4 * pos, uint_4 * step) const;
-
-  uint_4 ndim_; //!< number of dimensions of array
-  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
+  virtual void UpdateSubArraySizes(BaseArray & ra, sa_size_t ndim, sa_size_t * siz, sa_size_t * pos, sa_size_t * step) const;
+
+  int_4  ndim_; //!< number of dimensions of array
+  sa_size_t size_[BASEARRAY_MAXNDIMS]; //!< array of the size in each dimension
+  sa_size_t totsize_; //!< Total number of elements
+  sa_size_t 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
+  sa_size_t step_[BASEARRAY_MAXNDIMS];
+  sa_size_t minstep_; //!< minimal step (in any axes)
+  sa_size_t moystep_; //!< mean step, if == 0 --\> non regular steps
   int_2  marowi_; //!< For matrices, Row index in dimensions
   int_2  macoli_; //!< For matrices, Column index in dimensions
@@ -181,9 +181,9 @@
 
   static char * ck_op_msg_[6]; //!< Operation messages for CheckDI() CheckBound()
-  static uint_4 max_nprt_; //!< maximum number of printed elements
-  static uint_4 prt_lev_;  //!< Print level
+  static int_4 max_nprt_; //!< maximum number of printed elements
+  static int_4 prt_lev_;  //!< Print level
   static short default_memory_mapping; //!< Default memory mapping
   static short default_vector_type;    //!< Default vector type Row/Column
-  static uint_8 openmp_size_threshold; //!< Size limit for parallel routine calls
+  static sa_size_t openmp_size_threshold; //!< Size limit for parallel routine calls
 };
 
@@ -192,7 +192,7 @@
 // --------------------------------------------------
 //! to verify the compatibility of the dimension index
-inline int BaseArray::CheckDI(int ka, int msg)  const
+inline int_4 BaseArray::CheckDI(int_4 ka, int msg)  const
 {
-  if ( (ka < 0) || ((uint_4) ka >= ndim_) ) {
+  if ( (ka < 0) || (ka >= ndim_) ) {
     string txt = "BaseArray::CheckDimensionIndex/Error ";   txt += ck_op_msg_[msg];
     throw(RangeCheckError(txt));
@@ -202,8 +202,9 @@
 
 //! to verify the compatibility of the indexes in all dimensions
-inline void BaseArray::CheckBound(uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it, uint_4 iu, int msg)  const
+inline void BaseArray::CheckBound(sa_size_t ix, sa_size_t iy, sa_size_t iz, sa_size_t it, sa_size_t iu, int msg)  const
 {
-  if ( (ix >= size_[0]) || (iy >= size_[1]) || (iz > size_[2]) ||
-       (it >= size_[3]) || (iu >= size_[4]) ) {
+  if ( (ix >= size_[0]) || (ix < 0) || (iy >= size_[1]) || (iy < 0) || 
+       (iz >= size_[2]) || (iz < 0) || (it >= size_[3]) || (it < 0) ||
+       (iu >= size_[4]) || (iu < 0) )  {
     string txt = "BaseArray::CheckArrayBound/Error ";   txt += ck_op_msg_[msg];
     throw(RangeCheckError(txt));
@@ -218,5 +219,5 @@
 // --------------------------------------------------
 //! Offset of element (ix,iy,iz,it,iu)
-inline uint_8 BaseArray::Offset(uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it, uint_4 iu) const
+inline sa_size_t BaseArray::Offset(sa_size_t ix, sa_size_t iy, sa_size_t iz, sa_size_t it, sa_size_t iu) const
 {
 #ifdef SO_BOUNDCHECKING
Index: /trunk/SophyaLib/TArray/fioarr.cc
===================================================================
--- /trunk/SophyaLib/TArray/fioarr.cc	(revision 1155)
+++ /trunk/SophyaLib/TArray/fioarr.cc	(revision 1156)
@@ -93,4 +93,9 @@
   uint_4 itab[5];
   is.Get(itab,5);
+
+  // Checking version number
+  if (itab[0] < 2) 
+    FileFormatExc("FIO_TArray<T>::ReadSelf() - Unsupported (old V<2) version"); 
+
   if (dobj == NULL) {
     if (itab[1] == 12)   dobj = new TMatrix<T>;
@@ -99,14 +104,31 @@
   }
 // On lit les tailles, etc ...
-  is.Get(dobj->ndim_);
-  is.Get(dobj->size_, BASEARRAY_MAXNDIMS);
-  is.Get(dobj->totsize_);
-  is.Get(dobj->step_, BASEARRAY_MAXNDIMS);
-  is.Get(dobj->minstep_);
-  is.Get(dobj->moystep_);
-  is.Get(dobj->offset_);
-  is.Get(dobj->marowi_);
-  is.Get(dobj->macoli_);
-  is.Get(dobj->veceli_);
+// On ecrit les tailles, etc ...
+  int_4 tmpi4s[5];
+  is.Get(tmpi4s, 5);
+  dobj->ndim_ = tmpi4s[0];
+  dobj->marowi_ = tmpi4s[1];
+  dobj->macoli_ = tmpi4s[2];
+  dobj->veceli_ = tmpi4s[3];
+// tmpi4s[4] Reserved for future use 
+
+// Tous les sa_size_t sont ecrit/lu en int_8 afin de maintenir la compatibilite  
+// entre version du programme utilisant int_4 OU int_8 pour sa_size_t 
+  int_8 tmpi8s[BASEARRAY_MAXNDIMS];
+
+  is.Get(tmpi8s, BASEARRAY_MAXNDIMS);
+  for(int kk=0; kk<BASEARRAY_MAXNDIMS; kk++) 
+    dobj->size_[kk] = tmpi8s[kk];
+  is.Get(tmpi8s, BASEARRAY_MAXNDIMS);
+  for(int kk=0; kk<BASEARRAY_MAXNDIMS; kk++) 
+    dobj->step_[kk] = tmpi8s[kk];
+
+  is.Get(tmpi8s, 5);
+  dobj->totsize_ = tmpi8s[0];
+  dobj->offset_ = tmpi8s[1];
+  dobj->minstep_ = tmpi8s[2];
+  dobj->moystep_ = tmpi8s[3];
+// tmpi8s[4] Reserved for future use 
+
 // On lit le datablock
   is >> dobj->DataBlock();
@@ -132,20 +154,47 @@
 
   uint_4 itab[5];
-  itab[0] = 1;  // Numero de version a 1
+  itab[0] = 2;  // Numero de version a 2 depuis Aout 2000  - Reza
   itab[1] = typa;  // Real object type
   itab[2] = (dobj->mInfo != NULL) ? 1 : 0;
   itab[3] = itab[4] = 0;
   os.Put(itab,5);
+
 // On ecrit les tailles, etc ...
-  os.Put(dobj->ndim_);
-  os.Put(dobj->size_, BASEARRAY_MAXNDIMS);
-  os.Put(dobj->totsize_);
-  os.Put(dobj->step_, BASEARRAY_MAXNDIMS);
-  os.Put(dobj->minstep_);
-  os.Put(dobj->moystep_);
-  os.Put(dobj->offset_);
-  os.Put(dobj->marowi_);
-  os.Put(dobj->macoli_);
-  os.Put(dobj->veceli_);
+  int_4 tmpi4s[5];
+  //  os.Put(dobj->ndim_);
+  //  os.Put(dobj->marowi_);
+  //  os.Put(dobj->macoli_);
+  //  os.Put(dobj->veceli_);
+  tmpi4s[0] = dobj->ndim_;
+  tmpi4s[1] = dobj->marowi_;
+  tmpi4s[2] = dobj->macoli_;
+  tmpi4s[3] = dobj->veceli_;
+  tmpi4s[4] = 0;   // Reserved for future use
+  os.Put(tmpi4s, 5);
+
+// Tous les sa_size_t sont ecrit en int_8 afin de pouvoir etre ecrit/relu
+// entre version du programme utilisant int_4 OU int_8 pour sa_size_t 
+  int_8 tmpi8s[BASEARRAY_MAXNDIMS];
+
+  //  os.Put(dobj->size_, BASEARRAY_MAXNDIMS);
+  for(int kk=0; kk<BASEARRAY_MAXNDIMS; kk++) 
+    tmpi8s[kk] = dobj->size_[kk];
+  os.Put(tmpi8s, BASEARRAY_MAXNDIMS);
+  //  os.Put(dobj->step_, BASEARRAY_MAXNDIMS);
+  for(int kk=0; kk<BASEARRAY_MAXNDIMS; kk++) 
+    tmpi8s[kk] = dobj->step_[kk];
+  os.Put(tmpi8s, BASEARRAY_MAXNDIMS);
+
+  //  os.Put(dobj->totsize_);
+  //  os.Put(dobj->offset_);
+  //  os.Put(dobj->minstep_);
+  //  os.Put(dobj->moystep_);
+  tmpi8s[0] = dobj->totsize_;
+  tmpi8s[1] = dobj->offset_;
+  tmpi8s[2] = dobj->minstep_;
+  tmpi8s[3] = dobj->moystep_;
+  tmpi8s[4] = 0;  // Reserved for future use 
+  os.Put(tmpi8s, 5);
+  
 // On ecrit le datablock
   os << dobj->DataBlock();
Index: /trunk/SophyaLib/TArray/matharr.cc
===================================================================
--- /trunk/SophyaLib/TArray/matharr.cc	(revision 1155)
+++ /trunk/SophyaLib/TArray/matharr.cc	(revision 1156)
@@ -29,16 +29,16 @@
     throw RangeCheckError("MathArray<T>::ApplyFunctionInPlace(TArray<T> & a..) Not Allocated Array a !");
   T * pe;
-  uint_8 j,k;
+  sa_size_t j,k;
   if (a.AvgStep() > 0)   {  // regularly spaced elements
-    uint_8 step = a.AvgStep(); 
-    uint_8 maxx = a.Size()*step;
+    sa_size_t step = a.AvgStep(); 
+    sa_size_t maxx = a.Size()*step;
     pe = a.Data();
     for(k=0; k<maxx; k+=step )  pe[k] = (T)(f((double)pe[k])); 
   }
   else {    // Non regular data spacing ...
-    uint_4 ka = a.MaxSizeKA();
-    uint_8 step = a.Step(ka);
-    uint_8 gpas = a.Size(ka)*step;
-    uint_8 naxa = a.Size()/a.Size(ka);
+    int_4 ka = a.MaxSizeKA();
+    sa_size_t step = a.Step(ka);
+    sa_size_t gpas = a.Size(ka)*step;
+    sa_size_t naxa = a.Size()/a.Size(ka);
     for(j=0; j<naxa; j++)  {
       pe = a.DataBlock().Begin()+a.Offset(ka,j);
@@ -61,16 +61,16 @@
     throw RangeCheckError("MathArray<T>::ApplyFunctionInPlace(TArray<T> & a..) Not Allocated Array a !");
   T * pe;
-  uint_8 j,k;
+  sa_size_t j,k;
   if (a.AvgStep() > 0)   {  // regularly spaced elements
-    uint_8 step = a.AvgStep(); 
-    uint_8 maxx = a.Size()*step;
+    sa_size_t step = a.AvgStep(); 
+    sa_size_t maxx = a.Size()*step;
     pe = a.Data();
     for(k=0; k<maxx; k+=step )  pe[k] = (T)(f((float)pe[k])); 
   }
   else {    // Non regular data spacing ...
-    uint_4 ka = a.MaxSizeKA();
-    uint_8 step = a.Step(ka);
-    uint_8 gpas = a.Size(ka)*step;
-    uint_8 naxa = a.Size()/a.Size(ka);
+    int_4 ka = a.MaxSizeKA();
+    sa_size_t step = a.Step(ka);
+    sa_size_t gpas = a.Size(ka)*step;
+    sa_size_t naxa = a.Size()/a.Size(ka);
     for(j=0; j<naxa; j++)  {
       pe = a.DataBlock().Begin()+a.Offset(ka,j);
@@ -119,11 +119,11 @@
     throw RangeCheckError("MathArray<T>::MeanSigma(TArray<T> const & a..) Not Allocated Array a !");
   const T * pe;
-  uint_8 j,k;
+  sa_size_t j,k;
   mean=0.;
   sig = 0.;
   double valok;
   if (a.AvgStep() > 0)   {  // regularly spaced elements
-    uint_8 step = a.AvgStep(); 
-    uint_8 maxx = a.Size()*step;
+    sa_size_t step = a.AvgStep(); 
+    sa_size_t maxx = a.Size()*step;
     pe = a.Data();
     for(k=0; k<maxx; k+=step )  { 
@@ -133,8 +133,8 @@
   }
   else {    // Non regular data spacing ...
-    uint_4 ka = a.MaxSizeKA();
-    uint_8 step = a.Step(ka);
-    uint_8 gpas = a.Size(ka)*step;
-    uint_8 naxa = a.Size()/a.Size(ka);
+    int_4 ka = a.MaxSizeKA();
+    sa_size_t step = a.Step(ka);
+    sa_size_t gpas = a.Size(ka)*step;
+    sa_size_t naxa = a.Size()/a.Size(ka);
     for(j=0; j<naxa; j++)  {
       pe = a.DataBlock().Begin()+a.Offset(ka,j);
Index: /trunk/SophyaLib/TArray/tarray.cc
===================================================================
--- /trunk/SophyaLib/TArray/tarray.cc	(revision 1155)
+++ /trunk/SophyaLib/TArray/tarray.cc	(revision 1156)
@@ -39,8 +39,8 @@
  */
 template <class T>
-TArray<T>::TArray(uint_4 ndim, const uint_4 * siz, uint_4 step)
+TArray<T>::TArray(int_4 ndim, const sa_size_t * siz, sa_size_t step)
   : BaseArray() , mNDBlock(ComputeTotalSize(ndim, siz, step, 1))
 {
-  string exmsg = "TArray<T>::TArray(uint_4, uint_4 *, uint_4)";
+  string exmsg = "TArray<T>::TArray(int_4, sa_size_t *, sa_size_t)";
   if (!UpdateSizes(ndim, siz, step, 0, exmsg))  throw( ParmError(exmsg) );
 }
@@ -51,11 +51,11 @@
  */
 template <class T>
-TArray<T>::TArray(uint_4 nx, uint_4 ny, uint_4 nz, uint_4 nt, uint_4 nu)
+TArray<T>::TArray(sa_size_t nx, sa_size_t ny, sa_size_t nz, sa_size_t nt, sa_size_t nu)
   : BaseArray() , mNDBlock(nx*((ny>0)?ny:1)*((nz>0)?nz:1)*((nt>0)?nt:1)*((nu>0)?nu:1)) 
 {
-  uint_4 size[BASEARRAY_MAXNDIMS];
+  sa_size_t size[BASEARRAY_MAXNDIMS];
   size[0] = nx;   size[1] = ny;   size[2] = nz;
   size[3] = nt;   size[4] = nu;
-  int ndim = 1;
+  int_4 ndim = 1;
   if ((size[1] > 0) && (size[2] > 0) && (size[3] > 0) && (size[4] > 0) ) ndim = 5;
   else if ((size[1] > 0) && (size[2] > 0) && (size[3] > 0) ) ndim = 4;
@@ -63,5 +63,5 @@
   else if (size[1] > 0)  ndim = 2;
   else ndim = 1;
-  string exmsg = "TArray<T>::TArray(uint_4, uint_4, uint_4)";
+  string exmsg = "TArray<T>::TArray(sa_size_t, sa_size_t, sa_size_t, sa_size_t, sa_size_t)";
   if (!UpdateSizes(ndim, size, 1, 0, exmsg))  throw( ParmError(exmsg) );
 }
@@ -77,8 +77,8 @@
  */
 template <class T>
-TArray<T>::TArray(uint_4 ndim, const uint_4 * siz, NDataBlock<T> & db, bool share, uint_4 step, uint_8 offset)
+TArray<T>::TArray(int_4 ndim, const sa_size_t * siz, NDataBlock<T> & db, bool share, sa_size_t step, sa_size_t offset)
   : BaseArray() , mNDBlock(db, share) 
 {
-  string exmsg = "TArray<T>::TArray(uint_4, uint_4 *,  NDataBlock<T> & ... )";
+  string exmsg = "TArray<T>::TArray(int_4, sa_size_t *,  NDataBlock<T> & ... )";
   if (!UpdateSizes(ndim, siz, step, offset, exmsg))  throw( ParmError(exmsg) );
   
@@ -97,8 +97,8 @@
  */
 template <class T>
-TArray<T>::TArray(uint_4 ndim, const uint_4 * siz, T* values, uint_4 step, uint_8 offset, Bridge* br)
+TArray<T>::TArray(int_4 ndim, const sa_size_t * siz, T* values, sa_size_t step, sa_size_t offset, Bridge* br)
   : BaseArray() , mNDBlock(ComputeTotalSize(ndim, siz, step, 1), values, br) 
 {
-  string exmsg = "TArray<T>::TArray(uint_4, uint_4 *, T* ... )";
+  string exmsg = "TArray<T>::TArray(int_4, sa_size_t *, T* ... )";
   if (!UpdateSizes(ndim, siz, step, offset, exmsg))  throw( ParmError(exmsg) );
 }
@@ -225,5 +225,5 @@
  */
 template <class T>
-void TArray<T>::ReSize(uint_4 ndim, uint_4 * siz, uint_4 step)
+void TArray<T>::ReSize(int_4 ndim, sa_size_t * siz, sa_size_t step)
 {
   if (arrtype_ != 0) {
@@ -247,5 +247,5 @@
  */
 template <class T>
-void TArray<T>::Realloc(uint_4 ndim, uint_4 * siz, uint_4 step, bool force)
+void TArray<T>::Realloc(int_4 ndim, sa_size_t * siz, sa_size_t step, bool force)
 {
   if (arrtype_ != 0) {
@@ -279,8 +279,8 @@
 //! Give value (in \b double) for element at position \b ip..
 template <class T>
-MuTyV & TArray<T>::ValueAtPosition(uint_8 ip) const
+MuTyV & TArray<T>::ValueAtPosition(sa_size_t ip) const
 {
 #ifdef SO_BOUNDCHECKING
-  if (ip >= totsize_)  throw( ParmError("TArray<T>::ValueAtPosition(uint_8 ip) Out-of-bound Error") );
+  if (ip >= totsize_)  throw( ParmError("TArray<T>::ValueAtPosition(sa_size_t ip) Out-of-bound Error") );
 #endif
   my_mtv = *(mNDBlock.Begin()+Offset(ip));
@@ -326,8 +326,8 @@
   if (NbDimensions() < 1) 
     throw RangeCheckError("TArray<T>::operator () (Range, ...) - Not Allocated Array ! ");
-  uint_4 ndim = 0;
-  uint_4 size[BASEARRAY_MAXNDIMS];
-  uint_4 step[BASEARRAY_MAXNDIMS];
-  uint_4 pos[BASEARRAY_MAXNDIMS];
+  int_4 ndim = 0;
+  sa_size_t size[BASEARRAY_MAXNDIMS];
+  sa_size_t step[BASEARRAY_MAXNDIMS];
+  sa_size_t pos[BASEARRAY_MAXNDIMS];
   size[0] = rx.Size();
   size[1] = ry.Size();
@@ -373,11 +373,11 @@
   
   T * pe;
-  uint_8 j,k;
-  int ka;
+  sa_size_t j,k;
+  int_4 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);
+  sa_size_t step = Step(ka);
+  sa_size_t gpas = Size(ka);
+  sa_size_t naxa = Size()/Size(ka);
   for(j=0; j<naxa; j++)  {
     pe = mNDBlock.Begin()+Offset(ka,j);
@@ -401,16 +401,16 @@
     throw RangeCheckError("TArray<T>::SetT(T )  - Not Allocated Array ! ");
   T * pe;
-  uint_8 j,k;
+  sa_size_t j,k;
   if (AvgStep() > 0)   {  // regularly spaced elements
-    uint_8 step = AvgStep();
-    uint_8 maxx = totsize_*step;
+    sa_size_t step = AvgStep();
+    sa_size_t maxx = totsize_*step;
     pe = Data();
     for(k=0; k<maxx; k+=step )  pe[k] = x;
   }
   else {    // Non regular data spacing ...
-    uint_4 ka = MaxSizeKA();
-    uint_8 step = Step(ka);
-    uint_8 gpas = Size(ka)*step;
-    uint_8 naxa = Size()/Size(ka);
+    int_4 ka = MaxSizeKA();
+    sa_size_t step = Step(ka);
+    sa_size_t gpas = Size(ka)*step;
+    sa_size_t naxa = Size()/Size(ka);
     for(j=0; j<naxa; j++)  {
       pe = mNDBlock.Begin()+Offset(ka,j);
@@ -428,16 +428,16 @@
     throw RangeCheckError("TArray<T>::Add(T )  - Not Allocated Array ! ");
   T * pe;
-  uint_8 j,k;
+  sa_size_t j,k;
   if (AvgStep() > 0)   {  // regularly spaced elements
-    uint_8 step = AvgStep();
-    uint_8 maxx = totsize_*step;
+    sa_size_t step = AvgStep();
+    sa_size_t maxx = totsize_*step;
     pe = Data();
     for(k=0; k<maxx; k+=step )  pe[k] += x;
   }
   else {    // Non regular data spacing ...
-    uint_4 ka = MaxSizeKA();
-    uint_8 step = Step(ka);
-    uint_8 gpas = Size(ka)*step;
-    uint_8 naxa = Size()/Size(ka);
+    int_4 ka = MaxSizeKA();
+    sa_size_t step = Step(ka);
+    sa_size_t gpas = Size(ka)*step;
+    sa_size_t naxa = Size()/Size(ka);
     for(j=0; j<naxa; j++)  {
       pe = mNDBlock.Begin()+Offset(ka,j);
@@ -459,8 +459,8 @@
     throw RangeCheckError("TArray<T>::Sub(T )  - Not Allocated Array ! ");
   T * pe;
-  uint_8 j,k;
+  sa_size_t j,k;
   if (AvgStep() > 0)   {  // regularly spaced elements
-    uint_8 step = AvgStep();
-    uint_8 maxx = totsize_*step;
+    sa_size_t step = AvgStep();
+    sa_size_t maxx = totsize_*step;
     pe = Data();
     if (fginv)
@@ -470,8 +470,8 @@
   }
   else {    // Non regular data spacing ...
-    uint_4 ka = MaxSizeKA();
-    uint_8 step = Step(ka);
-    uint_8 gpas = Size(ka)*step;
-    uint_8 naxa = Size()/Size(ka);
+    int_4 ka = MaxSizeKA();
+    sa_size_t step = Step(ka);
+    sa_size_t gpas = Size(ka)*step;
+    sa_size_t naxa = Size()/Size(ka);
     for(j=0; j<naxa; j++)  {
       pe = mNDBlock.Begin()+Offset(ka,j);
@@ -492,16 +492,16 @@
     throw RangeCheckError("TArray<T>::Mul(T )  - Not Allocated Array ! ");
   T * pe;
-  uint_8 j,k;
+  sa_size_t j,k;
   if (AvgStep() > 0)   {  // regularly spaced elements
-    uint_8 step = AvgStep();
-    uint_8 maxx = totsize_*step;
+    sa_size_t step = AvgStep();
+    sa_size_t maxx = totsize_*step;
     pe = Data();
     for(k=0; k<maxx; k+=step )  pe[k] *= x;
   }
   else {    // Non regular data spacing ...
-    uint_4 ka = MaxSizeKA();
-    uint_8 step = Step(ka);
-    uint_8 gpas = Size(ka)*step;
-    uint_8 naxa = Size()/Size(ka);
+    int_4 ka = MaxSizeKA();
+    sa_size_t step = Step(ka);
+    sa_size_t gpas = Size(ka)*step;
+    sa_size_t naxa = Size()/Size(ka);
     for(j=0; j<naxa; j++)  {
       pe = mNDBlock.Begin()+Offset(ka,j);
@@ -525,8 +525,8 @@
     throw MathExc("TArray<T>::Div(T )  - Divide by zero ! ");
   T * pe;
-  uint_8 j,k;
+  sa_size_t j,k;
   if (AvgStep() > 0)   {  // regularly spaced elements
-    uint_8 step = AvgStep();
-    uint_8 maxx = totsize_*step;
+    sa_size_t step = AvgStep();
+    sa_size_t maxx = totsize_*step;
     pe = Data();
     if (fginv)
@@ -536,8 +536,8 @@
   }
   else {    // Non regular data spacing ...
-    uint_4 ka = MaxSizeKA();
-    uint_8 step = Step(ka);
-    uint_8 gpas = Size(ka)*step;
-    uint_8 naxa = Size()/Size(ka);
+    int_4 ka = MaxSizeKA();
+    sa_size_t step = Step(ka);
+    sa_size_t gpas = Size(ka)*step;
+    sa_size_t naxa = Size()/Size(ka);
     for(j=0; j<naxa; j++)  {
       pe = mNDBlock.Begin()+Offset(ka,j);
@@ -552,5 +552,30 @@
 
 
-
+//! Replace array elements values by their opposite ( a(i) -> -a(i) )
+template <class T>
+TArray<T>& TArray<T>::NegateElt()
+{
+  if (NbDimensions() < 1) 
+    throw RangeCheckError("TArray<T>::NegateElt()  - Not Allocated Array ! ");
+  T * pe;
+  sa_size_t j,k;
+  if (AvgStep() > 0)   {  // regularly spaced elements
+    sa_size_t step = AvgStep();
+    sa_size_t maxx = totsize_*step;
+    pe = Data();
+    for(k=0; k<maxx; k+=step )  pe[k] = -pe[k];
+  }
+  else {    // Non regular data spacing ...
+    int_4 ka = MaxSizeKA();
+    sa_size_t step = Step(ka);
+    sa_size_t gpas = Size(ka)*step;
+    sa_size_t naxa = Size()/Size(ka);
+    for(j=0; j<naxa; j++)  {
+      pe = mNDBlock.Begin()+Offset(ka,j);
+      for(k=0; k<gpas; k+=step)  pe[k] = -pe[k];
+    }
+  }
+  return(*this);
+}
 
 //  >>>> Operations avec 2nd membre de type tableau
@@ -567,9 +592,9 @@
   T * pe;
   const T * pea;
-  uint_8 j,k,ka;
+  sa_size_t j,k,ka;
   if (smo && (AvgStep() > 0) && (a.AvgStep() > 0))   {  // regularly spaced elements
-    uint_8 step = AvgStep();
-    uint_8 stepa = a.AvgStep();
-    uint_8 maxx = totsize_*step;
+    sa_size_t step = AvgStep();
+    sa_size_t stepa = a.AvgStep();
+    sa_size_t maxx = totsize_*step;
     pe = Data();
     pea = a.Data();
@@ -577,7 +602,7 @@
   }
   else {    // Non regular data spacing ...
-    int ax,axa;
-    uint_8 step, stepa;
-    uint_8 gpas, naxa;
+    int_4 ax,axa;
+    sa_size_t step, stepa;
+    sa_size_t gpas, naxa;
     GetOpeParams(a, smo, ax, axa, step, stepa, gpas, naxa);
     for(j=0; j<naxa; j++)  {
@@ -606,9 +631,9 @@
   T * pe;
   const T * pea;
-  uint_8 j,k,ka;
+  sa_size_t j,k,ka;
   if (smo && (AvgStep() > 0) && (a.AvgStep() > 0) )   {  // regularly spaced elements
-    uint_8 step = AvgStep();
-    uint_8 stepa = a.AvgStep();
-    uint_8 maxx = totsize_*step;
+    sa_size_t step = AvgStep();
+    sa_size_t stepa = a.AvgStep();
+    sa_size_t maxx = totsize_*step;
     pe = Data();
     pea = a.Data();
@@ -619,7 +644,7 @@
   }
   else {    // Non regular data spacing ...
-    int ax,axa;
-    uint_8 step, stepa;
-    uint_8 gpas, naxa;
+    int_4 ax,axa;
+    sa_size_t step, stepa;
+    sa_size_t gpas, naxa;
     GetOpeParams(a, smo, ax, axa, step, stepa, gpas, naxa);
     for(j=0; j<naxa; j++)  {
@@ -648,9 +673,9 @@
   T * pe;
   const T * pea;
-  uint_8 j,k,ka;
+  sa_size_t j,k,ka;
   if (smo && (AvgStep() > 0) && (a.AvgStep() > 0) )   {  // regularly spaced elements
-    uint_8 step = AvgStep();
-    uint_8 stepa = a.AvgStep();
-    uint_8 maxx = totsize_*step;
+    sa_size_t step = AvgStep();
+    sa_size_t stepa = a.AvgStep();
+    sa_size_t maxx = totsize_*step;
     pe = Data();
     pea = a.Data();
@@ -658,7 +683,7 @@
   }
   else {    // Non regular data spacing ...
-    int ax,axa;
-    uint_8 step, stepa;
-    uint_8 gpas, naxa;
+    int_4 ax,axa;
+    sa_size_t step, stepa;
+    sa_size_t gpas, naxa;
     GetOpeParams(a, smo, ax, axa, step, stepa, gpas, naxa);
     for(j=0; j<naxa; j++)  {
@@ -689,9 +714,9 @@
   T * pe;
   const T * pea;
-  uint_8 j,k,ka;
+  sa_size_t j,k,ka;
   if (smo && (AvgStep() > 0) && (a.AvgStep() > 0) )   {  // regularly spaced elements
-    uint_8 step = AvgStep();
-    uint_8 stepa = a.AvgStep();
-    uint_8 maxx = totsize_*step;
+    sa_size_t step = AvgStep();
+    sa_size_t stepa = a.AvgStep();
+    sa_size_t maxx = totsize_*step;
     pe = Data();
     pea = a.Data();
@@ -711,7 +736,7 @@
   }
   else {    // Non regular data spacing ...
-    int ax,axa;
-    uint_8 step, stepa;
-    uint_8 gpas, naxa;
+    int_4 ax,axa;
+    sa_size_t step, stepa;
+    sa_size_t gpas, naxa;
     GetOpeParams(a, smo, ax, axa, step, stepa, gpas, naxa);
     for(j=0; j<naxa; j++)  {
@@ -748,9 +773,9 @@
   T * pe;
   const T * pea;
-  uint_8 j,k,ka;
+  sa_size_t j,k,ka;
   if (smo && (AvgStep() > 0) && (a.AvgStep() > 0) )   {  // regularly spaced elements
-    uint_8 step = AvgStep();
-    uint_8 stepa = a.AvgStep();
-    uint_8 maxx = totsize_*step;
+    sa_size_t step = AvgStep();
+    sa_size_t stepa = a.AvgStep();
+    sa_size_t maxx = totsize_*step;
     pe = Data();
     pea = a.Data();
@@ -758,7 +783,7 @@
   }
   else {    // Non regular data spacing ...
-    int ax,axa;
-    uint_8 step, stepa;
-    uint_8 gpas, naxa;
+    int_4 ax,axa;
+    sa_size_t step, stepa;
+    sa_size_t gpas, naxa;
     GetOpeParams(a, smo, ax, axa, step, stepa, gpas, naxa);
     for(j=0; j<naxa; j++)  {
@@ -782,10 +807,10 @@
 
   T * pe;
-  uint_8 j,k,ka;
-  uint_8 offa;
+  sa_size_t j,k,ka;
+  sa_size_t offa;
   // Non regular data spacing ...
-  int ax,axa;
-  uint_8 step, stepa;
-  uint_8 gpas, naxa;
+  int_4 ax,axa;
+  sa_size_t step, stepa;
+  sa_size_t gpas, naxa;
   GetOpeParams(a, smo, ax, axa, step, stepa, gpas, naxa);
   for(j=0; j<naxa; j++)  {
@@ -812,16 +837,16 @@
   T ret=0;
   const T * pe;
-  uint_8 j,k;
+  sa_size_t j,k;
   if (AvgStep() > 0)   {  // regularly spaced elements
-    uint_8 step = AvgStep();
-    uint_8 maxx = totsize_*step;
+    sa_size_t step = AvgStep();
+    sa_size_t maxx = totsize_*step;
     pe = Data();
     for(k=0; k<maxx; k+=step )  ret += pe[k];
   }
   else {    // Non regular data spacing ...
-    uint_4 ka = MaxSizeKA();
-    uint_8 step = Step(ka);
-    uint_8 gpas = Size(ka)*step;
-    uint_8 naxa = Size()/Size(ka);
+    int_4 ka = MaxSizeKA();
+    sa_size_t step = Step(ka);
+    sa_size_t gpas = Size(ka)*step;
+    sa_size_t naxa = Size()/Size(ka);
     for(j=0; j<naxa; j++)  {
       pe = mNDBlock.Begin()+Offset(ka,j);
@@ -840,16 +865,16 @@
   T ret=(T)1;
   const T * pe;
-  uint_8 j,k;
+  sa_size_t j,k;
   if (AvgStep() > 0)   {  // regularly spaced elements
-    uint_8 step = AvgStep();
-    uint_8 maxx = totsize_*step;
+    sa_size_t step = AvgStep();
+    sa_size_t maxx = totsize_*step;
     pe = Data();
     for(k=0; k<maxx; k+=step )  ret *= pe[k];
   }
   else {    // Non regular data spacing ...
-    uint_4 ka = MaxSizeKA();
-    uint_8 step = Step(ka);
-    uint_8 gpas = Size(ka)*step;
-    uint_8 naxa = Size()/Size(ka);
+    int_4 ka = MaxSizeKA();
+    sa_size_t step = Step(ka);
+    sa_size_t gpas = Size(ka)*step;
+    sa_size_t naxa = Size()/Size(ka);
     for(j=0; j<naxa; j++)  {
       pe = mNDBlock.Begin()+Offset(ka,j);
@@ -868,16 +893,16 @@
   T ret=0;
   const T * pe;
-  uint_8 j,k;
+  sa_size_t j,k;
   if (AvgStep() > 0)   {  // regularly spaced elements
-    uint_8 step = AvgStep();
-    uint_8 maxx = totsize_*step;
+    sa_size_t step = AvgStep();
+    sa_size_t maxx = totsize_*step;
     pe = Data();
     for(k=0; k<maxx; k+=step )  ret += pe[k]*pe[k];
   }
   else {    // Non regular data spacing ...
-    uint_4 ka = MaxSizeKA();
-    uint_8 step = Step(ka);
-    uint_8 gpas = Size(ka)*step;
-    uint_8 naxa = Size()/Size(ka);
+    int_4 ka = MaxSizeKA();
+    sa_size_t step = Step(ka);
+    sa_size_t gpas = Size(ka)*step;
+    sa_size_t naxa = Size()/Size(ka);
     for(j=0; j<naxa; j++)  {
       pe = mNDBlock.Begin()+Offset(ka,j);
@@ -896,9 +921,9 @@
 {
   const T * pe;
-  uint_8 j,k;
-  uint_4 ka = MaxSizeKA();
-  uint_8 step = Step(ka);
-  uint_8 gpas = Size(ka)*step;
-  uint_8 naxa = Size()/Size(ka);
+  sa_size_t j,k;
+  int_4 ka = MaxSizeKA();
+  sa_size_t step = Step(ka);
+  sa_size_t gpas = Size(ka)*step;
+  sa_size_t naxa = Size()/Size(ka);
   min = (*this)[0];
   max = (*this)[0];
@@ -948,8 +973,8 @@
 {
   if (maxprt < 0)  maxprt = max_nprt_;
-  uint_4 npr = 0;
+  sa_size_t npr = 0;
   Show(os, si);
   if (ndim_ < 1) return;
-  uint_4 k0,k1,k2,k3,k4;
+  sa_size_t k0,k1,k2,k3,k4;
   for(k4=0; k4<size_[4]; k4++) {
     if (size_[4] > 1) cout << "\n ----- Dimension 5 (U) K4= " << k4 << endl;
@@ -963,5 +988,5 @@
             if(k0 > 0) os << ", ";  
             os << Elem(k0, k1, k2, k3, k4);     npr++;
-	    if (npr >= (uint_4) maxprt) {
+	    if (npr >= (sa_size_t) maxprt) {
 	      if (npr < totsize_)  os << "\n     .... " << endl; return;
 	    }
Index: /trunk/SophyaLib/TArray/tarray.h
===================================================================
--- /trunk/SophyaLib/TArray/tarray.h	(revision 1155)
+++ /trunk/SophyaLib/TArray/tarray.h	(revision 1156)
@@ -29,8 +29,8 @@
   // Creation / destruction 
   TArray();
-  TArray(uint_4 ndim, const uint_4 * siz, uint_4 step =1);
-  TArray(uint_4 nx, uint_4 ny=0, uint_4 nz=0, uint_4 nt=0, uint_4 nu=0);
-  TArray(uint_4 ndim, const uint_4 * siz, NDataBlock<T> & db, bool share=false, uint_4 step=1, uint_8 offset=0);
-  TArray(uint_4 ndim, const uint_4 * siz, T* values, uint_4 step=1, uint_8 offset=0, Bridge* br=NULL);
+  TArray(int_4 ndim, const sa_size_t * siz, sa_size_t step =1);
+  TArray(sa_size_t nx, sa_size_t ny=0, sa_size_t nz=0, sa_size_t nt=0, sa_size_t nu=0);
+  TArray(int_4 ndim, const sa_size_t * siz, NDataBlock<T> & db, bool share=false, sa_size_t step=1, sa_size_t offset=0);
+  TArray(int_4 ndim, const sa_size_t * siz, T* values, sa_size_t step=1, sa_size_t offset=0, Bridge* br=NULL);
   TArray(const TArray<T>& a);
   TArray(const TArray<T>& a, bool share);
@@ -57,6 +57,6 @@
 
   void Share(const TArray<T>& a);
-  void ReSize(uint_4 ndim, uint_4 * siz, uint_4 step=1);
-  void Realloc(uint_4 ndim, uint_4 * siz, uint_4 step=1, bool force=false);
+  void ReSize(int_4 ndim, sa_size_t * siz, sa_size_t step=1);
+  void Realloc(int_4 ndim, sa_size_t * siz, sa_size_t step=1, bool force=false);
 
   // Compacts size=1 array dimensions
@@ -88,18 +88,18 @@
   // ---- Access to data
   // Definition of virtual element acces method inherited from BaseArray class 
-  virtual MuTyV & ValueAtPosition(uint_8 ip) const;
+  virtual MuTyV & ValueAtPosition(sa_size_t ip) const;
 
   // Data Access: operator overloaded inline acces methods 
-  inline T const& operator()(uint_4 ix, uint_4 iy, uint_4 iz) const ;
-  inline T&       operator()(uint_4 ix, uint_4 iy, uint_4 iz);
-  inline T const& operator()(uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it, uint_4 iu=0) const ;
-  inline T&       operator()(uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it, uint_4 iu=0);
-  inline T const& operator[](uint_8 ip) const ;
-  inline T&       operator[](uint_8 ip);
-
-  inline T const& Elem(uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it=0, uint_4 iu=0) const ;
-  inline T&       Elem(uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it=0, uint_4 iu=0);
-  inline T const& ElemCheckBound(uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it=0, uint_4 iu=0) const ;
-  inline T&       ElemCheckBound(uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it=0, uint_4 iu=0);
+  inline T const& operator()(sa_size_t ix, sa_size_t iy, sa_size_t iz) const ;
+  inline T&       operator()(sa_size_t ix, sa_size_t iy, sa_size_t iz);
+  inline T const& operator()(sa_size_t ix, sa_size_t iy, sa_size_t iz, sa_size_t it, sa_size_t iu=0) const ;
+  inline T&       operator()(sa_size_t ix, sa_size_t iy, sa_size_t iz, sa_size_t it, sa_size_t iu=0);
+  inline T const& operator[](sa_size_t ip) const ;
+  inline T&       operator[](sa_size_t ip);
+
+  inline T const& Elem(sa_size_t ix, sa_size_t iy, sa_size_t iz, sa_size_t it=0, sa_size_t iu=0) const ;
+  inline T&       Elem(sa_size_t ix, sa_size_t iy, sa_size_t iz, sa_size_t it=0, sa_size_t iu=0);
+  inline T const& ElemCheckBound(sa_size_t ix, sa_size_t iy, sa_size_t iz, sa_size_t it=0, sa_size_t iu=0) const ;
+  inline T&       ElemCheckBound(sa_size_t ix, sa_size_t iy, sa_size_t iz, sa_size_t it=0, sa_size_t iu=0);
 
   //! Return pointer to first element adress
@@ -143,4 +143,7 @@
   inline  TArray<T>&  operator /= (T x)            { return Div(x); }
 
+// applique le signe moins a tous les elements
+  virtual TArray<T>&  NegateElt();
+  
 // A += -=  (ajoute, soustrait element par element les deux tableaux )
   virtual TArray<T>&  AddElt(const TArray<T>& a);
@@ -238,4 +241,14 @@
 
 ////////////////////////////////////////////////////////////////
+// Surcharge d'operateurs B = -A
+
+/*! \ingroup TArray \fn operator - (const TArray<T>&)
+  \brief Operator - Returns an array with elements equal to the opposite of
+  the original array elements.  */
+template <class T> inline TArray<T> operator - (const TArray<T>& a)
+    {TArray<T> result; result.CloneOrShare(a); result.SetTemp(true); 
+    result.NegateElt(); return result;}
+
+////////////////////////////////////////////////////////////////
 // Surcharge d'operateurs C = A (+,-) B
 
@@ -265,5 +278,5 @@
 //! Return element (ix,iy,iz,it,iu) value
 template <class T>
-inline T const& TArray<T>::Elem(uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it, uint_4 iu) const
+inline T const& TArray<T>::Elem(sa_size_t ix, sa_size_t iy, sa_size_t iz, sa_size_t it, sa_size_t iu) const
 {
   return ( *( mNDBlock.Begin()+ offset_+ 
@@ -274,5 +287,5 @@
 //! Return element (ix,iy,iz,it,iu) value
 template <class T>
-inline T & TArray<T>::Elem(uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it, uint_4 iu)
+inline T & TArray<T>::Elem(sa_size_t ix, sa_size_t iy, sa_size_t iz, sa_size_t it, sa_size_t iu)
 {
   return ( *( mNDBlock.Begin()+ offset_+ 
@@ -283,5 +296,5 @@
 //! Return element (ix,iy,iz,it,iu) value with Check of indexes bound first
 template <class T>
-inline T const& TArray<T>::ElemCheckBound(uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it, uint_4 iu) const
+inline T const& TArray<T>::ElemCheckBound(sa_size_t ix, sa_size_t iy, sa_size_t iz, sa_size_t it, sa_size_t iu) const
 {
   CheckBound(ix, iy, iz, it, iu, 4);
@@ -291,5 +304,5 @@
 //! Return element (ix,iy,iz,it,iu) value with Check of indexes bound first
 template <class T>
-inline T & TArray<T>::ElemCheckBound(uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it, uint_4 iu)
+inline T & TArray<T>::ElemCheckBound(sa_size_t ix, sa_size_t iy, sa_size_t iz, sa_size_t it, sa_size_t iu)
 {
   CheckBound(ix, iy, iz, it, iu, 4);
@@ -299,5 +312,5 @@
 //! Return element (ix,iy,iz) value
 template <class T>
-inline T const& TArray<T>::operator()(uint_4 ix, uint_4 iy, uint_4 iz) const
+inline T const& TArray<T>::operator()(sa_size_t ix, sa_size_t iy, sa_size_t iz) const
 {
 #ifdef SO_BOUNDCHECKING
@@ -310,5 +323,5 @@
 //! Return element (ix,iy,iz) value
 template <class T>
-inline T & TArray<T>::operator()(uint_4 ix, uint_4 iy, uint_4 iz) 
+inline T & TArray<T>::operator()(sa_size_t ix, sa_size_t iy, sa_size_t iz) 
 {
 #ifdef SO_BOUNDCHECKING
@@ -321,5 +334,5 @@
 //! Operator () : return element (ix,iy,iz,it,iu) value
 template <class T>
-inline T const& TArray<T>::operator()(uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it, uint_4 iu) const
+inline T const& TArray<T>::operator()(sa_size_t ix, sa_size_t iy, sa_size_t iz, sa_size_t it, sa_size_t iu) const
 {
 #ifdef SO_BOUNDCHECKING
@@ -333,5 +346,5 @@
 //! Operator () : return element (ix,iy,iz,it,iu) value
 template <class T>
-inline T & TArray<T>::operator()(uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it, uint_4 iu)
+inline T & TArray<T>::operator()(sa_size_t ix, sa_size_t iy, sa_size_t iz, sa_size_t it, sa_size_t iu)
 {
 #ifdef SO_BOUNDCHECKING
@@ -346,5 +359,5 @@
 //! Operator [] : return element at positon ip
 template <class T>
-inline T const& TArray<T>::operator[](uint_8 ip) const
+inline T const& TArray<T>::operator[](sa_size_t ip) const
 {
 #ifdef SO_BOUNDCHECKING
@@ -356,5 +369,5 @@
 //! Operator [] : return element at positon ip
 template <class T>
-inline T & TArray<T>::operator[](uint_8 ip) 
+inline T & TArray<T>::operator[](sa_size_t ip) 
 {
 #ifdef SO_BOUNDCHECKING
@@ -365,5 +378,5 @@
 
 
-//! Return the value of first element
+//! Converts to a scalar (value of first element) if the array size is equal to 1 
 template <class T>
 inline T TArray<T>::toScalar()
Index: /trunk/SophyaLib/TArray/tmatrix.cc
===================================================================
--- /trunk/SophyaLib/TArray/tmatrix.cc	(revision 1155)
+++ /trunk/SophyaLib/TArray/tmatrix.cc	(revision 1156)
@@ -1,3 +1,3 @@
-// $Id: tmatrix.cc,v 1.15 2000-07-27 00:00:09 ansari Exp $
+// $Id: tmatrix.cc,v 1.16 2000-08-29 16:10:30 ansari Exp $
 //                         C.Magneville          04/99
 #include "machdefs.h"
@@ -33,10 +33,10 @@
  */
 template <class T>
-TMatrix<T>::TMatrix(uint_4 r,uint_4 c, short mm)
+TMatrix<T>::TMatrix(sa_size_t r,sa_size_t c, short mm)
 // Construit une matrice de r lignes et c colonnes.
   :  TArray<T>() 
 {
   if ( (r == 0) || (c == 0) )
-    throw ParmError("TMatrix<T>::TMatrix(uint_4 r,uint_4 c) NRows or NCols = 0");
+    throw ParmError("TMatrix<T>::TMatrix(sa_size_t r,sa_size_t c) NRows or NCols = 0");
   arrtype_ = 1;   // Type = Matrix
   ReSize(r, c, mm);
@@ -175,5 +175,5 @@
  */
 template <class T>
-void TMatrix<T>::ReSize(uint_4 r, uint_4 c, short mm)
+void TMatrix<T>::ReSize(sa_size_t r, sa_size_t c, short mm)
 {
   if(r==0||c==0) 
@@ -181,6 +181,6 @@
   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;
+  sa_size_t size[BASEARRAY_MAXNDIMS];
+  for(int_4 kk=0; kk<BASEARRAY_MAXNDIMS; kk++)  size[kk] = 0;
   if (mm == SameMemoryMapping) mm = GetMemoryMapping();  
   else if ( (mm != CMemoryMapping) && (mm != FortranMemoryMapping) ) 
@@ -206,5 +206,5 @@
  */
 template <class T>
-void TMatrix<T>::Realloc(uint_4 r,uint_4 c, short mm, bool force)
+void TMatrix<T>::Realloc(sa_size_t r,sa_size_t c, short mm, bool force)
 {
   if(r==0||c==0) 
@@ -212,6 +212,6 @@
   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;
+  sa_size_t size[BASEARRAY_MAXNDIMS];
+  for(int_4 kk=0; kk<BASEARRAY_MAXNDIMS; kk++)  size[kk] = 0;
   if (mm == SameMemoryMapping) mm = GetMemoryMapping();  
   else if ( (mm != CMemoryMapping) && (mm != FortranMemoryMapping) ) 
@@ -249,5 +249,5 @@
 {
   short vt = (marowi_ == veceli_) ? ColumnVector : RowVector;
-  uint_4 rci = macoli_;
+  int_4 rci = macoli_;
   macoli_ = marowi_;
   marowi_ = rci;
@@ -268,6 +268,6 @@
   if (mm == SameMemoryMapping) mm = GetMemoryMapping();  
   TMatrix<T> tm(NCols(), NRows(), mm);
-  for(uint_4 i=0; i<NRows(); i++)
-    for(uint_4 j=0; j<NCols(); j++) 
+  for(sa_size_t i=0; i<NRows(); i++)
+    for(sa_size_t j=0; j<NCols(); j++) 
       tm(j,i) = (*this)(i,j);
   tm.SetTemp(true);
@@ -292,6 +292,6 @@
   
   TMatrix<T> tm(NRows(), NCols(), mm);
-  for(uint_4 i=0; i<NRows(); i++)
-    for(uint_4 j=0; j<NCols(); j++) 
+  for(sa_size_t i=0; i<NRows(); i++)
+    for(sa_size_t j=0; j<NCols(); j++) 
       tm(i,j) = (*this)(i,j);
   tm.SetTemp(true);
@@ -304,5 +304,5 @@
 {
   if (ndim_ == 0) {
-    uint_4 sz = imx.Size();
+    sa_size_t sz = imx.Size();
     if (sz < 1) sz = 1;
     ReSize(sz, sz);
@@ -312,5 +312,5 @@
     throw SzMismatchError("TMatrix::operator= (IdentityMatrix) NRows() != NCols()") ;
   *this = (T) 0;
-  for(uint_4 i=0; i<NRows(); i++) (*this)(i,i) = diag;
+  for(sa_size_t i=0; i<NRows(); i++) (*this)(i,i) = diag;
 
   return (*this);
@@ -343,8 +343,8 @@
 {
   if (maxprt < 0)  maxprt = max_nprt_;
-  uint_4 npr = 0;
+  sa_size_t npr = 0;
   Show(os, si);
   if (ndim_ < 1)  return;
-  uint_4 kc,kr;  
+  sa_size_t kc,kr;  
   for(kr=0; kr<size_[marowi_]; kr++) {
     if ( (size_[marowi_] > 1) && (size_[macoli_] > 10) ) cout << "----- Ligne Line= " << kr << endl;
@@ -352,5 +352,5 @@
       if(kc > 0) os << ", ";  
       os << (*this)(kr, kc);   npr++; 
-      if (npr >= (uint_4) maxprt) {
+      if (npr >= (sa_size_t) maxprt) {
 	if (npr < totsize_)  os << "\n     .... " << endl; return;
       }
@@ -380,7 +380,7 @@
   const T * peb;
   T sum;
-  uint_4 r,c,k;
-  uint_4 stepa = Step(ColsKA());
-  uint_4 stepb = b.Step(RowsKA());
+  sa_size_t r,c,k;
+  sa_size_t stepa = Step(ColsKA());
+  sa_size_t stepb = b.Step(RowsKA());
   // Calcul de C=rm = A*B   (A=*this)
   for(r=0; r<rm.NRows(); r++)      // Boucle sur les lignes de A
Index: /trunk/SophyaLib/TArray/tmatrix.h
===================================================================
--- /trunk/SophyaLib/TArray/tmatrix.h	(revision 1155)
+++ /trunk/SophyaLib/TArray/tmatrix.h	(revision 1156)
@@ -15,5 +15,5 @@
   // Creation / destruction 
   TMatrix();
-  TMatrix(uint_4 r,uint_4 c, short mm=BaseArray::AutoMemoryMapping);
+  TMatrix(sa_size_t r,sa_size_t c, short mm=BaseArray::AutoMemoryMapping);
   TMatrix(const TMatrix<T>& a);
   TMatrix(const TMatrix<T>& a, bool share);
@@ -42,12 +42,12 @@
   // Size - Changing the Size 
   //! return number of rows
-  inline uint_4 NRows() const {return Size(marowi_); }
+  inline sa_size_t NRows() const {return Size(marowi_); }
   //! return number of columns
-  inline uint_4 NCols() const {return Size(macoli_); }
+  inline sa_size_t NCols() const {return Size(macoli_); }
   //! return number of columns
-  inline uint_4 NCol()  const {return Size(macoli_); } // back-compat Peida
-
-  void ReSize(uint_4 r,uint_4 c, short mm=BaseArray::SameMemoryMapping);  // Reallocation de place
-  void Realloc(uint_4 r,uint_4 c, short mm=BaseArray::SameMemoryMapping, bool force=false);
+  inline sa_size_t NCol()  const {return Size(macoli_); } // back-compat Peida
+
+  void ReSize(sa_size_t r,sa_size_t c, short mm=BaseArray::SameMemoryMapping);  // Reallocation de place
+  void Realloc(sa_size_t r,sa_size_t c, short mm=BaseArray::SameMemoryMapping, bool force=false);
 
   // Sub-matrix extraction $CHECK$ Reza 03/2000  Doit-on declarer ces methode const ?
@@ -58,13 +58,13 @@
   // Lignes et colonnes de la matrice
   //! Return submatrix define by line \b ir (line vector)
-  inline TMatrix<T> Row(uint_4 ir) const
+  inline TMatrix<T> Row(sa_size_t ir) const
                     { return SubMatrix(Range(ir,ir), Range(0,NCols()-1)); }
   //! Return submatrix define by column \b ic (column vector)
-  inline TMatrix<T> Column(uint_4 ic) const
+  inline TMatrix<T> Column(sa_size_t ic) const
                     { return SubMatrix(Range(0,NRows()-1), Range(ic,ic)); }
 
   // Inline element acces methods 
-  inline T const& operator()(uint_4 r,uint_4 c) const;
-  inline T&       operator()(uint_4 r,uint_4 c);
+  inline T const& operator()(sa_size_t r,sa_size_t c) const;
+  inline T&       operator()(sa_size_t r,sa_size_t c);
 
   // Operations matricielles
@@ -116,5 +116,5 @@
  //! () : return element for line \b r and column \b c
 template <class T>
-inline T const& TMatrix<T>::operator()(uint_4 r, uint_4 c) const
+inline T const& TMatrix<T>::operator()(sa_size_t r, sa_size_t c) const
 {
 #ifdef SO_BOUNDCHECKING
@@ -128,5 +128,5 @@
 //! () : return element for line \b r and column \b c
 template <class T>
-inline T & TMatrix<T>::operator()(uint_4 r, uint_4 c) 
+inline T & TMatrix<T>::operator()(sa_size_t r, sa_size_t c) 
 {
 #ifdef SO_BOUNDCHECKING
@@ -188,4 +188,14 @@
     result.Div(b, true); return result;}
 
+////////////////////////////////////////////////////////////////
+// Surcharge d'operateurs B = -A
+
+/*! \ingroup TMatrix \fn operator - (const TMatrix<T>&)
+  \brief Operator - Returns a matrix with elements equal to the opposite of
+  the original matrix elements.  */
+template <class T> inline TMatrix<T> operator - (const TMatrix<T>& a)
+    {TMatrix<T> result; result.CloneOrShare(a); result.SetTemp(true); 
+    result.NegateElt(); return result;}
+
 
 // Surcharge d'operateurs C = A (+,-) B
Index: /trunk/SophyaLib/TArray/tvector.cc
===================================================================
--- /trunk/SophyaLib/TArray/tvector.cc	(revision 1155)
+++ /trunk/SophyaLib/TArray/tvector.cc	(revision 1156)
@@ -1,3 +1,3 @@
-// $Id: tvector.cc,v 1.10 2000-07-27 00:00:10 ansari Exp $
+// $Id: tvector.cc,v 1.11 2000-08-29 16:10:31 ansari Exp $
 //                         C.Magneville          04/99
 #include "machdefs.h"
@@ -31,5 +31,5 @@
  */
 template <class T>
-TVector<T>::TVector(uint_4 n, short lcv, short mm)
+TVector<T>::TVector(sa_size_t n, short lcv, short mm)
 // Constructeur 
   : TMatrix<T>(1,1,mm)
@@ -121,9 +121,9 @@
  */
 template <class T>
-void TVector<T>::ReSize(uint_4 n, short lcv)
+void TVector<T>::ReSize(sa_size_t n, short lcv)
 {
   if( n == 0 ) 
     throw(SzMismatchError("TVector::ReSize() n = 0 "));
-  uint_4 r,c;
+  sa_size_t r,c;
   if (lcv == SameVectorType)  lcv = GetVectorType();
   else if ( (lcv != ColumnVector) && (lcv != RowVector) ) lcv = GetDefaultVectorType();
@@ -143,9 +143,9 @@
  */
 template <class T>
-void TVector<T>::Realloc(uint_4 n, short lcv, bool force)
+void TVector<T>::Realloc(sa_size_t n, short lcv, bool force)
 {
   if( n == 0 ) 
     throw(SzMismatchError("TVector::Realloc() n = 0 "));
-  uint_4 r,c;
+  sa_size_t r,c;
   if (lcv == SameVectorType)  lcv = GetVectorType();
   else if ( (lcv != ColumnVector) && (lcv != RowVector) ) lcv = GetDefaultVectorType();
@@ -175,5 +175,5 @@
 {
   T ret = 0;
-  for(uint_8 k=0; k<Size(); k++)   ret += (*this)(k)*(*this)(k);
+  for(sa_size_t k=0; k<Size(); k++)   ret += (*this)(k)*(*this)(k);
   return ret;
 }
Index: /trunk/SophyaLib/TArray/tvector.h
===================================================================
--- /trunk/SophyaLib/TArray/tvector.h	(revision 1155)
+++ /trunk/SophyaLib/TArray/tvector.h	(revision 1156)
@@ -14,5 +14,5 @@
   // Creation / destruction 
   TVector();
-  TVector(uint_4 n, short lcv=AutoVectorType, short mm=AutoMemoryMapping);
+  TVector(sa_size_t n, short lcv=AutoVectorType, short mm=AutoMemoryMapping);
   TVector(const TVector<T>& v);
   TVector(const TVector<T>& v, bool share);
@@ -39,6 +39,6 @@
     
   // Gestion taille/Remplissage
-  void ReSize(uint_4 n, short lcv=SameVectorType ); 
-  void Realloc(uint_4 n, short lcv=SameVectorType, bool force=false);
+  void ReSize(sa_size_t n, short lcv=SameVectorType ); 
+  void Realloc(sa_size_t n, short lcv=SameVectorType, bool force=false);
 
   // Sub-Vector extraction $CHECK$ Reza 03/2000  Doit-on declarer cette methode const ?
@@ -50,9 +50,9 @@
   // Informations pointeur/data
   //! return the number of elements
-  inline uint_4 NElts() const {return Size(); }
+  inline sa_size_t NElts() const {return Size(); }
   
   // Inline element acces methods 
-  inline T const& operator()(uint_4 n) const;
-  inline T&       operator()(uint_4 n);
+  inline T const& operator()(sa_size_t n) const;
+  inline T&       operator()(sa_size_t n);
 
   // Operateur d'affectation
@@ -89,5 +89,5 @@
 //! Return the value of element \b n
 template <class T>
-inline T const& TVector<T>::operator()(uint_4 n) const
+inline T const& TVector<T>::operator()(sa_size_t n) const
 {
 #ifdef SO_BOUNDCHECKING
@@ -100,5 +100,5 @@
 //! Return the value of element \b n
 template <class T>
-inline T & TVector<T>::operator()(uint_4 n) 
+inline T & TVector<T>::operator()(sa_size_t n) 
 {
 #ifdef SO_BOUNDCHECKING
Index: /trunk/SophyaLib/TArray/utilarr.cc
===================================================================
--- /trunk/SophyaLib/TArray/utilarr.cc	(revision 1155)
+++ /trunk/SophyaLib/TArray/utilarr.cc	(revision 1156)
@@ -48,5 +48,5 @@
 }
 
-MuTyV & RandomSequence::Value(uint_8 k) const 
+MuTyV & RandomSequence::Value(sa_size_t k) const 
 {
   if (typ_ == Flat) retv_ = drandpm1()*sig_ + mean_;
@@ -96,5 +96,5 @@
  */
 
-MuTyV & RegularSequence::Value (uint_8 k) const 
+MuTyV & RegularSequence::Value (sa_size_t k) const 
 {
   double x = start_+(double)k*step_;
@@ -108,5 +108,5 @@
 }
 
-MuTyV & EnumeratedSequence::Value (uint_8 k) const 
+MuTyV & EnumeratedSequence::Value (sa_size_t k) const 
 {
   if (k >= vecv_.size())  retv_ = 0;
@@ -117,4 +117,11 @@
 EnumeratedSequence & EnumeratedSequence::operator , (MuTyV const & v)
 {
+  vecv_.push_back(v);
+  return(*this);
+}
+
+EnumeratedSequence & EnumeratedSequence::operator = (MuTyV const & v)
+{
+  vecv_.clear();
   vecv_.push_back(v);
   return(*this);
@@ -139,5 +146,5 @@
   \warning If not \b size is fixed and \b end recomputed
  */
-Range::Range(uint_4 start, uint_4 end, uint_4 size, uint_4 step)
+Range::Range(sa_size_t start, sa_size_t end, sa_size_t size, sa_size_t step)
 {
   start_ = start;
@@ -155,5 +162,5 @@
 
 /*
-Range & Range::operator = (uint_4 start)
+Range & Range::operator = (sa_size_t start)
 {
   start_ = start;
@@ -173,5 +180,5 @@
 
 //! Constructor of a (n,n) diagonal matrix with value diag on the diagonal
-IdentityMatrix::IdentityMatrix(double diag, uint_4 n)
+IdentityMatrix::IdentityMatrix(double diag, sa_size_t n)
 {
   size_ = n;
Index: /trunk/SophyaLib/TArray/utilarr.h
===================================================================
--- /trunk/SophyaLib/TArray/utilarr.h	(revision 1155)
+++ /trunk/SophyaLib/TArray/utilarr.h	(revision 1156)
@@ -32,6 +32,6 @@
 public:
   virtual ~Sequence();
-  virtual MuTyV & Value(uint_8 k) const = 0;
-  inline MuTyV & operator () (uint_8 k) const { return(Value(k)) ; }
+  virtual MuTyV & Value(sa_size_t k) const = 0;
+  inline MuTyV & operator () (sa_size_t k) const { return(Value(k)) ; }
 };
 
@@ -46,5 +46,5 @@
   explicit RandomSequence(int typ = RandomSequence::Gaussian, double m=0., double s=1.);
   virtual  ~RandomSequence();
-  virtual MuTyV & Value(uint_8 k) const ;
+  virtual MuTyV & Value(sa_size_t k) const ;
   double   Rand();
 
@@ -68,5 +68,5 @@
   inline double & Step() { return step_; }
 
-  virtual MuTyV & Value(uint_8 k) const ;
+  virtual MuTyV & Value(sa_size_t k) const ;
 
 protected:
@@ -80,6 +80,7 @@
 public:
   virtual ~EnumeratedSequence();
-  virtual MuTyV & Value(uint_8 k) const ;
+  virtual MuTyV & Value(sa_size_t k) const ;
   EnumeratedSequence & operator , (MuTyV const & v);
+  EnumeratedSequence & operator = (MuTyV const & v);
 private:
   vector<MuTyV> vecv_;
@@ -87,6 +88,6 @@
 };
 
-inline EnumeratedSequence operator , (MuTyV const & a, MuTyV const & b)
-{ EnumeratedSequence seq;   return ((seq,a),b) ; }
+  //inline EnumeratedSequence operator , (MuTyV const & a, MuTyV const & b)
+  //{ EnumeratedSequence seq;   return ((seq,a),b) ; }
 
 //////////////////////////////////////////////////////////
@@ -94,18 +95,18 @@
 class Range {
 public:
-  explicit Range(uint_4 start=0, uint_4 end=0, uint_4 size=1, uint_4 step=1);
+  explicit Range(sa_size_t start=0, sa_size_t end=0, sa_size_t size=1, sa_size_t step=1);
   //! Return the start index
-  inline uint_4 & Start()  {  return start_; }
+  inline sa_size_t & Start()  {  return start_; }
   //! Return the last index
-  inline uint_4 & End()    {  return end_; }
+  inline sa_size_t & End()    {  return end_; }
   //! Return the size
-  inline uint_4 & Size()   {  return size_; }
+  inline sa_size_t & Size()   {  return size_; }
   //! Return the step
-  inline uint_4 & Step()   {  return step_; }
+  inline sa_size_t & Step()   {  return step_; }
 protected:
-  uint_4 start_; //!< start index
-  uint_4 end_;   //!< end index
-  uint_4 size_;  //!< size
-  uint_4 step_;  //!< step
+  sa_size_t start_; //!< start index
+  sa_size_t end_;   //!< end index
+  sa_size_t size_;  //!< size
+  sa_size_t step_;  //!< step
 };
 
@@ -114,11 +115,11 @@
 class IdentityMatrix {
 public:
-  explicit IdentityMatrix(double diag=1., uint_4 n=0);
+  explicit IdentityMatrix(double diag=1., sa_size_t n=0);
   //! return the size of the identity matrix
-  inline uint_4 Size() { return size_; }
+  inline sa_size_t Size() { return size_; }
   //! return the value of the diagonal elements
   inline double Diag() { return diag_; }
 protected:
-  uint_4 size_; //!< size of the matrix
+  sa_size_t size_; //!< size of the matrix
   double diag_; //!< value of the diagonal elements
 };
