Index: trunk/doc/pslib/psMathGroup.tex
===================================================================
--- trunk/doc/pslib/psMathGroup.tex	(revision 286)
+++ trunk/doc/pslib/psMathGroup.tex	(revision 381)
@@ -5,5 +5,5 @@
 void {\bf ps\-Bit\-Mask\-Free} ({\bf ps\-Bit\-Mask} $\ast$restrict my\-Mask)
 \begin{CompactList}\small\item\em Destructor.\item\end{CompactList}\item 
-{\bf ps\-Bit\-Mask} $\ast$ {\bf ps\-Bit\-Mask\-Set} ({\bf ps\-Bit\-Mask} $\ast$out\-Mask, const {\bf ps\-Bit\-Mask} $\ast$my\-Mask, int bit)
+{\bf ps\-Bit\-Mask} $\ast$ {\bf ps\-Bit\-Mask\-Set} ({\bf ps\-Bit\-Mask} $\ast$my\-Mask, int bit)
 \begin{CompactList}\small\item\em Set a bit mask.\item\end{CompactList}\item 
 int {\bf ps\-Bit\-Mask\-Test} (const {\bf ps\-Bit\-Mask} $\ast$check\-Mask, int bit)
@@ -11,10 +11,28 @@
 {\bf ps\-Bit\-Mask} $\ast$ {\bf ps\-Bit\-Mask\-Op} ({\bf ps\-Bit\-Mask} $\ast$out\-Mask, const {\bf ps\-Bit\-Mask} $\ast$restrict in\-Mask1, char $\ast$operator, const {\bf ps\-Bit\-Mask} $\ast$restrict in\-Mask2)
 \begin{CompactList}\small\item\em apply the given operator to two bit masks\item\end{CompactList}\item 
-{\bf ps\-Complex\-Array} $\ast$ {\bf ps\-Real\-FFT} ({\bf ps\-Complex\-Array} $\ast$restrict out, const {\bf ps\-Float\-Array} $\ast$restrict my\-Array)
-\begin{CompactList}\small\item\em Return Fourier Transform of an array.\item\end{CompactList}\item 
-{\bf ps\-Complex\-Array} $\ast$ {\bf ps\-Complex\-FFT} ({\bf ps\-Complex\-Array} $\ast$restrict out, const {\bf ps\-Complex\-Array} $\ast$restrict my\-Array, int sign)
-\begin{CompactList}\small\item\em Return [inverse?] Fourier Transform of a complex array.\item\end{CompactList}\item 
-{\bf ps\-Float\-Array} $\ast$ {\bf ps\-Power\-Spec} ({\bf ps\-Float\-Array} $\ast$restrict out, const {\bf ps\-Float\-Array} $\ast$restrict my\-Array)
-\begin{CompactList}\small\item\em Return Power spectrum of a array.\item\end{CompactList}\item 
+{\bf ps\-FFT} $\ast$ {\bf ps\-FFTAlloc} ({\bf ps\-Image} $\ast$image)
+\begin{CompactList}\small\item\em Constructor.\item\end{CompactList}\item 
+{\bf ps\-FFT} $\ast$ {\bf ps\-FFTAlloc1D} (const {\bf ps\-Float\-Array} $\ast$arr)
+\begin{CompactList}\small\item\em Constructor for 1D case.\item\end{CompactList}\item 
+{\bf ps\-Image} $\ast$ {\bf ps\-FFTFree} ({\bf ps\-Image} $\ast$out, {\bf ps\-FFT} $\ast$restrict fft)
+\begin{CompactList}\small\item\em Destructor.\item\end{CompactList}\item 
+{\bf ps\-FFT} $\ast$ {\bf ps\-FFTForward} ({\bf ps\-FFT} $\ast$fft)
+\begin{CompactList}\small\item\em Forward FFT: from real to fourier space.\item\end{CompactList}\item 
+{\bf ps\-FFT} $\ast$ {\bf ps\-FFTReverse} ({\bf ps\-FFT} $\ast$fft)
+\begin{CompactList}\small\item\em Reverse FFT: from fourier to real space.\item\end{CompactList}\item 
+{\bf ps\-FFT} $\ast$ {\bf ps\-FFTFilter} ({\bf ps\-FFT} $\ast$fft, float($\ast$filter\-Func)(int kx, int ky))
+\begin{CompactList}\small\item\em Apply filter function in fourier space.\item\end{CompactList}\item 
+{\bf ps\-FFT} $\ast$ {\bf ps\-FFTFilter\-Complex} ({\bf ps\-FFT} $\ast$fft, float($\ast$real\-Filter\-Func)(int kx, int ky), float($\ast$imag\-Filter\-Func)(int kx, int ky))
+\begin{CompactList}\small\item\em Apply complex filter function.\item\end{CompactList}\item 
+{\bf ps\-FFT} $\ast$ {\bf ps\-FFTCross\-Correlate} ({\bf ps\-FFT} $\ast$out const {\bf ps\-FFT} $\ast$fft1, const {\bf ps\-FFT} $\ast$fft2)
+\begin{CompactList}\small\item\em Calculate FFT of the cross-correlation.\item\end{CompactList}\item 
+{\bf ps\-FFT} $\ast$ {\bf ps\-FFTConvolve} ({\bf ps\-FFT} $\ast$out, const {\bf ps\-FFT} $\ast$fft1, const {\bf ps\-FFT} $\ast$fft2)
+\begin{CompactList}\small\item\em Calculate FFT of the convolution.\item\end{CompactList}\item 
+{\bf ps\-Float\-Array} $\ast$ {\bf ps\-FFTPower\-Spec} ({\bf ps\-FFT} $\ast$fft)
+\begin{CompactList}\small\item\em Calculate power spectrum.\item\end{CompactList}\item 
+{\bf ps\-Image} $\ast$ {\bf ps\-FFTGet\-Image} ({\bf ps\-Image} $\ast$out, const {\bf ps\-FFT} $\ast$fft)
+\item 
+{\bf ps\-Image} $\ast$ {\bf ps\-FFTGet\-FT} ({\bf ps\-Image} $\ast$out, const {\bf ps\-FFT} $\ast$fft)
+\begin{CompactList}\small\item\em Convert the Fourier transform data in the FFT struct to an image of complex numbers.\item\end{CompactList}\item 
 {\bf ps\-Polynomial1D} $\ast$ {\bf ps\-Polynomial1DAlloc} (int n)
 \begin{CompactList}\small\item\em Constructor.\item\end{CompactList}\item 
