Index: /trunk/SophyaPI/PIext/nomskymapadapter.cc
===================================================================
--- /trunk/SophyaPI/PIext/nomskymapadapter.cc	(revision 585)
+++ /trunk/SophyaPI/PIext/nomskymapadapter.cc	(revision 585)
@@ -0,0 +1,224 @@
+#include "machdefs.h"
+#include <stdlib.h>
+#include <typeinfo>
+#include <iostream.h>
+#include <string>
+#include <complex>
+
+#include "nomskymapadapter.h"
+#include "spherethetaphi.h"
+#include "spheregorski.h"
+#include "localmap.h"
+
+
+//----------------------------------------------------------------
+// Class Adaptateur d'objet (Pour NamedObjMgr) d'objet PixelMap<T>
+//----------------------------------------------------------------
+
+
+/* --Methode-- */
+template <class T> 
+NOMAdapter_PixelMap<T>::NOMAdapter_PixelMap(PixelMap<T> * o)
+  : NObjMgrAdapter((AnyDataObj *)o)
+{
+mMap = o;
+}
+
+/* --Methode-- */
+template <class T> 
+NOMAdapter_PixelMap<T>::~NOMAdapter_PixelMap()
+{
+}
+
+/* --Methode-- */
+template <class T> 
+NObjMgrAdapter* NOMAdapter_PixelMap<T>::Clone(AnyDataObj* o)
+{
+PixelMap<T>* m = dynamic_cast<PixelMap<T> *>(o);
+if (m) return ( new NOMAdapter_PixelMap<T>(m) );
+return ( new NObjMgrAdapter(o) );
+}
+
+/* --Methode-- */
+template <class T> 
+AnyDataObj* NOMAdapter_PixelMap<T>::GetCopyObj()
+{
+LocalMap<T>* lm = dynamic_cast< LocalMap<T> * >(mMap); 
+if (lm != NULL) return( new LocalMap<T>(*lm) );
+SphereThetaPhi<T>* st = dynamic_cast< SphereThetaPhi<T> * >(mMap); 
+if (st != NULL) return( new SphereThetaPhi<T>(*st) );
+SphereGorski<T>* sg = dynamic_cast< SphereGorski<T> * >(mMap); 
+if (sg != NULL) return( new SphereGorski<T>(*sg) );
+return(NULL);
+}
+
+/* --Methode-- */
+template <class T> 
+void NOMAdapter_PixelMap<T>::SavePPF(POutPersist& pos, string const & nom)
+{
+LocalMap<T>* lm = dynamic_cast< LocalMap<T> * >(mMap); 
+if (lm != NULL) {
+  FIO_LocalMap<T> fio(lm);
+  fio.Write(pos, nom);
+  return;
+  }
+SphereThetaPhi<T>* st = dynamic_cast< SphereThetaPhi<T> * >(mMap); 
+if (st != NULL) {
+  FIO_SphereThetaPhi<T> fio(st);
+  fio.Write(pos, nom);
+  return;
+  }
+SphereGorski<T>* sg = dynamic_cast< SphereGorski<T> * >(mMap); 
+if (sg != NULL) {
+  FIO_SphereGorski<T> fio(sg);
+  fio.Write(pos, nom);
+  return;
+  }
+string s = typeid(*mMap).name();
+cout << "NOMAdapter_PixelMap<T>::SavePPF() - Error : Not supported for " << s << endl;
+}
+
+/* --Methode-- */
+template <class T> 
+void NOMAdapter_PixelMap<T>::Print(ostream& os)
+{
+string s = typeid(*mMap).name();
+cout << "SkyMap Type: " << s << " NbPixels= " << mMap->NbPixels() << endl;
+}
+
+
+/* --Methode-- */
+template <class T> 
+P2DArrayAdapter* NOMAdapter_PixelMap<T>::Get2DArray(string &)
+{
+return(NULL);
+}
+
+/* --Methode-- */
+template <class T> 
+NTupleInterface* NOMAdapter_PixelMap<T>::GetNTupleInterface(bool& adel)
+{
+adel = true;
+return( new NTupInt_PixelMap<T>(mMap) );
+}
+
+
+
+// -------------------------------------------------------------
+
+/* --Methode-- */
+template <class T> 
+NTupInt_PixelMap<T>::NTupInt_PixelMap(PixelMap<T>* m)
+{
+mMap = m;
+}
+
+/* --Methode-- */
+template <class T> 
+NTupInt_PixelMap<T>::~NTupInt_PixelMap()
+{
+}
+
+/* --Methode-- */
+template <class T> 
+uint_4 NTupInt_PixelMap<T>::NbLines() const
+{
+return( mMap->NbPixels() );
+}
+
+/* --Methode-- */
+template <class T> 
+uint_4 NTupInt_PixelMap<T>::NbColumns() const 
+{
+return(8);
+}
+
+/* --Methode-- */
+template <class T> 
+r_8* NTupInt_PixelMap<T>::GetLineD(int n) const 
+{
+int i;
+if ((n < 0) || (n >= (int)(mMap->NbPixels()) )) 
+    for(i=0; i<8; i++)  mRet[i] = 0.;
+else { 
+  double teta,phi;
+  mMap->PixThetaPhi(n, teta, phi);
+  mRet[0] = n;  mRet[1] = mMap->PixVal(n);
+  mRet[2] = mRet[1];  mRet[3] = 0.;
+  mRet[4] = mRet[1];  mRet[5] = 0.;
+  mRet[6] = teta;     mRet[7] = phi;
+  }
+return(mRet);
+}
+
+/* --Methode-- */
+template <class T> 
+string NTupInt_PixelMap<T>::VarList_C(const char* nx) const 
+{
+string nomx;
+if (nx) nomx = nx;
+else nomx = "_xh_";
+string vardec = "double i,k,val,real,imag,mod,phas,teta,phi; \n";
+vardec += "i = " + nomx + "[0]; k = " + nomx + "[0];  val = " + nomx + "[1]; \n";
+vardec += "real = " + nomx + "[2];  imag = " + nomx + "[3]; \n";
+vardec += "mod  = " + nomx + "[4];  phas = " + nomx + "[5]; \n";
+vardec += "teta = " + nomx + "[6];  phi  = " + nomx + "[7]; \n";
+return(vardec);
+}
+
+r_8* NTupInt_PixelMap< complex<float> >::GetLineD(int n) const 
+{
+int i;
+if ((n < 0) || (n >= (int)(mMap->NbPixels()) )) 
+    for(i=0; i<8; i++)  mRet[i] = 0.;
+else { 
+  double teta,phi;
+  mMap->PixThetaPhi(n, teta, phi);
+  mRet[0] = n;  
+  mRet[2] = mMap->PixVal(n).real();  mRet[3] = mMap->PixVal(n).imag();
+  mRet[1] = mRet[4] = sqrt(mRet[2]*mRet[2]+mRet[3]*mRet[3]);
+  mRet[5] = atan2(mRet[3], mRet[2]);
+  mRet[6] = teta;     mRet[7] = phi;
+  }
+return(mRet);
+}
+
+r_8* NTupInt_PixelMap< complex<double> >::GetLineD(int n) const 
+{
+int i;
+if ((n < 0) || (n >= (int)(mMap->NbPixels()) )) 
+    for(i=0; i<8; i++)  mRet[i] = 0.;
+else { 
+  double teta,phi;
+  mMap->PixThetaPhi(n, teta, phi);
+  mRet[0] = n;  
+  mRet[2] = mMap->PixVal(n).real();  mRet[3] = mMap->PixVal(n).imag();
+  mRet[1] = mRet[4] = sqrt(mRet[2]*mRet[2]+mRet[3]*mRet[3]);
+  mRet[5] = atan2(mRet[3], mRet[2]);
+  mRet[6] = teta;     mRet[7] = phi;
+  }
+return(mRet);
+}
+
+
+#ifdef __CXX_PRAGMA_TEMPLATES__
+#pragma define_template NOMAdapter_PixelMap<r_4>
+#pragma define_template NOMAdapter_PixelMap<r_8>
+#pragma define_template NOMAdapter_PixelMap< complex<float> >
+#pragma define_template NOMAdapter_PixelMap< complex<double> >
+#pragma define_template NTupInt_PixelMap<r_4>
+#pragma define_template NTupInt_PixelMap<r_8>
+#pragma define_template NTupInt_PixelMap< complex<float> >
+#pragma define_template NTupInt_PixelMap< complex<double> >
+#endif
+
+#if defined(ANSI_TEMPLATES) 
+template class NOMAdapter_PixelMap<r_4>;
+template class NOMAdapter_PixelMap<r_8>;
+template class NOMAdapter_PixelMap< complex<float> >;
+template class NOMAdapter_PixelMap< complex<double> >;
+template class NTupInt_PixelMap<r_4>;
+template class NTupInt_PixelMap<r_8>;
+template class NTupInt_PixelMap< complex<float> >;
+template class NTupInt_PixelMap< complex<double> >;
+#endif
Index: /trunk/SophyaPI/PIext/nomskymapadapter.h
===================================================================
--- /trunk/SophyaPI/PIext/nomskymapadapter.h	(revision 585)
+++ /trunk/SophyaPI/PIext/nomskymapadapter.h	(revision 585)
@@ -0,0 +1,57 @@
+// This may look like C code, but it is really -*- C++ -*-
+// Adaptateur d objets (pour NamedObjMgr) pour les classes 
+// PixelMap/SphericalMap/LocalMap  de Sophya
+//                                      Reza 11/99
+//  LAL-IN2P3/CNRS               CEA-DAPNIA     
+ 
+#ifndef NOMSKYMAPADAPTER_H_SEEN
+#define NOMSKYMAPADAPTER_H_SEEN
+
+#include "nomgadapter.h"
+#include "pixelmap.h"
+
+
+
+//----------------------------------------------------------------
+// Class Adaptateur d'objet (Pour NamedObjMgr) d'objet PixelMap<T> 
+//----------------------------------------------------------------
+
+template <class T> 
+class NOMAdapter_PixelMap : public NObjMgrAdapter {
+public:
+				NOMAdapter_PixelMap(PixelMap<T>* m = NULL);
+  virtual			~NOMAdapter_PixelMap();
+
+  virtual NObjMgrAdapter*	Clone(AnyDataObj* o);
+  virtual AnyDataObj*		GetCopyObj();
+
+  //  virtual void			ReadFits(string const & flnm);
+  //  virtual void			SaveFits(string const & flnm);
+  virtual void			SavePPF(POutPersist& s, string const & nom);
+
+  virtual void			Print(ostream& os);
+  virtual P2DArrayAdapter*	Get2DArray(string& dopt);
+  virtual NTupleInterface*	GetNTupleInterface(bool& adel);
+
+protected:
+  PixelMap<T>* mMap;
+};
+
+// Class Interface NTuple pour PixelMap<T>
+
+template <class T> 
+class NTupInt_PixelMap : public NTupleInterface {
+public:
+			NTupInt_PixelMap(PixelMap<T>* m);
+  virtual		~NTupInt_PixelMap();
+  virtual uint_4        NbLines() const ;
+  virtual uint_4        NbColumns() const ;
+  virtual r_8 *         GetLineD(int n) const ;
+  virtual string        VarList_C(const char* nomx=NULL) const ;
+protected:
+  PixelMap<T>* mMap;
+  mutable r_8 mRet[8];
+};
+
+
+#endif
Index: /trunk/SophyaPI/PIext/nomtmatvecadapter.cc
===================================================================
--- /trunk/SophyaPI/PIext/nomtmatvecadapter.cc	(revision 585)
+++ /trunk/SophyaPI/PIext/nomtmatvecadapter.cc	(revision 585)
@@ -0,0 +1,239 @@
+#include "machdefs.h"
+#include <stdlib.h>
+#include <typeinfo>
+#include <iostream.h>
+#include <string>
+#include <complex>
+
+#include "tvector.h"
+#include "nomtmatvecadapter.h"
+#include "piscdrawwdg.h"
+#include "pitvmaad.h"
+
+
+
+
+//----------------------------------------------------------------
+// Class Adaptateur d'objet (Pour NamedObjMgr) d'objet TMatrix<T> 
+//----------------------------------------------------------------
+
+
+/* --Methode-- */
+template <class T> 
+NOMAdapter_TMatrix<T>::NOMAdapter_TMatrix(TMatrix<T>* o)
+  : NObjMgrAdapter(o)
+{
+mMtx = o;
+}
+
+/* --Methode-- */
+template <class T> 
+NOMAdapter_TMatrix<T>::~NOMAdapter_TMatrix()
+{
+}
+
+/* --Methode-- */
+template <class T> 
+NObjMgrAdapter* NOMAdapter_TMatrix<T>::Clone(AnyDataObj* o)
+{
+TMatrix<T>* m = dynamic_cast<TMatrix<T> *>(o);
+if (m) return ( new NOMAdapter_TMatrix<T>(m) );
+return ( new NObjMgrAdapter(o) );
+}
+
+/* --Methode-- */
+template <class T> 
+AnyDataObj* NOMAdapter_TMatrix<T>::GetCopyObj()
+{
+if (mMtx == NULL)  return(NULL);
+TVector<T>* v = dynamic_cast<TVector<T> *>(mMtx);
+if (v != NULL) return( new TVector<T>(*v) );
+else return ( new TMatrix<T>(*mMtx) );
+}
+
+/* --Methode-- */
+template <class T> 
+void NOMAdapter_TMatrix<T>::SavePPF(POutPersist& pos, string const & nom)
+{
+if (mMtx == NULL)  return;
+TVector<T>* v = dynamic_cast<TVector<T> *>(mMtx);
+if (v != NULL) {
+  FIO_TVector<T> fio(v);
+  fio.Write(pos, nom);
+  }
+else {
+  FIO_TMatrix<T> fio(mMtx);
+  fio.Write(pos, nom);
+  }
+}
+
+/* --Methode-- */
+template <class T> 
+void NOMAdapter_TMatrix<T>::Print(ostream& os)
+{
+TVector<T>* v = dynamic_cast<TVector<T> *>(mMtx);
+if (v != NULL)  os << (*v);
+else os << (*mMtx);
+}
+
+/* --Methode-- */
+template <class T> 
+PIDrawer* NOMAdapter_TMatrix<T>::GetDrawer(string & dopt)
+{
+TVector<T>* v = dynamic_cast<TVector<T> *>(mMtx);
+if (v == NULL) return(NULL);
+else {
+  dopt = "thinline," + dopt;
+  return( new PIYfXDrawer( new POTVectorAdapter<T>(v, false), NULL, true) );
+  }
+}
+
+/* --Methode-- */
+template <class T> 
+P2DArrayAdapter* NOMAdapter_TMatrix<T>::Get2DArray(string &)
+{
+return ( new POTMatrixAdapter<T>(mMtx, false) );
+}
+
+/* --Methode-- */
+template <class T> 
+NTupleInterface* NOMAdapter_TMatrix<T>::GetNTupleInterface(bool& adel)
+{
+adel = true;
+return( new NTupInt_TMatrix<T>(mMtx) );
+}
+
+
+
+// -------------------------------------------------------------
+
+/* --Methode-- */
+template <class T> 
+NTupInt_TMatrix<T>::NTupInt_TMatrix(TMatrix<T>* m)
+{
+mMtx = m;
+}
+
+/* --Methode-- */
+template <class T> 
+NTupInt_TMatrix<T>::~NTupInt_TMatrix()
+{
+}
+
+/* --Methode-- */
+template <class T> 
+uint_4 NTupInt_TMatrix<T>::NbLines() const
+{
+return( mMtx->NRows()*mMtx->NCols() );
+}
+
+/* --Methode-- */
+template <class T> 
+uint_4 NTupInt_TMatrix<T>::NbColumns() const 
+{
+return(8);
+}
+
+/* --Methode-- */
+template <class T> 
+r_8* NTupInt_TMatrix<T>::GetLineD(int n) const 
+{
+int i,j;
+if ((n < 0) || (n >= (int)(mMtx->NRows()*mMtx->NCols()) )) {
+  mRet[0] = n;
+  for(i=1; i<8; i++)  mRet[i] = 0.;
+}
+else { 
+  i = n/mMtx->NCols(); j = n%mMtx->NCols(); 
+  mRet[0] = n;  mRet[1] = i;  mRet[2] = j;  
+  mRet[3] = (*mMtx)(i,j);
+  mRet[4] = mRet[2];  mRet[5] = 0.;
+  mRet[6] = mRet[2];  mRet[7] = 0.;
+  }
+return(mRet);
+}
+
+/* --Methode-- */
+template <class T> 
+string NTupInt_TMatrix<T>::VarList_C(const char* nx) const 
+{
+string nomx;
+if (nx) nomx = nx;
+else nomx = "_xh_";
+string vardec = "double n,r,c,val,real,imag,mod,phas; \n";
+vardec += "n = " + nomx + "[0];  r = " + nomx + "[1]; c = " + nomx + "[2]; \n"; 
+vardec += "val = " + nomx + "[3]; \n";
+vardec += "real = " + nomx + "[4];  imag = " + nomx + "[5]; \n";
+vardec += "mod  = " + nomx + "[6];  phas = " + nomx + "[7]; \n";
+return(vardec);
+}
+
+/* --Methode-- */
+r_8* NTupInt_TMatrix< complex<float> >::GetLineD(int n) const 
+{
+int i,j;
+if ((n < 0) || (n >= (int)(mMtx->NRows()*mMtx->NCols()) )) {
+  mRet[0] = n;
+  for(i=1; i<8; i++)  mRet[i] = 0.;
+}
+else { 
+  i = n/mMtx->NCols(); j = n%mMtx->NCols(); 
+  mRet[0] = n;   mRet[1] = i;  mRet[2] = j;  
+  mRet[4] = (*mMtx)(i,j).real();  mRet[5] = (*mMtx)(i,j).imag();
+  mRet[3] = mRet[6] = sqrt(mRet[4]*mRet[4]+mRet[5]*mRet[5]);
+  mRet[7] = atan2(mRet[5], mRet[4]);
+}
+return(mRet);
+}
+
+r_8* NTupInt_TMatrix< complex<double> >::GetLineD(int n) const 
+{
+int i,j;
+if ((n < 0) || (n >= (int)(mMtx->NRows()*mMtx->NCols()) )) {
+  mRet[0] = n;
+  for(i=1; i<8; i++)  mRet[i] = 0.;
+}
+else { 
+  i = n/mMtx->NCols(); j = n%mMtx->NCols(); 
+  mRet[0] = n;   mRet[1] = i;  mRet[2] = j;  
+  mRet[4] = (*mMtx)(i,j).real();  mRet[5] = (*mMtx)(i,j).imag();
+  mRet[3] = mRet[6] = sqrt(mRet[4]*mRet[4]+mRet[5]*mRet[5]);
+  mRet[7] = atan2(mRet[5], mRet[4]);
+}
+return(mRet);
+}
+
+
+#ifdef __CXX_PRAGMA_TEMPLATES__
+//#pragma define_template NOMAdapter_TMatrix<uint_2>
+//#pragma define_template NOMAdapter_TMatrix<int_2>
+#pragma define_template NOMAdapter_TMatrix<int_4>
+#pragma define_template NOMAdapter_TMatrix<r_4>
+#pragma define_template NOMAdapter_TMatrix<r_8>
+#pragma define_template NOMAdapter_TMatrix< complex<float> >
+#pragma define_template NOMAdapter_TMatrix< complex<double> >
+//#pragma define_template NTupInt_TMatrix<uint_2>
+//#pragma define_template NTupInt_TMatrix<int_2>
+#pragma define_template NTupInt_TMatrix<int_4>
+#pragma define_template NTupInt_TMatrix<r_4>
+#pragma define_template NTupInt_TMatrix<r_8>
+#pragma define_template NTupInt_TMatrix< complex<float> >
+#pragma define_template NTupInt_TMatrix< complex<double> >
+#endif
+
+#if defined(ANSI_TEMPLATES) 
+//template class NOMAdapter_TMatrix<uint_2>;
+//template class NOMAdapter_TMatrix<int_2>;
+template class NOMAdapter_TMatrix<int_4>;
+template class NOMAdapter_TMatrix<r_4>;
+template class NOMAdapter_TMatrix<r_8>;
+template class NOMAdapter_TMatrix< complex<float> >;
+template class NOMAdapter_TMatrix< complex<double> >;
+// template class NTupInt_TMatrix<uint_2>;
+// template class NTupInt_TMatrix<int_2>;
+template class NTupInt_TMatrix<int_4>;
+template class NTupInt_TMatrix<r_4>;
+template class NTupInt_TMatrix<r_8>;
+template class NTupInt_TMatrix< complex<float> >;
+template class NTupInt_TMatrix< complex<double> >;
+#endif
Index: /trunk/SophyaPI/PIext/nomtmatvecadapter.h
===================================================================
--- /trunk/SophyaPI/PIext/nomtmatvecadapter.h	(revision 585)
+++ /trunk/SophyaPI/PIext/nomtmatvecadapter.h	(revision 585)
@@ -0,0 +1,56 @@
+// This may look like C code, but it is really -*- C++ -*-
+// Adaptateur d objets (pour NamedObjMgr) 
+// pour les classes TMatrix<T>, TVector<T> de Sophya
+//                                      Reza 11/99
+//  LAL-IN2P3/CNRS               CEA-DAPNIA     
+ 
+#ifndef NOMTMATVECADAPTER_H_SEEN
+#define NOMTMATVECADAPTER_H_SEEN
+
+#include "nomgadapter.h"
+#include "tmatrix.h"
+
+//---------------------------------------------------------------
+// Class Adaptateur d'objet (Pour NamedObjMgr) d'objet TMatrix 
+//---------------------------------------------------------------
+
+template <class T> 
+class NOMAdapter_TMatrix : public NObjMgrAdapter {
+public:
+				NOMAdapter_TMatrix(TMatrix<T>* m = NULL);
+  virtual			~NOMAdapter_TMatrix();
+
+  virtual NObjMgrAdapter*	Clone(AnyDataObj* o);
+  virtual AnyDataObj*		GetCopyObj();
+
+  //  virtual void			ReadFits(string const & flnm);
+  //  virtual void			SaveFits(string const & flnm);
+  virtual void			SavePPF(POutPersist& s, string const & nom);
+
+  virtual void			Print(ostream& os);
+  virtual PIDrawer*		GetDrawer(string& dopt);
+  virtual P2DArrayAdapter*	Get2DArray(string& dopt);
+  virtual NTupleInterface*	GetNTupleInterface(bool& adel);
+
+protected:
+  TMatrix<T>* mMtx;
+};
+
+// Class Interface NTuple pour TMatrix<T>
+
+template <class T> 
+class NTupInt_TMatrix : public NTupleInterface {
+public:
+			NTupInt_TMatrix(TMatrix<T>* m);
+  virtual		~NTupInt_TMatrix();
+  virtual uint_4        NbLines() const ;
+  virtual uint_4        NbColumns() const ;
+  virtual r_8 *         GetLineD(int n) const ;
+  virtual string        VarList_C(const char* nomx=NULL) const ;
+protected:
+  TMatrix<T>* mMtx;
+  mutable r_8 mRet[8];
+};
+
+
+#endif
Index: /trunk/SophyaPI/PIext/pitvmaad.h
===================================================================
--- /trunk/SophyaPI/PIext/pitvmaad.h	(revision 585)
+++ /trunk/SophyaPI/PIext/pitvmaad.h	(revision 585)
@@ -0,0 +1,87 @@
+// This may look like C code, but it is really -*- C++ -*-
+//  Adaptateurs pour TMatrix TVector du package Sophya
+//                             R. Ansari  1/99
+// LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
+
+#ifndef PITVMAAD_H_SEEN
+#define PITVMAAD_H_SEEN
+
+#include "machdefs.h"
+#include <math.h>
+#include "parradapter.h"
+
+#include "tmatrix.h"
+#include "tvector.h"
+
+
+// Adaptateur de vecteurs SOPHYA a P1DArrayAdapter
+template <class T> 
+class POTVectorAdapter : public P1DArrayAdapter {
+public :
+		  POTVectorAdapter(TVector<T>* v, bool ad=false) 
+		        : P1DArrayAdapter(v->NElts())
+	     			{ aDel = ad; mVec = v; }
+  virtual         ~POTVectorAdapter()
+				{ if (aDel) delete mVec; }
+  virtual double  Value(int i)
+				{ return((*mVec)(i)); }
+
+protected:
+  bool aDel;
+  TVector<T>* mVec;
+};
+
+typedef POTVectorAdapter<r_8> POVectorAdapter;
+
+double POTVectorAdapter< complex<float> >::Value(int i)
+{
+double re,im;
+re = (*mVec)(i).real();
+im = (*mVec)(i).imag();
+return(sqrt(re*re+im*im));
+}
+
+double POTVectorAdapter< complex<double> >::Value(int i)
+{
+double re,im;
+re = (*mVec)(i).real();
+im = (*mVec)(i).imag();
+return(sqrt(re*re+im*im));
+}
+
+// Adaptateur de matrice SOPHYA a P2DArrayAdapter
+// Attention MatrixAdapter(X=Colonne, Y= Row) = Matrix(row, col)  
+template <class T> 
+class POTMatrixAdapter :  public P2DArrayAdapter {
+public :
+                  POTMatrixAdapter(TMatrix<T>* mtx, bool ad=false)
+			: P2DArrayAdapter(mtx->NCols(), mtx->NRows())
+			{ aDel = ad; mMtx = mtx; }
+  virtual         ~POTMatrixAdapter()
+			{ if (aDel)  delete mMtx; }
+  virtual double  Value(int ix, int iy)
+			{ return((double)(*mMtx)(iy, ix)); }
+
+protected:
+  bool aDel;
+  TMatrix<T>* mMtx;
+};
+
+typedef POTMatrixAdapter<r_8> POMatrixAdapter;
+
+double POTMatrixAdapter< complex<float> >::Value(int ix, int iy)
+{
+double re,im;
+re = (*mMtx)(iy, ix).real();
+im = (*mMtx)(iy, ix).imag();
+return(sqrt(re*re+im*im));
+}
+
+double POTMatrixAdapter< complex<double> >::Value(int ix, int iy)
+{
+double re,im;
+re = (*mMtx)(iy, ix).real();
+im = (*mMtx)(iy, ix).imag();
+return(sqrt(re*re+im*im));
+}
+#endif
