/*
 * @(#)matrix.h    generated by: makeheader    Mon Aug 22 17:15:01 1994
 *
 *		built from:	/rel/test42/bld/u2/extern/../matlab/platforms/sun4.ansi/src/include/mathwork.hlink
 *				/rel/test42/bld/u2/extern/../matlab/platforms/sun4.ansi/src/cmex/cmxcbk.c
 */

#ifndef matrix_h
#define matrix_h

#ifdef __cplusplus
    extern "C" {
#endif

typedef double Real;


#ifdef OLDSTYLE
/*
 * modified matrix definition for compatibility with pre v4 mex files
 */

#ifdef THINK_C
#define dummy   unsigned char dummy1,dummy2,type,dummy3; int dummy4
#else
#ifdef applec
#define dummy   unsigned char dummy1,dummy2,type,dummy3; int dummy4
#else
#define dummy   int dummy1,dummy2,type,dummy3
#endif /* applec */
#endif /* THINK_C */

#define mxMAXNAM        20
typedef struct matrix {
        char    name[mxMAXNAM];         /* name is now an array */
        dummy;                          /* type: 0 - matrix, 1 - string */
        int     m;                      /* row dimension */
        int     n;                      /* column dimension */
        Real    *pr;                    /* pointer to real part */
        Real    *pi;                    /* pointer to imag part */
        int     dummy6,dummy7,dummy8;
} Matrix;

#define TEXT    1                       /* mat.type indicating text */
#define MATRIX  0                       /* mat.type indicating matrix */
#define REAL    0
#define COMPLEX 1

#else
/*
 * Post V4 MEX-Files use an incomplete matrix structure and access methods
 */
#ifdef __STDC__
typedef struct matrix Matrix;	/* Incomplete definition of Matrix */
#else
#ifdef __cplusplus
typedef struct matrix Matrix;	/* Incomplete definition of Matrix */
#else
#ifdef VMS
typedef struct matrix Matrix;	/* Incomplete definition of Matrix */
#else
#ifdef MMACINTOSH
typedef struct matrix Matrix;	/* Incomplete definition of Matrix */
#else
typedef char    Matrix;
#endif /* MMACINTOSH */
#endif /* VMS */
#endif /* __cplusplus */
#endif /* __STDC__ */

#define REAL    (0)
#define COMPLEX (1)
#endif /* OLD_STYLE */


/*
 * Decide when to use function prototypes.
 */
#ifdef __STDC__
#define USE_FUNCTION_PROTOTYPES
#endif
#ifdef __cplusplus
#define USE_FUNCTION_PROTOTYPES
#endif


#ifdef VMS
#define sp2spam			Csp2spam
#define spam2sp			Cspam2sp
#define malloc			VAXCmalloc
#define calloc			VAXCcalloc
#define realloc			VAXCrealloc
#define free			VAXCfree
#define mxCreateFull		CmxCreateFull
#define mxFreeMatrix		CmxFreeMatrix
#define mxCalloc		CmxCalloc
#define mxFree			CmxFree
#define mxGetName		CmxGetName
#define mxSetName		CmxSetName
#define mxGetStruc		CmxGetStruc
#define mxSetStruc		CmxSetStruc
#define mxGetType		CmxGetType
#define mxSetType		CmxSetType
#define mxGetDispMode		CmxGetDispMode
#define mxSetDispMode		CmxSetDispMode
#define mxGetM			CmxGetM
#define mxSetM			CmxSetM
#define mxGetN			CmxGetN
#define mxSetN			CmxSetN
#define mxGetPr			CmxGetPr
#define mxSetPr			CmxSetPr
#define mxGetPi			CmxGetPi
#define mxSetPi			CmxSetPi
#define mxGetNzmax		CmxGetNzmax
#define mxSetNzmax		CmxSetNzmax
#define mxGetIr			CmxGetIr
#define mxSetIr			CmxSetIr
#define mxGetJc			CmxGetJc
#define mxSetJc			CmxSetJc
#define mxGetString		CmxGetString
#define mxSetString		CmxSetString
#define mxCreateString		CmxCreateString
#define mxGetScalar		CmxGetScalar
#define mxIsFull		CmxIsFull
#define mxIsSparse		CmxIsSparse
#define mxIsDouble		CmxIsDouble
#define mxIsString		CmxIsString
#define mxIsNumeric		CmxIsNumeric
#define mxIsComplex		CmxIsComplex
#define mxCreateSparse		CmxCreateSparse
#define mxCreateNDArray		CmxCreateNDArray
#define mxSetTag		CmxSetTag
#define mxGetTag		CmxGetTag
#define mxGetDim		CmxGetDim
#define mxSetDim		CmxSetDim
#define mxIsNDArray		CmxIsNDArray
#define mxGetDimNum		CmxGetDimNum
#define mxIsSpam		CmxIsSpam
#define mxGetNumEl		CmxGetNumEl
#define mxSizeofMatrix		CmxSizeofMatrix
#define mxRemoveFromAllocList	CmxRemoveFromAllocList
#endif /* VMS */


/*
 * create matrix 
 */
#ifdef USE_FUNCTION_PROTOTYPES
extern Matrix	*mxCreateFull(
    int		m,		/* number of rows in matrix */
    int		n,		/* number of columns */
    int		cmplx_flg	/* complex flag */
    );
#else
extern Matrix	*mxCreateFull();
#endif /* USE_FUNCTION_PROTOTYPES */


/*
 * free matrix structure and its contents
 */
#ifdef USE_FUNCTION_PROTOTYPES
extern void mxFreeMatrix(
    Matrix	*pmat		/* pointer to matrix */
    );
#else
extern mxFreeMatrix();
#endif /* USE_FUNCTION_PROTOTYPES */


/*
 * allocate memory on MATLAB's heap
 */
#ifdef USE_FUNCTION_PROTOTYPES
extern void *mxCalloc(
    unsigned	n,		/* number of elements */
    unsigned	size		/* size of elements */
    );
#else
extern void *mxCalloc();
#endif /* USE_FUNCTION_PROTOTYPES */


/*
 * return allocated memory to MATLAB's heap
 */
#ifdef USE_FUNCTION_PROTOTYPES
extern void mxFree(
    void	*ptr		/* pointer to allocated memory */
    );
#else
extern mxFree();
#endif /* USE_FUNCTION_PROTOTYPES */


/* 
 * Get pointer to matrix name.
 */
#ifdef USE_FUNCTION_PROTOTYPES
extern const char *mxGetName(
    const Matrix *pm		/* pointer to matrix */
    );
#else
extern char *mxGetName();
#endif /* USE_FUNCTION_PROTOTYPES */


/* 
 * Set matrix name.  This routine copies the string pointed to by s
 * into the mxMAXNAM length character name field.
 */
#ifdef USE_FUNCTION_PROTOTYPES
extern void mxSetName(
    Matrix	*pm,		/* pointer to matrix */
    const char	*s		/* string to copy into name */
    );
#else
extern mxSetName();
#endif /* USE_FUNCTION_PROTOTYPES */


/*
 * Get row dimension
 */
#ifdef USE_FUNCTION_PROTOTYPES
extern int mxGetM(
    const Matrix *pm		/* pointer to matrix */
    );
#else
extern int mxGetM();
#endif /* USE_FUNCTION_PROTOTYPES */


/*
 * Set row dimension
 */
#ifdef USE_FUNCTION_PROTOTYPES
extern void mxSetM(
    Matrix	*pm,		/* pointer to matrix */
    int		m		/* row dimension */
    );
#else
extern mxSetM();
#endif /* USE_FUNCTION_PROTOTYPES */


/*
 * Get column dimension
 */
#ifdef USE_FUNCTION_PROTOTYPES
extern int mxGetN(
    const Matrix *pm		/* pointer to matrix */
    );
#else
extern int mxGetN();
#endif /* USE_FUNCTION_PROTOTYPES */


/*
 * Set column dimension
 */
#ifdef USE_FUNCTION_PROTOTYPES
extern void mxSetN(
    Matrix	*pm,		/* pointer to matrix */
    int		n		/* column dimension */
    );
#else
extern mxSetN();
#endif /* USE_FUNCTION_PROTOTYPES */


/*
 * Get pointer to real part
 */
#ifdef USE_FUNCTION_PROTOTYPES
extern Real *mxGetPr(
    const Matrix *pm		/* pointer to matrix */
    );
#else
extern Real *mxGetPr();
#endif /* USE_FUNCTION_PROTOTYPES */


/*
 * Set pointer to real part
 */
#ifdef USE_FUNCTION_PROTOTYPES
extern void mxSetPr(	
    Matrix	*pm,		/* pointer to matrix */	
    Real	*pr		/* pointer to real part */
    );
#else
extern mxSetPr();
#endif /* USE_FUNCTION_PROTOTYPES */


/*
 * Get pointer to imag part
 */
#ifdef USE_FUNCTION_PROTOTYPES
extern Real *mxGetPi(
    const Matrix *pm		/* pointer to matrix */	
    );	
#else
extern Real *mxGetPi();
#endif /* USE_FUNCTION_PROTOTYPES */


/*
 * Set pointer to imag part
 */
#ifdef USE_FUNCTION_PROTOTYPES
extern void mxSetPi(	
    Matrix	*pm,		/* pointer to matrix */
    Real	*pi		/* pointer to imag part */
    );
#else
extern mxSetPi();	
#endif /* USE_FUNCTION_PROTOTYPES */


/*
 * Get number of nonzero elements of sparse matrix
 */
#ifdef USE_FUNCTION_PROTOTYPES
extern int mxGetNzmax(	
    const Matrix *pm		/* pointer to matrix */
    );
#else
extern int mxGetNzmax();	
#endif /* USE_FUNCTION_PROTOTYPES */


/*
 * Set number of nonzero elements of sparse matrix
 */
#ifdef USE_FUNCTION_PROTOTYPES
extern void mxSetNzmax(
    Matrix	*pm,		/* pointer to matrix */
    int		nzmax		/* number of nonzero elements */
    );
#else
extern mxSetNzmax();
#endif /* USE_FUNCTION_PROTOTYPES */


/*
 * Get pointer to sparse ir array
 */
#ifdef USE_FUNCTION_PROTOTYPES
extern int *mxGetIr(
    const Matrix *pm		/* pointer to matrix */
    );
#else
extern int *mxGetIr();
#endif /* USE_FUNCTION_PROTOTYPES */


/*
 * Set pointer to sparse ir array
 */
#ifdef USE_FUNCTION_PROTOTYPES
extern void mxSetIr(	
    Matrix	*pm,		/* pointer to matrix */
    int		*ir		/* pointer to ir array */
    );
#else
extern mxSetIr();
#endif /* USE_FUNCTION_PROTOTYPES */


/*
 * Get pointer to sparse jc array
 */
#ifdef USE_FUNCTION_PROTOTYPES
extern int *mxGetJc(	
    const Matrix *pm		/* pointer to matrix */
    );
#else
extern int *mxGetJc();
#endif /* USE_FUNCTION_PROTOTYPES */


/*
 * Set pointer to sparse jc array
 */
#ifdef USE_FUNCTION_PROTOTYPES
extern void mxSetJc(	
    Matrix	*pm,		/* pointer to matrix */
    int		*jc		/* pointer to sparse jc array */
    );
#else
extern mxSetJc();
#endif /* USE_FUNCTION_PROTOTYPES */


/*
 * Convert MATLAB string to C string
 */
#ifdef USE_FUNCTION_PROTOTYPES
extern int mxGetString(
    const Matrix *pm,		/* pointer to matrix */
    char	*str_ptr,	/* pointer to string holding results */
    int		str_len		/* length of string that holds results */
    );
#else
extern int mxGetString();
#endif /* USE_FUNCTION_PROTOTYPES */


/*
 * Put C string into MATLAB matrix
 */
#ifdef USE_FUNCTION_PROTOTYPES
extern Matrix *mxCreateString(
    const char	*str_ptr	/* input C string */
    );
#else
extern Matrix *mxCreateString();
#endif /* USE_FUNCTION_PROTOTYPES */


/*
 * Return first number in matrix input (assumed to be real)
 */
#ifdef USE_FUNCTION_PROTOTYPES
extern Real mxGetScalar(
    const Matrix	*pm		/* pointer to matrix */
    );
#else
extern Real mxGetScalar();
#endif /* USE_FUNCTION_PROTOTYPES */


/*
 * Is matrix struc set to FULL
 */
#ifdef USE_FUNCTION_PROTOTYPES
extern int mxIsFull(
    const Matrix *pm		/* pointer to matrix */
    );
#else
extern int mxIsFull();
#endif /* USE_FUNCTION_PROTOTYPES */


/*
 * Is matrix struc set to SPARSE
 */
#ifdef USE_FUNCTION_PROTOTYPES
extern int mxIsSparse(
    const Matrix *pm		/* pointer to matrix */
    );
#else
extern int mxIsSparse();
#endif /* USE_FUNCTION_PROTOTYPES */


/*
 * Is matrix type DOUBLE
 */
#ifdef USE_FUNCTION_PROTOTYPES
extern int mxIsDouble(
    const Matrix *pm		/* pointer to matrix */
    );
#else
extern int mxIsDouble();
#endif /* USE_FUNCTION_PROTOTYPES */


/*
 * Set matrix display mode to STRING
 */
#ifdef USE_FUNCTION_PROTOTYPES
extern void mxSetString(
    Matrix *pm		/* pointer to matrix */
    );
#else
extern void mxSetString();
#endif /* USE_FUNCTION_PROTOTYPES */


/*
 * Is matrix display mode STRING
 */
#ifdef USE_FUNCTION_PROTOTYPES
extern int mxIsString(
    const Matrix *pm		/* pointer to matrix */
    );
#else
extern int mxIsString();
#endif /* USE_FUNCTION_PROTOTYPES */


/*
 * Is matrix display mode NUMBER
 */
#ifdef USE_FUNCTION_PROTOTYPES
extern int mxIsNumeric(
    const Matrix *pm		/* pointer to matrix */
    );
#else
extern int mxIsNumeric();
#endif /* USE_FUNCTION_PROTOTYPES */


/*
 * Is matrix of type double and does is have a complex part
 */
#ifdef USE_FUNCTION_PROTOTYPES
extern int mxIsComplex(
    const Matrix *pm		/* pointer to matrix */
    );
#else
extern int mxIsComplex();
#endif /* USE_FUNCTION_PROTOTYPES */


/*
 * Create a sparse matrix
 */
#ifdef USE_FUNCTION_PROTOTYPES
extern Matrix *mxCreateSparse(
    int		m,		/* number of rows */
    int		n,		/* number of columns */
    int		nzmax,		/* initial number of non-zeros elements */
    int		cmplx_flg	/* complex data */
    );
#else
extern Matrix *mxCreateSparse();
#endif /* USE_FUNCTION_PROTOTYPES */

#ifdef __cplusplus
    }	/* extern "C" */
#endif

#endif /* matrix_h */