@@ -65,32 +83,34 @@
 double {\bf ps\-Eval\-DPolynomial4D} (double w, double x, double y, double z, const {\bf ps\-DPolynomial4D} $\ast$restrict my\-Poly)
 \begin{CompactList}\small\item\em Evaluate 4D polynomial (double precision).\item\end{CompactList}\item 
-{\bf ps\-Type} $\ast$ {\bf ps\-Binary\-Op} (void $\ast$out, void $\ast$in1, char $\ast$operator, void $\ast$in2)
-\begin{CompactList}\small\item\em Perform a binary operation on two data items (ps\-Image, ps\-Vector, ps\-Scalar).\item\end{CompactList}\item 
-{\bf ps\-Type} $\ast$ {\bf ps\-Unary\-Op} (void $\ast$out, void $\ast$in, char $\ast$operator)
-\begin{CompactList}\small\item\em Perform a binary operation on two data items (ps\-Image, ps\-Vector, ps\-Scalar).\item\end{CompactList}\item 
+{\bf ps\-Type} $\ast$ {\bf ps\-Binary\-Op} (void $\ast$out, void $\ast$in1, char $\ast$op, void $\ast$in2)
+\begin{CompactList}\small\item\em Perform a binary operation on two data items ({\bf ps\-Image} {\rm (p.\,\pageref{structpsImage})}, ps\-Vector, ps\-Scalar).\item\end{CompactList}\item 
+{\bf ps\-Type} $\ast$ {\bf ps\-Unary\-Op} (void $\ast$out, void $\ast$in, char $\ast$op)
+\begin{CompactList}\small\item\em Perform a unary operation on two data items ({\bf ps\-Image} {\rm (p.\,\pageref{structpsImage})}, ps\-Vector, ps\-Scalar).\item\end{CompactList}\item 
 {\bf p\_\-ps\-Scalar} $\ast$ {\bf ps\-Scalar} (double value)
