From 264ae31920c2fe40a88b5511d7cad405ba7776b6 Mon Sep 17 00:00:00 2001
From: ansari <>
Date: Fri, 23 Feb 2001 17:47:44 +0000
Subject: [PATCH] MAJ documentation - Reza 23/2/2001

---
 IFFTW/fftwserver.cc  |  6 ++++
 LinAlg/intflapack.cc | 79 ++++++++++++++++++++++++++++++++++++++++++++
 LinAlg/intflapack.h  | 18 ++++++++--
 3 files changed, 101 insertions(+), 2 deletions(-)

diff --git a/IFFTW/fftwserver.cc b/IFFTW/fftwserver.cc
index 5cbf692..dc5a037 100644
--- a/IFFTW/fftwserver.cc
+++ b/IFFTW/fftwserver.cc
@@ -2,6 +2,12 @@
 #include "FFTW/fftw.h"
 #include "FFTW/rfftw.h"
 
+/*!
+   \defgroup IFFTW IFFTW module
+   Module containing interface classes between Sophya objects
+   and FFTW Fourier transform package (see http://www.fftw.org )
+*/
+
 /*! 
   \class SOPHYA::FFTWServer
   \ingroup IFFTW
diff --git a/LinAlg/intflapack.cc b/LinAlg/intflapack.cc
index e73d094..5134eb0 100644
--- a/LinAlg/intflapack.cc
+++ b/LinAlg/intflapack.cc
@@ -4,6 +4,52 @@
 #include "tmatrix.h"
 #include <typeinfo>
 
+/*!
+   \defgroup LinAlg LinAlg module
+   This module contains classes and functions for complex linear
+   algebra on arrays. This module is intended mainly to have 
+   classes implementing C++ interfaces between Sophya objects
+   and external linear algebra libraries, such as LAPACK.  
+*/
+
+/*! 
+  \class SOPHYA::LapackServer
+  \ingroup LinAlg
+  This class implements an interface to LAPACK library driver routines.
+  The LAPACK (Linear Algebra PACKage) is a collection high performance 
+  routines to solve common problems in numerical linear algebra. 
+  its is available from http://www.netlib.org.
+  
+  The present version of our LapackServer (Feb 2001) provides only 
+  interfaces for the linear system solver and singular value 
+  decomposition (SVD). Only arrays with BaseArray::FortranMemoryMapping 
+  can be handled by LapackServer. LapackServer can be instanciated 
+  for simple and double precision real or complex array types.
+
+  The example below shows solving a linear system A*X = B
+
+  \code
+  #include "intflapack.h"
+  // ...
+  // Use FortranMemoryMapping as default
+  BaseArray::SetDefaultMemoryMapping(BaseArray::FortranMemoryMapping);
+  // Create an fill the arrays A and B
+  int n = 20;
+  Matrix A(n, n);
+  A = RandomSequence();
+  Vector X(n),B(n);
+  X = RandomSequence();
+  B = A*X;
+  // Solve the linear system A*X = B
+  LapackServer<r_8> lps;
+  lps.LinSolve(A,B);
+  // We get the result in B, which should be equal to X ...
+  // Compute the difference B-X ;
+  Vector diff = B-X;
+  \endcode
+
+*/
+
 extern "C" {
 // Drivers pour resolution de systemes lineaires
   void sgesv_(int_4* n, int_4* nrhs, r_4* a, int_4* lda, 
@@ -45,6 +91,13 @@ LapackServer<T>::~LapackServer()
 {
 }
 
+//! Interface to Lapack linear system solver driver s/d/c/zgesvd().
+/*! Solve the linear system a * x = b. Input arrays
+  should have FortranMemory mapping (column packed).
+  \param a : input matrix, overwritten on output
+  \param b : input-output, input vector b, contains x on exit
+  \return : return code from lapack driver _gesv()
+ */
 template <class T>
 int LapackServer<T>::LinSolve(TArray<T>& a, TArray<T> & b)
 {
@@ -90,18 +143,44 @@ int LapackServer<T>::LinSolve(TArray<T>& a, TArray<T> & b)
   return(info);
 }
 
+//! Interface to Lapack SVD driver s/d/c/zgesv().
+/*! Computes the vector of singular values of \b a. Input arrays
+  should have FortranMemoryMapping (column packed).
+  \param a : input m-by-n matrix 
+  \param s : Vector of min(m,n) singular values (descending order)
+  \return : return code from lapack driver _gesvd()
+ */
+
 template <class T>
 int LapackServer<T>::SVD(TArray<T>& a, TArray<T> & s)
 {
   return (SVDDriver(a, s, NULL, NULL) );
 }
 
+//! Interface to Lapack SVD driver s/d/c/zgesv().
+/*! Computes the vector of singular values of \b a, as well as
+  right and left singular vectors of \b a.
+  \f[
+  A = U \Sigma V^T , ( A = U \Sigma V^H \ complex)
+  \f]
+  \f[
+  A v_i = \sigma_i u_i \ and A^T u_i = \sigma_i v_i \ (A^H \ complex)
+  \f]
+  U and V are orthogonal (unitary) matrices.
+  \param a : input m-by-n matrix (in FotranMemoryMapping)
+  \param s : Vector of min(m,n) singular values (descending order)
+  \param u : Matrix of left singular vectors
+  \param vt : Transpose of right singular vectors.
+  \return : return code from lapack driver _gesvd()
+ */
 template <class T>
 int LapackServer<T>::SVD(TArray<T>& a, TArray<T> & s, TArray<T> & u, TArray<T> & vt)
 {
   return (SVDDriver(a, s, &u, &vt) );
 }
 
+
+//! Interface to Lapack SVD driver s/d/c/zgesv().
 template <class T>
 int LapackServer<T>::SVDDriver(TArray<T>& a, TArray<T> & s, TArray<T>* up, TArray<T>* vtp)
 {
diff --git a/LinAlg/intflapack.h b/LinAlg/intflapack.h
index 460b8d1..845bf14 100644
--- a/LinAlg/intflapack.h
+++ b/LinAlg/intflapack.h
@@ -16,8 +16,11 @@ public:
   virtual int SVD(TArray<T>& a, TArray<T> & s); 
   virtual int SVD(TArray<T>& a, TArray<T> & s, TArray<T> & u, TArray<T> & vt); 
 
+  //! Set the workspace size factor for LAPACK routines
   inline void SetWorkSpaceSizeFactor(int f = 2)
   { wspace_size_factor = (f > 1) ? f : 1; }
+
+  //! Returns the workspace size factor
   inline int  GetWorkSpaceSizeFactor() 
   { return wspace_size_factor; }
 
@@ -28,14 +31,27 @@ private:
   int wspace_size_factor;
 };
 
+/*! \ingroup LinAlg
+    \fn LapackLinSolve(TArray<T>&, TArray<T> &)
+    \brief Solves the linear system A*X = B using LapackServer. 
+*/
 template <class T>
 inline int LapackLinSolve(TArray<T>& a, TArray<T> & b)
 { LapackServer<T> lps; return( lps.LinSolve(a, b) );  }
 
+/*! \ingroup LinAlg
+    \fn LapackSVD(TArray<T>&, TArray<T> &)
+    \brief SVD decomposition using LapackServer. 
+*/
 template <class T>
 inline int LapackSVD(TArray<T>& a, TArray<T> & s)
 { LapackServer<T> lps; return( lps.SVD(a, s) ); }
 
+
+/*! \ingroup LinAlg
+    \fn LapackSVD(TArray<T>&, TArray<T> &, TArray<T> &, TArray<T> &)
+    \brief SVD decomposition using LapackServer. 
+*/
 template <class T>
 inline int LapackSVD(TArray<T>& a, TArray<T> & s, TArray<T> & u, TArray<T> & vt)
 { LapackServer<T> lps; return( lps.SVD(a, s, u, vt) ); }
@@ -43,6 +59,4 @@ inline int LapackSVD(TArray<T>& a, TArray<T> & s, TArray<T> & u, TArray<T> & vt)
 
 } // Fin du namespace
 
-void rztest_lapack(TArray<r_4>& a, TArray<r_4>& b);
-
 #endif
-- 
GitLab