Changeset 2421 in Sophya


Ignore:
Timestamp:
Aug 8, 2003, 3:07:06 PM (22 years ago)
Author:
ansari
Message:
  • Modifications methodes TMatrix::NRows() ::NCols() --> Peuvent etre

appelees sur des matrices non allouees.

  • Declaration const pour TMatrix::Transpose() et ::Rearrange(..)
  • remplacement THROW par throw ds Linfitter avec message explicite

Reza 08/08/2003

Location:
trunk/SophyaLib/TArray
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/TArray/sopemtx.cc

    r2322 r2421  
    619619{
    620620uint_4 n = x.NElts();
    621 if (n != y.NElts()) THROW(sizeMismatchErr);
     621if (n != y.NElts())
     622  throw SzMismatchError("LinFitter<T>::LinFit(x,y,nf,f,c)/Error x.NElts() <> y.Nelts() ");
    622623 
    623624TMatrix<T> fx(nf,n);
     
    643644{
    644645uint_4 n = y.NElts();
    645 if (n != fx.NCol()) THROW(sizeMismatchErr);
     646if (n != fx.NCol())
     647  throw SzMismatchError("LinFitter<T>::LinFit(fx, y, c)/Error y.NElts() <> fx.Nelts() ");
    646648
    647649uint_4 nf = fx.NRows();
     
    656658c = fx * y;
    657659
    658 if(SimpleMatrixOperation<T>::GausPiv(a,c)==(T) 0) THROW(singMatxErr);
     660if(SimpleMatrixOperation<T>::GausPiv(a,c)==(T) 0)
     661  throw SingMatrixExc("LinFitter<T>::LinFit(fx, y, c) - Non invertible matrix (by GausPiv())");
    659662
    660663r_8 xi2 = 0., ax;
     
    691694{
    692695uint_4 n = x.NElts();
    693 if (n != y.NElts()) THROW(sizeMismatchErr);
     696if (n != y.NElts())
     697  throw SzMismatchError("LinFitter<T>::LinFit(x,y,errY2,nf,f,c,errC)/Error x.NElts() <> y.Nelts() ");
    694698
    695699TMatrix<T> fx(nf, n);
     
    720724{
    721725uint_4 n = y.NElts();
    722 if( n != errY2.NElts()) THROW(sizeMismatchErr);
    723 if( n != fx.NCol()) THROW(sizeMismatchErr);
    724 
     726if( n != errY2.NElts())
     727  throw SzMismatchError("LinFitter<T>::LinFit(fx,y,errY2,c,errC)/Error y.NElts() <> errY2.Nelts() ");
     728if( n != fx.NCol())
     729  throw SzMismatchError("LinFitter<T>::LinFit(fx,y,errY2,c,errC)/Error y.NElts() <> fx.NCols() ");
    725730uint_4 nf = fx.NRows();
    726731
     
    748753}
    749754
    750 if(SimpleMatrixOperation<T>::GausPiv(a,d)==(T) 0) THROW(singMatxErr);
     755if(SimpleMatrixOperation<T>::GausPiv(a,d)==(T) 0)
     756  throw SingMatrixExc("LinFitter<T>::LinFit(...ErrY2...) - Non invertible matrix (by GausPiv())");
     757
    751758
    752759for(uint_4 l=0; l<nf; l++) {
  • trunk/SophyaLib/TArray/tmatrix.cc

    r2267 r2421  
    1 // $Id: tmatrix.cc,v 1.23 2002-11-15 09:35:44 ansari Exp $
     1// $Id: tmatrix.cc,v 1.24 2003-08-08 13:07:06 ansari Exp $
    22//                         C.Magneville          04/99
    33#include "machdefs.h"
     
    291291 */
    292292template <class T>
    293 TMatrix<T> TMatrix<T>::Transpose()
     293TMatrix<T> TMatrix<T>::Transpose() const
    294294{
    295295  TMatrix<T> tm(*this);
     
    305305 */
    306306template <class T>
    307 TMatrix<T> TMatrix<T>::Transpose(short mm)
     307TMatrix<T> TMatrix<T>::Transpose(short mm) const
    308308{
    309309  if (mm == SameMemoryMapping) mm = GetMemoryMapping(); 
     
    322322 */
    323323template <class T>
    324 TMatrix<T> TMatrix<T>::Rearrange(short mm)
     324TMatrix<T> TMatrix<T>::Rearrange(short mm) const
    325325{
    326326  if ( mm == SameMemoryMapping)  mm = GetMemoryMapping();
  • trunk/SophyaLib/TArray/tmatrix.h

    r1581 r2421  
    4242  // Size - Changing the Size
    4343  //! return number of rows
    44   inline sa_size_t NRows() const {return Size(marowi_); }
     44  inline sa_size_t NRows() const {return size_[marowi_]; }
    4545  //! return number of columns
    46   inline sa_size_t NCols() const {return Size(macoli_); }
     46  inline sa_size_t NCols() const {return size_[macoli_]; }
    4747  //! return number of columns
    48   inline sa_size_t NCol()  const {return Size(macoli_); } // back-compat Peida
     48  inline sa_size_t NCol()  const {return size_[macoli_]; } // back-compat Peida
    4949
    5050  void ReSize(sa_size_t r,sa_size_t c, short mm=BaseArray::SameMemoryMapping);
     
    7474  // Operations matricielles
    7575  TMatrix<T>& TransposeSelf();
    76   TMatrix<T>  Transpose();
     76  TMatrix<T>  Transpose() const;
    7777  //mm = SameMemoryMapping or CMemoryMapping or FortranMemoryMapping
    78   TMatrix<T>  Transpose(short mm);
     78  TMatrix<T>  Transpose(short mm) const ;
    7979  // Rearranging Matrix Elements
    80   TMatrix<T>  Rearrange(short mm);
     80  TMatrix<T>  Rearrange(short mm) const;
    8181
    8282  // Operateur d'affectation
Note: See TracChangeset for help on using the changeset viewer.