Ipopt  trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
hsl_ma77d.h
Go to the documentation of this file.
00001 /*
00002  * COPYRIGHT (c) 2011, 2013 The Science and Technology Facilities Council (STFC)
00003  * All Rights Reserved.
00004  * This code is published under the Eclipse Public License.
00005  *
00006  * Authors:  Jonathan Hogg    STFC     2011-05-18
00007  */
00008 
00009 #ifndef HSL_MA77D_H
00010 #define HSL_MA77D_H
00011 
00012 #ifndef ma77_default_control
00013 #define ma77_control ma77_control_d
00014 #define ma77_info ma77_info_d
00015 #define ma77_default_control ma77_default_control_d
00016 #define ma77_open_nelt ma77_open_nelt_d
00017 #define ma77_open ma77_open_d
00018 #define ma77_input_vars ma77_input_vars_d
00019 #define ma77_input_reals ma77_input_reals_d
00020 #define ma77_analyse ma77_analyse_d
00021 #define ma77_factor ma77_factor_d
00022 #define ma77_factor_solve ma77_factor_solve_d
00023 #define ma77_solve ma77_solve_d
00024 #define ma77_resid ma77_resid_d
00025 #define ma77_scale ma77_scale_d
00026 #define ma77_enquire_posdef ma77_enquire_posdef_d
00027 #define ma77_enquire_indef ma77_enquire_indef_d
00028 #define ma77_alter ma77_alter_d
00029 #define ma77_restart ma77_restart_d
00030 #define ma77_finalise ma77_finalise_d
00031 #define ma77_solve_fredholm ma77_solve_fredholm_d
00032 #define ma77_lmultiply ma77_lmultiply_d
00033 #endif
00034 
00035 typedef double ma77pkgtype_d_;
00036 
00037 /* Data type for user controls */
00038 struct ma77_control_d {
00039    /* Note: 0 is false, non-zero is true */
00040 
00041    /* C/Fortran interface related controls */
00042    int f_arrays; /* Treat arrays as 1-based (Fortran) if true or 0-based (C) if
00043                     false. */
00044 
00045    /* Printing controls */
00046    int print_level;
00047    int unit_diagnostics;   /* unit for diagnostic messages
00048                               Printing is suppressed if unit_diagnostics < 0. */
00049    int unit_error;         /* unit for error messages
00050                               Printing is suppressed if unit_error  <  0.     */
00051    int unit_warning;       /* unit for warning messages
00052                               Printing is suppressed if unit_warning  <  0.   */
00053 
00054    /* Controls used by MA77_open */
00055    int bits;
00056    int buffer_lpage[2];
00057    int buffer_npage[2];
00058    long int file_size;
00059    long int maxstore;
00060    long int storage[3];
00061 
00062    /* Controls used by MA77_analyse */
00063    int nemin;  /* Node amalgamation parameter. A child node is merged with its
00064                   parent if they both involve fewer than nemin eliminations.*/
00065 
00066    /* Controls used by MA77_scale */
00067    int maxit;
00068    int infnorm;
00069    ma77pkgtype_d_ thresh;
00070 
00071    /* Controls used by MA77_factor with posdef true */
00072    int nb54;
00073 
00074    /* Controls used by MA77_factor with posdef false */
00075    int action;    /* Keep going even if matrix is singular if true, or abort
00076                      if false */
00077    ma77pkgtype_d_ multiplier;
00078    int nb64;
00079    int nbi;
00080    ma77pkgtype_d_ small;
00081    ma77pkgtype_d_ static_;
00082    long int storage_indef;
00083    ma77pkgtype_d_ u;       /* Pivot tolerance*/
00084    ma77pkgtype_d_ umin;    /* Minimum pivot tolerance*/
00085 
00086 #if defined(COINHSL_HSL2013) || !defined(COINHSL_HAS_MA77)
00087    /* Controls used by ma77_solve_fredholm */
00088    ma77pkgtype_d_ consist_tol;   /* Tolerance for consistent singular system */
00089 
00090    /* Pad data structure to allow for future growth */
00091    int ispare[5]; long int lspare[5]; ma77pkgtype_d_ rspare[5];
00092 #endif
00093 };
00094 
00095 /***************************************************/
00096 
00097 /* data type for returning information to user.*/
00098 struct ma77_info_d {
00099    ma77pkgtype_d_ detlog;
00100    int detsign;
00101    int flag;
00102    int iostat;
00103    int matrix_dup;
00104    int matrix_rank;
00105    int matrix_outrange;
00106    int maxdepth;
00107    int maxfront;
00108    long int minstore;
00109    int ndelay;
00110    long int nfactor;
00111    long int nflops;
00112    int niter;
00113    int nsup;
00114    int num_neg;
00115    int num_nothresh;
00116    int num_perturbed;
00117    int ntwo;
00118    int stat;
00119    int index[4];
00120    long int nio_read[2];
00121    long int nio_write[2];
00122    long int nwd_read[2];
00123    long int nwd_write[2];
00124    int num_file[4];
00125    long int storage[4];
00126    int tree_nodes;
00127    int unit_restart;
00128    int unused;
00129    ma77pkgtype_d_ usmall;
00130 
00131    /* if we do not have MA77, we assume its is loaded via the linear solver loader, for which we assume HSL 2013 */
00132 #if defined(COINHSL_HSL2013) || !defined(COINHSL_HAS_MA77)
00133    /* Pad data structure to allow for future growth */
00134    int ispare[5]; long int lspare[5]; ma77pkgtype_d_ rspare[5];
00135 #endif
00136 };
00137 
00138 /* Initialise control with default values */
00139 void ma77_default_control_d(struct ma77_control_d *control);
00140 void ma77_open_nelt(const int n, const char* fname1, const char* fname2,
00141    const char *fname3, const char *fname4, void **keep,
00142    const struct ma77_control_d *control, struct ma77_info_d *info,
00143    const int nelt);
00144 void ma77_open_d(const int n, const char* fname1, const char* fname2,
00145    const char *fname3, const char *fname4, void **keep,
00146    const struct ma77_control_d *control, struct ma77_info_d *info);
00147 void ma77_input_vars(const int idx, const int nvar, const int list[],
00148    void **keep, const struct ma77_control_d *control, struct ma77_info_d *info);
00149 void ma77_input_reals_d(const int idx, const int length,
00150    const ma77pkgtype_d_ reals[], void **keep, const struct ma77_control_d *control,
00151    struct ma77_info_d *info);
00152 /* Analyse the sparsity pattern and prepare for factorization */
00153 void ma77_analyse(const int order[], void **keep,
00154    const struct ma77_control_d *control, struct ma77_info_d *info);
00155 /* To factorize the matrix */
00156 void ma77_factor_d(const int posdef, void **keep, 
00157    const struct ma77_control_d *control, struct ma77_info_d *info,
00158    const ma77pkgtype_d_ *scale);
00159 /* To factorize the matrix AND solve AX = B */
00160 void ma77_factor_solve_d(const int posdef, void **keep, 
00161    const struct ma77_control_d *control, struct ma77_info_d *info,
00162    const ma77pkgtype_d_ *scale, const int nrhs, const int lx,
00163    ma77pkgtype_d_ rhs[]);
00164 /* To solve AX = B using the computed factors */
00165 void ma77_solve_d(const int job, const int nrhs, const int lx, ma77pkgtype_d_ x[],
00166    void **keep, const struct ma77_control_d *control, struct ma77_info_d *info,
00167    const ma77pkgtype_d_ *scale);
00168 void ma77_resid_d(const int nrhs, const int lx, const ma77pkgtype_d_ x[],
00169    const int lresid, ma77pkgtype_d_ resid[], void **keep, 
00170    const struct ma77_control_d *control, struct ma77_info_d *info,
00171    ma77pkgtype_d_ *anorm_bnd);
00172 void ma77_scale_d(ma77pkgtype_d_ scale[], void **keep, 
00173    const struct ma77_control_d *control, struct ma77_info_d *info,
00174    ma77pkgtype_d_ *anorm);
00175 void ma77_enquire_posdef_d(ma77pkgtype_d_ d[], void **keep, 
00176    const struct ma77_control_d *control, struct ma77_info_d *info);
00177 void ma77_enquire_indef_d(int piv_order[], ma77pkgtype_d_ d[], void **keep, 
00178    const struct ma77_control_d *control, struct ma77_info_d *info);
00179 void ma77_alter_d(const ma77pkgtype_d_ d[], void **keep, 
00180    const struct ma77_control_d *control, struct ma77_info_d *info);
00181 void ma77_restart_d(const char *restart_file, const char *fname1, 
00182    const char *fname2, const char *fname3, const char *fname4, void **keep, 
00183    const struct ma77_control_d *control, struct ma77_info_d *info);
00184 /* exists only for HSL 2013 */
00185 void ma77_solve_fredholm_d(int nrhs, int flag_out[], int lx, ma77pkgtype_d_ x[],
00186    void **keep, const struct ma77_control_d *control,
00187    struct ma77_info_d *info, const ma77pkgtype_d_ *scale);
00188 /* exists only for HSL 2013 */
00189 void ma77_lmultiply_d(int trans, int k, int lx, ma77pkgtype_d_ x[], int ly,
00190    ma77pkgtype_d_ y[], void **keep, const struct ma77_control_d *control,
00191    struct ma77_info_d *info, const ma77pkgtype_d_ *scale);
00192 /* To clean up memory in keep */
00193 void ma77_finalise_d(void **keep, const struct ma77_control_d *control,
00194    struct ma77_info_d *info);
00195 
00196 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines