Ipopt  trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
HSLLoader.h
Go to the documentation of this file.
00001 /* Copyright (C) 2008, 2011 GAMS Development and others
00002  All Rights Reserved.
00003  This code is published under the Eclipse Public License.
00004 
00005  $Id$
00006 
00007  Author: Stefan Vigerske
00008 */
00009 
00010 #ifndef HSLLOADER_H_
00011 #define HSLLOADER_H_
00012 
00013 #include "IpoptConfig.h"
00014 
00015 #ifdef __cplusplus
00016 extern "C" {
00017 #endif
00018 
00019 #ifndef ma77_default_control
00020 #define ma77_control ma77_control_d
00021 #define ma77_info ma77_info_d
00022 #define ma77_default_control ma77_default_control_d
00023 #define ma77_open_nelt ma77_open_nelt_d
00024 #define ma77_open ma77_open_d
00025 #define ma77_input_vars ma77_input_vars_d
00026 #define ma77_input_reals ma77_input_reals_d
00027 #define ma77_analyse ma77_analyse_d
00028 #define ma77_factor ma77_factor_d
00029 #define ma77_factor_solve ma77_factor_solve_d
00030 #define ma77_solve ma77_solve_d
00031 #define ma77_resid ma77_resid_d
00032 #define ma77_scale ma77_scale_d
00033 #define ma77_enquire_posdef ma77_enquire_posdef_d
00034 #define ma77_enquire_indef ma77_enquire_indef_d
00035 #define ma77_alter ma77_alter_d
00036 #define ma77_restart ma77_restart_d
00037 #define ma77_finalise ma77_finalise_d
00038 #endif
00039 
00040 struct ma77_control;
00041 struct ma77_info;
00042 typedef double ma77pkgtype_d_;
00043 
00044 
00045 #ifndef ma86_default_control
00046 #define ma86_control ma86_control_d
00047 #define ma86_info ma86_info_d
00048 #define ma86_default_control ma86_default_control_d
00049 #define ma86_analyse ma86_analyse_d
00050 #define ma86_factor ma86_factor_d
00051 #define ma86_factor_solve ma86_factor_solve_d
00052 #define ma86_solve ma86_solve_d
00053 #define ma86_finalise ma86_finalise_d
00054 #endif
00055 
00056 struct ma86_control;
00057 struct ma86_info;
00058 typedef double ma86pkgtype_d_;
00059 typedef double ma86realtype_d_;
00060 
00061 #ifndef ma97_default_control
00062 #define ma97_control ma97_control_d
00063 #define ma97_info ma97_info_d
00064 #define ma97_default_control ma97_default_control_d
00065 #define ma97_analyse ma97_analyse_d
00066 #define ma97_factor ma97_factor_d
00067 #define ma97_factor_solve ma97_factor_solve_d
00068 #define ma97_solve ma97_solve_d
00069 #define ma97_finalise ma97_finalise_d
00070 #define ma97_free_akeep ma97_free_akeep_d
00071 #endif
00072 
00073 struct ma97_control;
00074 struct ma97_info;
00075 typedef double ma97pkgtype_d_;
00076 typedef double ma97realtype_d_;
00077 
00078 struct mc68_control_i;
00079 struct mc68_info_i;
00080 
00081 #ifndef __IPTYPES_HPP__
00082 /* Type of Fortran integer translated into C */
00083 typedef FORTRAN_INTEGER_TYPE ipfint;
00084 #endif
00085 
00086 typedef void (*ma27ad_t)(ipfint *N, ipfint *NZ, const ipfint *IRN, const ipfint* ICN,
00087           ipfint *IW, ipfint* LIW, ipfint* IKEEP, ipfint *IW1,
00088           ipfint* NSTEPS, ipfint* IFLAG, ipfint* ICNTL,
00089           double* CNTL, ipfint *INFO, double* OPS);
00090 typedef void (*ma27bd_t)(ipfint *N, ipfint *NZ, const ipfint *IRN, const ipfint* ICN,
00091           double* A, ipfint* LA, ipfint* IW, ipfint* LIW,
00092           ipfint* IKEEP, ipfint* NSTEPS, ipfint* MAXFRT,
00093           ipfint* IW1, ipfint* ICNTL, double* CNTL,
00094           ipfint* INFO);
00095 typedef void (*ma27cd_t)(ipfint *N, double* A, ipfint* LA, ipfint* IW,
00096           ipfint* LIW, double* W, ipfint* MAXFRT,
00097           double* RHS, ipfint* IW1, ipfint* NSTEPS,
00098           ipfint* ICNTL, double* CNTL);
00099 typedef void (*ma27id_t)(ipfint* ICNTL, double* CNTL);
00100 
00101 typedef void (*ma28ad_t)(void* nsize, void* nz, void* rw, void* licn, void* iw,
00102           void* lirn, void* iw2, void* pivtol, void* iw3, void* iw4, void* rw2, void* iflag);
00103 
00104 typedef void (*ma57ad_t) (
00105     ipfint    *n,     /* Order of matrix. */
00106     ipfint    *ne,            /* Number of entries. */
00107     const ipfint    *irn,       /* Matrix nonzero row structure */
00108     const ipfint    *jcn,       /* Matrix nonzero column structure */
00109     ipfint    *lkeep,     /* Workspace for the pivot order of lenght 3*n */
00110     ipfint    *keep,      /* Workspace for the pivot order of lenght 3*n */
00111     /* Automatically iflag = 0; ikeep pivot order iflag = 1 */
00112     ipfint    *iwork,     /* Integer work space. */
00113     ipfint    *icntl,     /* Integer Control parameter of length 30*/
00114     ipfint    *info,      /* Statistical Information; Integer array of length 20 */
00115     double    *rinfo);    /* Double Control parameter of length 5 */
00116 
00117 typedef void (*ma57bd_t) (
00118     ipfint    *n,     /* Order of matrix. */
00119     ipfint    *ne,            /* Number of entries. */
00120     double    *a,     /* Numerical values. */
00121     double    *fact,      /* Entries of factors. */
00122     ipfint    *lfact,     /* Length of array `fact'. */
00123     ipfint    *ifact,     /* Indexing info for factors. */
00124     ipfint    *lifact,    /* Length of array `ifact'. */
00125     ipfint    *lkeep,     /* Length of array `keep'. */
00126     ipfint    *keep,      /* Integer array. */
00127     ipfint    *iwork,     /* Workspace of length `n'. */
00128     ipfint    *icntl,     /* Integer Control parameter of length 20. */
00129     double    *cntl,      /* Double Control parameter of length 5. */
00130     ipfint    *info,      /* Statistical Information; Integer array of length 40. */
00131     double    *rinfo);    /* Statistical Information; Real array of length 20. */
00132 
00133 typedef void (*ma57cd_t) (
00134     ipfint    *job,       /* Solution job.  Solve for... */
00135     ipfint    *n,         /* Order of matrix. */
00136     double    *fact,      /* Entries of factors. */
00137     ipfint    *lfact,     /* Length of array `fact'. */
00138     ipfint    *ifact,     /* Indexing info for factors. */
00139     ipfint    *lifact,    /* Length of array `ifact'. */
00140     ipfint    *nrhs,      /* Number of right hand sides. */
00141     double    *rhs,       /* Numerical Values. */
00142     ipfint    *lrhs,      /* Leading dimensions of `rhs'. */
00143     double    *work,      /* Real workspace. */
00144     ipfint    *lwork,     /* Length of `work', >= N*NRHS. */
00145     ipfint    *iwork,     /* Integer array of length `n'. */
00146     ipfint    *icntl,     /* Integer Control parameter array of length 20. */
00147     ipfint    *info);     /* Statistical Information; Integer array of length 40. */
00148 
00149 typedef void (*ma57ed_t) (
00150     ipfint    *n,
00151     ipfint    *ic,        /* 0: copy real array.  >=1:  copy integer array. */
00152     ipfint    *keep,
00153     double    *fact,
00154     ipfint    *lfact,
00155     double    *newfac,
00156     ipfint    *lnew,
00157     ipfint    *ifact,
00158     ipfint    *lifact,
00159     ipfint    *newifc,
00160     ipfint    *linew,
00161     ipfint    *info);
00162 
00163 typedef void (*ma57id_t) (double *cntl, ipfint *icntl);
00164 
00165 typedef void (*ma77_default_control_t)(struct ma77_control_d *control);
00166 typedef void (*ma77_open_nelt_t)(const int n, const char* fname1, const char* fname2,
00167    const char *fname3, const char *fname4, void **keep,
00168    const struct ma77_control_d *control, struct ma77_info_d *info,
00169    const int nelt);
00170 typedef void (*ma77_open_t)(const int n, const char* fname1, const char* fname2,
00171    const char *fname3, const char *fname4, void **keep,
00172    const struct ma77_control_d *control, struct ma77_info_d *info);
00173 typedef void (*ma77_input_vars_t)(const int idx, const int nvar, const int list[],
00174    void **keep, const struct ma77_control_d *control, struct ma77_info_d *info);
00175 typedef void (*ma77_input_reals_t)(const int idx, const int length,
00176    const double reals[], void **keep, const struct ma77_control_d *control,
00177    struct ma77_info_d *info);
00178 typedef void (*ma77_analyse_t)(const int order[], void **keep,
00179    const struct ma77_control_d *control, struct ma77_info_d *info);
00180 typedef void (*ma77_factor_t)(const int posdef, void **keep,
00181    const struct ma77_control_d *control, struct ma77_info_d *info,
00182    const double *scale);
00183 typedef void (*ma77_factor_solve_t)(const int posdef, void **keep,
00184    const struct ma77_control_d *control, struct ma77_info_d *info,
00185    const double *scale, const int nrhs, const int lx,
00186    double rhs[]);
00187 typedef void (*ma77_solve_t)(const int job, const int nrhs, const int lx, double x[],
00188    void **keep, const struct ma77_control_d *control, struct ma77_info_d *info,
00189    const double *scale);
00190 typedef void (*ma77_resid_t)(const int nrhs, const int lx, const double x[],
00191    const int lresid, double resid[], void **keep,
00192    const struct ma77_control_d *control, struct ma77_info_d *info,
00193    double *anorm_bnd);
00194 typedef void (*ma77_scale_t)(double scale[], void **keep,
00195    const struct ma77_control_d *control, struct ma77_info_d *info,
00196    double *anorm);
00197 typedef void (*ma77_enquire_posdef_t)(double d[], void **keep,
00198    const struct ma77_control_d *control, struct ma77_info_d *info);
00199 typedef void (*ma77_enquire_indef_t)(int piv_order[], double d[], void **keep,
00200    const struct ma77_control_d *control, struct ma77_info_d *info);
00201 typedef void (*ma77_alter_t)(const double d[], void **keep,
00202    const struct ma77_control_d *control, struct ma77_info_d *info);
00203 typedef void (*ma77_restart_t)(const char *restart_file, const char *fname1,
00204    const char *fname2, const char *fname3, const char *fname4, void **keep,
00205    const struct ma77_control_d *control, struct ma77_info_d *info);
00206 typedef void (*ma77_finalise_t)(void **keep, const struct ma77_control_d *control,
00207    struct ma77_info_d *info);
00208 
00209 typedef void (*ma86_default_control_t)(struct ma86_control *control);
00210 typedef void (*ma86_analyse_t)(const int n, const int ptr[], const int row[],
00211    int order[], void **keep, const struct ma86_control *control,
00212    struct ma86_info *info);
00213 typedef void (*ma86_factor_t)(const int n, const int ptr[], const int row[],
00214    const ma86pkgtype_d_ val[], const int order[], void **keep,
00215    const struct ma86_control *control, struct ma86_info *info,
00216    const ma86pkgtype_d_ scale[]);
00217 typedef void (*ma86_factor_solve_t)(const int n, const int ptr[],
00218    const int row[], const ma86pkgtype_d_ val[], const int order[], void **keep,
00219    const struct ma86_control *control, struct ma86_info *info, const int nrhs,
00220    const int ldx, ma86pkgtype_d_ x[], const ma86pkgtype_d_ scale[]);
00221 typedef void (*ma86_solve_t)(const int job, const int nrhs, const int ldx,
00222    ma86pkgtype_d_ *x, const int order[], void **keep,
00223    const struct ma86_control *control, struct ma86_info *info,
00224    const ma86pkgtype_d_ scale[]);
00225 typedef void (*ma86_finalise_t)(void **keep,
00226    const struct ma86_control *control);
00227 
00228 typedef void (*ma97_default_control_t)(struct ma97_control *control);
00229 typedef void (*ma97_analyse_t)(const int check, const int n, const int ptr[],
00230    const int row[], ma97pkgtype_d_ val[], void **akeep,
00231    const struct ma97_control *control, struct ma97_info *info, int order[]);
00232 typedef void (*ma97_factor_t)(const int matrix_type, const int ptr[],
00233    const int row[], const ma97pkgtype_d_ val[], void **akeep, void **fkeep,
00234    const struct ma97_control *control, struct ma97_info *info,
00235    const ma97pkgtype_d_ scale[]);
00236 typedef void (*ma97_factor_solve_t)(const int matrix_type, const int ptr[],
00237    const int row[], const ma97pkgtype_d_ val[], const int nrhs,
00238    ma97pkgtype_d_ x[], const int ldx,  void **akeep, void **fkeep,
00239    const struct ma97_control *control, struct ma97_info *info,
00240    const ma97pkgtype_d_ scale[]);
00241 typedef void (*ma97_solve_t)(const int job, const int nrhs, ma97pkgtype_d_ *x,
00242    const int ldx, void **akeep, void **fkeep,
00243    const struct ma97_control *control, struct ma97_info *info);
00244 typedef void (*ma97_finalise_t)(void **akeep, void **fkeep);
00245 typedef void (*ma97_free_akeep_t)(void **akeep);
00246 
00247 typedef void (*mc19ad_t)(ipfint *N, ipfint *NZ, double* A, ipfint *IRN, ipfint* ICN, float* R, float* C, float* W);
00248 
00249 typedef void (*mc68_default_control_t)(struct mc68_control_i *control);
00250 typedef void (*mc68_order_t)(int ord, int n, const int ptr[],
00251    const int row[], int perm[], const struct mc68_control_i *control,
00252    struct mc68_info_i *info);
00253 
00269   int LSL_loadHSL(const char* libname, char* msgbuf, int msglen);
00270 
00274   int LSL_unloadHSL();
00275 
00279   int LSL_isHSLLoaded();
00280   
00284   int LSL_isMA27available();
00285 
00289   int LSL_isMA28available();
00290 
00294   int LSL_isMA57available();
00295 
00299   int LSL_isMA77available();
00300 
00304   int LSL_isMA86available();
00305 
00309   int LSL_isMA97available();
00310   
00314   int LSL_isMC19available();
00315   
00319   int LSL_isMC68available();
00320 
00322   char* LSL_HSLLibraryName();
00323 
00325   void LSL_setMA27(ma27ad_t ma27ad, ma27bd_t ma27bd, ma27cd_t ma27cd, ma27id_t ma27id);
00326 
00328   void LSL_setMA28(ma28ad_t ma28ad);
00329 
00331   void LSL_setMA57(ma57ad_t ma57ad, ma57bd_t ma57bd, ma57cd_t ma57cd, ma57ed_t ma57ed, ma57id_t ma57id);
00332 
00334   void LSL_setMA77(ma77_default_control_t ma77_default_control,
00335      ma77_open_nelt_t ma77_open_nelt,
00336      ma77_open_t ma77_open,
00337      ma77_input_vars_t ma77_input_vars,
00338      ma77_input_reals_t ma77_input_reals,
00339      ma77_analyse_t ma77_analyse,
00340      ma77_factor_t ma77_factor,
00341      ma77_factor_solve_t ma77_factor_solve,
00342      ma77_solve_t ma77_solve,
00343      ma77_resid_t ma77_resid,
00344      ma77_scale_t ma77_scale,
00345      ma77_enquire_posdef_t ma77_enquire_posdef,
00346      ma77_enquire_indef_t ma77_enquire_indef,
00347      ma77_alter_t ma77_alter,
00348      ma77_restart_t ma77_restart,
00349      ma77_finalise_t ma77_finalise);
00350 
00352   void LSL_setMA86(ma86_default_control_t ma86_default_control,
00353      ma86_analyse_t ma86_analyse,
00354      ma86_factor_t ma86_factor,
00355      ma86_factor_solve_t ma86_factor_solve,
00356      ma86_solve_t ma86_solve,
00357      ma86_finalise_t ma86_finalise);
00358 
00360   void LSL_setMA97(ma97_default_control_t ma97_default_control,
00361      ma97_analyse_t ma97_analyse,
00362      ma97_factor_t ma97_factor,
00363      ma97_factor_solve_t ma97_factor_solve,
00364      ma97_solve_t ma97_solve,
00365      ma97_finalise_t ma97_finalise,
00366      ma97_free_akeep_t ma97_free_akeep);
00367 
00369   void LSL_setMC19(mc19ad_t mc19ad);
00370 
00372   void LSL_setMC68(mc68_default_control_t mc68_default_control, mc68_order_t mc68_order);
00373 
00374 #ifdef __cplusplus
00375 }
00376 #endif
00377 
00378 #endif /*HSLLOADER_H_*/
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines