| 86 | |
| 87 | template <typename funct> |
| 88 | doublereal bobyqa_( |
| 89 | const funct& calfun, |
| 90 | const integer n, |
| 91 | const integer npt, |
| 92 | doublereal *x, |
| 93 | const doublereal *xl, |
| 94 | const doublereal *xu, |
| 95 | const doublereal rhobeg, |
| 96 | const doublereal rhoend, |
| 97 | const integer maxfun, |
| 98 | doublereal *w |
| 99 | ) const |
| 100 | { |
| 101 | |
| 102 | /* System generated locals */ |
| 103 | integer i__1; |
| 104 | doublereal d__1, d__2; |
| 105 | |
| 106 | /* Local variables */ |
| 107 | integer j, id_, np, iw, igo, ihq, ixb, ixa, ifv, isl, jsl, ipq, ivl, ixn, ixo, ixp, isu, jsu, ndim; |
| 108 | doublereal temp, zero; |
| 109 | integer ibmat, izmat; |
| 110 | |
| 111 | |
| 112 | /* This subroutine seeks the least value of a function of many variables, */ |
| 113 | /* by applying a trust region method that forms quadratic models by */ |
| 114 | /* interpolation. There is usually some freedom in the interpolation */ |
| 115 | /* conditions, which is taken up by minimizing the Frobenius norm of */ |
| 116 | /* the change to the second derivative of the model, beginning with the */ |
| 117 | /* zero matrix. The values of the variables are constrained by upper and */ |
| 118 | /* lower bounds. The arguments of the subroutine are as follows. */ |
| 119 | |
| 120 | /* N must be set to the number of variables and must be at least two. */ |
| 121 | /* NPT is the number of interpolation conditions. Its value must be in */ |
| 122 | /* the interval [N+2,(N+1)(N+2)/2]. Choices that exceed 2*N+1 are not */ |
| 123 | /* recommended. */ |
| 124 | /* Initial values of the variables must be set in X(1),X(2),...,X(N). They */ |
| 125 | /* will be changed to the values that give the least calculated F. */ |
| 126 | /* For I=1,2,...,N, XL(I) and XU(I) must provide the lower and upper */ |
| 127 | /* bounds, respectively, on X(I). The construction of quadratic models */ |
| 128 | /* requires XL(I) to be strictly less than XU(I) for each I. Further, */ |
| 129 | /* the contribution to a model from changes to the I-th variable is */ |
| 130 | /* damaged severely by rounding errors if XU(I)-XL(I) is too small. */ |
| 131 | /* RHOBEG and RHOEND must be set to the initial and final values of a trust */ |
| 132 | /* region radius, so both must be positive with RHOEND no greater than */ |
| 133 | /* RHOBEG. Typically, RHOBEG should be about one tenth of the greatest */ |
| 134 | /* expected change to a variable, while RHOEND should indicate the */ |
| 135 | /* accuracy that is required in the final values of the variables. An */ |
| 136 | /* error return occurs if any of the differences XU(I)-XL(I), I=1,...,N, */ |
| 137 | /* is less than 2*RHOBEG. */ |
| 138 | /* MAXFUN must be set to an upper bound on the number of calls of CALFUN. */ |
| 139 | /* The array W will be used for working space. Its length must be at least */ |
| 140 | /* (NPT+5)*(NPT+N)+3*N*(N+5)/2. */ |
| 141 | |
| 142 | /* Parameter adjustments */ |
| 143 | --w; |
| 144 | --xu; |
| 145 | --xl; |
nothing calls this directly
no test coverage detected