lssol_h

/*
**	Copyright 1997, Universities Research Association.  All rights reserved.
*/
/******************************************************************************/
/* lssol.h
**  
**	prototypes and defined constants for argument values for
**	ul_lssol library routines
**
*/
/******************************************************************************/


#ifndef LSSOL_DEFINED				/* do this only once */
#define	LSSOL_DEFINED

/******************************************************************************/
/* 
**	macros
*/
/******************************************************************************/

/******************************************************************************/
/* 
**	defined constants for argument values and structure definitions
*/
/******************************************************************************/

/******************************************************************************/
/* 
**	data structures
*/
/******************************************************************************/


/******************************************************************************/
/*
**	function prototypes
*/
/******************************************************************************/
/*
extern "C" {
void lsfile(int *options_vun, int *status);
void lsoptn(struct dsc_descriptor_s *parameter);
void lsoptn_c(char *parameter);
void lssol(int *num_rows_a, int *num_values_x, int *num_constraints,
	   int *num_rows_c, int *row_length_a, double *constr_coeffs,
	   double *lower_bounds, double *upper_bounds, double *cvec,
	   int *constr_status, int *a_column_order, double *array_x,
	   double *matrix_a, double *array_b, int *status,
	   int *num_iterations, double *objective_value,
	   double *constr_lagrange, int *workspace, int *workspace_len,
	   double *real_workspace, int *real_work_len);
}
*/
/******************************************************************************/
/*
**	equivalent name definitions
*/
/******************************************************************************/

#define	LSFILE				lsfile
#define	LSOPTN				lsoptn
#define	LSOPTN_C			lsoptn_c
#define	LSSOL				lssol

#endif

#define TRUE    1
#define FALSE   0

