[772] | 1 | // C.Magneville, R.Ansari 03/2000
|
---|
| 2 |
|
---|
[2615] | 3 | #include "sopnamsp.h"
|
---|
[772] | 4 | #include "machdefs.h"
|
---|
| 5 | #include <stdio.h>
|
---|
[2322] | 6 | #include <iostream>
|
---|
[772] | 7 | #include <complex>
|
---|
| 8 | #include <math.h>
|
---|
| 9 | #include "sopemtx.h"
|
---|
| 10 | #include "smathconst.h"
|
---|
| 11 |
|
---|
| 12 | ////////////////////////////////////////////////////////////////
|
---|
[939] | 13 | // ---------------------------------------------------------- //
|
---|
| 14 | // La classe de gestion des lignes et colonnes d'une matrice //
|
---|
| 15 | // ---------------------------------------------------------- //
|
---|
[772] | 16 | ////////////////////////////////////////////////////////////////
|
---|
[926] | 17 |
|
---|
[3012] | 18 | /*! \cond
|
---|
[939] | 19 | \class SOPHYA::TMatrixRC
|
---|
| 20 | \ingroup TArray
|
---|
| 21 | Class for representing rows, columns and diagonal of a matrix.
|
---|
| 22 | \sa TMatrix TArray
|
---|
[3012] | 23 | */
|
---|
[939] | 24 |
|
---|
[3012] | 25 | /*! \endcond */
|
---|
| 26 |
|
---|
[2881] | 27 | namespace SOPHYA {
|
---|
[804] | 28 | template <class T>
|
---|
| 29 | class TMatrixRC {
|
---|
| 30 | public:
|
---|
[926] | 31 | //! Define type of TMatrixRC
|
---|
| 32 | enum TRCKind {
|
---|
| 33 | TmatrixRow=0, //!< TMatrixRC ligne
|
---|
| 34 | TmatrixCol=1, //!< TMatrixRC column
|
---|
| 35 | TmatrixDiag=2 //!< TMatrixRC diagonal
|
---|
| 36 | };
|
---|
[804] | 37 | TMatrixRC();
|
---|
[3332] | 38 | TMatrixRC(TMatrix<T>& m, TRCKind kind, sa_size_t index=0);
|
---|
[804] | 39 | virtual ~TMatrixRC() {}
|
---|
[772] | 40 |
|
---|
[804] | 41 | // Acces aux rangees et colonnes de matrices
|
---|
[3332] | 42 | static TMatrixRC<T> Row(TMatrix<T> & m, sa_size_t r);
|
---|
| 43 | static TMatrixRC<T> Col(TMatrix<T> & m, sa_size_t c);
|
---|
[804] | 44 | static TMatrixRC<T> Diag(TMatrix<T> & m);
|
---|
| 45 |
|
---|
| 46 | int_4 SetCol(int_4 c);
|
---|
| 47 | int_4 SetRow(int_4 r);
|
---|
| 48 | int_4 SetDiag();
|
---|
| 49 |
|
---|
[3332] | 50 | static sa_size_t Step(const TMatrix<T>& m, TRCKind rckind);
|
---|
| 51 | static T* Org(const TMatrix<T>&, TRCKind rckind, sa_size_t ind=0);
|
---|
[804] | 52 |
|
---|
[926] | 53 | //! Return the kind of TMatrix (line,column,diagonal)
|
---|
[804] | 54 | TRCKind Kind() const { return kind; }
|
---|
[3332] | 55 | sa_size_t NElts() const;
|
---|
| 56 | T& operator()(sa_size_t i);
|
---|
| 57 | T operator()(sa_size_t i) const;
|
---|
[804] | 58 |
|
---|
| 59 |
|
---|
| 60 | TMatrixRC<T>& operator = (const TMatrixRC<T>& rc);
|
---|
| 61 |
|
---|
| 62 |
|
---|
| 63 | TMatrixRC<T>& operator *= (T x);
|
---|
| 64 | TMatrixRC<T>& operator /= (T x);
|
---|
| 65 |
|
---|
| 66 | // TMatrixRC<T>& operator -= (T x);
|
---|
| 67 | // TMatrixRC<T>& operator += (T x);
|
---|
| 68 |
|
---|
| 69 |
|
---|
[3332] | 70 | TMatrixRC<T>& LinComb(T a, T b, const TMatrixRC& rc, sa_size_t first=0);
|
---|
| 71 | TMatrixRC<T>& LinComb(T b, const TMatrixRC<T>& rc, sa_size_t first=0);
|
---|
[804] | 72 |
|
---|
[3332] | 73 | sa_size_t IMaxAbs(sa_size_t first=0);
|
---|
[813] | 74 | void Print(ostream & os) const ;
|
---|
[804] | 75 |
|
---|
| 76 | static void Swap(TMatrixRC<T>& rc1, TMatrixRC<T>& rc2);
|
---|
| 77 |
|
---|
[926] | 78 | //! Define Absolute value for uint_1
|
---|
[804] | 79 | inline static double Abs_Value(uint_1 v) {return (double) v;}
|
---|
[926] | 80 | //! Define Absolute value for uint_2
|
---|
[804] | 81 | inline static double Abs_Value(uint_2 v) {return (double) v;}
|
---|
[926] | 82 | //! Define Absolute value for int_2
|
---|
[804] | 83 | inline static double Abs_Value(int_2 v) {return (v>0)? (double) v: (double) -v;}
|
---|
[926] | 84 | //! Define Absolute value for int_4
|
---|
[804] | 85 | inline static double Abs_Value(int_4 v) {return (v>0)? (double) v: (double) -v;}
|
---|
[926] | 86 | //! Define Absolute value for int_8
|
---|
[804] | 87 | inline static double Abs_Value(int_8 v) {return (v>0)? (double) v: (double) -v;}
|
---|
[3332] | 88 | //! Define Absolute value for sa_size_t
|
---|
[804] | 89 | inline static double Abs_Value(uint_4 v) {return (double) v;}
|
---|
[926] | 90 | //! Define Absolute value for uint_8
|
---|
[804] | 91 | inline static double Abs_Value(uint_8 v) {return (double) v;}
|
---|
[926] | 92 | //! Define Absolute value for r_4
|
---|
[2147] | 93 | inline static double Abs_Value(r_4 v) {return (double) fabs((double)v);}
|
---|
[926] | 94 | //! Define Absolute value for r_8
|
---|
[804] | 95 | inline static double Abs_Value(r_8 v) {return fabs(v);}
|
---|
[926] | 96 | //! Define Absolute value for complex r_4
|
---|
| 97 | inline static double Abs_Value(complex<r_4> v)
|
---|
[804] | 98 | {return sqrt(v.real()*v.real()+v.imag()*v.imag());}
|
---|
[926] | 99 | //! Define Absolute value for complex r_8
|
---|
| 100 | inline static double Abs_Value(complex<r_8> v)
|
---|
[804] | 101 | {return sqrt(v.real()*v.real()+v.imag()*v.imag());}
|
---|
| 102 |
|
---|
| 103 | protected:
|
---|
[926] | 104 | TMatrix<T>* matrix; //!< pointer to the TMatrix
|
---|
| 105 | T* data; //!< pointer to the beginnig of interesting datas
|
---|
| 106 | int_4 index; //!< index of the line/column
|
---|
[3332] | 107 | sa_size_t step; //!< step of the line/column
|
---|
[926] | 108 | TRCKind kind; //!< type: line, column or diagonal
|
---|
[804] | 109 | };
|
---|
| 110 |
|
---|
[935] | 111 | //! Scalar product of two TMatrixRC
|
---|
| 112 | /*!
|
---|
| 113 | \return sum[ a(i) * b(i) ]
|
---|
| 114 | */
|
---|
[804] | 115 | template <class T>
|
---|
| 116 | inline T operator * (const TMatrixRC<T>& a, const TMatrixRC<T>& b)
|
---|
| 117 | {
|
---|
| 118 | if ( a.NElts() != b.NElts() )
|
---|
| 119 | throw(SzMismatchError("TMatrixRC::operator * size mismatch\n"));
|
---|
| 120 | if ( a.Kind() != b.Kind() )
|
---|
| 121 | throw(SzMismatchError("TMatrixRC::operator * type mismatch\n"));
|
---|
| 122 | T sum = 0;
|
---|
[3332] | 123 | for(sa_size_t i=0; i<a.NElts(); i++) sum += a(i)*b(i);
|
---|
[804] | 124 | return sum;
|
---|
| 125 | }
|
---|
| 126 |
|
---|
[935] | 127 | //! Get the step in datas for a TMatrix for type rckind
|
---|
| 128 | /*!
|
---|
| 129 | \param rckind : line, column or diagonal
|
---|
| 130 | \return step in TMatrix along TMatrixRC
|
---|
| 131 | */
|
---|
[804] | 132 | template <class T>
|
---|
[3332] | 133 | inline sa_size_t TMatrixRC<T>::Step(const TMatrix<T>& m, TRCKind rckind)
|
---|
[813] | 134 | { switch (rckind) { case TmatrixRow : return m.Step(m.ColsKA());
|
---|
| 135 | case TmatrixCol : return m.Step(m.RowsKA());
|
---|
[804] | 136 | case TmatrixDiag : return (m.Step(m.RowsKA())+m.Step(m.ColsKA())); }
|
---|
| 137 | return 0; }
|
---|
| 138 |
|
---|
[935] | 139 | //! Get the origin of datas.
|
---|
| 140 | /*!
|
---|
| 141 | Get the origin of datas in the TMatrix for a TMatrixRC for type
|
---|
| 142 | \b rckind and index \b index .
|
---|
| 143 | \param rckind : line, column or diagonal
|
---|
| 144 | \param index : index of the line or column.
|
---|
| 145 | \return adress of the first element in datas.
|
---|
| 146 | */
|
---|
[804] | 147 | template <class T>
|
---|
[3332] | 148 | inline T* TMatrixRC<T>::Org(const TMatrix<T>& m, TRCKind rckind, sa_size_t index)
|
---|
[804] | 149 | { switch (rckind) { case TmatrixRow : return const_cast<T *>(&(m(index,0)));
|
---|
| 150 | case TmatrixCol : return const_cast<T *>(&(m(0,index)));
|
---|
| 151 | case TmatrixDiag : return const_cast<T *>(m.Data()); }
|
---|
| 152 | return NULL; }
|
---|
| 153 |
|
---|
[926] | 154 | //! return number of elements for a TMatrixRC
|
---|
[3332] | 155 | template <class T> inline sa_size_t TMatrixRC<T>::NElts() const
|
---|
[804] | 156 | { if (!matrix) return 0;
|
---|
| 157 | switch (kind) { case TmatrixRow : return matrix->NCols();
|
---|
| 158 | case TmatrixCol : return matrix->NRows();
|
---|
| 159 | case TmatrixDiag : return matrix->NCols(); }
|
---|
| 160 | return 0; }
|
---|
| 161 |
|
---|
[926] | 162 | //! access of element \b i
|
---|
[804] | 163 | template <class T>
|
---|
[3332] | 164 | inline T& TMatrixRC<T>::operator()(sa_size_t i) {return data[i*step];}
|
---|
[926] | 165 | //! access of element \b i
|
---|
[804] | 166 | template <class T>
|
---|
[3332] | 167 | inline T TMatrixRC<T>::operator()(sa_size_t i) const {return data[i*step];}
|
---|
[804] | 168 |
|
---|
| 169 | ////////////////////////////////////////////////////////////////
|
---|
[935] | 170 | //! Typedef to simplify TMatrixRC<r_8> writing
|
---|
[804] | 171 | typedef TMatrixRC<r_8> MatrixRC;
|
---|
| 172 |
|
---|
| 173 |
|
---|
[926] | 174 | //! Default constructor
|
---|
[772] | 175 | template <class T> TMatrixRC<T>::TMatrixRC()
|
---|
| 176 | : matrix(NULL), data(NULL), index(0), step(0)
|
---|
| 177 | {}
|
---|
| 178 |
|
---|
[926] | 179 | //! Constructor
|
---|
| 180 | /*!
|
---|
| 181 | \param m : matrix
|
---|
| 182 | \param rckind : select line, column or diagonal
|
---|
| 183 | \param ind : number of the line or column
|
---|
| 184 | */
|
---|
[3332] | 185 | template <class T> TMatrixRC<T>::TMatrixRC(TMatrix<T>& m,TRCKind rckind,sa_size_t ind)
|
---|
[772] | 186 | : matrix(&m), data(Org(m,rckind,ind)),
|
---|
| 187 | index(ind), step(Step(m,rckind)), kind(rckind)
|
---|
| 188 | {
|
---|
| 189 | if (kind == TmatrixDiag && m.NCols() != m.NRows())
|
---|
| 190 | throw(SzMismatchError("TMatrixRC::TMatrixRC(...,TmatrixDiag,...) size mismatch\n"));
|
---|
| 191 | }
|
---|
| 192 |
|
---|
| 193 | ////////////////////////////////////////////////////////////////
|
---|
| 194 | // Acces aux rangees et colonnes de matrices
|
---|
| 195 |
|
---|
[926] | 196 | //! Return TMatrixRC for line \b r of matrix \b m
|
---|
[772] | 197 | template <class T>
|
---|
[3332] | 198 | TMatrixRC<T> TMatrixRC<T>::Row(TMatrix<T> & m, sa_size_t r)
|
---|
[772] | 199 | {
|
---|
| 200 | TMatrixRC<T> rc(m, TmatrixRow, r);
|
---|
| 201 | return rc;
|
---|
| 202 | }
|
---|
| 203 |
|
---|
[926] | 204 | //! Return TMatrixRC for column \b r of matrix \b m
|
---|
[772] | 205 | template <class T>
|
---|
[3332] | 206 | TMatrixRC<T> TMatrixRC<T>::Col(TMatrix<T> & m, sa_size_t c)
|
---|
[772] | 207 | {
|
---|
| 208 | TMatrixRC<T> rc(m, TmatrixCol, c);
|
---|
| 209 | return rc;
|
---|
| 210 | }
|
---|
| 211 |
|
---|
[926] | 212 | //! Return TMatrixRC for diagonal of matrix \b m
|
---|
[772] | 213 | template <class T>
|
---|
| 214 | TMatrixRC<T> TMatrixRC<T>::Diag(TMatrix<T> & m)
|
---|
| 215 | {
|
---|
| 216 | TMatrixRC<T> rc(m, TmatrixDiag);
|
---|
| 217 | return rc;
|
---|
| 218 | }
|
---|
| 219 |
|
---|
| 220 |
|
---|
| 221 |
|
---|
[926] | 222 | //! Set column \b c for this TMatrixRC
|
---|
[772] | 223 | template <class T> int_4 TMatrixRC<T>::SetCol(int_4 c)
|
---|
| 224 | {
|
---|
| 225 | if(!matrix) return -1;
|
---|
| 226 | if(c<0 || c>(int_4)matrix->NCols()) return -1;
|
---|
| 227 | kind = TmatrixCol;
|
---|
| 228 | index = c;
|
---|
| 229 | step = Step(*matrix, TmatrixCol);
|
---|
| 230 | data = Org(*matrix, TmatrixCol, c);
|
---|
| 231 | return c;
|
---|
| 232 | }
|
---|
| 233 |
|
---|
[926] | 234 | //! Set line \b r for this TMatrixRC
|
---|
[772] | 235 | template <class T> int_4 TMatrixRC<T>::SetRow(int_4 r)
|
---|
| 236 | {
|
---|
| 237 | if(!matrix) return -1;
|
---|
| 238 | if(r<0 && r>(int_4)matrix->NRows()) return -1;
|
---|
| 239 | kind = TmatrixRow;
|
---|
| 240 | index = r;
|
---|
| 241 | step = Step(*matrix, TmatrixRow);
|
---|
| 242 | data = Org(*matrix, TmatrixRow, r);
|
---|
| 243 | return r;
|
---|
| 244 | }
|
---|
| 245 |
|
---|
[926] | 246 | //! Set line diaginal for this TMatrixRC
|
---|
[772] | 247 | template <class T> int_4 TMatrixRC<T>::SetDiag()
|
---|
| 248 | {
|
---|
| 249 | if (!matrix) return -1;
|
---|
| 250 | if (matrix->NCols() != matrix->NRows())
|
---|
| 251 | throw(SzMismatchError("TMatrixRC::SetDiag size mismatch\n"));
|
---|
| 252 | kind = TmatrixDiag;
|
---|
| 253 | index = 0;
|
---|
| 254 | step = Step(*matrix, TmatrixDiag);
|
---|
| 255 | data = Org(*matrix, TmatrixDiag);
|
---|
| 256 | return 0;
|
---|
| 257 | }
|
---|
| 258 |
|
---|
[926] | 259 | //! Operator =
|
---|
[772] | 260 | template <class T> TMatrixRC<T>& TMatrixRC<T>::operator = (const TMatrixRC<T>& rc)
|
---|
| 261 | {
|
---|
| 262 | matrix = rc.matrix;
|
---|
| 263 | data = rc.data;
|
---|
| 264 | index = rc.index;
|
---|
| 265 | step = rc.step;
|
---|
| 266 | kind = rc.kind;
|
---|
| 267 | return *this;
|
---|
| 268 | }
|
---|
| 269 |
|
---|
| 270 |
|
---|
[926] | 271 | //! Operator to multiply by constant \b x
|
---|
[772] | 272 | template <class T> TMatrixRC<T>& TMatrixRC<T>::operator *= (T x)
|
---|
| 273 | {
|
---|
[3332] | 274 | for(sa_size_t i=0; i<NElts(); i++) (*this)(i) *= x;
|
---|
[772] | 275 | return *this;
|
---|
| 276 | }
|
---|
| 277 |
|
---|
[926] | 278 | //! Operator to divide by constant \b x
|
---|
[772] | 279 | template <class T> TMatrixRC<T>& TMatrixRC<T>::operator /= (T x)
|
---|
| 280 | {
|
---|
[3332] | 281 | for(sa_size_t i=0; i<NElts(); i++) (*this)(i) /= x;
|
---|
[772] | 282 | return *this;
|
---|
| 283 | }
|
---|
| 284 |
|
---|
| 285 |
|
---|
| 286 |
|
---|
[926] | 287 | //! Linear combination
|
---|
| 288 | /*!
|
---|
| 289 | Do : \f$ MRC(i) = MRC(i)*a + rc(i)*b \f$
|
---|
| 290 | \return *this
|
---|
| 291 | */
|
---|
[772] | 292 | template <class T>
|
---|
[3332] | 293 | TMatrixRC<T>& TMatrixRC<T>::LinComb(T a, T b, const TMatrixRC<T>& rc, sa_size_t first)
|
---|
[772] | 294 | {
|
---|
| 295 | if ( NElts() != rc.NElts() )
|
---|
| 296 | throw(SzMismatchError("TMatrixRC::LinComb size mismatch\n"));
|
---|
| 297 | if ( kind != rc.kind )
|
---|
| 298 | throw(SzMismatchError("TMatrixRC::LinComb type mismatch\n"));
|
---|
[3332] | 299 | for(sa_size_t i=first; i<NElts(); i++) (*this)(i) = (*this)(i)*a + rc(i)*b;
|
---|
[772] | 300 | return *this;
|
---|
| 301 | }
|
---|
| 302 |
|
---|
[926] | 303 | //! Linear combination
|
---|
| 304 | /*!
|
---|
| 305 | Do : \f$ MRC(i) = MRC(i) + rc(i)*b \f$
|
---|
| 306 | */
|
---|
[772] | 307 | template <class T>
|
---|
[3332] | 308 | TMatrixRC<T>& TMatrixRC<T>::LinComb(T b, const TMatrixRC<T>& rc, sa_size_t first)
|
---|
[772] | 309 | {
|
---|
| 310 | if ( NElts() != rc.NElts() )
|
---|
| 311 | throw(SzMismatchError("TMatrixRC::LinComb size mismatch\n"));
|
---|
| 312 | if ( kind != rc.kind )
|
---|
| 313 | throw(SzMismatchError("TMatrixRC::LinComb type mismatch\n"));
|
---|
[3332] | 314 | for(sa_size_t i=first; i<NElts(); i++) (*this)(i) += rc(i)*b;
|
---|
[772] | 315 | return *this;
|
---|
| 316 | }
|
---|
| 317 |
|
---|
[926] | 318 | //! Find maximum absolute value in TMatrixRC, search begin at \b first
|
---|
[3332] | 319 | template <class T> sa_size_t TMatrixRC<T>::IMaxAbs(sa_size_t first)
|
---|
[772] | 320 | {
|
---|
| 321 | if (first>NElts())
|
---|
| 322 | throw(SzMismatchError("TMatrixRC::IMaxAbs size mismatch\n"));
|
---|
[3332] | 323 | sa_size_t imax = first;
|
---|
[772] | 324 | double vmax = Abs_Value((*this)(first));
|
---|
[3332] | 325 | for(sa_size_t i=first+1; i<NElts(); i++) {
|
---|
[772] | 326 | double v = Abs_Value((*this)(i));
|
---|
| 327 | if(v > vmax) {vmax = v; imax = i;}
|
---|
| 328 | }
|
---|
| 329 | return imax;
|
---|
| 330 | }
|
---|
| 331 |
|
---|
[926] | 332 | //! Print on stream \b os
|
---|
[772] | 333 | template <class T>
|
---|
[813] | 334 | void TMatrixRC<T>::Print(ostream & os) const
|
---|
| 335 | {
|
---|
| 336 | os << " TMatrixRC<T>::Print(ostream & os) " << NElts() << " Kind="
|
---|
| 337 | << kind << " Index=" << index << " Step= " << step << endl;
|
---|
[3332] | 338 | for(sa_size_t i=0; i<NElts(); i++) {
|
---|
[813] | 339 | os << (*this)(i);
|
---|
| 340 | if (kind == TmatrixCol) os << endl;
|
---|
| 341 | else os << ", ";
|
---|
| 342 | }
|
---|
| 343 | os << endl;
|
---|
| 344 | }
|
---|
| 345 |
|
---|
[926] | 346 | //! Swap two TMatrixRC of the same kind
|
---|
[813] | 347 | template <class T>
|
---|
[772] | 348 | void TMatrixRC<T>::Swap(TMatrixRC<T>& rc1, TMatrixRC<T>& rc2)
|
---|
| 349 | {
|
---|
| 350 | if(rc1.NElts() != rc2.NElts())
|
---|
| 351 | throw(SzMismatchError("TMatrixRC::Swap size mismatch\n"));
|
---|
| 352 | if(rc1.kind != rc2.kind)
|
---|
| 353 | throw(SzMismatchError("TMatrixRC::Swap type mismatch\n"));
|
---|
| 354 | if(rc1.data == rc2.data) return;
|
---|
[3332] | 355 | for(sa_size_t i=0; i<rc1.NElts(); i++)
|
---|
[772] | 356 | {T tmp = rc1(i); rc1(i) = rc2(i); rc2(i) = tmp;}
|
---|
| 357 | }
|
---|
| 358 |
|
---|
| 359 |
|
---|
[926] | 360 | ////////////////////////////////////////////////////////////////
|
---|
[939] | 361 | // ---------------------------------------------------------- //
|
---|
| 362 | // La classe de calcul simple sur les TMatrix //
|
---|
| 363 | // ---------------------------------------------------------- //
|
---|
[926] | 364 | ////////////////////////////////////////////////////////////////
|
---|
[772] | 365 |
|
---|
| 366 | //**** Pour inversion
|
---|
| 367 | #ifndef M_LN2
|
---|
| 368 | #define M_LN2 0.69314718055994530942
|
---|
| 369 | #endif
|
---|
[1007] | 370 | //// CMV BUG BUG : sur OSF 5.0 DMINEXP est deconnant (~1.e+19 !!!)
|
---|
[772] | 371 | #ifndef LN_MINDOUBLE
|
---|
| 372 | #define LN_MINDOUBLE (M_LN2 * (DMINEXP - 1))
|
---|
| 373 | #endif
|
---|
| 374 | #ifndef LN_MAXDOUBLE
|
---|
| 375 | #define LN_MAXDOUBLE (M_LN2 * DMAXEXP)
|
---|
| 376 | #endif
|
---|
| 377 |
|
---|
[1007] | 378 | template <class T>
|
---|
| 379 | int SimpleMatrixOperation<T>::GausPivScaling = PIV_GLOB_SCALE;
|
---|
| 380 |
|
---|
[926] | 381 | //! Gaussian pivoting
|
---|
| 382 | /*!
|
---|
[999] | 383 | Do Gauss pivoting of \b a, doing the same operations on matrix \b b
|
---|
[1007] | 384 | \param computedet = true : return determimant of \b a (beware of over/underfloat)
|
---|
| 385 | \param computedet = false : return 1 if OK, 0 if not.
|
---|
[999] | 386 | \verbatim
|
---|
| 387 | Solve linear system A(n,n) * X(n,m) = B(n,m)
|
---|
| 388 | and put solution X in B for return.
|
---|
| 389 | \endverbatim
|
---|
| 390 | \warning If \b b is identity matrix, return inverse of \b a
|
---|
| 391 | \warning matrix \b a and \b b are modified.
|
---|
[926] | 392 | */
|
---|
[772] | 393 | template <class T>
|
---|
[1007] | 394 | T SimpleMatrixOperation<T>::GausPiv(TMatrix<T>& a, TMatrix<T>& b,bool computedet)
|
---|
[772] | 395 | // Pivot de Gauss
|
---|
| 396 | // * Attention: egcs impose que cette fonction soit mise dans le .cc
|
---|
| 397 | // avant ::Inverse() (car Inverse() l'utilise)
|
---|
| 398 | // {TMatrix A(a); TMatrix B(b); return (T) TMatrix::GausPiv(A,B);}
|
---|
| 399 | {
|
---|
[3332] | 400 | sa_size_t n = a.NRows();
|
---|
[772] | 401 | if(n!=b.NRows())
|
---|
| 402 | throw(SzMismatchError("TMatrix::GausPiv size mismatch\n"));
|
---|
| 403 |
|
---|
[926] | 404 | T det = 1;
|
---|
[1007] | 405 |
|
---|
| 406 | //////////////////
|
---|
| 407 | // Data scaling //
|
---|
| 408 | //////////////////
|
---|
| 409 |
|
---|
| 410 | // Pas de normalisation des donnees
|
---|
| 411 | if(GausPivScaling==PIV_NO_SCALE) {
|
---|
| 412 | if(computedet) det = (T) 1;
|
---|
| 413 | // normalisation des donnees ligne par ligne
|
---|
| 414 | } else if(GausPivScaling==PIV_ROW_SCALE) {
|
---|
| 415 | double nrm = 0.;
|
---|
[3332] | 416 | for(sa_size_t iii=0; iii<a.NRows(); iii++) {
|
---|
| 417 | sa_size_t jjj; double vmax = -1.;
|
---|
[1007] | 418 | for(jjj=0; jjj<a.NCols(); jjj++) {
|
---|
| 419 | double v = TMatrixRC<T>::Abs_Value(a(iii,jjj));
|
---|
| 420 | if(v>vmax) vmax = v;
|
---|
| 421 | }
|
---|
| 422 | if(vmax>0.) {
|
---|
| 423 | for(jjj=0; jjj<a.NCols(); jjj++) a(iii,jjj) /= (T) vmax;
|
---|
| 424 | for(jjj=0; jjj<b.NCols(); jjj++) b(iii,jjj) /= (T) vmax;
|
---|
| 425 | nrm += log(vmax);
|
---|
| 426 | } else return (T) 0;
|
---|
[772] | 427 | }
|
---|
[1007] | 428 | if(computedet) {
|
---|
| 429 | if(nrm <= LN_MINDOUBLE || nrm >= LN_MAXDOUBLE) {
|
---|
| 430 | cerr<<"GausPiv_Row: normalisation failure, "
|
---|
| 431 | <<"determinant has to be multiplied by exp("<<nrm<<")"<<endl;
|
---|
| 432 | } else det = (T) exp(nrm);
|
---|
| 433 | }
|
---|
| 434 | // On fait une normalisation un peu brutale globale
|
---|
| 435 | } else {
|
---|
| 436 | double vmin=MAXDOUBLE, vmax=0;
|
---|
[3332] | 437 | for(sa_size_t iii=0; iii<a.NRows(); iii++)
|
---|
| 438 | for(sa_size_t jjj=0; jjj<a.NCols(); jjj++) {
|
---|
[1007] | 439 | double v = TMatrixRC<T>::Abs_Value(a(iii,jjj));
|
---|
| 440 | if(v>vmax) vmax = v;
|
---|
| 441 | if(v<vmin && v>0.) vmin = v;
|
---|
| 442 | }
|
---|
| 443 | double nrm = sqrt(vmin*vmax);
|
---|
| 444 | if(nrm>0.) { a /= (T) nrm; b /= (T) nrm;} else return (T) 0;
|
---|
| 445 | if(computedet) {
|
---|
| 446 | nrm = a.NRows() * log(nrm);
|
---|
| 447 | if (nrm <= LN_MINDOUBLE || nrm >= LN_MAXDOUBLE) {
|
---|
| 448 | cerr<<"GausPiv_Glob: normalisation failure, "
|
---|
| 449 | <<"determinant has to be multiplied by exp("<<nrm<<")"<<endl;
|
---|
| 450 | } else det = (T) exp(nrm);
|
---|
| 451 | }
|
---|
[772] | 452 | }
|
---|
| 453 |
|
---|
[1007] | 454 | ////////////////////////////////////////
|
---|
| 455 | // Gaussian elimination with pivoting //
|
---|
| 456 | ////////////////////////////////////////
|
---|
| 457 |
|
---|
[926] | 458 | TMatrixRC<T> pivRowa(a,TMatrixRC<T>::TmatrixRow);
|
---|
| 459 | TMatrixRC<T> pivRowb(b,TMatrixRC<T>::TmatrixRow);
|
---|
[772] | 460 |
|
---|
[3332] | 461 | for(sa_size_t k=0; k<n-1; k++) {
|
---|
| 462 | sa_size_t iPiv = TMatrixRC<T>::Col(a, k).IMaxAbs(k);
|
---|
[772] | 463 | if(iPiv != k) {
|
---|
| 464 | TMatrixRC<T> aIPiv(TMatrixRC<T>::Row(a,iPiv));
|
---|
| 465 | TMatrixRC<T> aK(TMatrixRC<T>::Row(a, k));
|
---|
| 466 | TMatrixRC<T>::Swap(aIPiv,aK);
|
---|
| 467 | TMatrixRC<T> bIPiv(TMatrixRC<T>::Row(b, iPiv));
|
---|
| 468 | TMatrixRC<T> bK(TMatrixRC<T>::Row(b, k));
|
---|
| 469 | TMatrixRC<T>::Swap(bIPiv,bK);
|
---|
| 470 | }
|
---|
[926] | 471 | T pivot = a(k,k);
|
---|
| 472 | if( TMatrixRC<T>::Abs_Value(pivot) < 1.e-50 ) return (T) 0;
|
---|
[1007] | 473 | if(computedet) det *= pivot;
|
---|
[772] | 474 | pivRowa.SetRow(k); // to avoid constructors
|
---|
| 475 | pivRowb.SetRow(k);
|
---|
[3332] | 476 | for (sa_size_t i=k+1; i<n; i++) {
|
---|
[926] | 477 | T r = -a(i,k)/pivot;
|
---|
[772] | 478 | TMatrixRC<T>::Row(a, i).LinComb(r, pivRowa); // + rapide que -= r * pivRowa
|
---|
| 479 | TMatrixRC<T>::Row(b, i).LinComb(r, pivRowb);
|
---|
| 480 | }
|
---|
| 481 | }
|
---|
[1007] | 482 | if(computedet) det *= a(n-1, n-1);
|
---|
[772] | 483 |
|
---|
| 484 | // on remonte
|
---|
[3332] | 485 | for(sa_size_t kk=n-1; kk>0; kk--) {
|
---|
[926] | 486 | T pivot = a(kk,kk);
|
---|
| 487 | if( TMatrixRC<T>::Abs_Value(pivot) <= 1.e-50 ) return (T) 0;
|
---|
[772] | 488 | pivRowa.SetRow(kk); // to avoid constructors
|
---|
| 489 | pivRowb.SetRow(kk);
|
---|
[3332] | 490 | for(sa_size_t jj=0; jj<kk; jj++) {
|
---|
[926] | 491 | T r = -a(jj,kk)/pivot;
|
---|
[772] | 492 | TMatrixRC<T>::Row(a, jj).LinComb(r, pivRowa);
|
---|
| 493 | TMatrixRC<T>::Row(b, jj).LinComb(r, pivRowb);
|
---|
| 494 | }
|
---|
| 495 | }
|
---|
| 496 |
|
---|
[3332] | 497 | for(sa_size_t l=0; l<n; l++) {
|
---|
[926] | 498 | if( TMatrixRC<T>::Abs_Value(a(l,l)) <= 1.e-50 ) return (T) 0;
|
---|
[772] | 499 | TMatrixRC<T>::Row(b, l) /= a(l,l);
|
---|
| 500 | }
|
---|
| 501 |
|
---|
| 502 | return det;
|
---|
| 503 | }
|
---|
| 504 |
|
---|
[926] | 505 | //! Return the inverse matrix of \b A
|
---|
[772] | 506 | template <class T>
|
---|
| 507 | TMatrix<T> SimpleMatrixOperation<T>::Inverse(TMatrix<T> const & A)
|
---|
| 508 | {
|
---|
[976] | 509 | TMatrix<T> a(A,false);
|
---|
[813] | 510 | TMatrix<T> b(a.NCols(),a.NRows()); b = IdentityMatrix(1.);
|
---|
[1007] | 511 | if(GausPiv(a,b)==(T) 0)
|
---|
[926] | 512 | throw(MathExc("TMatrix Inverse() Singular Matrix"));
|
---|
[772] | 513 | return b;
|
---|
| 514 | }
|
---|
| 515 |
|
---|
| 516 |
|
---|
[926] | 517 | ////////////////////////////////////////////////////////////////
|
---|
[939] | 518 | // ---------------------------------------------------------- //
|
---|
| 519 | // La classe fit lineaire //
|
---|
| 520 | // ---------------------------------------------------------- //
|
---|
[926] | 521 | ////////////////////////////////////////////////////////////////
|
---|
| 522 |
|
---|
[939] | 523 | //! Creator
|
---|
| 524 | template <class T>
|
---|
| 525 | LinFitter<T>::LinFitter()
|
---|
[804] | 526 | {
|
---|
| 527 | }
|
---|
[772] | 528 |
|
---|
[939] | 529 | //! Destructor
|
---|
| 530 | template <class T>
|
---|
| 531 | LinFitter<T>::~LinFitter()
|
---|
[804] | 532 | {
|
---|
| 533 | }
|
---|
| 534 |
|
---|
[939] | 535 | // fit lineaire des y(k) en tant que somme de c(i)f(i,x(k)), i=0..nf-1;
|
---|
| 536 | //! Linear fitting
|
---|
| 537 | /*!
|
---|
| 538 | Linear fit of y(k) as the sum of \f$ c(i)f(i,x(k)), i=0..nf-1 \f$
|
---|
| 539 | \param x : vector of X values
|
---|
| 540 | \param y : vector of datas
|
---|
| 541 | \param nf: number of functions
|
---|
| 542 | \param f : f(i,x(k)), i=0..nf-1
|
---|
| 543 | \return c : vector of solutions
|
---|
| 544 | \return return chisquare
|
---|
| 545 | */
|
---|
| 546 | template <class T>
|
---|
| 547 | r_8 LinFitter<T>::LinFit(const TVector<T>& x, const TVector<T>& y,
|
---|
[3332] | 548 | sa_size_t nf, T (*f)(sa_size_t,T), TVector<T>& c)
|
---|
[804] | 549 | {
|
---|
[3332] | 550 | sa_size_t n = x.NElts();
|
---|
[2421] | 551 | if (n != y.NElts())
|
---|
| 552 | throw SzMismatchError("LinFitter<T>::LinFit(x,y,nf,f,c)/Error x.NElts() <> y.Nelts() ");
|
---|
[939] | 553 |
|
---|
| 554 | TMatrix<T> fx(nf,n);
|
---|
[804] | 555 |
|
---|
[3332] | 556 | for(sa_size_t i=0; i<nf; i++)
|
---|
| 557 | for(sa_size_t j=0; j<n; j++) fx(i,j) = f(i,x(j));
|
---|
[939] | 558 |
|
---|
| 559 | return LinFit(fx,y,c);
|
---|
[804] | 560 | }
|
---|
| 561 |
|
---|
[939] | 562 | // fit lineaire des y(k) en tant que somme de c(i)f(i,x(k)), i=0..nf-1,
|
---|
| 563 | // la matrice fx contient les valeurs des f: fx(i,j) = f(i, x(j)).
|
---|
| 564 | //! Linear fitting
|
---|
| 565 | /*!
|
---|
| 566 | Linear fit of y(k) as the sum of \f$ c(i)f(i,x(k)), i=0..nf-1 \f$.
|
---|
| 567 | \param fx : matrix which contains \f$ fx(i,j) = f(i, x(j)) \f$.
|
---|
| 568 | \param y : vector of datas
|
---|
| 569 | \return c : vector of solutions
|
---|
| 570 | \return return chisquare
|
---|
| 571 | */
|
---|
| 572 | template <class T>
|
---|
| 573 | r_8 LinFitter<T>::LinFit(const TMatrix<T>& fx, const TVector<T>& y, TVector<T>& c)
|
---|
[804] | 574 | {
|
---|
[3332] | 575 | sa_size_t n = y.NElts();
|
---|
[2421] | 576 | if (n != fx.NCol())
|
---|
| 577 | throw SzMismatchError("LinFitter<T>::LinFit(fx, y, c)/Error y.NElts() <> fx.Nelts() ");
|
---|
[804] | 578 |
|
---|
[3332] | 579 | sa_size_t nf = fx.NRows();
|
---|
[804] | 580 |
|
---|
[939] | 581 | TMatrix<T> a(nf,nf);
|
---|
[804] | 582 |
|
---|
[3332] | 583 | for(sa_size_t j=0; j<nf; j++)
|
---|
| 584 | for(sa_size_t k=j; k<nf; k++)
|
---|
[939] | 585 | a(j,k) = a(k,j) = TMatrixRC<T>::Row(const_cast<TMatrix<T> &>(fx), j)
|
---|
| 586 | * TMatrixRC<T>::Row(const_cast<TMatrix<T> &>(fx), k);
|
---|
[804] | 587 |
|
---|
[939] | 588 | c = fx * y;
|
---|
[804] | 589 |
|
---|
[2421] | 590 | if(SimpleMatrixOperation<T>::GausPiv(a,c)==(T) 0)
|
---|
| 591 | throw SingMatrixExc("LinFitter<T>::LinFit(fx, y, c) - Non invertible matrix (by GausPiv())");
|
---|
[804] | 592 |
|
---|
[939] | 593 | r_8 xi2 = 0., ax;
|
---|
| 594 | T x;
|
---|
[3332] | 595 | for(sa_size_t k=0; k<n; k++) {
|
---|
[939] | 596 | x = (T) 0;
|
---|
[3332] | 597 | for(sa_size_t i=0; i<nf; i++) x += c(i) * fx(i,k);
|
---|
[939] | 598 | x -= y(k);
|
---|
| 599 | ax = TMatrixRC<T>::Abs_Value(x);
|
---|
| 600 | xi2 += ax*ax;
|
---|
[804] | 601 | }
|
---|
[939] | 602 | return xi2;
|
---|
| 603 | }
|
---|
[804] | 604 |
|
---|
[939] | 605 | // fit lineaire des y(k) en tant que somme de c(i)f(i,x(k)), i=0..nf-1,
|
---|
| 606 | // errY2 contient les carres des erreurs sur les Y.
|
---|
| 607 | // au retour, errC contient les erreurs sur les coefs.
|
---|
| 608 | //! Linear fitting with errors
|
---|
| 609 | /*!
|
---|
| 610 | Linear fit with errors of y(k) as the sum of \f$ c(i)f(i,x(k)), i=0..nf-1 \f$.
|
---|
| 611 | \param x : vector of X values
|
---|
| 612 | \param y : vector of datas
|
---|
| 613 | \param errY2 : vector of errors square on Y
|
---|
| 614 | \param nf: number of functions
|
---|
| 615 | \param f : f(i,x(k)), i=0..nf-1
|
---|
| 616 | \return c : vector of solutions
|
---|
| 617 | \return errC : vector of errors on solutions C
|
---|
| 618 | \return return chisquare
|
---|
| 619 | */
|
---|
| 620 | template <class T>
|
---|
| 621 | r_8 LinFitter<T>::LinFit(const TVector<T>& x, const TVector<T>& y,
|
---|
[3332] | 622 | const TVector<T>& errY2, sa_size_t nf, T (*f)(sa_size_t,T),
|
---|
[939] | 623 | TVector<T>& c, TVector<T>& errC)
|
---|
| 624 | {
|
---|
[3332] | 625 | sa_size_t n = x.NElts();
|
---|
[2421] | 626 | if (n != y.NElts())
|
---|
| 627 | throw SzMismatchError("LinFitter<T>::LinFit(x,y,errY2,nf,f,c,errC)/Error x.NElts() <> y.Nelts() ");
|
---|
[804] | 628 |
|
---|
[939] | 629 | TMatrix<T> fx(nf, n);
|
---|
[3332] | 630 | for(sa_size_t i=0; i<nf; i++)
|
---|
| 631 | for(sa_size_t j=0; j<n; j++)
|
---|
[939] | 632 | fx(i,j) = f(i,x(j));
|
---|
[804] | 633 |
|
---|
[939] | 634 | return LinFit(fx,y,errY2,c,errC);
|
---|
[804] | 635 | }
|
---|
| 636 |
|
---|
[939] | 637 | // fit lineaire des y(k) en tant que somme de c(i)f(i,x(k)), i=0..nf-1,
|
---|
| 638 | // la matrice fx contient les valeurs des f:
|
---|
| 639 | // fx(i,j) = f(i, x(j)).
|
---|
| 640 | // errY2 contient les carres des erreurs sur les Y.
|
---|
| 641 | // au retour, errC contient les erreurs sur les coefs.
|
---|
| 642 | //! Linear fitting with errors
|
---|
| 643 | /*!
|
---|
| 644 | \param fx : matrix which contains \f$ fx(i,j) = f(i, x(j)) \f$.
|
---|
| 645 | \param y : vector of datas
|
---|
| 646 | \param errY2 : vector of errors square on Y
|
---|
| 647 | \return c : vector of solutions
|
---|
| 648 | \return errC : vector of errors on solutions on C
|
---|
| 649 | \return return chisquare
|
---|
| 650 | */
|
---|
| 651 | template <class T>
|
---|
| 652 | r_8 LinFitter<T>::LinFit(const TMatrix<T>& fx, const TVector<T>& y,
|
---|
| 653 | const TVector<T>& errY2,TVector<T>& c, TVector<T>& errC)
|
---|
[804] | 654 | {
|
---|
[3332] | 655 | sa_size_t n = y.NElts();
|
---|
[2421] | 656 | if( n != errY2.NElts())
|
---|
| 657 | throw SzMismatchError("LinFitter<T>::LinFit(fx,y,errY2,c,errC)/Error y.NElts() <> errY2.Nelts() ");
|
---|
| 658 | if( n != fx.NCol())
|
---|
| 659 | throw SzMismatchError("LinFitter<T>::LinFit(fx,y,errY2,c,errC)/Error y.NElts() <> fx.NCols() ");
|
---|
[3332] | 660 | sa_size_t nf = fx.NRows();
|
---|
[804] | 661 |
|
---|
[939] | 662 | TMatrix<T> a(nf,nf);
|
---|
[804] | 663 |
|
---|
[939] | 664 | c.Realloc(nf);
|
---|
| 665 | errC.Realloc(nf);
|
---|
[804] | 666 |
|
---|
[3332] | 667 | for(sa_size_t j=0; j<nf; j++)
|
---|
| 668 | for(sa_size_t k=j; k<nf; k++) {
|
---|
[939] | 669 | T x=0;
|
---|
| 670 | // Matrice a inverser
|
---|
[3332] | 671 | for(sa_size_t l=0; l<n; l++) x += fx(j,l)*fx(k,l)/errY2(l);
|
---|
[939] | 672 | a(j,k) = a(k,j) = x;
|
---|
| 673 | }
|
---|
[804] | 674 |
|
---|
[939] | 675 | TMatrix<T> d(nf,nf+1);
|
---|
[3332] | 676 | for(sa_size_t k=0; k<nf; k++) {
|
---|
[939] | 677 | T x = (T) 0;
|
---|
| 678 | // Second membre 1ere colonne
|
---|
[3332] | 679 | for(sa_size_t l=0; l<n; l++) x += fx(k,l)*y(l)/errY2(l);
|
---|
[939] | 680 | d(k,0) = x;
|
---|
| 681 | // Reste second membre = Id.
|
---|
[3332] | 682 | for(sa_size_t m=1; m<=nf; m++) d(k,m) = (k==m)?1:0;
|
---|
[939] | 683 | }
|
---|
[804] | 684 |
|
---|
[2421] | 685 | if(SimpleMatrixOperation<T>::GausPiv(a,d)==(T) 0)
|
---|
| 686 | throw SingMatrixExc("LinFitter<T>::LinFit(...ErrY2...) - Non invertible matrix (by GausPiv())");
|
---|
[804] | 687 |
|
---|
[2421] | 688 |
|
---|
[3332] | 689 | for(sa_size_t l=0; l<nf; l++) {
|
---|
[939] | 690 | c(l) = d(l,0); // Parametres = 1ere colonne
|
---|
| 691 | errC(l) = d(l,l+1); // Erreurs = diag inverse.
|
---|
| 692 | }
|
---|
[804] | 693 |
|
---|
[939] | 694 | r_8 xi2 = 0., ax;
|
---|
| 695 | T x;
|
---|
[3332] | 696 | for(sa_size_t jj=0; jj<n; jj++) {
|
---|
[939] | 697 | x = (T) 0;
|
---|
[3332] | 698 | for(sa_size_t ii=0; ii<nf; ii++) x += c(ii) * fx(ii,jj);
|
---|
[804] | 699 | x -= y(jj);
|
---|
[939] | 700 | ax = TMatrixRC<T>::Abs_Value(x);
|
---|
| 701 | xi2 += ax*ax/TMatrixRC<T>::Abs_Value(errY2(jj));
|
---|
[804] | 702 | }
|
---|
| 703 | return xi2;
|
---|
| 704 | }
|
---|
| 705 |
|
---|
[2881] | 706 | } // Fin namespace SOPHYA
|
---|
[939] | 707 | ///////////////////////////////////////////////////////////////////////////
|
---|
| 708 | ///////////////////////////////////////////////////////////////////////////
|
---|
| 709 | ///////////////////////////////////////////////////////////////////////////
|
---|
| 710 | ///////////////////////////////////////////////////////////////////////////
|
---|
[2883] | 711 |
|
---|
[813] | 712 | void _ZZ_TestTMatrixRC_YY_(TMatrix<r_8> & m)
|
---|
| 713 | {
|
---|
| 714 | cout << " ::::: _ZZ_TestTMatrixRC_YY_ :::: M= \n" << m << endl;
|
---|
| 715 | TMatrixRC<r_8> l0 = TMatrixRC<r_8>::Row(m,0);
|
---|
| 716 | cout << "TMatrixRC<r_8>::Row(m,0) = \n" ;
|
---|
| 717 | l0.Print(cout);
|
---|
| 718 | TMatrixRC<r_8> l1 = TMatrixRC<r_8>::Row(m,1);
|
---|
| 719 | cout << "TMatrixRC<r_8>::Row(m,1) = \n" ;
|
---|
| 720 | l1.Print(cout);
|
---|
| 721 | l0.SetRow(2);
|
---|
| 722 | cout << "TMatrixRC<r_8>::l0.SetRow(2 = \n" ;
|
---|
| 723 | l0.Print(cout);
|
---|
[804] | 724 |
|
---|
[813] | 725 | TMatrixRC<r_8> c0 = TMatrixRC<r_8>::Col(m,0);
|
---|
| 726 | cout << "TMatrixRC<r_8>::Col(m,0) = \n" ;
|
---|
| 727 | c0.Print(cout);
|
---|
| 728 | TMatrixRC<r_8> c1 = TMatrixRC<r_8>::Col(m,1);
|
---|
| 729 | cout << "TMatrixRC<r_8>::Col(m,1) = \n" ;
|
---|
| 730 | c1.Print(cout);
|
---|
| 731 | c0.SetCol(2);
|
---|
| 732 | cout << "TMatrixRC<r_8>::c0.SetCol(2) = \n" ;
|
---|
| 733 | c0.Print(cout);
|
---|
| 734 | TMatrixRC<r_8> c00 = TMatrixRC<r_8>::Col(m,0);
|
---|
| 735 | TMatrixRC<r_8>::Swap(c0, c00);
|
---|
| 736 | cout << " ::::: M Apres Swap = \n" << m << endl;
|
---|
| 737 |
|
---|
| 738 | }
|
---|
[2883] | 739 |
|
---|
[772] | 740 | ///////////////////////////////////////////////////////////////
|
---|
| 741 | #ifdef __CXX_PRAGMA_TEMPLATES__
|
---|
| 742 | // Instances gestion lignes/colonnes
|
---|
| 743 | #pragma define_template TMatrixRC<int_4>
|
---|
| 744 | #pragma define_template TMatrixRC<r_4>
|
---|
| 745 | #pragma define_template TMatrixRC<r_8>
|
---|
[926] | 746 | #pragma define_template TMatrixRC< complex<r_4> >
|
---|
| 747 | #pragma define_template TMatrixRC< complex<r_8> >
|
---|
[804] | 748 | #pragma define_template SimpleMatrixOperation<int_4>
|
---|
| 749 | #pragma define_template SimpleMatrixOperation<r_4>
|
---|
[772] | 750 | #pragma define_template SimpleMatrixOperation<r_8>
|
---|
[926] | 751 | #pragma define_template SimpleMatrixOperation< complex<r_4> >
|
---|
| 752 | #pragma define_template SimpleMatrixOperation< complex<r_8> >
|
---|
[939] | 753 | #pragma define_template LinFitter<r_4>
|
---|
| 754 | #pragma define_template LinFitter<r_8>
|
---|
| 755 | #pragma define_template LinFitter< complex<r_4> >
|
---|
| 756 | #pragma define_template LinFitter< complex<r_8> >
|
---|
[772] | 757 | #endif
|
---|
| 758 |
|
---|
| 759 | #if defined(ANSI_TEMPLATES) || defined(GNU_TEMPLATES)
|
---|
[2868] | 760 | namespace SOPHYA {
|
---|
[772] | 761 | // Instances gestion lignes/colonnes
|
---|
| 762 | template class TMatrixRC<int_4>;
|
---|
| 763 | template class TMatrixRC<r_4>;
|
---|
| 764 | template class TMatrixRC<r_8>;
|
---|
[926] | 765 | template class TMatrixRC< complex<r_4> >;
|
---|
| 766 | template class TMatrixRC< complex<r_8> >;
|
---|
[804] | 767 | template class SimpleMatrixOperation<int_4>;
|
---|
[772] | 768 | template class SimpleMatrixOperation<r_4>;
|
---|
| 769 | template class SimpleMatrixOperation<r_8>;
|
---|
[926] | 770 | template class SimpleMatrixOperation< complex<r_4> >;
|
---|
| 771 | template class SimpleMatrixOperation< complex<r_8> >;
|
---|
[939] | 772 | template class LinFitter<r_4>;
|
---|
| 773 | template class LinFitter<r_8>;
|
---|
| 774 | template class LinFitter< complex<r_4> >;
|
---|
| 775 | template class LinFitter< complex<r_8> >;
|
---|
[2868] | 776 | }
|
---|
[772] | 777 | #endif
|
---|
[935] | 778 |
|
---|