IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 11, 2004, 11:04:22 AM (22 years ago)
Author:
eugene
Message:

cleaned psMath.h : we have settled on a scheme for binary & unary operators
fixed up the psType entries in psStdArrays.h

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/archive/pslib/include/psStdArrays.h

    r210 r218  
    88/** Types of the elements of vectors, matrices, etc. */
    99enum {
    10     PS_TYPE_CHAR,                       //!< Character
    11     PS_TYPE_SHORT,                      //!< Short integer
    12     PS_TYPE_INT,                        //!< Integer
    13     PS_TYPE_LONG,                       //!< Long integer
    14     PS_TYPE_UCHAR,                      //!< Unsigned character
    15     PS_TYPE_USHORT,                     //!< Unsigned short integer
    16     PS_TYPE_UINT,                       //!< Unsigned integer
    17     PS_TYPE_ULONG,                      //!< Unsigned long integer
    18     PS_TYPE_FLOAT,                      //!< Floating point
    19     PS_TYPE_DOUBLE,                     //!< Double-precision floating point
    20     PS_TYPE_COMPLEX                     //!< Complex numbers consisting of floating point
    21     PS_TYPE_OTHER                       //!< Something else that's not supported for arithmetic
     10    PS_TYPE_CHAR,                       ///< Character
     11    PS_TYPE_SHORT,                      ///< Short integer
     12    PS_TYPE_INT,                        ///< Integer
     13    PS_TYPE_LONG,                       ///< Long integer
     14    PS_TYPE_UCHAR,                      ///< Unsigned character
     15    PS_TYPE_USHORT,                     ///< Unsigned short integer
     16    PS_TYPE_UINT,                       ///< Unsigned integer
     17    PS_TYPE_ULONG,                      ///< Unsigned long integer
     18    PS_TYPE_FLOAT,                      ///< Floating point
     19    PS_TYPE_DOUBLE,                     ///< Double-precision floating point
     20    PS_TYPE_COMPLEX                     ///< Complex numbers consisting of floating point
     21    PS_TYPE_OTHER                       ///< Something else that's not supported for arithmetic
    2222} psElemType;
    2323
    2424/** Dimensions of a data type */
    2525enum {
    26     PS_DIMEN_SCALAR,                    //!< Scalar
    27     PS_DIMEN_VECTOR,                    //!< A vector
    28     PS_DIMEN_MATRIX,                    //!< A matrix
    29     PS_DIMEN_OTHER                      //!< Something else that's not supported for arithmetic
     26    PS_DIMEN_SCALAR,                    ///< Scalar
     27    PS_DIMEN_VECTOR,                    ///< A vector
     28    PS_DIMEN_TRANSV,                    ///< A transposed vector
     29    PS_DIMEN_MATRIX,                    ///< A matrix
     30    PS_DIMEN_OTHER                      ///< Something else that's not supported for arithmetic
    3031} psDimen;
    3132
    3233/** The type of a data type */
    3334typedef struct {
    34     enum psElemType type;               //!< The type
    35     enum psDimen dimen;                 //!< The dimensionality
     35    enum psElemType type;               ///< The type
     36    enum psDimen dimen;                 ///< The dimensionality
    3637} psType;
    3738
     
    7172/** An array of real numbers */
    7273typedef struct {
    73     enum psType type;                   //!< Type of data.  THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT!
    74     int size;                           //!< Total number of elements available
    75     int n;                              //!< Number of elements in use
    76     float *arr;                         //!< The array data
     74    enum psType type;                   ///< Type of data.  THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT!
     75    int size;                           ///< Total number of elements available
     76    int n;                              ///< Number of elements in use
     77    float *arr;                         ///< The array data
    7778} psFloatArray;
    7879
    7980/** Constructor */
    80 psFloatArray *psFloatArrayAlloc(int s,  //!< Total number of elements to make available
    81                                 int n   //!< Number of elements that will be used
     81psFloatArray *psFloatArrayAlloc(int s,  ///< Total number of elements to make available
     82                                int n   ///< Number of elements that will be used
    8283    );
    8384/** Reallocator */
    84 psFloatArray *psFloatArrayRealloc(psFloatArray *myArray, //!< Array to reallocate
    85                                   int s //!< Total number of elements to make available
     85psFloatArray *psFloatArrayRealloc(psFloatArray *myArray, ///< Array to reallocate
     86                                  int s ///< Total number of elements to make available
    8687    );
    8788/** Destructor */
    88 void psFloatArrayFree(psFloatArray *restrict myArray //!< Array to free
     89void psFloatArrayFree(psFloatArray *restrict myArray ///< Array to free
    8990    );
    9091
     
    9394/** Define a vector as an array of real numbers */
    9495typedef psFloatArray psVector;
    95 #define psVectorAlloc(S,N) psFloatArrayAlloc(S,N) //!< Constructor
    96 #define psVectorRealloc(A,S) psFloatArrayRealloc(A,S) //!< Reallocator
    97 #define psVectorFree(A) psFloatArrayFree(A) //!< Destructor
     96#define psVectorAlloc(S,N) psFloatArrayAlloc(S,N) ///< Constructor
     97#define psVectorRealloc(A,S) psFloatArrayRealloc(A,S) ///< Reallocator
     98#define psVectorFree(A) psFloatArrayFree(A) ///< Destructor
    9899
    99100/************************************************************************************************************/
     
    101102/** An array of complex numbers */
    102103typedef struct {
    103     enum psType type;                   //!< Type of data.  THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT!
    104     int size;                           //!< Total number of elements available
    105     int n;                              //!< Number of elements in use
    106     complex float *arr;                 //!< The array data
     104    enum psType type;                   ///< Type of data.  THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT!
     105    int size;                           ///< Total number of elements available
     106    int n;                              ///< Number of elements in use
     107    complex float *arr;                 ///< The array data
    107108} psComplexArray;
    108109
    109110/** Constructor */
    110 psComplexArray *psComplexArrayAlloc(int s, //!< Total number of elements to make available
    111                                     int n       //!< Number of elements that will be used
     111psComplexArray *psComplexArrayAlloc(int s, ///< Total number of elements to make available
     112                                    int n       ///< Number of elements that will be used
    112113    );
    113114/** Reallocator */
    114 psComplexArray *psComplexArrayRealloc(psComplexArray *myArray, //!< Array to reallocate
    115                                       int s     //!< Total number of elements to make available
     115psComplexArray *psComplexArrayRealloc(psComplexArray *myArray, ///< Array to reallocate
     116                                      int s     ///< Total number of elements to make available
    116117    );
    117118/** Destructor */
    118 void psComplexArrayFree(psComplexArray *restrict myArray //!< Array to free
     119void psComplexArrayFree(psComplexArray *restrict myArray ///< Array to free
    119120    );
    120121
     
    123124/** An array of integers */
    124125typedef struct {
    125     enum psType type;                   //!< Type of data.  THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT!
    126     int size;                           //!< Total number of elements available
    127     int n;                              //!< Number of elements in use
    128     int *arr;                           //!< The array data
     126    enum psType type;                   ///< Type of data.  THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT!
     127    int size;                           ///< Total number of elements available
     128    int n;                              ///< Number of elements in use
     129    int *arr;                           ///< The array data
    129130} psIntArray;
    130131
    131132/** Constructor */
    132 psIntArray *psIntArrayAlloc(int s,      //!< Total number of elements to make available
    133                             int n       //!< Number of elements that will be used
     133psIntArray *psIntArrayAlloc(int s,      ///< Total number of elements to make available
     134                            int n       ///< Number of elements that will be used
    134135    );
    135136/** Reallocator */
    136 psIntArray *psIntArrayRealloc(psIntArray *myArray, //!< Array to reallocate
    137                               int s     //!< Total number of elements to make available
     137psIntArray *psIntArrayRealloc(psIntArray *myArray, ///< Array to reallocate
     138                              int s     ///< Total number of elements to make available
    138139    );
    139140/** Destructor */
    140 void psIntArrayFree(psIntArray *restrict myArray //!< Array to free
     141void psIntArrayFree(psIntArray *restrict myArray ///< Array to free
    141142    );
    142143
     
    145146/** An array of double-precision real numbers */
    146147typedef struct {
    147     enum psType type;                   //!< Type of data.  THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT!
    148     int size;                           //!< Total number of elements available
    149     int n;                              //!< Number of elements in use
    150     double *arr;                        //!< The array data
     148    enum psType type;                   ///< Type of data.  THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT!
     149    int size;                           ///< Total number of elements available
     150    int n;                              ///< Number of elements in use
     151    double *arr;                        ///< The array data
    151152} psDoubleArray;
    152153
    153154/** Constructor */
    154 psDoubleArray *psDoubleArrayAlloc(int s, //!< Total number of elements to make available
    155                                   int n //!< Number of elements that will be used
     155psDoubleArray *psDoubleArrayAlloc(int s, ///< Total number of elements to make available
     156                                  int n ///< Number of elements that will be used
    156157    );
    157158/** Reallocator */
    158 psDoubleArray *psDoubleArrayRealloc(psDoubleArray *myArray, //!< Array to reallocate
    159                                     int s       //!< Total number of elements to make available
     159psDoubleArray *psDoubleArrayRealloc(psDoubleArray *myArray, ///< Array to reallocate
     160                                    int s       ///< Total number of elements to make available
    160161    );
    161162/** Destructor */
    162 void psDoubleArrayFree(psDoubleArray *restrict myArray //!< Array to free
     163void psDoubleArrayFree(psDoubleArray *restrict myArray ///< Array to free
    163164    );
    164165
     
    167168/** An array of real vectors */
    168169typedef struct {
    169     enum psType type;                   //!< Type of data.  THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT!
    170     int size;                           //!< Total number of elements available
    171     int n;                              //!< Number of elements in use
    172     psFloatArray *arr;                  //!< The array data
     170    enum psType type;                   ///< Type of data.  THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT!
     171    int size;                           ///< Total number of elements available
     172    int n;                              ///< Number of elements in use
     173    psFloatArray *arr;                  ///< The array data
    173174} psVectorArray;
    174175
    175176/** Constructor */
    176 psVectorArray *psVectorArrayAlloc(int s, //!< Total number of elements to make available
    177                                   int n //!< Number of elements that will be used
     177psVectorArray *psVectorArrayAlloc(int s, ///< Total number of elements to make available
     178                                  int n ///< Number of elements that will be used
    178179    );
    179180/** Reallocator */
    180 psVectorArray *psVectorArrayRealloc(psVectorArray *myArray, //!< Array to reallocate
    181                                     int s       //!< Total number of elements to make available
     181psVectorArray *psVectorArrayRealloc(psVectorArray *myArray, ///< Array to reallocate
     182                                    int s       ///< Total number of elements to make available
    182183    );
    183184/** Destructor */
    184 void psVectorArrayFree(psVectorArray *restrict myArray //!< Array to free
     185void psVectorArrayFree(psVectorArray *restrict myArray ///< Array to free
    185186    );
    186187
Note: See TracChangeset for help on using the changeset viewer.