-\begin{CompactList}\small\item\em create a ps\-Type-ed structure from a constant double value.\item\end{CompactList}\item 
+\begin{CompactList}\small\item\em create a {\bf ps\-Type} {\rm (p.\,\pageref{structpsType})}-ed structure from a constant double value.\item\end{CompactList}\item 
 {\bf p\_\-ps\-Scalar} $\ast$ {\bf ps\-Scalar\-Type} (char $\ast$mode,...)
-\begin{CompactList}\small\item\em create a ps\-Type-ed structure from a specified type\item\end{CompactList}\item 
-{\bf ps\-Matrix} $\ast$ {\bf ps\-Matrix\-Alloc} (int Xdimen, int Ydimen)
-\begin{CompactList}\small\item\em Constructor.\item\end{CompactList}\item 
-void {\bf ps\-Matrix\-Free} ({\bf ps\-Matrix} $\ast$restrict my\-Matrix)
-\begin{CompactList}\small\item\em Destructor.\item\end{CompactList}\item 
-{\bf ps\-Matrix} $\ast$ {\bf ps\-Matrix\-Invert} ({\bf ps\-Matrix} $\ast$out, const {\bf ps\-Matrix} $\ast$my\-Matrix, float $\ast$restrict determinant)
+\begin{CompactList}\small\item\em create a {\bf ps\-Type} {\rm (p.\,\pageref{structpsType})}-ed structure from a specified type\item\end{CompactList}\item 
+{\bf ps\-Image} $\ast$ {\bf ps\-Matrix\-Invert} ({\bf ps\-Image} $\ast$out, const {\bf ps\-Image} $\ast$my\-Matrix, float $\ast$restrict determinant)
 \begin{CompactList}\small\item\em Invert matrix.\item\end{CompactList}\item 
-float {\bf ps\-Matrix\-Determinant} (const {\bf ps\-Matrix} $\ast$restrict my\-Matrix)
+float {\bf ps\-Matrix\-Determinant} (const {\bf ps\-Image} $\ast$restrict my\-Matrix)
 \begin{CompactList}\small\item\em Matrix determinant.\item\end{CompactList}\item 
-{\bf ps\-Matrix} $\ast$ {\bf ps\-Matrix\-Op} ({\bf ps\-Matrix} $\ast$out, const {\bf ps\-Matrix} $\ast$matrix1, const char $\ast$op, const {\bf ps\-Matrix} $\ast$matrix2)
-\begin{CompactList}\small\item\em Matrix operations.\item\end{CompactList}\item 
-{\bf ps\-Matrix} $\ast$ {\bf ps\-Matrix\-Transpose} ({\bf ps\-Matrix} $\ast$out, const {\bf ps\-Matrix} $\ast$my\-Matrix)
+{\bf ps\-Image} $\ast$ {\bf ps\-Matrix\-Op} ({\bf ps\-Image} $\ast$out, const {\bf ps\-Image} $\ast$matrix1, const char $\ast$op, const {\bf ps\-Image} $\ast$matrix2)
+\begin{CompactList}\small\item\em Matrix operation: addition, subtraction, multiplication.\item\end{CompactList}\item 
+{\bf ps\-Image} $\ast$ {\bf ps\-Matrix\-Transpose} ({\bf ps\-Image} $\ast$out, const {\bf ps\-Image} $\ast$my\-Matrix)
 \begin{CompactList}\small\item\em Transpose Matrix.\item\end{CompactList}\item 
-{\bf ps\-Vector} $\ast$ {\bf ps\-Matrix\-To\-Vector} ({\bf ps\-Matrix} $\ast$my\-Matrix)
+{\bf ps\-Image} $\ast$ {\bf ps\-Matrix\-LUD} ({\bf ps\-Image} $\ast$out, {\bf ps\-Image} $\ast$my\-Matrix)
+\begin{CompactList}\small\item\em LU Decomposition of a matrix.\item\end{CompactList}\item 
+{\bf ps\-Vector} $\ast$ {\bf ps\-Matrix\-LUSolve} ({\bf ps\-Vector} $\ast$out, const {\bf ps\-Image} $\ast$lu\-Matrix, const {\bf ps\-Vector} $\ast$rhs\-Vector)
+\begin{CompactList}\small\item\em LU Solution.\item\end{CompactList}\item 
+{\bf ps\-Vector} $\ast$ {\bf ps\-Matrix\-To\-Vector} ({\bf ps\-Vector} $\ast$out, {\bf ps\-Image} $\ast$my\-Matrix)
 \begin{CompactList}\small\item\em Convert matrix to vector.\item\end{CompactList}\item 
