Ipopt
trunk
|
00001 /* 00002 * COPYRIGHT (c) 2011 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-02-25 00007 */ 00008 00009 #ifndef HSL_MA86D_H 00010 #define HSL_MA86D_H 00011 00012 #ifndef ma86_default_control 00013 #define ma86_control ma86_control_d 00014 #define ma86_info ma86_info_d 00015 #define ma86_default_control ma86_default_control_d 00016 #define ma86_analyse ma86_analyse_d 00017 #define ma86_factor ma86_factor_d 00018 #define ma86_factor_solve ma86_factor_solve_d 00019 #define ma86_solve ma86_solve_d 00020 #define ma86_finalise ma86_finalise_d 00021 #endif 00022 00023 typedef double ma86pkgtype_d_; 00024 typedef double ma86realtype_d_; 00025 00026 /* Data type for user controls */ 00027 struct ma86_control_d { 00028 /* Note: 0 is false, non-zero is true */ 00029 00030 /* C/Fortran interface related controls */ 00031 int f_arrays; /* Treat arrays as 1-based (Fortran) if true or 0-based (C) if 00032 false. */ 00033 00034 /* Printing controls */ 00035 int diagnostics_level; /* Controls diagnostic printing.*/ 00036 /* Possible values are: 00037 < 0: no printing. 00038 0: error and warning messages only. 00039 1: as 0 plus basic diagnostic printing. 00040 2: as 1 plus some more detailed diagnostic messages. 00041 3: as 2 plus all entries of user-supplied arrays. */ 00042 int unit_diagnostics; /* unit for diagnostic messages 00043 Printing is suppressed if unit_diagnostics < 0. */ 00044 int unit_error; /* unit for error messages 00045 Printing is suppressed if unit_error < 0. */ 00046 int unit_warning; /* unit for warning messages 00047 Printing is suppressed if unit_warning < 0. */ 00048 00049 /* Controls used by ma86_analyse */ 00050 int nemin; /* Node amalgamation parameter. A child node is merged with its 00051 parent if they both involve fewer than nemin eliminations.*/ 00052 int nb; /* Controls the size of the blocks used within each node (used to 00053 set nb within node_type)*/ 00054 00055 /* Controls used by ma86_factor and ma86_factor_solve */ 00056 int action; /* Keep going even if matrix is singular if true, or abort 00057 if false */ 00058 int nbi; /* Inner block size for use with ma64*/ 00059 int pool_size; /* Size of task pool arrays*/ 00060 ma86realtype_d_ small_; /* Pivots less than small are treated as zero*/ 00061 ma86realtype_d_ static_;/* Control static pivoting*/ 00062 ma86realtype_d_ u; /* Pivot tolerance*/ 00063 ma86realtype_d_ umin; /* Minimum pivot tolerance*/ 00064 int scaling; /* Scaling algorithm to use */ 00065 }; 00066 00067 /***************************************************/ 00068 00069 /* data type for returning information to user.*/ 00070 struct ma86_info_d { 00071 ma86realtype_d_ detlog; /* Holds logarithm of abs det A (or 0) */ 00072 int detsign; /* Holds sign of determinant (+/-1 or 0) */ 00073 int flag; /* Error return flag (0 on success) */ 00074 int matrix_rank; /* Rank of matrix */ 00075 int maxdepth; /* Maximum depth of the tree. */ 00076 int num_delay; /* Number of delayed pivots */ 00077 long num_factor; /* Number of entries in the factor. */ 00078 long num_flops; /* Number of flops for factor. */ 00079 int num_neg; /* Number of negative pivots */ 00080 int num_nodes; /* Number of nodes */ 00081 int num_nothresh; /* Number of pivots not satisfying u */ 00082 int num_perturbed; /* Number of perturbed pivots */ 00083 int num_two; /* Number of 2x2 pivots */ 00084 int pool_size; /* Maximum size of task pool used */ 00085 int stat; /* STAT value on error return -1. */ 00086 ma86realtype_d_ usmall; /* smallest threshold parameter used */ 00087 }; 00088 00089 /* Initialise control with default values */ 00090 void ma86_default_control_d(struct ma86_control_d *control); 00091 /* Analyse the sparsity pattern and prepare for factorization */ 00092 void ma86_analyse_d(const int n, const int ptr[], const int row[], int order[], 00093 void **keep, const struct ma86_control_d *control, 00094 struct ma86_info_d *info); 00095 /* To factorize the matrix */ 00096 void ma86_factor_d(const int n, const int ptr[], const int row[], 00097 const ma86pkgtype_d_ val[], const int order[], void **keep, 00098 const struct ma86_control_d *control, struct ma86_info_d *info, 00099 const ma86realtype_d_ scale[]); 00100 /* To factorize the matrix AND solve AX = B */ 00101 void ma86_factor_solve_d(const int n, const int ptr[], const int row[], 00102 const ma86pkgtype_d_ val[], const int order[], void **keep, 00103 const struct ma86_control_d *control, struct ma86_info_d *info, 00104 const int nrhs, const int ldx, ma86pkgtype_d_ x[], 00105 const ma86realtype_d_ scale[]); 00106 /* To solve AX = B using the computed factors */ 00107 void ma86_solve_d(const int job, const int nrhs, const int ldx, 00108 ma86pkgtype_d_ *x, const int order[], void **keep, 00109 const struct ma86_control_d *control, struct ma86_info_d *info, 00110 const ma86realtype_d_ scale[]); 00111 /* To clean up memory in keep */ 00112 void ma86_finalise_d(void **keep, const struct ma86_control_d *control); 00113 00114 #endif