extern "C" {
void lsoptn_c(char *parameter);
void cmalf1( int firstv, int negstp, double bigalf, double bigbnd,
             double pnorm,int *jadd1, int *jadd2, double *palfa1,double *palfa2,
             int *istate, int n,   int nctotl,
             double *Anorm, double *Ap, double *Ax,
	     double *bl, double *bu, double *featol, double *p, double *x );
void cmalf ( int firstv, int *hitlow, 
             int *istate, int *inform, int *jadd,
	     int n, int nctotl, int numinf,
             double *alfa, double *palfa, double *atphit, 
             double bigalf, double bigbnd, double pnorm,
             double *Anorm, double *Ap, double *Ax, double *bl,
	     double *bu, double *featol, double *p, double *x );
	     
void cmwrap( int nfree, int n, int nclin, int nctotl,
             int nactiv, int *istate, int *kactiv, int *kx,
             double **A, double *bl, double *bu, double *c, double *clamda,
	     double *featol, double *r, double *rlamda, double *x );
void cmtsol( int mode,int n, double **T, double *y );
void cmperm( int *kx, int m1, int m2, int *ifail );
void cmqmul( int mode, int n, int nZ, int nfree, int ldQ, int unitQ,
                         int *kx, double *v, double **Q, double *w );
void cmrswp( int n, int nU, int nrank, int i, int j, double **R,
		double **U, double *c, double *s );
void cmchk ( int *nerror, int msglvl, int lcrash, int userkx,
             int liwork, int lwork, int litotl, int lwtotl,
             int n, int nclin, int ncnln, int *istate, int *kx,
	     int named, char *names, double  bigbnd,
	     double *bl, double *bu, double *clamda, double *x );
void cmprnt(int msglvl, int n, int nclin, int nctotl, double  bigbnd,
                         int named, char *names, int *istate,
                         double *bl, double *bu, double *clamda, double *featol,
			 double  *r );

void write_x (int ipr, char *format, ...);
void read_x  (int ipr, char *format, ...);
void dload ( int n, double cons, double *x );
int dload_subcolumn ( int m, int n, double **A, double consta,
                      int Row, int Col, int nrows );
int dload_subrow ( int m, int n, double **A, double consta,
                   int Row, int Col, int ncols );
void dgemv ( char trans, int m, int n, double alpha,
	     double **A, double *x, double beta, double *y );
int dswap_subcolumns ( int m, int n, double **A, int xrow, int xcol,
                       int yrow, int ycol, int mrows );
int dswap_subrows ( int m, int n, double **A, int xrow, int xcol,
                    int yrow, int ycol, int ncols );
int dswap_subcol_subrow ( int m, int n, double **A, int Crow, int Ccol,
                          int Rrow, int Rcol, int nelems );
void dcond ( int n, double *x, double *xmax, double *xmin );
int dcond_subdiagonal ( int n, int diag, double **A, int Row, int Col,
                        double *xmax, double *xmin );
void dscal ( int n, double alpha, double *x );
void f06qhf( char matrix, int m, int n, double consta, double diag, double **a);
void f06qkf( char side, char trans, int n, double *perm, int k,
             double **b, int ldb );
void f06qnf( char side, int n, int k1, int k2, double *s, double **a );
void f06qrf( char side, int n, int k1, int k2, double *c, double *s,double **a);
void f06qsf( char side, int n, int k1, int k2, double *c, double *s,double **a);
void f06qtf( char side, int n, int k1, int k2, double *c, double *s,double **a);
void f06qvf( char side, int n, int k1, int k2, double *c, double *s,double **a);
void f06qwf( char side, int n, int k1, int k2, double *c, double *s,double **a);
void f06qxf( char side, char pivot, char direct, int m, int n,
	     int k1, int k2, double *c, double *s, double **A );
void f06qzf( char hess, int n, int k1, int k2, double *c, double *s,double **a);
void f06fqf( char pivot, char direct, int n, double *alpha,
             double *x, double *c, double *s );
void f06baf( double  *x, double  *y, double  *cs, double  *sn );
void f06fjf( int n, double *x, double *scale, double *sumsq );
double f06bmf( double scale, double ssq );
void  f06aaz( char *subname, int info );
void dgrfg ( int n, double *alpha, double *x, double tol, double *zeta );

int  idrank( int n, double *x, int incx, double tol );
int  idrank_subdiagonal( int n, double **A, int Row, int Col, double tol );
double ddot ( int n, double *x, double *y );
double ddiv  ( double a, double b, int *fail );
void daxpy (int n, double alpha, double *x, double *y );
int idamax( int n, double *x, int incx );
int idamax_subrow     ( int n, double **A, int Row, int Col );
int idamax_subcolumn  ( int n, double **A, int Row, int Col );
int idamax_subdiagonal( int n, double **A, int Row, int Col );
void dtrsv ( char uplo, char trans, char diag, int n, double **a, double *x );
void dtrmv ( char uplo, char trans, char diag, int n, double **a, double *x );
void dger  ( int m, int n, double alpha, double *x, double *y, double **a );

double dnrm2 ( int n, double *x );
int imin2(int x, int y);
int imin3(int x, int y, int z);
int imin4(int v, int x, int y, int z);
int imax2(int x, int y);
int iabs (int x);
double sign (double x, double y);
double fmax3(double x, double y, double z);
double **make_submatrix (double **A, int m, int n, int Row, int Column);
double *submatrix_column (double **A, int m, int n, int Row, int Column);
int subcolumn_to_matrix ( double **A, int m, int n, double *V,
                        int Row, int Column);
double **vector_to_matrix ( int m, int n, double *V);

void dgeqrp( char pivot, int m, int n, double **A,
	     int ldA, double *zeta, int *perm, double *work, int *inform );
void dgeapq( char trans, char wherez, int m, int n, double **A,
             int ldA, double *zeta, int ncolB, double **B,
	     int ldB, double *work, int *inform );
void dgeqr ( int m, int n, double **A, int ldA, double *zeta, int *inform );

void mchpar(void);

void lssol( int *mm, int *n,
         int *nclin, int *ldA, int *ldR,
         double *A, double *bl, double *bu, double *cvec,
         int *istate, int *kx, double *x, double *R, double *b,
         int *inform, int *iter, double *obj, double *clamda,
         int *iw, int *leniw, double *w, int *lenw );
void lssol_c( int *mm, int *n,
         int *nclin, int *ldA, int *ldR,
         double **A, double *bl, double *bu, double *cvec,
         int *istate, int *kx, double *x, double **R, double *b,
         int *inform, int *iter, double *obj, double *clamda,
         int *iw, int *leniw, double *w, int *lenw );
void lsfrmH( char task, int *unitQ, 
         int nfree, int n, int nRank, int ldQ, int ldR,
         int *kx, double **R, double **Q, double *v, double *w, int *inform );
void lsdflt( int m, int n, int nclin, char *title );
void lsloc ( int lprob, int n, int nclin, int *litotl, int *lwtotl );
void lschol( int ldH, int n, int *nRank, double tolrnk, int *kx,
	 double **H, int *inform );
void lscrsh( int cold, int vertex,
         int nclin, int nctotl, int *nactiv, int *nartif,
         int *nfree, int n, int ldA,
         int *istate, int *kactiv,
         double bigbnd, double tolact,
         double **A, double *Ax, double *bl, double *bu,
	 double *x, double *wx, double *work );
void lsbnds( int *unitQ, int *inform, int *nZ, int *nfree,
         int nRank, int nres, int ngQ,
         int n, int ldQ, int ldA, int ldR, int ldT,
         int *istate, int *kx, double condmx,
         double **A, double **R, double **T,
	 double **res, double *gQm, double **Q,
         double *w, double *c, double *s );
void lsadd ( int *unitQ, int *inform, int ifix, int iadd, int jadd,
         int nactiv, int nZ, int nfree, int nRank, int nres, int ngQ,
         int n, int ldA, int ldQ, int ldR, int ldT,
         int *kx, double condmx,
         double **A, double **R, double **T, double **res,
	 double **gQm, double **Q,
         double *w, double *c, double *s );
void lsadds( int *unitQ, int vertex,
         int *inform, int k1, int k2, int *nactiv, int *nartif, int *nZ,
	 int *nfree, int nRank, int *nrejtd, int nres, int ngQ,
         int n, int ldQ, int ldA, int ldR, int ldT,
         int *istate, int *kactiv, int *kx, double condmx,
         double **A, double **R, double **T, double **res, double **gQm,
	 double **Q, double *w, double *c, double *s );
void lssetx( int linObj, int *rowerr, int *unitQ,
         int nclin, int nactiv, int nfree, int nRank, int nZ,
         int n, int nctotl, int ldQ, int ldA, int ldR, int ldT,
         int *istate, int *kactiv, int *kx,
         int *jmax, double *errmax, double *ctx, double *xnorm,
         double **A, double *Ax, double *bl, double *bu,
	 double *cQ, double *res, double *res0, double *featol,
         double **R, double **T, double *x, double **Q,
	 double *p, double *work );
void lscore( char *prbtyp, int named, char *names, int linObj, int *unitQ,
         int *inform, int *iter, int jinf, int nclin, int nctotl,
         int *nactiv, int *nfree, int nRank, int *nZ, int *nZr,
         int n, int ldA, int ldR,
         int *istate, int *kactiv, int *kx,
         double *ctx, double *ssq, double ssq1, double *suminf,
	 int *numinf, double *xnorm, double *bl, double *bu, double **A,
	 double *clamda, double *Ax,
         double *featol, double **R, double *x, double *w );
void lsgset( char *prbtyp, int linObj, int *singlr, int *unitgZ, int *unitQ,
         int n, int nclin, int nfree,int ldA, int ldQ, int ldR,
	 int nRank, int nZ, int *nZr, int *istate, int *kx,
         double bigbnd, double tolrnk, int *numinf, double *suminf,
         double *bl, double *bu, double **A, double *res, double *featol,
         double *gQ, double *cQ, double **R, double *x, double *wtinf,
	 double **Q, double *wrk );
void lsprt ( char *prbtyp, int isdel, int iter, int jadd, int *jdel,
         int msglvl, int nactiv, int nfree, int n, int nclin,
         int nRank, int ldR, int ldT, int nZ, int nZr, int *istate,
         double alfa, double condRz, double condT, double gZrnrm,
         int numinf, double suminf, double ctx, double ssq,
         double *Ax, double **R, double **T, double *x, double *work );
void lsmove( int hitcon, int hitlow, int linObj, int unitgZ,
       	 int nclin, int nRank,int  nZr, int n, int ldR, int jadd,
	 int numinf,
         double alfa, double ctp, double *ctx, double *xnorm,
         double *Ap, double *Ax, double *bl, double *bu, double *gQ,
	 double *hZ, double *p, double *res,
         double **R, double *x, double *work );
void lsgetp( int linObj, int singlr, int unitgZ, int *unitQ,
         int n, int nclin, int nfree,
         int ldA, int ldQ, int ldR, int nRank, int numinf, int nZr,
         int *kx, double *ctp, double *pnorm,
         double **A, double *Ap, double *res, double *hZ, double *p,
         double *gQ, double *cQ, double **R, double **Q, double *work );
void lsfeas(int n, int nclin, int *istate,
         double bigbnd, double *cvnorm, double *errmax, int *jmax, int *nviol,
         double *Ax, double *bl, double *bu, double *featol,
	 double *x, double *work );
void lsmuls( char *prbtyp, int msglvl, int n, int nactiv, int nfree,
         int ldA, int ldT, int numinf, int nZ, int nZr,
         int *istate, int *kactiv, int *kx, double dinky,
         int *jsmlst, int *ksmlst, int jinf, int *jtiny,
         int *jbigst, int *kbigst, double *trulam,
         double **A, double *anorms, double *gQ, double *rlamda,
	 double **T, double *wtinf );
void lsdel ( int *unitQ, int n, int *nactiv, int *nfree,
             int nres, int ngQ, int *nZ, int *nZr,
             int ldA, int ldQ, int ldR, int ldT, int nRank,
             int jdel, int kdel, int *kactiv, int *kx,
             double **A, double **res, double **R, double **T, double **gQ,
	     double **Q, double *c, double *s );
void lskey ( int nout, char *buffer, char *key );
void lsoptn(char *parameter);
/*int lenchs_c(char *addr, int maxn=80);	/ * ul_clib, clib.h * /
int str_find_character_c( char *str, char ch, int lng, int direction); */
/* void optokn (char *string, int *number, char **list); */
void optokn (char *string, int *number, char list[][17]);
void oplook (int ndict, char dictry[][17], int alpha, char *key, int *entry);
int opnumb( char *string, int *exp_flag );
void opuppr(char *string);
void opscan (char *string, int *first, int *last, int *mark);
int solid (char ch);
double **Fres_to_Cres ( int m, int n, double *V );
void Cres_to_Fres ( int m, int n, double *V );
double **Fmatrix_to_Cmatrix ( int m, int n, double *V );
void Cmatrix_to_Fmatrix ( int m, int n, double *V );
}