IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 338


Ignore:
Timestamp:
Mar 31, 2004, 4:40:28 PM (22 years ago)
Author:
Paul Price
Message:

Hacked math stuff.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/pslib/psLibSDRS.tex

    r337 r338  
    1 %%% $Id: psLibSDRS.tex,v 1.16 2004-04-01 02:34:37 eugene Exp $
     1%%% $Id: psLibSDRS.tex,v 1.17 2004-04-01 02:40:28 price Exp $
    22\documentclass[panstarrs]{panstarrs}
    3 %\documentclass[panstarrs]{panstarrs}
    43
    54% basic document variables
     
    870869section~\ref{math}. 
    871870
    872 \subsection{Simple Array types}
    873 
    874 \begin{verbatim}
    875 psIntArray
    876 psFloatArray
    877 psDoubleArray
    878 psComplexArray
    879 psVoidPtrArray
    880 \end{verbatim}
    881 
    882 \subsubsection{Arrays of Simple Types}
     871\subsection{Arrays of Simple Types}
    883872
    884873We require several types of basic one-dimensional arrays: arrays of
     
    934923functions may be easily generated with C pre-processor macros.
    935924
    936 \subsubsection{Arrays of Pointer Types}
     925\subsection{Arrays of Pointer Types}
    937926
    938927Arrays of pointer types need some additional specification.  We
     
    15001489psMatrixToVector(psMatrix *myMatrix     ///< Matrix to convert
    15011490    );
     1491
     1492/** Convert vector to matrix. */
     1493psImage *
     1494psVectorToMatrix(psImage *out,          //!< Matrix to return, or NULL
     1495                 psVector *myVector     //!< Vector to convert
     1496    );
    15021497\end{verbatim}
    15031498
     
    21982193images, e.g.\ dividing one image by another, subtracting a vector
    21992194from an image, etc.  Both binary operations and unary operations are
    2200 required.
     2195required.  To avoid the burden of memorizing a ton of APIs, we specify
     2196two generic APIs for the binary and unary operations.
    22012197
    22022198\begin{verbatim}
     
    22122208
    22132209\begin{verbatim}
    2214 /** Perform a binary operation on two data items (psImage, psVector, psScalar).
     2210/** Perform a unary operation on two data items (psImage, psVector, psScalar).
    22152211*/
    22162212psType *
     
    22272223perform the onerous task of creating the loops.
    22282224
     2225Vectors are defined as arrays of floats:
     2226\begin{verbatim}
     2227/** Define a vector as an array of real numbers */
     2228typedef psFloatArray psVector;
     2229#define psVectorAlloc(S,N) psFloatArrayAlloc(S,N) ///< Constructor
     2230#define psVectorRealloc(A,S) psFloatArrayRealloc(A,S) ///< Reallocator
     2231#define psVectorFree(A) psFloatArrayFree(A) ///< Destructor
     2232\end{verbatim}
     2233
    22292234It is desirable to use the same functions for both vectors and
    22302235images, so inputs are \code{void*}; this necessitates that vectors
    22312236and images each have a type element at a pre-determined and constant
    2232 location in the \code{struct}.  It is further desirable to allow
    2233 scalar values to be used within these functions, which requires the
    2234 following additions:
     2237location in the \code{struct}.
     2238
     2239\begin{verbatim}
     2240/** The type of a data type */
     2241typedef struct {
     2242    psElemType type;                    ///< The type
     2243    psDimen dimen;                      ///< The dimensionality
     2244} psType;
     2245
     2246/** Types of the elements of vectors, images, etc. */
     2247typedef enum {
     2248    PS_TYPE_CHAR,                       ///< Character
     2249    PS_TYPE_SHORT,                      ///< Short integer
     2250    PS_TYPE_INT,                        ///< Integer
     2251    PS_TYPE_LONG,                       ///< Long integer
     2252    PS_TYPE_UCHAR,                      ///< Unsigned character
     2253    PS_TYPE_USHORT,                     ///< Unsigned short integer
     2254    PS_TYPE_UINT,                       ///< Unsigned integer
     2255    PS_TYPE_ULONG,                      ///< Unsigned long integer
     2256    PS_TYPE_FLOAT,                      ///< Floating point
     2257    PS_TYPE_DOUBLE,                     ///< Double-precision floating point
     2258    PS_TYPE_COMPLEX,                    ///< Complex numbers consisting of floating point
     2259    PS_TYPE_OTHER,                      ///< Something else that's not supported for arithmetic
     2260} psElemType;
     2261
     2262/** Dimensions of a data type */
     2263typedef enum {
     2264    PS_DIMEN_SCALAR,                    ///< Scalar
     2265    PS_DIMEN_VECTOR,                    ///< A vector
     2266    PS_DIMEN_TRANSV,                    ///< A transposed vector
     2267    PS_DIMEN_IMAGE,                     ///< An image
     2268    PS_DIMEN_OTHER                      ///< Something else that's not supported for arithmetic
     2269} psDimen;
     2270\end{verbatim}
     2271
     2272Binary operations between an image and a vector have a potential
     2273ambiguity --- do the vector elements correspond to the rows or the
     2274columns?  For this reason, we define two vector types: a ``vector''
     2275(\code{PS_DIMEN_VECTOR}), and a ``transposed vector''
     2276(\code{PS_DIMEN_TRANSV}).  We specify that a ``vector'', when involved
     2277in binary operations on an image, acts on the rows, while a
     2278``transposed vector'' in the same context acts on the columns.
     2279Vectors, when created, will be created as ``vectors'', but may be
     2280converted to ``transposed vectors'' using the following function:
     2281
     2282\begin{verbatim}
     2283/** Transpose a vector.  Changes the type to a PS_DIMEN_TRANSV */
     2284psVector *psVectorTranspose(psVector *out, //!< Output vector, or NULL
     2285                            psVector *myVector //!< Vector to be transposed
     2286    );
     2287\end{verbatim}
     2288
     2289It is further desirable to allow scalar values to be used within these
     2290functions, which requires the following additions:
    22352291
    22362292\begin{verbatim}
     
    28592915%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    28602916
    2861 \subsection{Astronomy Images}
     2917\subsection{Astronomical Images}
    28622918
    28632919\subsubsection{Overview}
Note: See TracChangeset for help on using the changeset viewer.