-{\bf ps\-Float\-Array} $\ast$ {\bf ps\-Minimize} (float($\ast$my\-Function)(const {\bf ps\-Float\-Array} $\ast$restrict), {\bf ps\-Float\-Array} $\ast$restrict initial\-Guess)
-\begin{CompactList}\small\item\em Minimize a particular function.\item\end{CompactList}\item 
-{\bf ps\-Float\-Array} $\ast$ {\bf ps\-Minimize\-Chi2} (float($\ast$eval\-Model)(const {\bf ps\-Float\-Array} $\ast$restrict, const {\bf ps\-Float\-Array} $\ast$restrict), const {\bf ps\-Float\-Array} $\ast$restrict domain, const {\bf ps\-Float\-Array} $\ast$restrict data, const {\bf ps\-Float\-Array} $\ast$restrict errors, {\bf ps\-Float\-Array} $\ast$restrict initial\-Guess, const {\bf ps\-Int\-Array} $\ast$restrict guess\-Mask)
+{\bf ps\-Image} $\ast$ {\bf ps\-Vector\-To\-Matrix} ({\bf ps\-Image} $\ast$out, {\bf ps\-Vector} $\ast$my\-Vector)
+\begin{CompactList}\small\item\em Convert vector to matrix.\item\end{CompactList}\item 
+{\bf ps\-Float\-Array} $\ast$ {\bf ps\-Minimize} (float($\ast$my\-Function)(const {\bf ps\-Float\-Array} $\ast$restrict), {\bf ps\-Float\-Array} $\ast$restrict initial\-Guess, {\bf ps\-Int\-Array} $\ast$restrict param\-Mask)
+\begin{CompactList}\small\item\em Minimize a particular non-linear function.\item\end{CompactList}\item 
+{\bf ps\-Float\-Array} $\ast$ {\bf ps\-Minimize\-Chi2} (float($\ast$eval\-Model)(const {\bf ps\-Float\-Array} $\ast$restrict, const {\bf ps\-Float\-Array} $\ast$restrict), const {\bf ps\-Float\-Array} $\ast$restrict domain, const {\bf ps\-Float\-Array} $\ast$restrict data, const {\bf ps\-Float\-Array} $\ast$restrict errors, {\bf ps\-Float\-Array} $\ast$restrict initial\-Guess, const {\bf ps\-Int\-Array} $\ast$restrict param\-Mask)
 \begin{CompactList}\small\item\em Minimize chi$^\wedge$2 for input data.\item\end{CompactList}\item 
-{\bf ps\-Float\-Array} $\ast$ {\bf ps\-Get\-Array\-Polynomial} (const {\bf ps\-Float\-Array} $\ast$restrict ord, const {\bf ps\-Float\-Array} $\ast$restrict coord)
-\begin{CompactList}\small\item\em Derive a polynomial fit by least-squares --- can be done analytically.\item\end{CompactList}\item 
+{\bf ps\-Polynomial1D} $\ast$ {\bf ps\-Get\-Array\-Polynomial} ({\bf ps\-Polynomial1D} my\-Poly, const {\bf ps\-Float\-Array} $\ast$restrict x, const {\bf ps\-Float\-Array} $\ast$restrict y, const {\bf ps\-Float\-Array} $\ast$restrict y\-Err)
+\begin{CompactList}\small\item\em Derive a polynomial fit by chi$^\wedge$2 minimisation --- can be done analytically.\item\end{CompactList}\item 
 {\bf ps\-Float\-Array} $\ast$ {\bf ps\-Sort} ({\bf ps\-Float\-Array} $\ast$out, const {\bf ps\-Float\-Array} $\ast$my\-Array)
 \begin{CompactList}\small\item\em Sort an array.\item\end{CompactList}\item 
