Xmipp  v3.23.11-Nereus
Classes | Macros | Typedefs | Functions | Variables
numerical_recipes.cpp File Reference
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vector>
#include "numerical_recipes.h"
Include dependency graph for numerical_recipes.cpp:

Go to the source code of this file.

Classes

struct  cfsqpcomplex
 
struct  doublecomplex
 
struct  cilist
 
struct  icilist
 
struct  olist
 
struct  cllist
 
struct  alist
 
struct  inlist
 
union  Multitype
 
struct  Vardesc
 
struct  Namelist
 
struct  Tcmache
 
struct  _objective
 
struct  _constraint
 
struct  _parameter
 
struct  _violation
 
struct  Tglob_info
 
struct  Tglob_prnt
 
struct  Tglob_grd
 
struct  Tglob_log
 

Macros

#define NRSIGN(a, b)   ((b) >= 0.0 ? fabs(a) : -fabs(a))
 
#define M1   259200
 
#define IA1   7141
 
#define IC1   54773
 
#define RM1   (1.0/M1)
 
#define M2   134456
 
#define IA2   8121
 
#define IC2   28411
 
#define RM2   (1.0/M2)
 
#define M3   243000
 
#define IA3   4561
 
#define IC3   51349
 
#define NUSE1   5
 
#define NUSE2   5
 
#define EPS   1.0e-16
 
#define FPMIN   1.0e-30
 
#define MAXIT   10000
 
#define XMIN   2.0
 
#define ITMAX   100
 
#define EPS   3.0e-7
 
#define GOLD   1.618034
 
#define GLIMIT   100.0
 
#define TINY   1.0e-20
 
#define MAX(a, b)   ((a) > (b) ? (a) : (b))
 
#define SIGN(a, b)   ((b) > 0.0 ? fabs(a) : -fabs(a))
 
#define SHFT(a, b, c, d)   (a)=(b);(b)=(c);(c)=(d);
 
#define F1DIM(x, f)
 
#define ITMAX   100
 
#define CGOLD   0.3819660
 
#define ZEPS   1.0e-10
 
#define TOL   2.0e-4
 
#define ITMAX   200
 
#define SQR(a)   ((a)*(a))
 
#define SVDMAXITER   1000
 
#define TRUE   1
 
#define FALSE   0
 
#define F2C_INCLUDE
 
#define TRUE_   (1)
 
#define FALSE_   (0)
 
#define Extern   extern
 
#define VOID   void
 
#define abs(x)   ((x) >= 0 ? (x) : -(x))
 
#define dabs(x)   (doublereal)abs(x)
 
#define min(a, b)   ((a) <= (b) ? (a) : (b))
 
#define max(a, b)   ((a) >= (b) ? (a) : (b))
 
#define dmin(a, b)   (doublereal)min(a,b)
 
#define dmax(a, b)   (doublereal)max(a,b)
 
#define F2C_proc_par_types   1
 
#define Skip_f2c_Undefs
 
#define cmache_1   cmache_
 
#define DMAX1(a, b)   ((a) > (b) ? (a) : (b))
 
#define DMIN1(a, b)   ((a) < (b) ? (a) : (b))
 
#define NONE   0
 
#define OBJECT   1
 
#define CONSTR   2
 
#define ITMAX   100
 
#define EPS   3.0e-7
 
#define ITMAX   100
 
#define EPS   3.0e-7
 
#define FPMIN   1.0e-30
 

Typedefs

typedef int integer
 
typedef char * address
 
typedef short int shortint
 
typedef float cfsqpreal
 
typedef double doublereal
 
typedef long int logical
 
typedef short int shortlogical
 
typedef long flag
 
typedef long ftnlen
 
typedef long ftnint
 
typedef union Multitype Multitype
 
typedef long Long
 
typedef struct Vardesc Vardesc
 
typedef struct Namelist Namelist
 
typedef int(* U_fp) ()
 
typedef shortint(* J_fp) ()
 
typedef integer(* I_fp) ()
 
typedef cfsqpreal(* R_fp) ()
 
typedef doublereal(* D_fp) ()
 
typedef doublereal(*)(* E_fp) ()
 
typedef VOID(* C_fp) ()
 
typedef VOID(* Z_fp) ()
 
typedef logical(* L_fp) ()
 
typedef shortlogical(* K_fp) ()
 
typedef VOID(* H_fp) ()
 
typedef int(* S_fp) ()
 
typedef VOID C_f
 
typedef VOID H_f
 
typedef VOID Z_f
 
typedef doublereal E_f
 

Functions

void nrerror (const char error_text[])
 
double ran1 (int *idum)
 
double gasdev (int *idum)
 
double tdev (double nu, int *idum)
 
void ksone (double data[], int n, double(*func)(double), double *d, double *prob)
 
double probks (double alam)
 
void indexx (int n, double arrin[], int indx[])
 
double bessj0 (double x)
 
double bessi0 (double x)
 
double bessi1 (double x)
 
double chebev (double a, double b, double c[], int m, double x)
 
void beschb (double x, double *gam1, double *gam2, double *gampl, double *gammi)
 
void bessjy (double x, double xnu, double *rj, double *ry, double *rjp, double *ryp)
 
double bessi0_5 (double x)
 
double bessi1_5 (double x)
 
double bessi2 (double x)
 
double bessi2_5 (double x)
 
double bessi3 (double x)
 
double bessi3_5 (double x)
 
double bessi4 (double x)
 
double bessj1_5 (double x)
 
double bessj3_5 (double x)
 
double gammln (double xx)
 
double betai (double a, double b, double x)
 
double betacf (double a, double b, double x)
 
void mnbrak (double *ax, double *bx, double *cx, double *fa, double *fb, double *fc, double(*func)(double *, void *), void *prm, int ncom, double *pcom, double *xicom)
 
double brent (double ax, double bx, double cx, double(*func)(double *, void *), void *prm, double tol, double *xmin, int ncom, double *pcom, double *xicom)
 
void linmin (double *p, double *xi, int n, double &fret, double(*func)(double *, void *), void *prm)
 
void powell (double *p, double *xi, int n, double ftol, int &iter, double &fret, double(*func)(double *, void *), void *prm, bool show)
 
void _nnls_g1 (double a, double b, double *cterm, double *sterm, double *sig)
 
int _nnls_h12 (int mode, int lpivot, int l1, int m, double *u, int u_dim1, double *up, double *cm, int ice, int icv, int ncv)
 
int nnls (double *a, int m, int n, double *b, double *x, double *rnorm, double *wp, double *zzp, int *indexp)
 
int nnlsWght (int N, int M, double *A, double *b, double *weight)
 
double Pythag (double a, double b)
 
void svdcmp (double *U, int Lines, int Columns, double *W, double *V)
 
void svbksb (double *u, double *w, double *v, int m, int n, double *b, double *x)
 
int ql0002_ ()
 
int ql0001_ (m, me, mmax, n, nmax, mnn, c, d, a, b, xl, xu, x, u, iout, ifail, iprint, war, lwar, iwar, liwar, eps1) integer *m
 
 if (fabs(c[*nmax+ *nmax *c_dim1])==0.e0)
 
 if (iwar[1]==1)
 
 for (j=1;j<=i__1;++j)
 
 if (inw2+lw > *lwar)
 
 ql0002_ (n, m, me, mmax, &mn, mnn, nmax, &lql, &a[a_offset], &war[inw1], &d[1], &c[c_offset], &xl[1], &xu[1], &x[1], &nact, &iwar[1], &maxit, &qpeps, &info, &diag, &war[inw2], &lw)
 
 if (info==1)
 
 if (info< 0)
 
 if (nact==0)
 
 for (i=1;i<=i__1;++i) = nfsr + mesh_pts[i]
 
int ql0002_ (n, m, meq, mmax, mn, mnn, nmax, lql, a, b, grad, g, xl, xu, x, nact, iact, maxit, vsmall, info, diag, w, lw) integer *n
 
 for (k=1;k<=i__1;++k)
 
 if (!(*lql))
 
 if (k >=2)
 
 if (w[kdrop] >=zero)
 
 if (iact[kdrop]<= *meq)
 
 if (cvmax<= *vsmall)
 
 if (jfinc==0)
 
 if (jfinc !=ifinc)
 
 if (sum<=fdiffa)
 
 if (temp<=sum)
 
 if (iterc<= *maxit)
 
 if (knext > *m)
 
 if (k1 > *n)
 
 if (tempa<=temp)
 
 if (sumb > *vsmall)
 
 if (knext<= *m)
 
 if (kdrop==0)
 
 if (itref<=0)
 
 if (itref==1)
 
 if (i > 1)
 
 if (lflag==3)
 
 if (iact[kdrop] > *mn)
 
 switch ((int) mflag)
 
 if (nu== *nact)
 
 if (w[is]==zero)
 
int ql0001_ ()
 
void grobfd ()
 
void grcnfd ()
 
void cfsqp (nparam, nf, nfsr, nineqn, nineq, neqn, neq, ncsrl, ncsrn, mesh_pts, mode, iprint, miter, inform, bigbnd, eps, epseqn, udelta, bl, bu, x, f, g, lambda, obj, constr, gradob, gradcn, cd) int nparam
 
 if (ncsipn1) for(i
 
 if (glob_prnt.iprint > 0)
 
 check (nparam, nf, nfsr, &Linfty, nineq, nineqn, neq, neqn, ncsrl, ncsrn, mode, &modem, eps, bgbnd, param)
 
 if (glob_prnt.info==7)
 
 if (nclin !=0)
 
 if (!feasbl) = FALSE
 
 if (feasb)
 
 cfsqp1 (miter, nparam, nob, nobL, nfsip1, nineqn, neq, neqn, ncsipl1, ncsipn1, mesh_pts1, ncnstr, nctotl, nrowa, feasb, epskt, epseqn, indxob, indxcn, param, cs, ob, signeq, obj, constr, gradob, gradcn)
 
 free_iv (iw)
 
 free_dv (w)
 
 if (glob_prnt.info !=0)
 
 if (nf==1) lambda[1+nparam+nineq+neq]
 
 free ((char *) ob)
 
 dealloc (nineq, neq, signeq, indxcn, indxob, cs, param)
 
 free_dv (param->x)
 
 free_dv (signeq)
 
 free_iv (indxob)
 
 free_iv (indxcn)
 
 if (glob_info.mode !=0) nfs
 
 nullvc (nparam, grdpsf)
 
 if (feasb &&neqn !=0) resign(nparam
 
 if (feasb &&nob==0) fmax=0.e0
 
 if (glob_prnt.iprint >=3 &&glob_log.first)
 
 for (;;)
 
 free_dm (hess, nparam)
 
 free_dm (hess1, nparam+1)
 
 free_dv (di)
 
 free_dv (d)
 
 free_dv (gm)
 
 free_dv (grdpsf)
 
 free_dv (penp)
 
 free_dv (bl)
 
 free_dv (bu)
 
 free_dv (clamda)
 
 free_dv (cvec)
 
 free_dv (psmu)
 
 free_dv (span)
 
 free_dv (backup)
 
 free_iv (iact)
 
 free_iv (iskip)
 
 free_iv (istore)
 
 if (nparam<=0) error("nparam should be positive! "
 
 if (nparam<=neq - neqn) error("Must have nparam > number of linear equalities"
 
 if (glob_prnt.iprint< 0||glob_prnt.iprint > 3) error("iprint mod 10 should be 0
 
 if (eps<=glob_grd.epsmac)
 
 if (!(mode==100||mode==101||mode==110||mode==111||mode==200||mode==201||mode==210||mode==211)) error("mode is not properly specified! "
 
 if (mode >=200)
 
 free_dm (a, nrowa)
 
 free_dv (x)
 
 free_dv (bj)
 
 if (glob_prnt.iter % glob_prnt.iter_mod) display = FALSE
 
 if (ncsipn !=0)
 
 if (ncsipl !=0)
 
 if (glob_log.first) = FALSE
 
 if (steps< 1.e0 &&viol->type==CONSTR)
 
 if (glob_prnt.iprint >=2 &&display) fprintf(glob_prnt.io
 
 if (nfsip)
 
 if (nobL<=1)
 
 nullvc (nparam, cvec)
 
 dqp (nparam, nqprm0, nob, nobL, nfsip, nineqn, neq, neqn, nn, ncsipl, ncsipn, ncnstr, nctot0, nrowa0, nineqn, &infoqp, param, di, feasb, ob, *fmax, grdpsf, cs, a, cvec, bl, bu, clamda, hess, hess1, di, vv, 0)
 
 if (infoqp !=0)
 
 if (nn > 1)
 
 if (nobL > 1)
 
 if (nob > 0) vv
 
 if (glob_log.first &&nclin0==0)
 
 matrvc (nparam, nparam, hess, di, w)
 
 if (nn==0) *grdftd
 
 if (((*d0nm<=epskt)||((gLgeps > 0.e0) &&(*sktnom<=gLgeps))) &&(neqn==0|| *scvneq<=epseqn))
 
 if (glob_prnt.iprint >=3 &&display)
 
 if (neqn !=0 &&*d0nm<=DMIN1(0.5e0 *epskt,(0.1e-1) *glob_grd.rteps) &&*scvneq > epseqn)
 
 if (nn !=0) *grdftd
 
 if (glob_info.mode==1)
 
 if (need_d1)
 
 if (rhol==0.e0)
 
 if (nob==1) grdfd1
 
 if (temp1<=0.e0) rhog
 
 if (!(glob_prnt.iprint< 3||glob_info.mode==1||nn==0) &&display)
 
 if (rho !=rhog) ncg=0
 
 if ((neqn !=0) &&(feasb)) resign(nparam
 
 if (ncg !=0) for(i
 
 if (job==1) xdi
 
 if (nobL==1)
 
 matrcp (nparam, hess, nparam+1, hess1)
 
 nullvc (nqpram, x)
 
ql0001_k (htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
 
 free_dv (htemp)
 
 free_dv (atemp)
 
 nullvc (nqpram, param->mult)
 
 if (ncsipl+ncsipn) for(i
 
 if (nctotl > nqnp)
 
 free_iv (iw_hold)
 
 if ((ncsipl+ncsipn) !=0) nrowa
 
 if (mode==0) eta=0.1e0 = 3.e0
 
 if (mode !=1)
 
 diagnl (nqpram, eta, hess1)
 
 if (nobL > nob) temp3
 
ql0001_temp3 (htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
 
 if (!glob_log.get_ne_mult)
 
 nullvc (nparam, delta)
 
 nullvc (nparam, eta)
 
 if (neqn !=0 &&(feasb))
 
 if (nfs !=0)
 
 if (ncnstr !=0)
 
 sbout1 (glob_prnt.io, nparam, "multipliers for x ", dummy, param->mult, 2, 2)
 
 if (glob_prnt.iter >=miter &&nstop !=0)
 
 if ((glob_prnt.info > 0 &&glob_prnt.info< 3)||glob_prnt.info==7) goto L120
 
 if (glob_prnt.iprint<=2 &&nstop==0) fprintf(glob_prnt.io
 
 if (!((glob_prnt.iter) % glob_prnt.iter_mod)) display
 
 if (glob_prnt.iter_mod !=1 &&display) fprintf(glob_prnt.io
 
 if (display)
 
 if (glob_info.mode==1 &&glob_prnt.iter > 1 &&display) sbout1(glob_prnt.io
 
objective if (nob > 1 &&display) sbout1(glob_prnt.io
 
 if (glob_prnt.iter<=1 &&display)
 
 if (glob_prnt.iprint >=2 &&glob_prnt.initvl==0 &&display) sbout1(glob_prnt.io
 
 if (glob_prnt.iprint >=3 &&glob_prnt.iter_mod !=1 &&nstop !=0 &&!(glob_prnt.iter % glob_prnt.iter_mod)) fprintf(glob_prnt.io
 
 if (nstop !=0 &&(glob_prnt.iter_mod==1)) fprintf(glob_prnt.io
 
 fprintf (glob_prnt.io, "\)
 
 if (glob_prnt.iprint >=3) fprintf(glob_prnt.io
 
 if (glob_prnt.info==0 &&sktnom > 0.1e0) fprintf(glob_prnt.io
 
void grobfd (nparam, j, x, gradf, obj, cd) int nparam
 
void grcnfd (nparam, j, x, gradg, constr, cd) int nparam
 
ql0001_zero (ctemp+1),(cvec+1),(a+1),(b+1),(bl+1),(bu+1),(x+1),(w+1), &iout, ifail, &zero,(w+3), &lwar2,(iw+1), &leniw, &glob_grd.epsmac
 
 free_dv (ctemp)
 
 if (fabs(val)<=thrshd) temp
 
 while (mm > nfs) mm -
 
 if (isign >=0)
 
void gser (double *gamser, double a, double x, double *gln)
 
void gcf (double *gammcf, double a, double x, double *gln)
 
double gammp (double a, double x)
 
void choldc (double *a, int n, double *p)
 
void cholsl (double *a, int n, double *p, double *b, double *x)
 
void polint (double *xa, double *ya, int n, double x, double &y, double &dy)
 

Variables

int x_is_new = TRUE
 
double objeps = -1.e0
 
double objrep = -1.e0
 
double gLgeps = -1.e0
 
int nstop = 1
 
struct Tcmache cmache_
 
int * me
 
int * mmax
 
int * n
 
int * nmax
 
int * mnn
 
doublerealc = c_offset
 
doublereald = make_dv(nparam + 1)
 
doublereala = a_offset
 
doublerealb
 
doublerealxl
 
doublerealxu
 
doublerealx = x[i]
 
doublerealu
 
integeriout = 6
 
integerifail = 0
 
integeriprint = iprint % 10
 
doublerealwar
 
integerlwar
 
integeriwar
 
integerliwar
 
doublerealeps1
 
 a_dim1 = *mmax
 
 a_offset = a_dim1 + 1
 
 c_dim1 = *nmax
 
 c_offset = c_dim1 + 1
 
cmache_1 eps = *eps1
 
if m
 
 i__1 = *m
 
L20 __pad0__
 
L30 __pad1__
 
L70 __pad2__
 
 return
 
L80 __pad3__
 
L81 __pad4__
 
L82 __pad5__
 
L40 __pad6__
 
L90 __pad7__
 
int * meq
 
doublerealgrad
 
doublerealg = g_offset
 
integeriact = knext
 
doublerealvsmall
 
doublerealw = sum / w[ir]
 
doublereal d__1
 
doublereal d__2 = w[ir] / temp
 
doublereal d__3 = (d__1 = w[ir - 1], abs(d__1))
 
doublereal d__4 = (d__2 = w[ir], abs(d__2))
 
 g_dim1 = *nmax
 
 g_offset = g_dim1 + 1
 
L45 __pad8__
 
L70 __pad9__
 
L90 __pad10__
 
goto L170
 
L140 __pad11__
 
L150 __pad12__
 
goto L70
 
L165 __pad13__
 
L170 __pad14__
 
 i__2 = *n
 
L230 __pad15__
 
 else
 
L250 __pad16__
 
L280 __pad17__
 
L340 __pad18__
 
goto L930
 
L350 __pad19__
 
L380 __pad20__
 
goto L740
 
L390 __pad21__
 
L410 __pad22__
 
goto L910
 
L420 __pad23__
 
goto L440
 
L430 __pad24__
 
goto L800
 
L440 __pad25__
 
L450 __pad26__
 
L481 __pad27__
 
L510 __pad28__
 
L530 __pad29__
 
goto L710
 
L531 __pad30__
 
goto L549
 
L541 __pad31__
 
goto L550
 
L545 __pad32__
 
L549 __pad33__
 
L550 __pad34__
 
goto L860
 
L560 __pad35__
 
goto L570
 
L5 __pad36__
 
goto L640
 
L567 __pad37__
 
L570 __pad38__
 
L571 __pad39__
 
goto L775
 
L574 __pad40__
 
L580 __pad41__
 
L590 __pad42__
 
L601 __pad43__
 
L610 __pad44__
 
L630 __pad45__
 
L640 __pad46__
 
L650 __pad47__
 
L660 __pad48__
 
L680 __pad49__
 
L690 __pad50__
 
L700 __pad51__
 
L710 __pad52__
 
L730 __pad53__
 
L740 __pad54__
 
goto L770
 
L750 __pad55__
 
L761 __pad56__
 
L770 __pad57__
 
L775 __pad58__
 
L791 __pad59__
 
case __pad60__
 
L800 __pad61__
 
L810 __pad62__
 
L850 __pad63__
 
L860 __pad64__
 
L870 __pad65__
 
L880 __pad66__
 
goto L880
 
L900 __pad67__
 
case __pad68__
 
L910 __pad69__
 
L930 __pad70__
 
double bgbnd = bigbnd
 
double tolfea = glob_grd.epsmac * 1.e2
 
struct Tglob_info glob_info
 
struct Tglob_prnt glob_prnt
 
struct Tglob_grd glob_grd
 
struct Tglob_log glob_log
 
int lenw
 
int leniw
 
void nf = nf - nfsr
 
void nfsr = 0
 
void neqn
 
void nineqn = nineqn - ncsrn
 
void nineq = nineq - ncsrl - ncsrn
 
void neq
 
void ncsrl = 0
 
void ncsrn = 0
 
void mode
 
void miter
 
void * mesh_pts = mesh_pts - 1
 
void * inform = glob_prnt.info
 
double bigbnd
 
double epseqn
 
double udelta = udelta
 
double * bl = bl[i]
 
double * bu = bu[i]
 
double * f = f - 1
 
double * lambda = lambda - 1
 
void(* obj )()
 
void(*)(*) constr ()
 
void(*)(*)(*) gradob ()
 
void(*)(*)(*)(*) gradcn ()
 
void * cd = cd
 
int feasbl
 
int feasb = TRUE
 
int prnt = FALSE
 
int Linfty =0
 
int * indxob = make_iv(DMAX1(nineq + neq, nf))
 
int * indxcn = make_iv(nineq + neq)
 
int * mesh_pts1 = mesh_pts
 
double * signeq = make_dv(neqn)
 
double xi
 
double gi
 
double gmax = -bgbnd
 
double dummy = 0.e0
 
double epskt
 
struct _constraintcs
 
struct _objectiveob
 
struct _parameterparam
 
struct _parameter _param
 
glob_info tot_actf_sip = glob_info.tot_actg_sip = 0
 
glob_info nfsip = nfsr
 
glob_info ncsipl = ncsrl
 
glob_info ncsipn = ncsrn
 
 nfsip1 = nfsr
 
 ncsipl1 = ncsrl
 
 ncsipn1 = ncsrn
 
glob_prnt iter = 0
 
 nn = nineqn + neqn
 
glob_grd epsmac = smallNumber()
 
glob_grd rteps = sqrt(glob_grd.epsmac)
 
glob_log rhol_is1 = FALSE
 
glob_log get_ne_mult = FALSE
 
 nob = 0
 
 ipp = iprint
 
glob_prnt iter_mod = DMAX1(iprint - iprint % 10, 1)
 
glob_prnt io = stdout
 
 ncnstr = nineq + neq
 
glob_info nnineq = nineq
 
 nppram = nparam + 1
 
 nclin = ncnstr - nn
 
L510 __pad71__
 
 nrowa = DMAX1(ncnstr + DMAX1(nobL, 1), 1)
 
static void nparam
 
static void nobL
 
static void nctotl
 
int * iskip = make_iv(glob_info.nnineq + 1)
 
int * istore = make_iv(nineqn + nob + neqn)
 
double Cbar
 
double Ck = Cbar = 1.e-2
 
double dbar = 5.e0
 
double fmax = -bgbnd
 
double fM = fmax
 
double fMp = fmax - psf
 
double steps = 0.e0
 
double d0nm = 0.e0
 
double sktnom = 0.e0
 
double scvneq = 0.e0
 
double grdftd
 
double psf = 0.e0
 
double * di = make_dv(nparam + 1)
 
double * gm = make_dv(4 * neqn)
 
double * grdpsf = make_dv(nparam)
 
double * penp = make_dv(neqn)
 
double * clamda = make_dv(nctotl + nparam + 1)
 
double * cvec = make_dv(nparam + 1)
 
double * psmu = make_dv(neqn)
 
double * span = make_dv(4)
 
double * backup = make_dv(nob + ncnstr)
 
double ** hess = make_dm(nparam, nparam)
 
double ** hess1 = make_dm(nparam + 1, nparam + 1)
 
double * tempv
 
struct _violationviol = &_viol
 
struct _violation _viol
 
viol index = 0
 
viol type = NONE
 
glob_prnt initvl = 1
 
glob_log first = TRUE
 
 nrst = glob_prnt.ipd = 0
 
 e0
 
 nstart = 1
 
glob_info ncallf = 0
 
 nfs = 0
 
 ncnst1 = ncnstr - nineqn - neqn
 
static void nnl
 
static void * modem
 
double bli
 
double bui
 
 or
 
glob_info modec = 1
 
double x0i
 
double * atemp = convert(a, nrowa, nqpram)
 
double * htemp = convert(hess1, nparam + 1, nparam + 1)
 
double * bj = make_dv(nclin)
 
double epsilon
 
double g_max
 
double fprev
 
double fnow
 
double fnext
 
double fmult
 
else display = TRUE
 
Xi_k for g glob_info tot_actg_sip
 
static void * iskp
 
double fmxl
 
double vv = 0.e0
 
double dx
 
double dmx
 
double dnm1
 
double dnm = sqrt(scaprd(nparam, di, di))
 
double v0
 
double v1
 
double vk =0.
 
double temp1 = temp2 = 0.e0
 
double temp2 = (theta - 1.e0) * grdfd0 / temp1
 
double theta = 0.2e0
 
double rhol
 
double rhog = DMIN1(rhol, temp2)
 
double rho = rhog
 
double grdfd0
 
double grdfd1 = 0.e0
 
double grdgd0
 
double grdgd1
 
double thrshd = tolfea
 
double sign
 
double * adummy = make_dv(1)
 
double dnmtil
 
 ncg = ncf = *iskp = 0
 
 ncl = glob_info.nnineq - nineqn
 
glob_log local = glob_log.update = FALSE
 
 need_d1 = TRUE
 
 nclin0 = ncnstr + nobL
 
 nctot0 = nqprm0 + nclin0
 
 nrowa0 = DMAX1(nclin0, 1)
 
glob_log d0_is0 = FALSE
 
L310 __pad72__
 
 ncc = ncg + 1
 
 ninq = nncn = ncg
 
 ncnstr_used = k
 
if infoqp
 
i<=ncnstr;i++) cs[i].mult=0.e0;if(nfsip) for(i=1;i<=nob;i++) { ob[i].mult=0.e0;ob[i].mult_L=0.e0;} for(i=1;i<=nqpram;i++) { ii=k+i;if(clamda[ii]==0.e0 &&clamda[ii+nqpram]==0.e0) continue;else if(clamda[ii] !=0.e0) clamda[ii]=-clamda[ii];else clamda[ii]=clamda[ii+nqpram];} nqnp=nqpram+ncnstr;for(i=1;i<=nqpram;i++) param-> mult [i] = clamda[k+i]
 
static void nqpram
 
double * d0
 
int * iw_hold
 
double eta
 
else temp3 = k
 
static void * ncf
 
double * xnew
 
struct _violationsip_viol
 
double prod1
 
double prod
 
double fmax1 =0.
 
double tolfe = 0.e0
 
double ostep = *steps = 1.e0
 
double fii
 
 nlin = glob_info.nnineq - nineqn
 
 itry = ii = jj = 1
 
 fbind = cdone = fdone = eqdone = FALSE
 
 sipldone = (ncsipl == 0)
 
 ikeep = nlin - *iskp
 
directional deriv
 
L1500 __pad73__
 
double * delta
 
double * gamma
 
double * hd
 
double ** phess
 
double * psb
 
double dhd
 
double gammd
 
double etad
 
double signgj =1.
 
double psfnew = 0.e0
 
double delta_s = glob_grd.rteps
 
glob_prnt ipd = 0
 
 done = FALSE
 
static void ncn
 
double d0norm
 
double SNECV
 
objective max4
 
objective objmax
 
ncallg glob_info ncallg
 
n The following was calculated during iteration
 
L120 __pad74__
 
nNormal termination
 
Warning __pad75__
 
nError __pad76__
 
nError __pad77__
 
L9000 __pad78__
 
double * gradf
 
double * gradg
 
double * ctemp
 
 lwar2 = lenw - 1
 
int col
 
int nrows
 
static double * y
 
double z
 
return mm
 
int ndima
 
int ndimb
 

Macro Definition Documentation

◆ abs

#define abs (   x)    ((x) >= 0 ? (x) : -(x))

Definition at line 2108 of file numerical_recipes.cpp.

◆ CGOLD

#define CGOLD   0.3819660

Definition at line 755 of file numerical_recipes.cpp.

◆ cmache_1

#define cmache_1   cmache_

Definition at line 2186 of file numerical_recipes.cpp.

◆ CONSTR

#define CONSTR   2

Definition at line 4138 of file numerical_recipes.cpp.

◆ dabs

#define dabs (   x)    (doublereal)abs(x)

Definition at line 2109 of file numerical_recipes.cpp.

◆ dmax

#define dmax (   a,
  b 
)    (doublereal)max(a,b)

Definition at line 2113 of file numerical_recipes.cpp.

◆ DMAX1

#define DMAX1 (   a,
  b 
)    ((a) > (b) ? (a) : (b))

Definition at line 4128 of file numerical_recipes.cpp.

◆ dmin

#define dmin (   a,
  b 
)    (doublereal)min(a,b)

Definition at line 2112 of file numerical_recipes.cpp.

◆ DMIN1

#define DMIN1 (   a,
  b 
)    ((a) < (b) ? (a) : (b))

Definition at line 4129 of file numerical_recipes.cpp.

◆ EPS [1/4]

#define EPS   1.0e-16

Definition at line 9291 of file numerical_recipes.cpp.

◆ EPS [2/4]

#define EPS   3.0e-7

Definition at line 9291 of file numerical_recipes.cpp.

◆ EPS [3/4]

#define EPS   3.0e-7

Definition at line 9291 of file numerical_recipes.cpp.

◆ EPS [4/4]

#define EPS   3.0e-7

Definition at line 9291 of file numerical_recipes.cpp.

◆ Extern

#define Extern   extern

Definition at line 1973 of file numerical_recipes.cpp.

◆ F1DIM

#define F1DIM (   x,
  f 
)
Value:
{\
for (int j = 1; j<=ncom; j++) \
xt[j] = pcom[j] + x * xicom[j]; \
f = (*func)(xt,prm);}
doublereal * x
#define j
ProgClassifyCL2D * prm

Definition at line 674 of file numerical_recipes.cpp.

◆ F2C_INCLUDE

#define F2C_INCLUDE

barf [ba:rf] 2. "He suggested using FORTRAN, and everybody barfed."

  • From The Shogakukan DICTIONARY OF NEW ENGLISH (Second edition)

Definition at line 1948 of file numerical_recipes.cpp.

◆ F2C_proc_par_types

#define F2C_proc_par_types   1

Definition at line 2117 of file numerical_recipes.cpp.

◆ FALSE

#define FALSE   0

Definition at line 1824 of file numerical_recipes.cpp.

◆ FALSE_

#define FALSE_   (0)

Definition at line 1969 of file numerical_recipes.cpp.

◆ FPMIN [1/2]

#define FPMIN   1.0e-30

Definition at line 9292 of file numerical_recipes.cpp.

◆ FPMIN [2/2]

#define FPMIN   1.0e-30

Definition at line 9292 of file numerical_recipes.cpp.

◆ GLIMIT

#define GLIMIT   100.0

Definition at line 669 of file numerical_recipes.cpp.

◆ GOLD

#define GOLD   1.618034

Definition at line 668 of file numerical_recipes.cpp.

◆ IA1

#define IA1   7141

Definition at line 46 of file numerical_recipes.cpp.

◆ IA2

#define IA2   8121

Definition at line 50 of file numerical_recipes.cpp.

◆ IA3

#define IA3   4561

Definition at line 54 of file numerical_recipes.cpp.

◆ IC1

#define IC1   54773

Definition at line 47 of file numerical_recipes.cpp.

◆ IC2

#define IC2   28411

Definition at line 51 of file numerical_recipes.cpp.

◆ IC3

#define IC3   51349

Definition at line 55 of file numerical_recipes.cpp.

◆ ITMAX [1/5]

#define ITMAX   100

Definition at line 9290 of file numerical_recipes.cpp.

◆ ITMAX [2/5]

#define ITMAX   100

Definition at line 9290 of file numerical_recipes.cpp.

◆ ITMAX [3/5]

#define ITMAX   200

Definition at line 9290 of file numerical_recipes.cpp.

◆ ITMAX [4/5]

#define ITMAX   100

Definition at line 9290 of file numerical_recipes.cpp.

◆ ITMAX [5/5]

#define ITMAX   100

Definition at line 9290 of file numerical_recipes.cpp.

◆ M1

#define M1   259200

Definition at line 45 of file numerical_recipes.cpp.

◆ M2

#define M2   134456

Definition at line 49 of file numerical_recipes.cpp.

◆ M3

#define M3   243000

Definition at line 53 of file numerical_recipes.cpp.

◆ MAX

#define MAX (   a,
  b 
)    ((a) > (b) ? (a) : (b))

Definition at line 671 of file numerical_recipes.cpp.

◆ max

#define max (   a,
  b 
)    ((a) >= (b) ? (a) : (b))

Definition at line 2111 of file numerical_recipes.cpp.

◆ MAXIT

#define MAXIT   10000

Definition at line 379 of file numerical_recipes.cpp.

◆ min

#define min (   a,
  b 
)    ((a) <= (b) ? (a) : (b))

Definition at line 2110 of file numerical_recipes.cpp.

◆ NONE

#define NONE   0

Definition at line 4136 of file numerical_recipes.cpp.

◆ NRSIGN

#define NRSIGN (   a,
  b 
)    ((b) >= 0.0 ? fabs(a) : -fabs(a))

Definition at line 42 of file numerical_recipes.cpp.

◆ NUSE1

#define NUSE1   5

Definition at line 348 of file numerical_recipes.cpp.

◆ NUSE2

#define NUSE2   5

Definition at line 349 of file numerical_recipes.cpp.

◆ OBJECT

#define OBJECT   1

Definition at line 4137 of file numerical_recipes.cpp.

◆ RM1

#define RM1   (1.0/M1)

Definition at line 48 of file numerical_recipes.cpp.

◆ RM2

#define RM2   (1.0/M2)

Definition at line 52 of file numerical_recipes.cpp.

◆ SHFT

#define SHFT (   a,
  b,
  c,
  d 
)    (a)=(b);(b)=(c);(c)=(d);

Definition at line 673 of file numerical_recipes.cpp.

◆ SIGN

#define SIGN (   a,
  b 
)    ((b) > 0.0 ? fabs(a) : -fabs(a))

Definition at line 672 of file numerical_recipes.cpp.

◆ Skip_f2c_Undefs

#define Skip_f2c_Undefs

Definition at line 2152 of file numerical_recipes.cpp.

◆ SQR

#define SQR (   a)    ((a)*(a))

◆ SVDMAXITER

#define SVDMAXITER   1000

Definition at line 1506 of file numerical_recipes.cpp.

◆ TINY

#define TINY   1.0e-20

Definition at line 670 of file numerical_recipes.cpp.

◆ TOL

#define TOL   2.0e-4

Definition at line 847 of file numerical_recipes.cpp.

◆ TRUE

#define TRUE   1

Definition at line 1821 of file numerical_recipes.cpp.

◆ TRUE_

#define TRUE_   (1)

Definition at line 1968 of file numerical_recipes.cpp.

◆ VOID

#define VOID   void

Definition at line 2076 of file numerical_recipes.cpp.

◆ XMIN

#define XMIN   2.0

Definition at line 380 of file numerical_recipes.cpp.

◆ ZEPS

#define ZEPS   1.0e-10

Definition at line 756 of file numerical_recipes.cpp.

Typedef Documentation

◆ address

typedef char* address

Definition at line 1951 of file numerical_recipes.cpp.

◆ C_f

typedef VOID C_f

Definition at line 2144 of file numerical_recipes.cpp.

◆ C_fp

typedef VOID(* C_fp) ()

Definition at line 2136 of file numerical_recipes.cpp.

◆ cfsqpreal

typedef float cfsqpreal

Definition at line 1953 of file numerical_recipes.cpp.

◆ D_fp

typedef doublereal(* D_fp) ()

Definition at line 2135 of file numerical_recipes.cpp.

◆ doublereal

typedef double doublereal

Definition at line 1954 of file numerical_recipes.cpp.

◆ E_f

typedef doublereal E_f

Definition at line 2147 of file numerical_recipes.cpp.

◆ E_fp

typedef doublereal(*)(* E_fp) ()

Definition at line 2135 of file numerical_recipes.cpp.

◆ flag

typedef long flag

Definition at line 1984 of file numerical_recipes.cpp.

◆ ftnint

typedef long ftnint

Definition at line 1986 of file numerical_recipes.cpp.

◆ ftnlen

typedef long ftnlen

Definition at line 1985 of file numerical_recipes.cpp.

◆ H_f

typedef VOID H_f

Definition at line 2145 of file numerical_recipes.cpp.

◆ H_fp

typedef VOID(* H_fp) ()

Definition at line 2140 of file numerical_recipes.cpp.

◆ I_fp

typedef integer(* I_fp) ()

Definition at line 2133 of file numerical_recipes.cpp.

◆ integer

typedef int integer

Definition at line 1950 of file numerical_recipes.cpp.

◆ J_fp

typedef shortint(* J_fp) ()

Definition at line 2132 of file numerical_recipes.cpp.

◆ K_fp

typedef shortlogical(* K_fp) ()

Definition at line 2139 of file numerical_recipes.cpp.

◆ L_fp

typedef logical(* L_fp) ()

Definition at line 2138 of file numerical_recipes.cpp.

◆ logical

typedef long int logical

Definition at line 1965 of file numerical_recipes.cpp.

◆ Long

typedef long Long

Definition at line 2089 of file numerical_recipes.cpp.

◆ Multitype

typedef union Multitype Multitype

Definition at line 2087 of file numerical_recipes.cpp.

◆ Namelist

typedef struct Namelist Namelist

Definition at line 2106 of file numerical_recipes.cpp.

◆ R_fp

typedef cfsqpreal(* R_fp) ()

Definition at line 2134 of file numerical_recipes.cpp.

◆ S_fp

typedef int(* S_fp) ()

Definition at line 2141 of file numerical_recipes.cpp.

◆ shortint

typedef short int shortint

Definition at line 1952 of file numerical_recipes.cpp.

◆ shortlogical

typedef short int shortlogical

Definition at line 1966 of file numerical_recipes.cpp.

◆ U_fp

typedef int(* U_fp) ()

Definition at line 2131 of file numerical_recipes.cpp.

◆ Vardesc

typedef struct Vardesc Vardesc

Definition at line 2098 of file numerical_recipes.cpp.

◆ Z_f

typedef VOID Z_f

Definition at line 2146 of file numerical_recipes.cpp.

◆ Z_fp

typedef VOID(* Z_fp) ()

Definition at line 2137 of file numerical_recipes.cpp.

Function Documentation

◆ _nnls_g1()

void _nnls_g1 ( double  a,
double  b,
double *  cterm,
double *  sterm,
double *  sig 
)

Definition at line 1011 of file numerical_recipes.cpp.

1012 {
1013  double d1, xr, yr;
1014 
1015  if (fabs(a) > fabs(b))
1016  {
1017  xr = b / a;
1018  d1 = xr;
1019  yr = sqrt(d1 * d1 + 1.);
1020  d1 = 1. / yr;
1021  *cterm = (a >= 0.0 ? fabs(d1) : -fabs(d1));
1022  *sterm = (*cterm) * xr;
1023  *sig = fabs(a) * yr;
1024  }
1025  else if (b != 0.)
1026  {
1027  xr = a / b;
1028  d1 = xr;
1029  yr = sqrt(d1 * d1 + 1.);
1030  d1 = 1. / yr;
1031  *sterm = (b >= 0.0 ? fabs(d1) : -fabs(d1));
1032  *cterm = (*sterm) * xr;
1033  *sig = fabs(b) * yr;
1034  }
1035  else
1036  {
1037  *sig = 0.;
1038  *cterm = 0.;
1039  *sterm = 1.;
1040  }
1041 } /* _nnls_g1 */
void sqrt(Image< double > &op)
doublereal * b
doublereal * a

◆ _nnls_h12()

int _nnls_h12 ( int  mode,
int  lpivot,
int  l1,
int  m,
double *  u,
int  u_dim1,
double *  up,
double *  cm,
int  ice,
int  icv,
int  ncv 
)

Definition at line 1052 of file numerical_recipes.cpp.

1075 {
1076  double d1, d2, b, clinv, cl, sm;
1077  int incr, k, j, i2, i3, i4;
1078 
1079  /* Check parameters */
1080  if (mode != 1 && mode != 2)
1081  return(1);
1082  if (m < 1 || u == NULL || u_dim1 < 1 || cm == NULL)
1083  return(2);
1084  if (lpivot < 0 || lpivot >= l1 || l1 >= m)
1085  return(0);
1086  /* Function Body */
1087  cl = (d1 = u[lpivot*u_dim1], fabs(d1));
1088  if (mode == 2)
1089  { /* Apply transformation I+U*(U**T)/B to cm[] */
1090  if (cl <= 0.)
1091  return(0);
1092  }
1093  else
1094  { /* Construct the transformation */
1095  for (j = l1; j < m; j++)
1096  { /* Computing MAX */
1097  d2 = (d1 = u[j*u_dim1], fabs(d1));
1098  if (d2 > cl)
1099  cl = d2;
1100  }
1101  if (cl <= 0.)
1102  return(0);
1103  clinv = 1.0 / cl;
1104  /* Computing 2nd power */
1105  d1 = u[lpivot*u_dim1] * clinv;
1106  sm = d1 * d1;
1107  for (j = l1; j < m; j++)
1108  {
1109  d1 = u[j*u_dim1] * clinv;
1110  sm += d1 * d1;
1111  }
1112  cl *= sqrt(sm);
1113  if (u[lpivot*u_dim1] > 0.)
1114  cl = -cl;
1115  *up = u[lpivot*u_dim1] - cl;
1116  u[lpivot*u_dim1] = cl;
1117  }
1118  if (ncv <= 0)
1119  return(0);
1120  b = (*up) * u[lpivot*u_dim1];
1121  /* b must be nonpositive here; if b>=0., then return */
1122  if (b >= 0.)
1123  return(0);
1124  b = 1.0 / b;
1125  i2 = 1 - icv + ice * lpivot;
1126  incr = ice * (l1 - lpivot);
1127  for (j = 0; j < ncv; j++)
1128  {
1129  i2 += icv;
1130  i3 = i2 + incr;
1131  i4 = i3;
1132  sm = cm[i2-1] * (*up);
1133  for (k = l1; k < m; k++)
1134  {
1135  sm += cm[i3-1] * u[k*u_dim1];
1136  i3 += ice;
1137  }
1138  if (sm != 0.0)
1139  {
1140  sm *= b;
1141  cm[i2-1] += sm * (*up);
1142  for (k = l1; k < m; k++)
1143  {
1144  cm[i4-1] += sm * u[k*u_dim1];
1145  i4 += ice;
1146  }
1147  }
1148  }
1149  return(0);
1150 } /* _nnls_h12 */
void sqrt(Image< double > &op)
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
#define cl(i, j)
doublereal * b
void mode
#define j
doublereal * u

◆ beschb()

void beschb ( double  x,
double *  gam1,
double *  gam2,
double *  gampl,
double *  gammi 
)

Definition at line 351 of file numerical_recipes.cpp.

352 {
353  double xx;
354  static double c1[] =
355  {
356  -1.142022680371172e0, 6.516511267076e-3,
357  3.08709017308e-4, -3.470626964e-6, 6.943764e-9,
358  3.6780e-11, -1.36e-13
359  };
360  static double c2[] =
361  {
362  1.843740587300906e0, -0.076852840844786e0,
363  1.271927136655e-3, -4.971736704e-6, -3.3126120e-8,
364  2.42310e-10, -1.70e-13, -1.0e-15
365  };
366 
367  xx = 8.0 * x * x - 1.0;
368  *gam1 = chebev(-1.0, 1.0, c1, NUSE1, xx);
369  *gam2 = chebev(-1.0, 1.0, c2, NUSE2, xx);
370  *gampl = *gam2 - x * (*gam1);
371  *gammi = *gam2 + x * (*gam1);
372 }
doublereal * x
double chebev(double a, double b, double c[], int m, double x)
#define NUSE2
#define NUSE1

◆ bessi0()

double bessi0 ( double  x)

Definition at line 286 of file numerical_recipes.cpp.

287 {
288  double y, ax, ans;
289  if ((ax = fabs(x)) < 3.75)
290  {
291  y = x / 3.75;
292  y *= y;
293  ans = 1.0 + y * (3.5156229 + y * (3.0899424 + y * (1.2067492
294  + y * (0.2659732 + y * (0.360768e-1 + y * 0.45813e-2)))));
295  }
296  else
297  {
298  y = 3.75 / ax;
299  ans = (exp(ax) / sqrt(ax)) * (0.39894228 + y * (0.1328592e-1
300  + y * (0.225319e-2 + y * (-0.157565e-2 + y * (0.916281e-2
301  + y * (-0.2057706e-1 + y * (0.2635537e-1 + y * (-0.1647633e-1
302  + y * 0.392377e-2))))))));
303  }
304  return ans;
305 }
void sqrt(Image< double > &op)
static double * y
doublereal * x

◆ bessi0_5()

double bessi0_5 ( double  x)

Definition at line 547 of file numerical_recipes.cpp.

548 {
549  return (x == 0) ? 0 : sqrt(2 / (PI*x))*sinh(x);
550 }
void sqrt(Image< double > &op)
doublereal * x
#define PI
Definition: tools.h:43

◆ bessi1()

double bessi1 ( double  x)

Definition at line 308 of file numerical_recipes.cpp.

309 {
310  double ax, ans;
311  double y;
312  if ((ax = fabs(x)) < 3.75)
313  {
314  y = x / 3.75;
315  y *= y;
316  ans = ax * (0.5 + y * (0.87890594 + y * (0.51498869 + y * (0.15084934
317  + y * (0.2658733e-1 + y * (0.301532e-2 + y * 0.32411e-3))))));
318  }
319  else
320  {
321  y = 3.75 / ax;
322  ans = 0.2282967e-1 + y * (-0.2895312e-1 + y * (0.1787654e-1
323  - y * 0.420059e-2));
324  ans = 0.39894228 + y * (-0.3988024e-1 + y * (-0.362018e-2
325  + y * (0.163801e-2 + y * (-0.1031555e-1 + y * ans))));
326  ans *= (exp(ax) / sqrt(ax));
327  }
328  return x < 0.0 ? -ans : ans;
329 }
void sqrt(Image< double > &op)
static double * y
doublereal * x

◆ bessi1_5()

double bessi1_5 ( double  x)

Definition at line 551 of file numerical_recipes.cpp.

552 {
553  return (x == 0) ? 0 : sqrt(2 / (PI*x))*(cosh(x) - sinh(x) / x);
554 }
void sqrt(Image< double > &op)
doublereal * x
#define PI
Definition: tools.h:43

◆ bessi2()

double bessi2 ( double  x)

Definition at line 555 of file numerical_recipes.cpp.

556 {
557  return (x == 0) ? 0 : bessi0(x) - ((2*1) / x) * bessi1(x);
558 }
double bessi0(double x)
double bessi1(double x)
doublereal * x

◆ bessi2_5()

double bessi2_5 ( double  x)

Definition at line 559 of file numerical_recipes.cpp.

560 {
561  return (x == 0) ? 0 : bessi0_5(x) - ((2*1.5) / x) * bessi1_5(x);
562 }
doublereal * x
double bessi1_5(double x)
double bessi0_5(double x)

◆ bessi3()

double bessi3 ( double  x)

Definition at line 563 of file numerical_recipes.cpp.

564 {
565  return (x == 0) ? 0 : bessi1(x) - ((2*2) / x) * bessi2(x);
566 }
double bessi1(double x)
doublereal * x
double bessi2(double x)

◆ bessi3_5()

double bessi3_5 ( double  x)

Definition at line 567 of file numerical_recipes.cpp.

568 {
569  return (x == 0) ? 0 : bessi1_5(x) - ((2*2.5) / x) * bessi2_5(x);
570 }
doublereal * x
double bessi1_5(double x)
double bessi2_5(double x)

◆ bessi4()

double bessi4 ( double  x)

Definition at line 571 of file numerical_recipes.cpp.

572 {
573  return (x == 0) ? 0 : bessi2(x) - ((2*3) / x) * bessi3(x);
574 }
doublereal * x
double bessi2(double x)
double bessi3(double x)

◆ bessj0()

double bessj0 ( double  x)

Definition at line 250 of file numerical_recipes.cpp.

251 {
252  double ax, z;
253  double xx, y, ans, ans1, ans2;
254 
255  if ((ax = fabs(x)) < 8.0)
256  {
257  y = x * x;
258  ans1 = 57568490574.0 + y * (-13362590354.0 +
259  y * (651619640.7
260  + y * (-11214424.18 +
261  y * (77392.33017 +
262  y * (-184.9052456)))));
263  ans2 = 57568490411.0 + y * (1029532985.0 +
264  y * (9494680.718
265  + y * (59272.64853 +
266  y * (267.8532712 +
267  y * 1.0))));
268  ans = ans1 / ans2;
269  }
270  else
271  {
272  z = 8.0 / ax;
273  y = z * z;
274  xx = ax - 0.785398164;
275  ans1 = 1.0 + y * (-0.1098628627e-2 + y * (0.2734510407e-4
276  + y * (-0.2073370639e-5 + y * 0.2093887211e-6)));
277  ans2 = -0.1562499995e-1 + y * (0.1430488765e-3
278  + y * (-0.6911147651e-5 + y * (0.7621095161e-6
279  - y * 0.934935152e-7)));
280  ans = sqrt(0.636619772 / ax) * (cos(xx) * ans1 - z * sin(xx) * ans2);
281  }
282  return ans;
283 }
void sqrt(Image< double > &op)
static double * y
doublereal * x
double z

◆ bessj1_5()

double bessj1_5 ( double  x)

Definition at line 575 of file numerical_recipes.cpp.

576 {
577  double rj, ry, rjp, ryp;
578  bessjy(x, 1.5, &rj, &ry, &rjp, &ryp);
579  return rj;
580 }
doublereal * x
void bessjy(double x, double xnu, double *rj, double *ry, double *rjp, double *ryp)

◆ bessj3_5()

double bessj3_5 ( double  x)

Definition at line 581 of file numerical_recipes.cpp.

582 {
583  double rj, ry, rjp, ryp;
584  bessjy(x, 3.5, &rj, &ry, &rjp, &ryp);
585  return rj;
586 }
doublereal * x
void bessjy(double x, double xnu, double *rj, double *ry, double *rjp, double *ryp)

◆ bessjy()

void bessjy ( double  x,
double  xnu,
double *  rj,
double *  ry,
double *  rjp,
double *  ryp 
)

Definition at line 381 of file numerical_recipes.cpp.

382 {
383  int i, isign, l, nl;
384  double a, b, br, bi, c, cr, ci, d, del, del1, den, di, dlr, dli, dr, e, f, fact, fact2,
385  fact3, ff, gam, gam1, gam2, gammi, gampl, h, p, pimu, pimu2, q, r, rjl,
386  rjl1, rjmu, rjp1, rjpl, rjtemp, ry1, rymu, rymup, rytemp, sum, sum1,
387  temp, w, x2, xi, xi2, xmu, xmu2;
388 
389  if (x <= 0.0 || xnu < 0.0)
390  nrerror("bad arguments in bessjy");
391  nl = (x < XMIN ? (int)(xnu + 0.5) : XMIPP_MAX(0, (int)(xnu - x + 1.5)));
392  xmu = xnu - nl;
393  xmu2 = xmu * xmu;
394  xi = 1.0 / x;
395  xi2 = 2.0 * xi;
396  w = xi2 / PI;
397  isign = 1;
398  h = xnu * xi;
399  if (h < FPMIN)
400  h = FPMIN;
401  b = xi2 * xnu;
402  d = 0.0;
403  c = h;
404  for (i = 1;i <= MAXIT;i++)
405  {
406  b += xi2;
407  d = b - d;
408  if (fabs(d) < FPMIN)
409  d = FPMIN;
410  c = b - 1.0 / c;
411  if (fabs(c) < FPMIN)
412  c = FPMIN;
413  d = 1.0 / d;
414  del = c * d;
415  h = del * h;
416  if (d < 0.0)
417  isign = -isign;
418  if (fabs(del - 1.0) < EPS)
419  break;
420  }
421  if (i > MAXIT)
422  nrerror("x too large in bessjy; try asymptotic expansion");
423  rjl = isign * FPMIN;
424  rjpl = h * rjl;
425  rjl1 = rjl;
426  rjp1 = rjpl;
427  fact = xnu * xi;
428  for (l = nl;l >= 1;l--)
429  {
430  rjtemp = fact * rjl + rjpl;
431  fact -= xi;
432  rjpl = fact * rjtemp - rjl;
433  rjl = rjtemp;
434  }
435  if (rjl == 0.0)
436  rjl = EPS;
437  f = rjpl / rjl;
438  if (x < XMIN)
439  {
440  x2 = 0.5 * x;
441  pimu = PI * xmu;
442  fact = (fabs(pimu) < EPS ? 1.0 : pimu / sin(pimu));
443  d = -log(x2);
444  e = xmu * d;
445  fact2 = (fabs(e) < EPS ? 1.0 : sinh(e) / e);
446  beschb(xmu, &gam1, &gam2, &gampl, &gammi);
447  ff = 2.0 / PI * fact * (gam1 * cosh(e) + gam2 * fact2 * d);
448  e = exp(e);
449  p = e / (gampl * PI);
450  q = 1.0 / (e * PI * gammi);
451  pimu2 = 0.5 * pimu;
452  fact3 = (fabs(pimu2) < EPS ? 1.0 : sin(pimu2) / pimu2);
453  r = PI * pimu2 * fact3 * fact3;
454  c = 1.0;
455  d = -x2 * x2;
456  sum = ff + r * q;
457  sum1 = p;
458  for (i = 1;i <= MAXIT;i++)
459  {
460  ff = (i * ff + p + q) / (i * i - xmu2);
461  c *= (d / i);
462  p /= (i - xmu);
463  q /= (i + xmu);
464  del = c * (ff + r * q);
465  sum += del;
466  del1 = c * p - i * del;
467  sum1 += del1;
468  if (fabs(del) < (1.0 + fabs(sum))*EPS)
469  break;
470  }
471  if (i > MAXIT)
472  nrerror("bessy series failed to converge");
473  rymu = -sum;
474  ry1 = -sum1 * xi2;
475  rymup = xmu * xi * rymu - ry1;
476  rjmu = w / (rymup - f * rymu);
477  }
478  else
479  {
480  a = 0.25 - xmu2;
481  p = -0.5 * xi;
482  q = 1.0;
483  br = 2.0 * x;
484  bi = 2.0;
485  fact = a * xi / (p * p + q * q);
486  cr = br + q * fact;
487  ci = bi + p * fact;
488  den = br * br + bi * bi;
489  dr = br / den;
490  di = -bi / den;
491  dlr = cr * dr - ci * di;
492  dli = cr * di + ci * dr;
493  temp = p * dlr - q * dli;
494  q = p * dli + q * dlr;
495  p = temp;
496  for (i = 2;i <= MAXIT;i++)
497  {
498  a += 2 * (i - 1);
499  bi += 2.0;
500  dr = a * dr + br;
501  di = a * di + bi;
502  if (fabs(dr) + fabs(di) < FPMIN)
503  dr = FPMIN;
504  fact = a / (cr * cr + ci * ci);
505  cr = br + cr * fact;
506  ci = bi - ci * fact;
507  if (fabs(cr) + fabs(ci) < FPMIN)
508  cr = FPMIN;
509  den = dr * dr + di * di;
510  dr /= den;
511  di /= -den;
512  dlr = cr * dr - ci * di;
513  dli = cr * di + ci * dr;
514  temp = p * dlr - q * dli;
515  q = p * dli + q * dlr;
516  p = temp;
517  if (fabs(dlr - 1.0) + fabs(dli) < EPS)
518  break;
519  }
520  if (i > MAXIT)
521  nrerror("cf2 failed in bessjy");
522  gam = (p - f) / q;
523  rjmu = sqrt(w / ((p - f) * gam + q));
524  rjmu = NRSIGN(rjmu, rjl);
525  rymu = rjmu * gam;
526  rymup = rymu * (p + q / gam);
527  ry1 = xmu * xi * rymu - rymup;
528  }
529  fact = rjmu / rjl;
530  *rj = rjl1 * fact;
531  *rjp = rjp1 * fact;
532  for (i = 1;i <= nl;i++)
533  {
534  rytemp = (xmu + i) * xi2 * ry1 - rymu;
535  rymu = ry1;
536  ry1 = rytemp;
537  }
538  *ry = rymu;
539  *ryp = xnu * xi * rymu - ry1;
540 }
double xi
#define XMIPP_MAX(x, y)
Definition: xmipp_macros.h:193
#define MAXIT
doublereal * c
#define EPS
void sqrt(Image< double > &op)
float del
doublereal * w
void nrerror(const char error_text[])
#define XMIN
double * di
doublereal * x
#define i
doublereal * d
doublereal * b
void log(Image< double > &op)
double * f
#define NRSIGN(a, b)
void beschb(double x, double *gam1, double *gam2, double *gampl, double *gammi)
#define FPMIN
#define PI
Definition: tools.h:43
size_t fact(int num)
doublereal * a

◆ betacf()

double betacf ( double  a,
double  b,
double  x 
)

Definition at line 630 of file numerical_recipes.cpp.

631 {
632  double qap, qam, qab, em, tem, d;
633  double bz, bm = 1.0, bp, bpp;
634  double az = 1.0, am = 1.0, ap, app, aold;
635  int m;
636 
637  qab = a + b;
638  qap = a + 1.0;
639  qam = a - 1.0;
640  bz = 1.0 - qab * x / qap;
641  for (m = 1;m <= ITMAX;m++)
642  {
643  em = (double) m;
644  tem = em + em;
645  d = em * (b - em) * x / ((qam + tem) * (a + tem));
646  ap = az + d * am;
647  bp = bz + d * bm;
648  d = -(a + em) * (qab + em) * x / ((qap + tem) * (a + tem));
649  app = ap + d * az;
650  bpp = bp + d * bz;
651  aold = az;
652  am = ap / bpp;
653  bm = bp / bpp;
654  az = app / bpp;
655  bz = 1.0;
656  if (fabs(az - aold) < (EPS*fabs(az)))
657  return az;
658  }
659  nrerror("a or b too big, or ITMAX too small in BETACF");
660  return 0;
661 }
#define EPS
void nrerror(const char error_text[])
doublereal * x
doublereal * d
doublereal * b
#define ITMAX
doublereal * a

◆ betai()

double betai ( double  a,
double  b,
double  x 
)

Definition at line 612 of file numerical_recipes.cpp.

613 {
614  double bt;
615  if (x < 0.0 || x > 1.0)
616  nrerror("Bad x in routine BETAI");
617  if (x == 0.0 || x == 1.0)
618  bt = 0.0;
619  else
620  bt = exp(gammln(a + b) - gammln(a) - gammln(b) + a * log(x) + b * log(1.0 - x));
621  if (x < (a + 1.0) / (a + b + 2.0))
622  return bt*betacf(a, b, x) / a;
623  else
624  return 1.0 -bt*betacf(b, a, 1.0 - x) / b;
625 
626 }
double betacf(double a, double b, double x)
void nrerror(const char error_text[])
doublereal * x
doublereal * b
void log(Image< double > &op)
doublereal * a
double gammln(double xx)

◆ brent()

double brent ( double  ax,
double  bx,
double  cx,
double(*)(double *, void *)  func,
void *  prm,
double  tol,
double *  xmin,
int  ncom,
double *  pcom,
double *  xicom 
)

Definition at line 757 of file numerical_recipes.cpp.

760 {
761  int iter;
762  double a, b, d, etemp, fu, fv, fw, fx, p, q, r, tol1, tol2, u, v, w, x, xm;
763  double e = 0.0;
764  std::vector<double> buffer(ncom);
765  auto *xt= buffer.data()-1;
766 
767  a = (ax < cx ? ax : cx);
768  b = (ax > cx ? ax : cx);
769  x = w = v = bx;
770  F1DIM(x,fx);
771  fw = fv = fx;
772  for (iter = 1;iter <= ITMAX;iter++)
773  {
774  xm = 0.5 * (a + b);
775  tol2 = 2.0 * (tol1 = tol * fabs(x) + ZEPS);
776  if (fabs(x - xm) <= (tol2 - 0.5*(b - a)))
777  {
778  *xmin = x;
779  return fx;
780  }
781  if (fabs(e) > tol1)
782  {
783  r = (x - w) * (fx - fv);
784  q = (x - v) * (fx - fw);
785  p = (x - v) * q - (x - w) * r;
786  q = 2.0 * (q - r);
787  if (q > 0.0)
788  p = -p;
789  q = fabs(q);
790  etemp = e;
791  e = d;
792  if (fabs(p) >= fabs(0.5*q*etemp) || p <= q*(a - x) || p >= q*(b - x))
793  d = CGOLD * (e = (x >= xm ? a - x : b - x));
794  else
795  {
796  d = p / q;
797  u = x + d;
798  if (u - a < tol2 || b - u < tol2)
799  d = SIGN(tol1, xm - x);
800  }
801  }
802  else
803  {
804  d = CGOLD * (e = (x >= xm ? a - x : b - x));
805  }
806  u = (fabs(d) >= tol1 ? x + d : x + SIGN(tol1, d));
807  F1DIM(u,fu);
808  if (fu <= fx)
809  {
810  if (u >= x)
811  a = x;
812  else
813  b = x;
814  SHFT(v, w, x, u)
815  SHFT(fv, fw, fx, fu)
816  }
817  else
818  {
819  if (u < x)
820  a = u;
821  else
822  b = u;
823  if (fu <= fw || w == x)
824  {
825  v = w;
826  w = u;
827  fv = fw;
828  fw = fu;
829  }
830  else if (fu <= fv || v == x || v == w)
831  {
832  v = u;
833  fv = fu;
834  }
835  }
836  }
837  nrerror("Too many iterations in brent");
838  *xmin = x;
839  return fx;
840 }
#define ZEPS
HBITMAP buffer
Definition: svm-toy.cpp:37
doublereal * w
void nrerror(const char error_text[])
glob_prnt iter
doublereal * x
doublereal * d
#define F1DIM(x, f)
doublereal * b
#define ITMAX
#define SHFT(a, b, c, d)
#define SIGN(a, b)
doublereal * u
#define CGOLD
doublereal * a

◆ cfsqp()

void cfsqp ( nparam  ,
nf  ,
nfsr  ,
nineqn  ,
nineq  ,
neqn  ,
neq  ,
ncsrl  ,
ncsrn  ,
mesh_pts  ,
mode  ,
iprint  ,
miter  ,
inform  ,
bigbnd  ,
eps  ,
epseqn  ,
udelta  ,
bl  ,
bu  ,
x  ,
f  ,
g  ,
lambda  ,
obj  ,
constr  ,
gradob  ,
gradcn  ,
cd   
)

◆ cfsqp1()

cfsqp1 ( miter  ,
nparam  ,
nob  ,
nobL  ,
nfsip1  ,
nineqn  ,
neq  ,
neqn  ,
ncsipl1  ,
ncsipn1  ,
mesh_pts1  ,
ncnstr  ,
nctotl  ,
nrowa  ,
feasb  ,
epskt  ,
epseqn  ,
indxob  ,
indxcn  ,
param  ,
cs  ,
ob  ,
signeq  ,
obj  ,
constr  ,
gradob  ,
gradcn   
)

◆ chebev()

double chebev ( double  a,
double  b,
double  c[],
int  m,
double  x 
)

Definition at line 332 of file numerical_recipes.cpp.

333 {
334  double d = 0.0, dd = 0.0, sv, y, y2;
335  int j;
336 
337  if ((x - a)*(x - b) > 0.0)
338  nrerror("x not in range in routine chebev");
339  y2 = 2.0 * (y = (2.0 * x - a - b) / (b - a));
340  for (j = m - 1;j >= 1;j--)
341  {
342  sv = d;
343  d = y2 * d - dd + c[j];
344  dd = sv;
345  }
346  return y*d - dd + 0.5*c[0];
347 }
doublereal * c
static double * y
void nrerror(const char error_text[])
doublereal * x
doublereal * d
doublereal * b
#define j
doublereal * a

◆ check()

check ( nparam  ,
nf  ,
nfsr  ,
Linfty,
nineq  ,
nineqn  ,
neq  ,
neqn  ,
ncsrl  ,
ncsrn  ,
mode  ,
modem,
eps  ,
bgbnd  ,
param   
)

◆ choldc()

void choldc ( double *  a,
int  n,
double *  p 
)

Definition at line 9347 of file numerical_recipes.cpp.

9348 {
9349  int i, j, k;
9350  double sum;
9351 
9352  for (i = 1;i <= n;i++)
9353  {
9354  for (j = i;j <= n;j++)
9355  {
9356  for (sum = a[i*n+j], k = i - 1;k >= 1;k--)
9357  sum -= a[i*n+k] * a[j*n+k];
9358  if (i == j)
9359  {
9360  if (sum <= 0.0)
9361  nrerror("choldc failed");
9362  p[i] = sqrt(sum);
9363  }
9364  else
9365  a[j*n+i] = sum / p[i];
9366  }
9367  }
9368 }
void sqrt(Image< double > &op)
void nrerror(const char error_text[])
#define i
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
#define j
int * n
doublereal * a

◆ cholsl()

void cholsl ( double *  a,
int  n,
double *  p,
double *  b,
double *  x 
)

Definition at line 9370 of file numerical_recipes.cpp.

9371 {
9372  int i, k;
9373  double sum;
9374 
9375  for (i = 1;i <= n;i++)
9376  {
9377  for (sum = b[i], k = i - 1;k >= 1;k--)
9378  sum -= a[i*n+k] * x[k];
9379  x[i] = sum / p[i];
9380  }
9381  for (i = n;i >= 1;i--)
9382  {
9383  for (sum = x[i], k = i + 1;k <= n;k++)
9384  sum -= a[k*n+i] * x[k];
9385  x[i] = sum / p[i];
9386  }
9387 }
doublereal * x
#define i
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
doublereal * b
int * n
doublereal * a

◆ dealloc()

dealloc ( nineq  ,
neq  ,
signeq  ,
indxcn  ,
indxob  ,
cs  ,
param   
)

◆ diagnl()

diagnl ( nqpram  ,
eta  ,
hess1   
)

◆ dqp()

dqp ( nparam  ,
nqprm0  ,
nob  ,
nobL  ,
nfsip  ,
nineqn  ,
neq  ,
neqn  ,
nn  ,
ncsipl  ,
ncsipn  ,
ncnstr  ,
nctot0  ,
nrowa0  ,
nineqn  ,
infoqp,
param  ,
di  ,
feasb  ,
ob  ,
fmax,
grdpsf  ,
cs  ,
a  ,
cvec  ,
bl  ,
bu  ,
clamda  ,
hess  ,
hess1  ,
di  ,
vv  ,
 
)

◆ for() [1/4]

for ( j  = 1; j <= i__1; ++j)

Definition at line 2310 of file numerical_recipes.cpp.

2311  {
2312  war[in] = -b[j];
2313  /* L10: */
2314  ++in;
2315  }
doublereal * war
doublereal * b
int in
#define j

◆ for() [2/4]

for ( i  = 1;i<=i__1;++i) = nfsr + mesh_pts[i]

Definition at line 2368 of file numerical_recipes.cpp.

2369  {
2370  j = iwar[i];
2371  u[j] = war[in + i];
2372  /* L60: */
2373  }
doublereal * war
#define i
int in
integer * iwar
#define j
doublereal * u

◆ for() [3/4]

for ( k  = 1; k <= i__1; ++k)

Definition at line 2608 of file numerical_recipes.cpp.

2609  {
2610  sum = zero;
2611  i__2 = *n;
2612  for (i = 1; i <= i__2; ++i)
2613  {
2614  /* L10: */
2615  /* Computing 2nd power */
2616  d__1 = a[k + i * a_dim1];
2617  sum += d__1 * d__1;
2618  }
2619  if (sum > zero)
2620  {
2621  goto L20;
2622  }
2623  if (b[k] == zero)
2624  {
2625  goto L30;
2626  }
2627  *info = -k;
2628  if (k <= *meq)
2629  {
2630  goto L730;
2631  }
2632  if (b[k] <= 0.)
2633  {
2634  goto L30;
2635  }
2636  else
2637  {
2638  goto L730;
2639  }
2640 L20:
2641  sum = one / sqrt(sum);
2642 L30:
2643  ia = iwa + k;
2644  /* L40: */
2645  w[ia] = sum;
2646  }
doublereal d__1
void sqrt(Image< double > &op)
doublereal * w
#define i
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
doublereal * b
int * meq
int * n
doublereal * a
ql0001_ & zero(ctemp+1),(cvec+1),(a+1),(b+1),(bl+1),(bu+1),(x+1),(w+1), &iout, ifail, &zero,(w+3), &lwar2,(iw+1), &leniw, &glob_grd.epsmac

◆ for() [4/4]

for ( ;;  )

Definition at line 5341 of file numerical_recipes.cpp.

5342  {
5343  out(miter, nparam, nob, nobL, nfsip, nineqn, nn, nineqn, ncnst1,
5345  sktnom, d0nm, feasb);
5346  if (nstop == 0)
5347  {
5348  if (!feasb)
5349  {
5350  dealloc1(nparam, nrowa, a, hess, hess1, di, d, gm,
5352  iact, iskip, istore);
5353  return;
5354  }
5355  for (i = 1; i <= ncnst1; i++)
5356  cs[i].val = backup[i];
5357  for (i = 1; i <= nob; i++)
5358  ob[i].val = backup[i+ncnst1];
5359  for (i = 1; i <= neqn; i++)
5360  cs[glob_info.nnineq+i].mult = signeq[i] * psmu[i];
5361  dealloc1(nparam, nrowa, a, hess, hess1, di, d, gm,
5363  iact, iskip, istore);
5364  return;
5365  }
5366  if (!feasb && glob_prnt.iprint == 0)
5367  glob_prnt.iter++;
5368  /* Update the SIP constraint set Omega_k */
5369  if ((ncsipl + ncsipn) != 0 || nfsip)
5370  update_omega(nparam, ncsipl, ncsipn, mesh_pts, nineqn, nob, nobL,
5371  nfsip, steps, fmax, cs, ob, param->x, viol,
5372  constr, obj, gradob, gradcn, param->cd, feasb);
5373  /* Compute search direction */
5374  dir(nparam, nob, nobL, nfsip, nineqn, neq, neqn, nn, ncsipl, ncsipn,
5377  cs, ob, &fM, &fMp, &fmax, &psf, grdpsf, penp, a, bl, bu, clamda, cvec,
5379  if (nstop == 0 && !glob_log.get_ne_mult)
5380  continue;
5381  glob_log.first = FALSE;
5382  if (!glob_log.update && !glob_log.d0_is0)
5383  {
5384  /* Determine step length */
5385  step1(nparam, nob, nobL, nfsip, nineqn, neq, neqn, nn, ncsipl, ncsipn,
5387  feasb, grdftd, ob, &fM, &fMp, &fmax, &psf, penp, &steps, &scvneq,
5388  bu, param->x, di, d, cs, backup, signeq, viol, obj, constr,
5389  param->cd);
5390  if (nstop == 0)
5391  continue;
5392  }
5393  /* Update the Hessian */
5394  hessian(nparam, nob, nfsip, nobL, nineqn, neq, neqn, nn, ncsipn, ncnst1,
5395  nfs, &nstart, feasb, bu, param, ob, fmax, &fM, &fMp, &psf, grdpsf,
5396  penp, cs, gm, indxob, indxcn, bl, clamda, di, hess, d, steps, &nrst,
5398  if (nstop == 0 || glob_info.mode == 0)
5399  continue;
5400  if (d0nm > dbar)
5401  Ck = DMAX1(0.5e0 * Ck, Cbar);
5402  if (d0nm <= dbar && !glob_log.dlfeas &&
5403  !glob_log.rhol_is1)
5404  Ck = 10.e0 * Ck;
5405  }
double grdftd
struct Tglob_info glob_info
glob_info ncsipl
#define DMAX1(a, b)
glob_info ncsipn
double * gm
double * bl
double d0nm
void(*)(*)(*) gradob()
double * grdpsf
double Cbar
static void nparam
int * iskip
void * mesh_pts
void(*)(*)(*)(*) gradcn()
double epseqn
int * istore
double * di
void nineqn
static void * iskp
#define i
double epskt
double fMp
doublereal * d
double ** hess
double * bu
void miter
double psf
struct _constraint * cs
struct Tglob_prnt glob_prnt
integer * iact
double * cvec
double * penp
#define FALSE
int * indxcn
double sktnom
double * signeq
void neqn
double scvneq
static void * ncf
double * psmu
double steps
struct _parameter * param
glob_info nfsip
struct Tglob_log glob_log
int * indxob
void neq
int nstop
void(*)(*) constr()
struct _objective * ob
int feasb
double fM
double * clamda
void(* obj)()
struct _violation * viol
double dbar
double ** hess1
double * span
double fmax
doublereal * a
double Ck
double * backup
static void nobL

◆ fprintf()

fprintf ( glob_prnt.  io,
"\   
)

◆ free()

free ( (char *)  ob)

◆ free_dm() [1/3]

free_dm ( hess  ,
nparam   
)

◆ free_dm() [2/3]

free_dm ( hess1  ,
nparam 1 
)

◆ free_dm() [3/3]

free_dm ( a  ,
nrowa   
)

◆ free_dv() [1/20]

free_dv ( w  )

◆ free_dv() [2/20]

free_dv ( param->  x)

◆ free_dv() [3/20]

free_dv ( signeq  )

◆ free_dv() [4/20]

free_dv ( di  )

◆ free_dv() [5/20]

free_dv ( d  )

◆ free_dv() [6/20]

free_dv ( gm  )

◆ free_dv() [7/20]

free_dv ( grdpsf  )

◆ free_dv() [8/20]

free_dv ( penp  )

◆ free_dv() [9/20]

free_dv ( bl  )

◆ free_dv() [10/20]

free_dv ( bu  )

◆ free_dv() [11/20]

free_dv ( clamda  )

◆ free_dv() [12/20]

free_dv ( cvec  )

◆ free_dv() [13/20]

free_dv ( psmu  )

◆ free_dv() [14/20]

free_dv ( span  )

◆ free_dv() [15/20]

free_dv ( backup  )

◆ free_dv() [16/20]

free_dv ( x  )

◆ free_dv() [17/20]

free_dv ( bj  )

◆ free_dv() [18/20]

free_dv ( htemp  )

◆ free_dv() [19/20]

free_dv ( atemp  )

◆ free_dv() [20/20]

free_dv ( ctemp  )

◆ free_iv() [1/7]

free_iv ( iw  )

◆ free_iv() [2/7]

free_iv ( indxob  )

◆ free_iv() [3/7]

free_iv ( indxcn  )

◆ free_iv() [4/7]

free_iv ( iact  )

◆ free_iv() [5/7]

free_iv ( iskip  )

◆ free_iv() [6/7]

free_iv ( istore  )

◆ free_iv() [7/7]

free_iv ( iw_hold  )

◆ gammln()

double gammln ( double  xx)

Definition at line 589 of file numerical_recipes.cpp.

590 {
591  double x, tmp, ser;
592  static double cof[6] =
593  {
594  76.18009173, -86.50532033, 24.01409822,
595  -1.231739516, 0.120858003e-2, -0.536382e-5
596  };
597  int j;
598 
599  x = xx - 1.0;
600  tmp = x + 5.5;
601  tmp -= (x + 0.5) * log(tmp);
602  ser = 1.0;
603  for (j = 0;j <= 5;j++)
604  {
605  x += 1.0;
606  ser += cof[j] / x;
607  }
608  return -tmp + log(2.50662827465*ser);
609 }
doublereal * x
void log(Image< double > &op)
#define j

◆ gammp()

double gammp ( double  a,
double  x 
)

Definition at line 9328 of file numerical_recipes.cpp.

9329 {
9330  double gamser, gammcf, gln;
9331 
9332  if (x < 0.0 || a <= 0.0)
9333  nrerror("Invalid arguments in routine gammp");
9334  if (x < (a + 1.0))
9335  {
9336  gser(&gamser, a, x, &gln);
9337  return gamser;
9338  }
9339  else
9340  {
9341  gcf(&gammcf, a, x, &gln);
9342  return 1.0 -gammcf;
9343  }
9344 }
void nrerror(const char error_text[])
void gcf(double *gammcf, double a, double x, double *gln)
doublereal * x
void gser(double *gamser, double a, double x, double *gln)
doublereal * a

◆ gasdev()

double gasdev ( int *  idum)

Definition at line 106 of file numerical_recipes.cpp.

107 {
108  static int iset = 0;
109  static double gset;
110  double fac, r, v1, v2;
111 
112  if (iset == 0)
113  {
114  do
115  {
116  v1 = 2.0 * ran1(idum) - 1.0;
117  v2 = 2.0 * ran1(idum) - 1.0;
118  r = v1 * v1 + v2 * v2;
119  }
120  while (r >= 1.0);
121  fac = sqrt(-2.0 * log(r) / r);
122  gset = v1 * fac;
123  iset = 1;
124  return v2*fac;
125  }
126  else
127  {
128  iset = 0;
129  return gset;
130  }
131 }
void sqrt(Image< double > &op)
double v1
void log(Image< double > &op)
double ran1(int *idum)
int idum

◆ gcf()

void gcf ( double *  gammcf,
double  a,
double  x,
double *  gln 
)

Definition at line 9294 of file numerical_recipes.cpp.

9295 {
9296  int i;
9297  double an, b, c, d, del, h;
9298 
9299  *gln = gammln(a);
9300  b = x + 1.0 - a;
9301  c = 1.0 / FPMIN;
9302  d = 1.0 / b;
9303  h = d;
9304  for (i = 1;i <= ITMAX;i++)
9305  {
9306  an = -i * (i - a);
9307  b += 2.0;
9308  d = an * d + b;
9309  if (fabs(d) < FPMIN)
9310  d = FPMIN;
9311  c = b + an / c;
9312  if (fabs(c) < FPMIN)
9313  c = FPMIN;
9314  d = 1.0 / d;
9315  del = d * c;
9316  h *= del;
9317  if (fabs(del - 1.0) < EPS)
9318  break;
9319  }
9320  if (i > ITMAX)
9321  nrerror("a too large, ITMAX too small in gcf");
9322  *gammcf = exp(-x + a * log(x) - (*gln)) * h;
9323 }
doublereal * c
#define EPS
float del
void nrerror(const char error_text[])
doublereal * x
#define i
doublereal * d
doublereal * b
void log(Image< double > &op)
#define ITMAX
#define FPMIN
doublereal * a
double gammln(double xx)

◆ grcnfd() [1/2]

void grcnfd ( )

◆ grcnfd() [2/2]

void grcnfd ( nparam  ,
j  ,
x  ,
gradg  ,
constr  ,
cd   
)

◆ grobfd() [1/2]

void grobfd ( )

◆ grobfd() [2/2]

void grobfd ( nparam  ,
j  ,
x  ,
gradf  ,
obj  ,
cd   
)

◆ gser()

void gser ( double *  gamser,
double  a,
double  x,
double *  gln 
)

Definition at line 9255 of file numerical_recipes.cpp.

9256 {
9257  int n;
9258  double sum, del, ap;
9259 
9260  *gln = gammln(a);
9261  if (x <= 0.0)
9262  {
9263  if (x < 0.0)
9264  nrerror("x less than 0 in routine gser");
9265  *gamser = 0.0;
9266  return;
9267  }
9268  else
9269  {
9270  ap = a;
9271  del = sum = 1.0 / a;
9272  for (n = 1;n <= ITMAX;n++)
9273  {
9274  ++ap;
9275  del *= x / ap;
9276  sum += del;
9277  if (fabs(del) < fabs(sum)*EPS)
9278  {
9279  *gamser = sum * exp(-x + a * log(x) - (*gln));
9280  return;
9281  }
9282  }
9283  nrerror("a too large, ITMAX too small in routine gser");
9284  return;
9285  }
9286 }
#define EPS
float del
void nrerror(const char error_text[])
doublereal * x
void log(Image< double > &op)
#define ITMAX
int * n
doublereal * a
double gammln(double xx)

◆ if() [1/102]

if ( fabs(c[ *nmax+*nmax *c_dim1])  = = 0.e0)

Definition at line 2279 of file numerical_recipes.cpp.

2280  {
2281  c[*nmax + *nmax * c_dim1] = cmache_1.eps;
2282  }
int * nmax
#define cmache_1
doublereal * c

◆ if() [2/102]

if ( iwar  [1] = = 1)

Definition at line 2292 of file numerical_recipes.cpp.

2293  {
2294  lql = TRUE_;
2295  }
#define TRUE_

◆ if() [3/102]

if ( inw2+  lw,
lwar 
)

Definition at line 2318 of file numerical_recipes.cpp.

2319  {
2320  goto L80;
2321  }

◆ if() [4/102]

if ( info  = = 1)

Definition at line 2341 of file numerical_recipes.cpp.

2342  {
2343  goto L40;
2344  }

◆ if() [5/102]

if ( )

Definition at line 2349 of file numerical_recipes.cpp.

2350  {
2351  goto L70;
2352  }
goto L70

◆ if() [6/102]

if ( nact  = = 0)

Definition at line 2363 of file numerical_recipes.cpp.

2364  {
2365  goto L30;
2366  }

◆ if() [7/102]

if ( ! *  lql)

Definition at line 2658 of file numerical_recipes.cpp.

2659  {
2660  goto L165;
2661  }

◆ if() [8/102]

if ( k >=  2)

Definition at line 2775 of file numerical_recipes.cpp.

2776  {
2777  goto L150;
2778  }

◆ if() [9/102]

if ( w >=  zero[kdrop])

Definition at line 3137 of file numerical_recipes.cpp.

3138  {
3139  goto L440;
3140  }
goto L440

◆ if() [10/102]

if ( iact<= *  meq[kdrop])

Definition at line 3141 of file numerical_recipes.cpp.

3142  {
3143  goto L440;
3144  }
goto L440

◆ if() [11/102]

if ( cvmax<= *  vsmall)

Definition at line 3257 of file numerical_recipes.cpp.

3258  {
3259  goto L700;
3260  }

◆ if() [12/102]

if ( jfinc  = = 0)

Definition at line 3266 of file numerical_recipes.cpp.

3267  {
3268  goto L510;
3269  }

◆ if() [13/102]

if ( jfinc !  = ifinc)

Definition at line 3270 of file numerical_recipes.cpp.

3271  {
3272  goto L530;
3273  }

◆ if() [14/102]

if ( sum<=  fdiffa)

Definition at line 3322 of file numerical_recipes.cpp.

3323  {
3324  goto L700;
3325  }

◆ if() [15/102]

if ( temp<=  sum)

Definition at line 3327 of file numerical_recipes.cpp.

3328  {
3329  goto L700;
3330  }

◆ if() [16/102]

if ( iterc<= *  maxit)

Definition at line 3348 of file numerical_recipes.cpp.

3349  {
3350  goto L531;
3351  }

◆ if() [17/102]

if ( knext  ,
m 
)

Definition at line 3356 of file numerical_recipes.cpp.

3357  {
3358  goto L541;
3359  }

◆ if() [18/102]

if ( k1  ,
n 
)

Definition at line 3377 of file numerical_recipes.cpp.

3378  {
3379  goto L545;
3380  }

◆ if() [19/102]

if ( tempa<=  temp)

Definition at line 3454 of file numerical_recipes.cpp.

3455  {
3456  goto L570;
3457  }
goto L570

◆ if() [20/102]

if ( sumb  ,
vsmall 
)

Definition at line 3458 of file numerical_recipes.cpp.

3459  {
3460  goto L5;
3461  }

◆ if() [21/102]

if ( knext<= *  m)

Definition at line 3466 of file numerical_recipes.cpp.

3467  {
3468  sumc /= w[ia];
3469  }
doublereal * w

◆ if() [22/102]

if ( kdrop  = = 0)

Definition at line 3633 of file numerical_recipes.cpp.

3634  {
3635  goto L700;
3636  }

◆ if() [23/102]

if ( itref<=  0)

Definition at line 3764 of file numerical_recipes.cpp.

3765  {
3766  goto L450;
3767  }

◆ if() [24/102]

if ( itref  = = 1)

Definition at line 3783 of file numerical_recipes.cpp.

3784  {
3785  goto L250;
3786  }

◆ if() [25/102]

if ( i  ,
 
)

Definition at line 3840 of file numerical_recipes.cpp.

3841  {
3842  goto L750;
3843  }

◆ if() [26/102]

if ( lflag  = = 3)

Definition at line 3844 of file numerical_recipes.cpp.

3845  {
3846  goto L390;
3847  }

◆ if() [27/102]

if ( iact  [kdrop],
mn 
)

Definition at line 3906 of file numerical_recipes.cpp.

3907  {
3908  ia -= *n;
3909  }
int * n

◆ if() [28/102]

if ( nu  = = *nact)

Definition at line 4009 of file numerical_recipes.cpp.

4010  {
4011  goto L900;
4012  }

◆ if() [29/102]

if ( w  [is] = zero)

Definition at line 4013 of file numerical_recipes.cpp.

4014  {
4015  goto L870;
4016  }

◆ if() [30/102]

if ( ncsipn1  )

◆ if() [31/102]

if ( glob_prnt.  iprint,
 
)

Definition at line 4719 of file numerical_recipes.cpp.

4720  {
4722  "\n\n CFSQP Version 2.5b (Released June 1997) \n");
4724  " Copyright (c) 1993 --- 1997 \n");
4726  " C.T. Lawrence, J.L. Zhou \n");
4728  " and A.L. Tits \n");
4730  " All Rights Reserved \n\n");
4731  }
struct Tglob_prnt glob_prnt
fprintf(glob_prnt.io, "\)

◆ if() [32/102]

if ( glob_prnt.  info = = 7)

Definition at line 4737 of file numerical_recipes.cpp.

4738  {
4739  *inform = glob_prnt.info;
4740  return;
4741  }
struct Tglob_prnt glob_prnt
void * inform

◆ if() [33/102]

if ( nclin = 0)

Definition at line 4764 of file numerical_recipes.cpp.

4765  {
4766  for (i = 1; i <= nclin; i++)
4767  {
4768  j = i + nineqn;
4769  if (j <= nineq)
4770  {
4771  constr(nparam, j, (param->x) + 1, &gi, param->cd);
4772  if (gi > glob_grd.epsmac)
4773  feasbl = FALSE;
4774  }
4775  else
4776  {
4777  constr(nparam, j + neqn, (param->x) + 1, &gi, param->cd);
4778  if (fabs(gi) > glob_grd.epsmac)
4779  feasbl = FALSE;
4780  }
4781  cs[j].val = gi;
4782  }
4783  }
void nineq
static void nparam
double gi
void nineqn
#define i
struct _constraint * cs
#define FALSE
void neqn
int feasbl
#define j
struct _parameter * param
void(*)(*) constr()
struct Tglob_grd glob_grd

◆ if() [34/102]

if ( feasbl) = FALSE

Definition at line 4787 of file numerical_recipes.cpp.

4788  {
4789  if (glob_prnt.iprint > 0)
4790  {
4792  " The given initial point is infeasible for inequality\n");
4794  " constraints and linear equality constraints:\n");
4795  sbout1(glob_prnt.io, nparam, " ", dummy,
4796  param->x, 2, 1);
4797  prnt = TRUE;
4798  }
4799  nctotl = nparam + nclin;
4800  lenw = 2 * nparam * nparam + 10 * nparam + 2 * nctotl + 1;
4801  leniw = DMAX1(2 * nparam + 2 * nctotl + 3, 2 * nclin + 2 * nparam + 6);
4802  /*-----------------------------------------------------*/
4803  /* Attempt to generate a point satisfying all linear */
4804  /* constraints. */
4805  /*-----------------------------------------------------*/
4806  nrowa = DMAX1(nclin, 1);
4807  iw = make_iv(leniw);
4808  w = make_dv(lenw);
4809  initpt(nparam, nineqn, neq, neqn, nclin, nctotl, nrowa, param,
4810  &cs[nineqn], constr, gradcn);
4811  free_iv(iw);
4812  free_dv(w);
4813  if (glob_prnt.info != 0)
4814  {
4815  *inform = glob_prnt.info;
4816  return;
4817  }
4818  }
free_dv(w)
#define DMAX1(a, b)
sbout1(glob_prnt.io, nparam, "multipliers for x ", dummy, param->mult, 2, 2)
static void nparam
doublereal * w
void(*)(*)(*)(*) gradcn()
free_iv(iw)
void nineqn
struct _constraint * cs
struct Tglob_prnt glob_prnt
void neqn
double dummy
int leniw
struct _parameter * param
void neq
void(*)(*) constr()
int lenw
int prnt
#define TRUE
void * inform
static void nctotl
fprintf(glob_prnt.io, "\)

◆ if() [35/102]

if ( feasb  )

Definition at line 4986 of file numerical_recipes.cpp.

4987  {
4988  for (i = 1; i <= neqn; i++)
4989  {
4990  if (cs[i+nineq].val > 0.e0)
4991  signeq[i] = -1.e0;
4992  else
4993  signeq[i] = 1.e0;
4994  }
4995  }
void nineq
#define i
struct _constraint * cs
double * signeq
void neqn

◆ if() [36/102]

if ( glob_prnt.info !  = 0)

Definition at line 5034 of file numerical_recipes.cpp.

5035  {
5036  if (feasb)
5037  {
5038  for (i = 1; i <= nparam; i++)
5039  x[i] = param->x[i];
5040  for (i = 1; i <= nineq + neq; i++)
5041  g[i] = cs[i].val;
5042  *inform = glob_prnt.info;
5043  dealloc(nineq, neq, signeq, indxcn, indxob, cs, param);
5044  for (i = 1; i <= nf; i++)
5045  {
5046  f[i] = ob[i].val;
5047  free_dv(ob[i].grad);
5048  }
5049  free((char *) ob);
5050  return;
5051  }
5052  glob_prnt.info = 2;
5054  "Error: No feasible point is found for nonlinear inequality\n");
5056  "constraints and linear equality constraints\n");
5057  *inform = glob_prnt.info;
5058  dealloc(nineq, neq, signeq, indxcn, indxob, cs, param);
5059  for (i = 1; i <= nineqn; i++)
5060  free_dv(ob[i].grad);
5061  free((char *) ob);
5062  return;
5063  }
free_dv(w)
void nineq
doublereal * g
doublereal * grad
static void nparam
dealloc(nineq, neq, signeq, indxcn, indxob, cs, param)
void nineqn
doublereal * x
#define i
void nf
struct _constraint * cs
struct Tglob_prnt glob_prnt
double * f
int * indxcn
double * signeq
free((char *) ob)
for(j=1;j<=i__1;++j)
struct _parameter * param
int * indxob
void neq
struct _objective * ob
int feasb
void * inform
fprintf(glob_prnt.io, "\)

◆ if() [37/102]

if ( nf  = =1)

◆ if() [38/102]

if ( glob_info.mode = 0)

Definition at line 6472 of file numerical_recipes.cpp.

6473  {
6474  v0 = pow(*d0nm, 2.1);
6475  v1 = DMAX1(0.5e0, pow(dnm1, 2.5));
6476  rho = v0 / (v0 + v1);
6477  rhog = rho;
6478  }
#define DMAX1(a, b)
double d0nm
double rho
double dnm1
double v1
double v0
double rhog

◆ if() [39/102]

if ( feasb &&neqn = 0)

◆ if() [40/102]

if ( feasb &&  nob = =0)
pure virtual

◆ if() [41/102]

if ( glob_prnt.iprint >=3 &&glob_log.  first)

Definition at line 5291 of file numerical_recipes.cpp.

5292  {
5293  for (i = 1; i <= nob; i++)
5294  {
5295  if (feasb)
5296  {
5297  if (nob > 1)
5298  {
5299  tempv = ob[i].grad;
5300  sbout2(glob_prnt.io, nparam, i, "gradf(j,", ")", tempv);
5301  }
5302  if (nob == 1)
5303  {
5304  tempv = ob[1].grad;
5305  sbout1(glob_prnt.io, nparam, "gradf(j) ",
5306  dummy, tempv, 2, 2);
5307  }
5308  continue;
5309  }
5310  tempv = ob[i].grad;
5311  sbout2(glob_prnt.io, nparam, indxob[i], "gradg(j,", ")", tempv);
5312  }
5313  if (ncnstr != 0)
5314  {
5315  for (i = 1; i <= ncnst1; i++)
5316  {
5317  tempv = cs[indxcn[i]].grad;
5318  sbout2(glob_prnt.io, nparam, indxcn[i], "gradg(j,", ")", tempv);
5319  }
5320  if (neqn != 0)
5321  {
5322  sbout1(glob_prnt.io, nparam, "grdpsf(j) ", dummy,
5323  grdpsf, 2, 2);
5324  sbout1(glob_prnt.io, neqn, "P ", dummy,
5325  penp, 2, 2);
5326  }
5327  }
5328  for (i = 1; i <= nparam; i++)
5329  {
5330  tempv = colvec(hess, i, nparam);
5331  sbout2(glob_prnt.io, nparam, i, "hess (j,", ")", tempv);
5332  free_dv(tempv);
5333  }
5334  }
free_dv(w)
double * grdpsf
sbout1(glob_prnt.io, nparam, "multipliers for x ", dummy, param->mult, 2, 2)
double * tempv
static void nparam
#define i
double ** hess
struct _constraint * cs
struct Tglob_prnt glob_prnt
double * penp
int * indxcn
void neqn
double dummy
int * indxob
struct _objective * ob
int feasb

◆ if() [42/102]

if ( nparam<=  0)

◆ if() [43/102]

if ( nparam<=neq neqn)

◆ if() [44/102]

◆ if() [45/102]

if ( eps<=glob_grd.  epsmac)

Definition at line 5501 of file numerical_recipes.cpp.

5502  {
5503  error("eps should be bigger than epsmac! ",
5504  &glob_prnt.info);
5506  "epsmac = %22.14e which is machine dependent.\n",
5507  glob_grd.epsmac);
5508  }
struct Tglob_prnt glob_prnt
void error(char *s)
Definition: tools.cpp:107
struct Tglob_grd glob_grd
fprintf(glob_prnt.io, "\)

◆ if() [46/102]

if ( mode==100||mode==101||mode==110||mode==111||mode==200||mode==201||mode==210||mode==211)

◆ if() [47/102]

if ( mode >=  200)

Definition at line 5536 of file numerical_recipes.cpp.

5537  {
5538  i = mode - 200;
5539  glob_info.modec = 2;
5540  }
struct Tglob_info glob_info
#define i
void mode

◆ if() [48/102]

if ( glob_prnt.iter % glob_prnt.  iter_mod) = FALSE

◆ if() [49/102]

if ( ncsipn = 0)

Definition at line 5726 of file numerical_recipes.cpp.

5727  {
5728  offset = nineqn - ncsipn;
5729  for (i = 1; i <= glob_info.ncsipn; i++)
5730  {
5731  for (j = 1; j <= mesh_pts[glob_info.nfsip+i]; j++)
5732  {
5733  offset++;
5734  if (j == 1)
5735  {
5736  if (cs[offset].val >= -epsilon &&
5737  cs[offset].val >= cs[offset+1].val)
5738  {
5739  cs[offset].act_sip = TRUE;
5741  if (cs[offset].mult == 0.e0 && !glob_log.first)
5742  {
5743  glob_grd.valnom = cs[offset].val;
5744  gradcn(nparam, offset, x + 1, cs[offset].grad + 1, constr,
5745  cd);
5746  }
5747  continue;
5748  }
5749  }
5750  else if (j == mesh_pts[glob_info.nfsip+i])
5751  {
5752  if (cs[offset].val >= -epsilon &&
5753  cs[offset].val > cs[offset-1].val)
5754  {
5755  cs[offset].act_sip = TRUE;
5757  if (cs[offset].mult == 0.e0 && !glob_log.first)
5758  {
5759  glob_grd.valnom = cs[offset].val;
5760  gradcn(nparam, offset, x + 1, cs[offset].grad + 1, constr,
5761  cd);
5762  }
5763  continue;
5764  }
5765  }
5766  else
5767  {
5768  if (cs[offset].val >= -epsilon && cs[offset].val >
5769  cs[offset-1].val && cs[offset].val >=
5770  cs[offset+1].val)
5771  {
5772  cs[offset].act_sip = TRUE;
5774  if (cs[offset].mult == 0.e0 && !glob_log.first)
5775  {
5776  glob_grd.valnom = cs[offset].val;
5777  gradcn(nparam, offset, x + 1, cs[offset].grad + 1, constr,
5778  cd);
5779  }
5780  continue;
5781  }
5782  }
5783  if (cs[offset].val >= -glob_grd.epsmac)
5784  {
5785  cs[offset].act_sip = TRUE;
5787  if (cs[offset].mult == 0.e0 && !glob_log.first)
5788  {
5789  glob_grd.valnom = cs[offset].val;
5790  gradcn(nparam, offset, x + 1, cs[offset].grad + 1, constr, cd);
5791  }
5792  continue;
5793  }
5794  if (cs[offset].mult > 0.e0)
5795  {
5796  cs[offset].act_sip = TRUE;
5798  }
5799  /* Add if binding for d1 */
5800  if (cs[offset].d1bind)
5801  {
5802  cs[offset].act_sip = TRUE;
5804  if (cs[offset].mult == 0.e0 && !glob_log.first)
5805  {
5806  glob_grd.valnom = cs[offset].val;
5807  gradcn(nparam, offset, x + 1, cs[offset].grad + 1, constr, cd);
5808  }
5809  }
5810 
5811  }
5812  }
5813  }
struct Tglob_info glob_info
glob_info ncsipn
void * cd
doublereal * grad
static void nparam
void * mesh_pts
void(*)(*)(*)(*) gradcn()
i<=ncnstr;i++) cs[i].mult=0.e0;if(nfsip) for(i=1;i<=nob;i++) { ob[i].mult=0.e0;ob[i].mult_L=0.e0;} for(i=1;i<=nqpram;i++) { ii=k+i;if(clamda[ii]==0.e0 &&clamda[ii+nqpram]==0.e0) continue;else if(clamda[ii] !=0.e0) clamda[ii]=-clamda[ii];else clamda[ii]=clamda[ii+nqpram];} nqnp=nqpram+ncnstr;for(i=1;i<=nqpram;i++) param-> mult[i]
void nineqn
doublereal * x
#define i
struct _constraint * cs
#define j
struct Tglob_log glob_log
void(*)(*) constr()
#define TRUE
struct Tglob_grd glob_grd
double epsilon

◆ if() [50/102]

if ( ncsipl = 0)

Definition at line 5814 of file numerical_recipes.cpp.

5815  {
5816  /* Don't need to get gradients */
5817  offset = nineq - ncsipl;
5818  for (i = 1; i <= glob_info.ncsipl; i++)
5819  {
5820  if (feasb)
5822  else
5823  index = glob_info.ncsipn + i;
5824  for (j = 1; j <= mesh_pts[index]; j++)
5825  {
5826  offset++;
5827  if (j == 1)
5828  {
5829  if (cs[offset].val >= -epsilon &&
5830  cs[offset].val >= cs[offset+1].val)
5831  {
5832  cs[offset].act_sip = TRUE;
5834  continue;
5835  }
5836  }
5837  else
5838  if (j == mesh_pts[index])
5839  {
5840  if (cs[offset].val >= -epsilon &&
5841  cs[offset].val > cs[offset-1].val)
5842  {
5843  cs[offset].act_sip = TRUE;
5845  continue;
5846  }
5847  }
5848  else
5849  {
5850  if (cs[offset].val >= -epsilon && cs[offset].val >
5851  cs[offset-1].val && cs[offset].val >=
5852  cs[offset+1].val)
5853  {
5854  cs[offset].act_sip = TRUE;
5856  continue;
5857  }
5858  }
5859  if (cs[offset].val >= -glob_grd.epsmac ||
5860  cs[offset].mult > 0.e0 || cs[offset].d1bind)
5861  {
5862  cs[offset].act_sip = TRUE;
5864  }
5865  }
5866  }
5867  }
struct Tglob_info glob_info
glob_info ncsipl
void nineq
void * mesh_pts
#define i
struct _constraint * cs
viol index
#define j
int feasb
#define TRUE
struct Tglob_grd glob_grd
double epsilon

◆ if() [51/102]

if ( glob_log.  first) = FALSE

Definition at line 5871 of file numerical_recipes.cpp.

5872  {
5873  if (feasb)
5874  {
5875  offset = nineqn - ncsipn;
5876  for (i = 1; i <= glob_info.ncsipn; i++)
5877  {
5878  i_max = ++offset;
5879  g_max = cs[i_max].val;
5880  if (!cs[i_max].act_sip)
5881  { /* add first point */
5882  cs[i_max].act_sip = TRUE;
5884  }
5885  for (j = 2;j <= mesh_pts[glob_info.nfsip+i];j++)
5886  {
5887  offset++;
5888  if (cs[offset].val > g_max)
5889  {
5890  i_max = offset;
5891  g_max = cs[i_max].val;
5892  }
5893  }
5894  if (!cs[i_max].act_sip)
5895  {
5896  cs[i_max].act_sip = TRUE;
5898  }
5899  if (!cs[offset].act_sip)
5900  { /* add last point */
5901  cs[offset].act_sip = TRUE;
5903  }
5904  }
5905  }
5906  offset = nineq - ncsipl;
5907  for (i = 1; i <= glob_info.ncsipl; i++)
5908  {
5909  i_max = ++offset;
5910  g_max = cs[i_max].val;
5911  if (!cs[i_max].act_sip)
5912  { /* add first point */
5913  cs[i_max].act_sip = TRUE;
5915  }
5916  if (feasb)
5918  else
5919  index = glob_info.ncsipn + i;
5920  for (j = 2;j <= mesh_pts[index]; j++)
5921  {
5922  offset++;
5923  if (cs[offset].val > g_max)
5924  {
5925  i_max = offset;
5926  g_max = cs[i_max].val;
5927  }
5928  }
5929  if (!cs[i_max].act_sip)
5930  {
5931  cs[i_max].act_sip = TRUE;
5933  }
5934  if (!cs[offset].act_sip)
5935  { /* add last point */
5936  cs[offset].act_sip = TRUE;
5938  }
5939  }
5940  }
struct Tglob_info glob_info
glob_info ncsipl
void nineq
glob_info ncsipn
void * mesh_pts
void nineqn
#define i
struct _constraint * cs
viol index
#define j
double g_max
int feasb
#define TRUE

◆ if() [52/102]

if ( steps< 1.e0 &&viol->  type = CONSTR)

Definition at line 5943 of file numerical_recipes.cpp.

5944  {
5945  i = viol->index;
5946  if (!cs[i].act_sip)
5947  {
5948  cs[i].act_sip = TRUE;
5950  }
5951  }
struct Tglob_info glob_info
#define i
struct _constraint * cs
#define TRUE
struct _violation * viol

◆ if() [53/102]

if ( glob_prnt.iprint >=2 &&  display)

◆ if() [54/102]

if ( nfsip  )

Definition at line 5965 of file numerical_recipes.cpp.

5966  {
5967  offset = nob - nfsip;
5968  if (feasb)
5969  index = glob_info.nfsip;
5970  else
5972  for (i = 1; i <= index; i++)
5973  {
5974  for (j = 1; j <= mesh_pts[i]; j++)
5975  {
5976  offset++;
5977  if (nobL > nob)
5978  {
5979  fnow = fabs(ob[offset].val);
5980  fmult = DMAX1(fabs(ob[offset].mult),
5981  fabs(ob[offset].mult_L));
5982  }
5983  else
5984  {
5985  fnow = ob[offset].val;
5986  fmult = ob[offset].mult;
5987  }
5988  if (j == 1)
5989  {
5990  if (nobL > nob)
5991  fnext = fabs(ob[offset+1].val);
5992  else
5993  fnext = ob[offset+1].val;
5994  if ((fnow >= fmax - epsilon) && fnow >= fnext)
5995  {
5996  ob[offset].act_sip = TRUE;
5998  if (fmult == 0.e0 && !glob_log.first)
5999  {
6000  glob_grd.valnom = ob[offset].val;
6001  if (feasb)
6002  gradob(nparam, offset, x + 1,
6003  ob[offset].grad + 1, obj, cd);
6004  else
6005  gradcn(nparam, offset, x + 1, ob[offset].grad + 1,
6006  constr, cd);
6007  }
6008  continue;
6009  }
6010  }
6011  else if (j == mesh_pts[i])
6012  {
6013  if (nobL > nob)
6014  fprev = fabs(ob[offset-1].val);
6015  else
6016  fprev = ob[offset-1].val;
6017  if ((fnow >= fmax - epsilon) && fnow > fprev)
6018  {
6019  ob[offset].act_sip = TRUE;
6021  if (fmult == 0.e0 && !glob_log.first)
6022  {
6023  glob_grd.valnom = ob[offset].val;
6024  if (feasb)
6025  gradob(nparam, offset, x + 1,
6026  ob[offset].grad + 1, obj, cd);
6027  else
6028  gradcn(nparam, offset, x + 1, ob[offset].grad + 1,
6029  constr, cd);
6030  }
6031  continue;
6032  }
6033  }
6034  else
6035  {
6036  if (nobL > nob)
6037  {
6038  fprev = fabs(ob[offset-1].val);
6039  fnext = fabs(ob[offset+1].val);
6040  }
6041  else
6042  {
6043  fprev = ob[offset-1].val;
6044  fnext = ob[offset+1].val;
6045  }
6046  if ((fnow >= fmax - epsilon) && fnow > fprev &&
6047  fnow >= fnext)
6048  {
6049  ob[offset].act_sip = TRUE;
6051  if (fmult == 0.e0 && !glob_log.first)
6052  {
6053  glob_grd.valnom = ob[offset].val;
6054  if (feasb)
6055  gradob(nparam, offset, x + 1,
6056  ob[offset].grad + 1, obj, cd);
6057  else
6058  gradcn(nparam, offset, x + 1, ob[offset].grad + 1,
6059  constr, cd);
6060  }
6061  continue;
6062  }
6063  }
6064  if (fnow >= fmax - glob_grd.epsmac && !ob[offset].act_sip)
6065  {
6066  ob[offset].act_sip = TRUE;
6068  if (fmult == 0.e0 && !glob_log.first)
6069  {
6070  glob_grd.valnom = ob[offset].val;
6071  if (feasb)
6072  gradob(nparam, offset, x + 1,
6073  ob[offset].grad + 1, obj, cd);
6074  else
6075  gradcn(nparam, offset, x + 1, ob[offset].grad + 1,
6076  constr, cd);
6077  }
6078  continue;
6079  }
6080  if (fmult != 0.e0 && !ob[offset].act_sip)
6081  {
6082  ob[offset].act_sip = TRUE;
6084  continue;
6085  }
6086  }
6087  }
6088  /* Addition of objectives for first iteration. */
6089  /* Current heuristics: maximizers and end-points */
6090  if (glob_log.first)
6091  {
6092  offset = nob - nfsip;
6093  if (feasb)
6094  index = glob_info.nfsip;
6095  else
6097  for (i = 1; i <= index; i++)
6098  {
6099  i_max = ++offset;
6100  if (nobL == nob)
6101  g_max = ob[i_max].val;
6102  else
6103  g_max = fabs(ob[i_max].val);
6104  if (!ob[i_max].act_sip)
6105  { /* add first point */
6106  ob[i_max].act_sip = TRUE;
6108  }
6109  for (j = 2;j <= mesh_pts[i];j++)
6110  {
6111  offset++;
6112  if (nobL == nob)
6113  fnow = ob[offset].val;
6114  else
6115  fnow = fabs(ob[offset].val);
6116  if (fnow > g_max)
6117  {
6118  i_max = offset;
6119  g_max = fnow;
6120  }
6121  }
6122  if (!ob[i_max].act_sip)
6123  {
6124  ob[i_max].act_sip = TRUE;
6126  }
6127  if (!ob[offset].act_sip)
6128  { /* add last point */
6129  ob[offset].act_sip = TRUE;
6131  }
6132  }
6133  }
6134 
6135  /* If necessary, append omega_bar */
6136  if (steps < 1.e0 && viol->type == OBJECT)
6137  {
6138  i = viol->index;
6139  if (!ob[i].act_sip)
6140  {
6141  ob[i].act_sip = TRUE;
6143  }
6144  }
6145  if (glob_prnt.iprint >= 2 && display)
6146  fprintf(glob_prnt.io, " |Omega_k| for f %26d\n",
6148  }
else display
struct Tglob_info glob_info
#define DMAX1(a, b)
void * cd
doublereal * grad
void(*)(*)(*) gradob()
static void nparam
void * mesh_pts
void(*)(*)(*)(*) gradcn()
i<=ncnstr;i++) cs[i].mult=0.e0;if(nfsip) for(i=1;i<=nob;i++) { ob[i].mult=0.e0;ob[i].mult_L=0.e0;} for(i=1;i<=nqpram;i++) { ii=k+i;if(clamda[ii]==0.e0 &&clamda[ii+nqpram]==0.e0) continue;else if(clamda[ii] !=0.e0) clamda[ii]=-clamda[ii];else clamda[ii]=clamda[ii+nqpram];} nqnp=nqpram+ncnstr;for(i=1;i<=nqpram;i++) param-> mult[i]
doublereal * x
#define i
double fnow
struct Tglob_prnt glob_prnt
viol index
viol type
#define OBJECT
double fmult
double fprev
#define j
double g_max
glob_info nfsip
struct Tglob_log glob_log
void(*)(*) constr()
struct _objective * ob
double fnext
int feasb
#define TRUE
struct Tglob_grd glob_grd
fprintf(glob_prnt.io, "\)
void(* obj)()
struct _violation * viol
double epsilon
double fmax
static void nobL

◆ if() [55/102]

if ( nobL<=  1)

Definition at line 6233 of file numerical_recipes.cpp.

6234  {
6235  nqprm0 = nparam;
6236  nclin0 = ncnstr;
6237  }
static void nparam

◆ if() [56/102]

if ( infoqp = 0)

Definition at line 6271 of file numerical_recipes.cpp.

6272  {
6273  glob_prnt.info = 5;
6274  if (!feasb)
6275  glob_prnt.info = 2;
6276  nstop = 0;
6277  free_dv(adummy);
6278  return;
6279  }
free_dv(w)
struct Tglob_prnt glob_prnt
int nstop
int feasb
double * adummy

◆ if() [57/102]

if ( nn  ,
 
)

Definition at line 6283 of file numerical_recipes.cpp.

6284  {
6285  j = 1;
6286  k = nn;
6287  for (i = nn; i >= 1; i--)
6288  {
6289  if (fuscmp(cs[indxcn[i]].mult, thrshd))
6290  {
6291  iact[j] = indxcn[i];
6292  j++;
6293  }
6294  else
6295  {
6296  iact[k] = indxcn[i];
6297  k--;
6298  }
6299  }
6300  }
i<=ncnstr;i++) cs[i].mult=0.e0;if(nfsip) for(i=1;i<=nob;i++) { ob[i].mult=0.e0;ob[i].mult_L=0.e0;} for(i=1;i<=nqpram;i++) { ii=k+i;if(clamda[ii]==0.e0 &&clamda[ii+nqpram]==0.e0) continue;else if(clamda[ii] !=0.e0) clamda[ii]=-clamda[ii];else clamda[ii]=clamda[ii+nqpram];} nqnp=nqpram+ncnstr;for(i=1;i<=nqpram;i++) param-> mult[i]
#define i
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
struct _constraint * cs
integer * iact
double thrshd
int * indxcn
#define j

◆ if() [58/102]

if ( nobL  ,
 
)

Definition at line 6301 of file numerical_recipes.cpp.

6302  {
6303  j = nn + 1;
6304  k = nn + nob;
6305  for (i = nob; i >= 1; i--)
6306  {
6307  kk = nqprm0 + ncnstr;
6308  ltem1 = fuscmp(ob[i].mult, thrshd);
6309  ltem2 = (nobL != nob) && (fuscmp(ob[i].mult_L, thrshd));
6310  if (ltem1 || ltem2)
6311  {
6312  iact[j] = i;
6313  j++;
6314  }
6315  else
6316  {
6317  iact[k] = i;
6318  k--;
6319  }
6320  }
6321  }
i<=ncnstr;i++) cs[i].mult=0.e0;if(nfsip) for(i=1;i<=nob;i++) { ob[i].mult=0.e0;ob[i].mult_L=0.e0;} for(i=1;i<=nqpram;i++) { ii=k+i;if(clamda[ii]==0.e0 &&clamda[ii+nqpram]==0.e0) continue;else if(clamda[ii] !=0.e0) clamda[ii]=-clamda[ii];else clamda[ii]=clamda[ii+nqpram];} nqnp=nqpram+ncnstr;for(i=1;i<=nqpram;i++) param-> mult[i]
#define i
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
integer * iact
double thrshd
#define j
struct _objective * ob
static void nobL

◆ if() [59/102]

if ( nob  ,
 
)

◆ if() [60/102]

if ( glob_log.first &&  nclin0 = = 0)

Definition at line 6325 of file numerical_recipes.cpp.

6326  {
6327  dx = sqrt(scaprd(nparam, param->x, param->x));
6328  dmx = DMAX1(dx, 1.e0);
6329  if (*d0nm > dmx)
6330  {
6331  for (i = 1; i <= nparam; i++)
6332  di[i] = di[i] * dmx / (*d0nm);
6333  *d0nm = dmx;
6334  }
6335  }
#define DMAX1(a, b)
double d0nm
void sqrt(Image< double > &op)
static void nparam
double * di
#define i
double dmx
double dx
struct _parameter * param

◆ if() [61/102]

if ( nn  = = 0)

Definition at line 6401 of file numerical_recipes.cpp.

6402  {
6403  for (i = 1; i <= nparam; i++)
6404  d[i] = 0.e0;
6405  dnmtil = 0.e0;
6406  free_dv(adummy);
6407  return;
6408  }
free_dv(w)
static void nparam
#define i
doublereal * d
double * adummy
double dnmtil

◆ if() [62/102]

if ( ((*d0nm<=epskt)||((gLgeps > 0.e0) &&(*sktnom<=gLgeps))) &&(neqn==0||*scvneq<=epseqn )

Definition at line 6340 of file numerical_recipes.cpp.

6342  {
6343  /* We are finished! */
6344  nstop = 0;
6345  if (feasb && glob_log.first && neqn != 0)
6346  {
6347  /* Finished, but still need to estimate nonlinear equality
6348  constraint multipliers */
6350  glob_log.d0_is0 = TRUE;
6351  }
6352  if (!feasb)
6353  glob_prnt.info = 2;
6354  free_dv(adummy);
6355  if (glob_prnt.iprint < 3 || !display)
6356  return;
6357  if (nobL <= 1)
6358  nff = 1;
6359  if (nobL > 1)
6360  nff = 2;
6361  sbout1(glob_prnt.io, nparam, "multipliers for x ", dummy,
6362  param->mult, 2, 2);
6363  if (ncnstr != 0)
6364  {
6365  fprintf(glob_prnt.io, "\t\t\t %s\t %22.14e\n",
6366  " for g ", cs[1].mult);
6367  for (j = 2; j <= ncnstr; j++)
6368  fprintf(glob_prnt.io, " \t\t\t\t\t\t %22.14e\n", cs[j].mult);
6369  }
6370  if (nobL > 1)
6371  {
6372  fprintf(glob_prnt.io, "\t\t\t %s\t %22.14e\n",
6373  " for f ", ob[1].mult);
6374  for (j = 2; j <= nob; j++)
6375  fprintf(glob_prnt.io, " \t\t\t\t\t\t %22.14e\n", ob[j].mult);
6376  }
6377  return;
6378  }
else display
free_dv(w)
sbout1(glob_prnt.io, nparam, "multipliers for x ", dummy, param->mult, 2, 2)
static void nparam
struct _constraint * cs
struct Tglob_prnt glob_prnt
void neqn
double dummy
#define j
struct _parameter * param
struct Tglob_log glob_log
int nstop
struct _objective * ob
int feasb
#define TRUE
fprintf(glob_prnt.io, "\)
double * adummy
static void nobL

◆ if() [63/102]

if ( glob_prnt.iprint >=3 &&  display)

Definition at line 6379 of file numerical_recipes.cpp.

6380  {
6381  sbout1(glob_prnt.io, nparam, "d0 ", dummy, di, 2, 2);
6382  sbout1(glob_prnt.io, 0, "d0norm ", *d0nm, adummy, 1, 2);
6383  sbout1(glob_prnt.io, 0, "ktnorm ", *sktnom, adummy, 1, 2);
6384  }
double d0nm
sbout1(glob_prnt.io, nparam, "multipliers for x ", dummy, param->mult, 2, 2)
static void nparam
double * di
struct Tglob_prnt glob_prnt
double sktnom
double dummy
double * adummy

◆ if() [64/102]

if ( neqn = 0 && *d0nm <= DMIN1(0.5e0*epskt, (0.1e-1)*glob_grd.rteps) && *scvneq,
epseqn   
)

Definition at line 6385 of file numerical_recipes.cpp.

6387  {
6388  /* d0 is "zero", but equality constraints not satisfied */
6389  glob_log.d0_is0 = TRUE;
6390  return;
6391  }
struct Tglob_log glob_log
#define TRUE

◆ if() [65/102]

if ( nn = 0)

◆ if() [66/102]

if ( glob_info.  mode = = 1)

Definition at line 6421 of file numerical_recipes.cpp.

6422  {
6423  vk = DMIN1(Ck * (*d0nm) * (*d0nm), *d0nm);
6424  need_d1 = FALSE;
6425  for (i = 1; i <= nn; i++)
6426  {
6427  tempv = cs[indxcn[i]].grad;
6428  grdgd0 = scaprd(nparam, tempv, di);
6429  temp1 = vk + cs[indxcn[i]].val + grdgd0;
6430  if (temp1 > 0.e0)
6431  {
6432  need_d1 = TRUE;
6433  break;
6434  }
6435  }
6436  }
double grdgd0
double d0nm
double * tempv
static void nparam
double * di
#define i
struct _constraint * cs
#define FALSE
int * indxcn
double vk
#define DMIN1(a, b)
#define TRUE
double Ck
double temp1

◆ if() [67/102]

if ( need_d1  )

Definition at line 6437 of file numerical_recipes.cpp.

6438  {
6439  nqprm1 = nparam + 1;
6440  if (glob_info.mode == 0)
6441  nclin1 = ncnstr + DMAX1(nobL, 1);
6442  if (glob_info.mode == 1)
6443  nclin1 = ncnstr;
6444  nrowa1 = DMAX1(nclin1, 1);
6445  ninq = glob_info.nnineq;
6446  di1(nparam, nqprm1, nob, nobL, nfsip, nineqn, neq, neqn, ncnstr,
6447  ncsipl, ncsipn, nrowa1, &infoqp, glob_info.mode,
6448  param, di, ob, *fmax, grdpsf, cs, cvec, bl, bu, clamda,
6449  hess1, d, *steps);
6450  if (infoqp != 0)
6451  {
6452  glob_prnt.info = 6;
6453  if (!feasb)
6454  glob_prnt.info = 2;
6455  nstop = 0;
6456  free_dv(adummy);
6457  return;
6458  }
6459  dnm1 = sqrt(scaprd(nparam, d, d));
6460  if (glob_prnt.iprint >= 3 && display)
6461  {
6462  sbout1(glob_prnt.io, nparam, "d1 ", dummy, d, 2, 2);
6463  sbout1(glob_prnt.io, 0, "d1norm ", dnm1, adummy, 1, 2);
6464  }
6465  }
else display
free_dv(w)
struct Tglob_info glob_info
glob_info ncsipl
#define DMAX1(a, b)
glob_info ncsipn
double * bl
void sqrt(Image< double > &op)
double * grdpsf
sbout1(glob_prnt.io, nparam, "multipliers for x ", dummy, param->mult, 2, 2)
static void nparam
double * di
void nineqn
doublereal * d
double * bu
double dnm1
struct _constraint * cs
struct Tglob_prnt glob_prnt
double * cvec
void neqn
double dummy
double steps
struct _parameter * param
glob_info nfsip
void neq
int nstop
struct _objective * ob
int feasb
double * clamda
double * adummy
double ** hess1
double fmax
static void nobL

◆ if() [68/102]

if ( rhol  = = 0.e0)

Definition at line 6508 of file numerical_recipes.cpp.

6509  {
6510  rhog = rho = 0.e0;
6511  dnm = *d0nm;
6512  goto L310;
6513  }
double d0nm
double rho
double dnm
double rhog

◆ if() [69/102]

if ( nob  = =1)

◆ if() [70/102]

if ( temp1<=0.  e0)

◆ if() [71/102]

if ( !(glob_prnt.iprint< 3||glob_info.mode==1||nn==0) &&  display)

Definition at line 6546 of file numerical_recipes.cpp.

6547  {
6548  sbout1(glob_prnt.io, 0, "rho ", rho, adummy, 1, 2);
6549  sbout1(glob_prnt.io, nparam, "d ", dummy, di, 2, 2);
6550  sbout1(glob_prnt.io, 0, "dnorm ", dnm, adummy, 1, 2);
6551  }
double rho
sbout1(glob_prnt.io, nparam, "multipliers for x ", dummy, param->mult, 2, 2)
static void nparam
double * di
struct Tglob_prnt glob_prnt
double dnm
double dummy
double * adummy

◆ if() [72/102]

if ( rho = rhog)
pure virtual

◆ if() [73/102]

if ( (neqn !=0) &&(feasb )

◆ if() [74/102]

if ( ncg = 0)

◆ if() [75/102]

if ( job  = =1)

◆ if() [76/102]

if ( nobL  = = 1)

Definition at line 6898 of file numerical_recipes.cpp.

6899  {
6900  for (i = 1; i <= nparam; i++)
6901  cvec[i] = cvec[i] + ob[1].grad[i];
6902  }
doublereal * grad
static void nparam
#define i
double * cvec
struct _objective * ob

◆ if() [77/102]

if ( ncsipl ncsipn)

Definition at line 7149 of file numerical_recipes.cpp.

7150  {
7151  for (i = 1; i <= ncnstr_used; i++)
7152  if (clamda[i] > 0.e0)
7153  cs[iw_hold[i]].d1bind = TRUE;
7154  }
#define i
struct _constraint * cs
#define TRUE
int * iw_hold
double * clamda

◆ if() [78/102]

if ( nctotl  ,
nqnp   
)

Definition at line 6989 of file numerical_recipes.cpp.

6990  { /* Objectives */
6991  for (i = 1; i <= numf_used; i++)
6992  {
6993  ij = ncnstr_used + i;
6994  if (nobL != nob)
6995  {
6996  ii = k - 2 * numf_used + i;
6997  ob[iw_hold[ij]].mult = clamda[ii] - clamda[ii+numf_used];
6998  ob[iw_hold[ij]].mult_L = clamda[ii+numf_used];
6999  }
7000  else
7001  {
7002  ii = k - numf_used + i;
7003  ob[iw_hold[ij]].mult = clamda[ii];
7004  }
7005  }
7006  }
#define i
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
struct _objective * ob
int * iw_hold
double * clamda
static void nobL

◆ if() [79/102]

if ( (ncsipl+ncsipn) !  = 0)

◆ if() [80/102]

if ( mode  = =0) = 3.e0
pure virtual

◆ if() [81/102]

if ( mode = 1)

Definition at line 7095 of file numerical_recipes.cpp.

7096  {
7097  numf_used = nob - nfsip + glob_info.tot_actf_sip;
7098  for (i = 1; i <= nob; i++)
7099  {
7100  if ((i <= nob - nfsip) || ob[i].act_sip)
7101  {
7102  k++;
7103  bj[k] = fmax - ob[i].val;
7104  for (j = 1; j <= nparam; j++)
7105  {
7106  a[k][j] = -ob[i].grad[j] + grdpsf[j];
7107  if (nobL > nob)
7108  a[k+numf_used][j] = ob[i].grad[j] + grdpsf[j];
7109  }
7110  a[k][nqpram] = 1.e0;
7111  if (nobL > nob)
7112  a[k+numf_used][nqpram] = 1.e0;
7113  }
7114  }
7115  if (nob == 0)
7116  {
7117  k++;
7118  bj[k] = fmax;
7119  for (j = 1; j <= nparam; j++)
7120  a[k][j] = grdpsf[j];
7121  a[k][nqpram] = 1.e0;
7122  }
7123  }
double * bj
struct Tglob_info glob_info
double * grdpsf
static void nparam
#define i
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
static void nqpram
#define j
glob_info nfsip
struct _objective * ob
double fmax
doublereal * a
static void nobL

◆ if() [82/102]

if ( nobL  ,
nob   
)

◆ if() [83/102]

if ( !glob_log.  get_ne_mult)

Definition at line 7614 of file numerical_recipes.cpp.

7615  {
7616  if (feasb && nstop && !neqn)
7617  if ((fabs(w[1] - fmax) <= objeps) ||
7618  (fabs(w[1] - fmax) <= objrep*fabs(w[1])))
7619  nstop = 0;
7620  if (!nstop)
7621  {
7622  for (i = 1; i <= nparam; i++)
7623  param->x[i] = xnew[i];
7624  x_is_new = TRUE;
7625  return;
7626  }
7627  }
static void nparam
doublereal * w
#define i
void neqn
struct _parameter * param
double objeps
int nstop
int feasb
#define TRUE
double objrep
int x_is_new
double fmax
double * xnew

◆ if() [84/102]

if ( neqn = 0 && (feasb))

Definition at line 7785 of file numerical_recipes.cpp.

7786  {
7787  i = glob_info.nnineq - nineqn;
7788  if (i != 0)
7789  {
7790  for (j = 1; j <= nparam; j++)
7791  {
7792  gamma[j] = 0.e0;
7793  for (k = 1; k <= i; k++)
7794  gamma[j] = gamma[j] + cs[k+nineqn].grad[j] *
7795  cs[nineqn+k].mult;
7796  }
7797  for (i = 1; i <= nparam; i++)
7798  psb[i] = psb[i] + gamma[i];
7799  }
7800  i = neq - neqn;
7801  if (i != 0)
7802  {
7803  for (j = 1; j <= nparam; j++)
7804  {
7805  gamma[j] = 0.e0;
7806  for (k = 1; k <= i; k++)
7807  gamma[j] = gamma[j] + cs[k+neqn+glob_info.nnineq].grad[j] *
7808  cs[glob_info.nnineq+neqn+k].mult;
7809  }
7810  for (i = 1; i <= nparam; i++)
7811  psb[i] = psb[i] + gamma[i];
7812  }
7813  /* Update penalty parameters for nonlinear equality constraints */
7814  estlam(nparam, neqn, &ifail, bgbnd, phess, delta, eta,
7815  gamma, cs, psb, hd, xnew, psmu);
7816  if (glob_log.get_ne_mult)
7817  return;
7818  for (i = 1; i <= neqn; i++)
7819  {
7820  if (ifail != 0 || glob_log.d0_is0)
7821  penp[i] = 2.e0 * penp[i];
7822  else
7823  {
7824  etad = psmu[i] + penp[i];
7825  if (etad < 1.e0)
7826  penp[i] = DMAX1((1.e0 - psmu[i]), (2.e0 * penp[i]));
7827  }
7828  if (penp[i] > bgbnd)
7829  {
7830  nstop = 0;
7831  glob_prnt.info = 9;
7832  return;
7833  }
7834  }
7835  resign(nparam, neqn, psf, grdpsf, penp, cs, signeq, 20, 12);
7836  *fMp = *fM - *psf;
7837  }
struct Tglob_info glob_info
#define DMAX1(a, b)
double * psb
double eta
doublereal * grad
double * grdpsf
static void nparam
double * gamma
i<=ncnstr;i++) cs[i].mult=0.e0;if(nfsip) for(i=1;i<=nob;i++) { ob[i].mult=0.e0;ob[i].mult_L=0.e0;} for(i=1;i<=nqpram;i++) { ii=k+i;if(clamda[ii]==0.e0 &&clamda[ii+nqpram]==0.e0) continue;else if(clamda[ii] !=0.e0) clamda[ii]=-clamda[ii];else clamda[ii]=clamda[ii+nqpram];} nqnp=nqpram+ncnstr;for(i=1;i<=nqpram;i++) param-> mult[i]
void nineqn
#define i
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
double fMp
double psf
double ** phess
struct _constraint * cs
struct Tglob_prnt glob_prnt
double * penp
double * signeq
void neqn
double * psmu
double etad
#define j
double * hd
double bgbnd
struct Tglob_log glob_log
void neq
int nstop
double fM
integer * ifail
double * xnew
double * delta

◆ if() [85/102]

if ( nfs = 0)

Definition at line 7838 of file numerical_recipes.cpp.

7839  {
7840  (*nstart)++;
7841  np = indexs(*nstart, nfs);
7842  span[np] = fmax;
7843  for (i = 1; i <= neqn; i++)
7844  gm[(np-1)*neqn+i] = cs[glob_info.nnineq+i].val;
7845  if (neqn != 0)
7846  {
7847  psfnew = 0.e0;
7848  for (i = 1; i <= neqn; i++)
7849  psfnew = psfnew + gm[i]*penp[i];
7850  }
7851  *fM = span[1];
7852  *fMp = span[1] - psfnew;
7853  mnm = DMIN1(*nstart, nfs);
7854  for (i = 2; i <= mnm; i++)
7855  {
7856  if (neqn != 0)
7857  {
7858  psfnew = 0.e0;
7859  for (j = 1; j <= neqn; j++)
7860  psfnew = psfnew + gm[(i-1)*neqn +j]*penp[j];
7861  }
7862  *fM = DMAX1(*fM, span[i]);
7863  *fMp = DMAX1(*fMp, span[i] - psfnew);
7864  }
7865  }
struct Tglob_info glob_info
#define DMAX1(a, b)
double * gm
#define i
double fMp
struct _constraint * cs
double * penp
void neqn
double psfnew
#define j
#define DMIN1(a, b)
double fM
double * span
double fmax

◆ if() [86/102]

objective if ( ncnstr = 0)

Definition at line 7883 of file numerical_recipes.cpp.

7884  {
7885  for (i = 1; i <= ncnstr; i++)
7886  {
7887  tempv = cs[indxcn[i]].grad;
7888  sbout2(glob_prnt.io, nparam, indxcn[i], "gradg(j,", ")", tempv);
7889  }
7890  if (neqn != 0)
7891  {
7892  sbout1(glob_prnt.io, nparam, "grdpsf(j) ",
7893  dummy, grdpsf, 2, 2);
7894  sbout1(glob_prnt.io, neqn, "P ", dummy,
7895  penp, 2, 2);
7896  sbout1(glob_prnt.io, neqn, "psmu ", dummy,
7897  psmu, 2, 2);
7898  }
7899  }
double * grdpsf
sbout1(glob_prnt.io, nparam, "multipliers for x ", dummy, param->mult, 2, 2)
double * tempv
static void nparam
#define i
struct _constraint * cs
struct Tglob_prnt glob_prnt
double * penp
int * indxcn
void neqn
double * psmu
double dummy

◆ if() [87/102]

if ( glob_prnt.iter >=miter &&nstop = 0)

Definition at line 7954 of file numerical_recipes.cpp.

7955  {
7956  glob_prnt.info = 3;
7957  nstop = 0;
7958  if (glob_prnt.iprint == 0)
7959  goto L9000;
7960  }
struct Tglob_prnt glob_prnt
int nstop

◆ if() [88/102]

if ( (glob_prnt.info > 0 &&glob_prnt.info< 3)||glob_prnt.  info = =7)

◆ if() [89/102]

if ( glob_prnt.iprint<=2 &&  nstop = = 0)

◆ if() [90/102]

if ( (glob_prnt.iter) % glob_prnt.iter_mod)

◆ if() [91/102]

if ( glob_prnt.iter_mod = 1 && display)

◆ if() [92/102]

if ( display  )

Definition at line 8080 of file numerical_recipes.cpp.

8081  {
8082  if (nob > 0)
8083  {
8084  fprintf(glob_prnt.io, " objectives\n");
8085  for (i = 1; i <= nob - nfsip; i++)
8086  {
8087  if (nob == nobL)
8088  fprintf(glob_prnt.io, " \t\t\t %22.14e\n", ob[i].val);
8089  else
8090  fprintf(glob_prnt.io, " \t\t\t %22.14e\n",
8091  fabs(ob[i].val));
8092  }
8093  }
8094  if (nfsip)
8095  {
8096  offset = nob - nfsip;
8097  if (feasb)
8098  index = glob_info.nfsip;
8099  else
8101  for (i = 1; i <= index; i++)
8102  {
8103  if (nob == nobL)
8104  gmax = ob[++offset].val;
8105  else
8106  gmax = fabs(ob[++offset].val);
8107  for (j = 2; j <= mesh_pts[i]; j++)
8108  {
8109  offset++;
8110  if (nob == nobL && ob[offset].val > gmax)
8111  gmax = ob[offset].val;
8112  else if (nob != nobL && fabs(ob[offset].val) > gmax)
8113  gmax = fabs(ob[offset].val);
8114  }
8115  fprintf(glob_prnt.io, " \t\t\t %22.14e\n", gmax);
8116  }
8117  }
8118  }
double gmax
struct Tglob_info glob_info
void * mesh_pts
#define i
struct Tglob_prnt glob_prnt
viol index
#define j
glob_info nfsip
struct _objective * ob
int feasb
fprintf(glob_prnt.io, "\)
static void nobL

◆ if() [93/102]

if ( glob_info.  mode = = 1 && glob_prnt.iter,
1 &&  display 
)

◆ if() [94/102]

objective if ( nob  ,
1 &&  display 
)

◆ if() [95/102]

if ( glob_prnt.iter<=1 &&  display)

Definition at line 8177 of file numerical_recipes.cpp.

8178  {
8179  fprintf(glob_prnt.io, " \n");
8180  fprintf(glob_prnt.io, " iteration %26d\n",
8181  glob_prnt.iter);
8182  goto L9000;
8183  }
struct Tglob_prnt glob_prnt
fprintf(glob_prnt.io, "\)

◆ if() [96/102]

if ( glob_prnt.iprint >=2 &&glob_prnt.  initvl = = 0 && display)

◆ if() [97/102]

if ( glob_prnt.iprint >=3 &&glob_prnt.iter_mod = 1 && nstop != 0 && !(glob_prnt.iter % glob_prnt.iter_mod))

◆ if() [98/102]

if ( nstop = 0 && (glob_prnt.iter_mod == 1))

◆ if() [99/102]

if ( glob_prnt.iprint >=  3)

◆ if() [100/102]

if ( glob_prnt.  info = = 0 && sktnom,
0.  1e0 
)

◆ if() [101/102]

if ( fabs(val)<=  thrshd)

◆ if() [102/102]

if ( isign >=  0)

Definition at line 9189 of file numerical_recipes.cpp.

9190  {
9191  for (ii = 1, i = 1;i <= n;i += 2, ii++)
9192  {
9193  ni = i + nmod + wfilt.ioff;
9194  nj = i + nmod + wfilt.joff;
9195  double &aux1=wksp[ii];
9196  double &aux2=wksp[ii+nh];
9197  unsigned long kmax=4*(wfilt.ncof/4);
9198  // Loop unrolling (every 4 coefficients)
9199  for (k = 1;k <= kmax;k+=4)
9200  {
9201  unsigned long k_1=k+1;
9202  unsigned long k_2=k+2;
9203  unsigned long k_3=k+3;
9204  jf = n1 & (ni + k);
9205  jr = n1 & (nj + k);
9206  aux1 += wfilt.cc[k] * a[jf+1];
9207  aux2 += wfilt.cr[k] * a[jr+1];
9208  unsigned long jf_1 = n1 & (ni + k_1);
9209  unsigned long jr_1 = n1 & (nj + k_1);
9210  aux1 += wfilt.cc[k_1] * a[jf_1+1];
9211  aux2 += wfilt.cr[k_1] * a[jr_1+1];
9212  unsigned long jf_2 = n1 & (ni + k_2);
9213  unsigned long jr_2 = n1 & (nj + k_2);
9214  aux1 += wfilt.cc[k_2] * a[jf_2+1];
9215  aux2 += wfilt.cr[k_2] * a[jr_2+1];
9216  unsigned long jf_3 = n1 & (ni + k_3);
9217  unsigned long jr_3 = n1 & (nj + k_3);
9218  aux1 += wfilt.cc[k_3] * a[jf_3+1];
9219  aux2 += wfilt.cr[k_3] * a[jr_3+1];
9220  }
9221  // The rest of coefficients
9222  for (k = kmax+1;k <= wfilt.ncof;++k)
9223  {
9224  jf = n1 & (ni + k);
9225  jr = n1 & (nj + k);
9226  aux1 += wfilt.cc[k] * a[jf+1];
9227  aux2 += wfilt.cr[k] * a[jr+1];
9228  }
9229  }
9230  }
#define i
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
int ni
int * n
doublereal * a

◆ indexx()

void indexx ( int  n,
double  arrin[],
int  indx[] 
)

Definition at line 206 of file numerical_recipes.cpp.

207 {
208  int l, j, ir, indxt, i;
209  double q;
210 
211  for (j = 1;j <= n;j++)
212  indx[j] = j;
213  l = (n >> 1) + 1;
214  ir = n;
215  for (;;)
216  {
217  if (l > 1)
218  q = arrin[(indxt=indx[--l])];
219  else
220  {
221  q = arrin[(indxt=indx[ir])];
222  indx[ir] = indx[1];
223  if (--ir == 1)
224  {
225  indx[1] = indxt;
226  return;
227  }
228  }
229  i = l;
230  j = l << 1;
231  while (j <= ir)
232  {
233  if (j < ir && arrin[indx[j]] < arrin[indx[j+1]])
234  j++;
235  if (q < arrin[indx[j]])
236  {
237  indx[i] = indx[j];
238  j += (i = j);
239  }
240  else
241  j = ir + 1;
242  }
243  indx[i] = indxt;
244  }
245 }
#define i
#define j
int * n
int ir

◆ k()

ql0001_& k ( htemp 1) &

◆ ksone()

void ksone ( double  data[],
int  n,
double(*)(double)  func,
double *  d,
double *  prob 
)

Definition at line 165 of file numerical_recipes.cpp.

166 {
167  std::sort(data, data + n);
168  double fn, ff, en, dt, fo=0.;
169  en = (double)n;
170  *d = 0.;
171  for (int j=1; j<=n; j++)
172  {
173  fn = j / en;
174  ff = (*func)(data[j]);
175  dt = XMIPP_MAX(fabs(fo - ff), fabs(fn - ff));
176  if (dt> *d)
177  *d = dt;
178  fo = fn;
179  }
180  *prob = probks(sqrt(en)*(*d));
181 }
#define XMIPP_MAX(x, y)
Definition: xmipp_macros.h:193
double probks(double alam)
void sqrt(Image< double > &op)
doublereal * d
void sort(struct DCEL_T *dcel)
Definition: sorting.cpp:18
#define j
int * n

◆ linmin()

void linmin ( double *  p,
double *  xi,
int  n,
double &  fret,
double(*)(double *, void *)  func,
void *  prm 
)

Definition at line 848 of file numerical_recipes.cpp.

850 {
851  int j;
852  double xx, xmin, fx, fb, fa, bx, ax;
853 
854  int ncom = n;
855  std::vector<double> buffer(2*n);
856  auto *pcom= buffer.data()-1;
857  auto *xicom= pcom + n;
858  for (j = 1;j <= n;j++)
859  {
860  pcom[j] = p[j];
861  xicom[j] = xi[j];
862  }
863  ax = 0.0;
864  xx = 1.0;
865  bx = 2.0;
866  mnbrak(&ax, &xx, &bx, &fa, &fx, &fb, func, prm, ncom, pcom, xicom);
867  fret = brent(ax, xx, bx, func, prm, TOL, &xmin, ncom, pcom, xicom);
868  for (j = 1;j <= n;j++)
869  {
870  xi[j] *= xmin;
871  p[j] += xi[j];
872  }
873 }
double xi
void mnbrak(double *ax, double *bx, double *cx, double *fa, double *fb, double *fc, double(*func)(double *, void *), void *prm, int ncom, double *pcom, double *xicom)
double brent(double ax, double bx, double cx, double(*func)(double *, void *), void *prm, double tol, double *xmin, int ncom, double *pcom, double *xicom)
#define TOL
HBITMAP buffer
Definition: svm-toy.cpp:37
#define j
ProgClassifyCL2D * prm
int * n

◆ matrcp()

matrcp ( nparam  ,
hess  ,
nparam 1,
hess1   
)

◆ matrvc()

matrvc ( nparam  ,
nparam  ,
hess  ,
di  ,
w   
)

◆ mnbrak()

void mnbrak ( double *  ax,
double *  bx,
double *  cx,
double *  fa,
double *  fb,
double *  fc,
double(*)(double *, void *)  func,
void *  prm,
int  ncom,
double *  pcom,
double *  xicom 
)

Definition at line 679 of file numerical_recipes.cpp.

682 {
683  double ulim, u, r, q, fu, dum;
684  std::vector<double> buffer(ncom);
685  auto *xt= buffer.data()-1;
686 
687  F1DIM(*ax,*fa);
688  F1DIM(*bx,*fb);
689  if (*fb > *fa)
690  {
691  SHFT(dum, *ax, *bx, dum)
692  SHFT(dum, *fb, *fa, dum)
693  }
694  *cx = (*bx) + GOLD * (*bx - *ax);
695  F1DIM(*cx,*fc);
696  while (*fb > *fc)
697  {
698  r = (*bx - *ax) * (*fb - *fc);
699  q = (*bx - *cx) * (*fb - *fa);
700  u = (*bx) - ((*bx - *cx) * q - (*bx - *ax) * r) /
701  (2.0 * SIGN(MAX(fabs(q - r), TINY), q - r));
702  ulim = (*bx) + GLIMIT * (*cx - *bx);
703  if ((*bx - u)*(u - *cx) > 0.0)
704  {
705  F1DIM(u,fu);
706  if (fu < *fc)
707  {
708  *ax = (*bx);
709  *bx = u;
710  *fa = (*fb);
711  *fb = fu;
712  return;
713  }
714  else if (fu > *fb)
715  {
716  *cx = u;
717  *fc = fu;
718  return;
719  }
720  u = (*cx) + GOLD * (*cx - *bx);
721  F1DIM(u,fu);
722  }
723  else if ((*cx - u)*(u - ulim) > 0.0)
724  {
725  F1DIM(u,fu);
726  if (fu < *fc)
727  {
728  SHFT(*bx, *cx, u, *cx + GOLD*(*cx - *bx))
729  double aux;
730  F1DIM(u,aux);
731  SHFT(*fb, *fc, fu, aux)
732  }
733  }
734  else if ((u - ulim)*(ulim - *cx) >= 0.0)
735  {
736  u = ulim;
737  F1DIM(u,fu);
738  }
739  else
740  {
741  u = (*cx) + GOLD * (*cx - *bx);
742  F1DIM(u,fu);
743  }
744  SHFT(*ax, *bx, *cx, u)
745  SHFT(*fa, *fb, *fc, fu)
746  }
747 }
#define GOLD
#define MAX(a, b)
HBITMAP buffer
Definition: svm-toy.cpp:37
#define F1DIM(x, f)
#define GLIMIT
#define SHFT(a, b, c, d)
#define TINY
#define SIGN(a, b)
doublereal * u

◆ nnls()

int nnls ( double *  a,
int  m,
int  n,
double *  b,
double *  x,
double *  rnorm,
double *  wp,
double *  zzp,
int *  indexp 
)

Definition at line 1165 of file numerical_recipes.cpp.

1183 {
1184  int pfeas, ret = 0, iz, jz, iz1, iz2, npp1, *index;
1185  double d1, d2, sm, up, ss, *w, *zz;
1186  int iter, k, j = 0, l, itmax, izmax = 0, nsetp, ii, jj = 0, ip;
1187  double temp, wmax, t, alpha, asave, dummy, unorm, ztest, cc;
1188 
1189 
1190  /* Check the parameters and data */
1191  if (m <= 0 || n <= 0 || a == NULL || b == NULL || x == NULL)
1192  return(2);
1193  /* Allocate memory for working space, if required */
1194  if (wp != NULL)
1195  w = wp;
1196  else
1197  w = (double*)calloc(n, sizeof(double));
1198  if (zzp != NULL)
1199  zz = zzp;
1200  else
1201  zz = (double*)calloc(m, sizeof(double));
1202  if (indexp != NULL)
1203  index = indexp;
1204  else
1205  index = (int*)calloc(n, sizeof(int));
1206  if (w == NULL || zz == NULL || index == NULL)
1207  return(2);
1208 
1209  /* Initialize the arrays INDEX[] and X[] */
1210  for (k = 0; k < n; k++)
1211  {
1212  x[k] = 0.;
1213  index[k] = k;
1214  }
1215  iz2 = n - 1;
1216  iz1 = 0;
1217  nsetp = 0;
1218  npp1 = 0;
1219 
1220  /* Main loop; quit if all coeffs are already in the solution or */
1221  /* if M cols of A have been triangularized */
1222  iter = 0;
1223  itmax = n * 3;
1224  while (iz1 <= iz2 && nsetp < m)
1225  {
1226  /* Compute components of the dual (negative gradient) vector W[] */
1227  for (iz = iz1; iz <= iz2; iz++)
1228  {
1229  j = index[iz];
1230  sm = 0.;
1231  for (l = npp1; l < m; l++)
1232  sm += a[j*m+l] * b[l];
1233  w[j] = sm;
1234  }
1235 
1236  while (1)
1237  {
1238  /* Find largest positive W[j] */
1239  for (wmax = 0., iz = iz1; iz <= iz2; iz++)
1240  {
1241  j = index[iz];
1242  if (w[j] > wmax)
1243  {
1244  wmax = w[j];
1245  izmax = iz;
1246  }
1247  }
1248 
1249  /* Terminate if wmax<=0.; */
1250  /* it indicates satisfaction of the Kuhn-Tucker conditions */
1251  if (wmax <= 0.0)
1252  break;
1253  iz = izmax;
1254  j = index[iz];
1255 
1256  /* The sign of W[j] is ok for j to be moved to set P. */
1257  /* Begin the transformation and check new diagonal element to avoid */
1258  /* near linear dependence. */
1259  asave = a[j*m+npp1];
1260  _nnls_h12(1, npp1, npp1 + 1, m, &a[j*m+0], 1, &up, &dummy, 1, 1, 0);
1261  unorm = 0.;
1262  if (nsetp != 0)
1263  for (l = 0; l < nsetp; l++)
1264  {
1265  d1 = a[j*m+l];
1266  unorm += d1 * d1;
1267  }
1268  unorm = sqrt(unorm);
1269  d2 = unorm + (d1 = a[j*m+npp1], fabs(d1)) * 0.01;
1270  if ((d2 - unorm) > 0.)
1271  {
1272  /* Col j is sufficiently independent. Copy B into ZZ, update ZZ */
1273  /* and solve for ztest ( = proposed new value for X[j] ) */
1274  for (l = 0; l < m; l++)
1275  zz[l] = b[l];
1276  _nnls_h12(2, npp1, npp1 + 1, m, &a[j*m+0], 1, &up, zz, 1, 1, 1);
1277  ztest = zz[npp1] / a[j*m+npp1];
1278  /* See if ztest is positive */
1279  if (ztest > 0.)
1280  break;
1281  }
1282 
1283  /* Reject j as a candidate to be moved from set Z to set P. Restore */
1284  /* A[npp1,j], set W[j]=0., and loop back to test dual coeffs again */
1285  a[j*m+npp1] = asave;
1286  w[j] = 0.;
1287  } /* while(1) */
1288  if (wmax <= 0.0)
1289  break;
1290 
1291  /* Index j=INDEX[iz] has been selected to be moved from set Z to set P. */
1292  /* Update B and indices, apply householder transformations to cols in */
1293  /* new set Z, zero subdiagonal elts in col j, set W[j]=0. */
1294  for (l = 0; l < m; ++l)
1295  b[l] = zz[l];
1296  index[iz] = index[iz1];
1297  index[iz1] = j;
1298  iz1++;
1299  nsetp = npp1 + 1;
1300  npp1++;
1301  if (iz1 <= iz2)
1302  for (jz = iz1; jz <= iz2; jz++)
1303  {
1304  jj = index[jz];
1305  _nnls_h12(2, nsetp - 1, npp1, m, &a[j*m+0], 1, &up,
1306  &a[jj*m+0], 1, m, 1);
1307  }
1308  if (nsetp != m)
1309  for (l = npp1; l < m; l++)
1310  a[j*m+l] = 0.;
1311  w[j] = 0.;
1312  /* Solve the triangular system; store the solution temporarily in Z[] */
1313  for (l = 0; l < nsetp; l++)
1314  {
1315  ip = nsetp - (l + 1);
1316  if (l != 0)
1317  for (ii = 0; ii <= ip; ii++)
1318  zz[ii] -= a[jj*m+ii] * zz[ip+1];
1319  jj = index[ip];
1320  zz[ip] /= a[jj*m+ip];
1321  }
1322 
1323  /* Secondary loop begins here */
1324  while (++iter < itmax)
1325  {
1326  /* See if all new constrained coeffs are feasible; if not, compute alpha */
1327  for (alpha = 2.0, ip = 0; ip < nsetp; ip++)
1328  {
1329  l = index[ip];
1330  if (zz[ip] <= 0.)
1331  {
1332  t = -x[l] / (zz[ip] - x[l]);
1333  if (alpha > t)
1334  {
1335  alpha = t;
1336  jj = ip - 1;
1337  }
1338  }
1339  }
1340 
1341  /* If all new constrained coeffs are feasible then still alpha==2. */
1342  /* If so, then exit from the secondary loop to main loop */
1343  if (alpha == 2.0)
1344  break;
1345  /* Use alpha (0.<alpha<1.) to interpolate between old X and new ZZ */
1346  for (ip = 0; ip < nsetp; ip++)
1347  {
1348  l = index[ip];
1349  x[l] += alpha * (zz[ip] - x[l]);
1350  }
1351 
1352  /* Modify A and B and the INDEX arrays to move coefficient i */
1353  /* from set P to set Z. */
1354  k = index[jj+1];
1355  pfeas = 1;
1356  do
1357  {
1358  x[k] = 0.;
1359  if (jj != (nsetp - 1))
1360  {
1361  jj++;
1362  for (j = jj + 1; j < nsetp; j++)
1363  {
1364  ii = index[j];
1365  index[j-1] = ii;
1366  _nnls_g1(a[ii*m+j-1], a[ii*m+j], &cc, &ss, &a[ii*m+j-1]);
1367  for (a[ii*m+j] = 0., l = 0; l < n; l++)
1368  if (l != ii)
1369  {
1370  /* Apply procedure G2 (CC,SS,A(J-1,L),A(J,L)) */
1371  temp = a[l*m+j-1];
1372  a[l*m+j-1] = cc * temp + ss * a[l*m+j];
1373  a[l*m+j] = -ss * temp + cc * a[l*m+j];
1374  }
1375  /* Apply procedure G2 (CC,SS,B(J-1),B(J)) */
1376  temp = b[j-1];
1377  b[j-1] = cc * temp + ss * b[j];
1378  b[j] = -ss * temp + cc * b[j];
1379  }
1380  }
1381  npp1 = nsetp - 1;
1382  nsetp--;
1383  iz1--;
1384  index[iz1] = k;
1385 
1386  /* See if the remaining coeffs in set P are feasible; they should */
1387  /* be because of the way alpha was determined. If any are */
1388  /* infeasible it is due to round-off error. Any that are */
1389  /* nonpositive will be set to zero and moved from set P to set Z */
1390  for (jj = 0; jj < nsetp; jj++)
1391  {
1392  k = index[jj];
1393  if (x[k] <= 0.)
1394  {
1395  pfeas = 0;
1396  break;
1397  }
1398  }
1399  }
1400  while (pfeas == 0);
1401 
1402  /* Copy B[] into zz[], then solve again and loop back */
1403  for (k = 0; k < m; k++)
1404  zz[k] = b[k];
1405  for (l = 0; l < nsetp; l++)
1406  {
1407  ip = nsetp - (l + 1);
1408  if (l != 0)
1409  for (ii = 0; ii <= ip; ii++)
1410  zz[ii] -= a[jj*m+ii] * zz[ip+1];
1411  jj = index[ip];
1412  zz[ip] /= a[jj*m+ip];
1413  }
1414  } /* end of secondary loop */
1415  if (iter > itmax)
1416  {
1417  ret = 1;
1418  break;
1419  }
1420  for (ip = 0; ip < nsetp; ip++)
1421  {
1422  k = index[ip];
1423  x[k] = zz[ip];
1424  }
1425  } /* end of main loop */
1426  /* Compute the norm of the final residual vector */
1427  sm = 0.;
1428  if (npp1 < m)
1429  for (k = npp1; k < m; k++)
1430  sm += (b[k] * b[k]);
1431  else
1432  for (j = 0; j < n; j++)
1433  w[j] = 0.;
1434  *rnorm = sqrt(sm);
1435  /* Free working space, if it was allocated here */
1436  if (wp == NULL)
1437  free(w);
1438  if (zzp == NULL)
1439  free(zz);
1440  if (indexp == NULL)
1441  free(index);
1442  return(ret);
1443 } /* nnls_ */
double alpha
Smoothness parameter.
Definition: blobs.h:121
void sqrt(Image< double > &op)
doublereal * w
glob_prnt iter
void _nnls_g1(double a, double b, double *cterm, double *sterm, double *sig)
doublereal * x
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
doublereal * b
viol index
free((char *) ob)
double dummy
#define j
int _nnls_h12(int mode, int lpivot, int l1, int m, double *u, int u_dim1, double *up, double *cm, int ice, int icv, int ncv)
int * n
doublereal * a

◆ nnlsWght()

int nnlsWght ( int  N,
int  M,
double *  A,
double *  b,
double *  weight 
)

Definition at line 1455 of file numerical_recipes.cpp.

1456 {
1457  int n, m;
1458  double *w;
1459 
1460  /* Check the arguments */
1461  if (N < 1 || M < 1 || A == NULL || b == NULL || weight == NULL)
1462  return(1);
1463 
1464  /* Allocate memory */
1465  w = (double*)malloc(M * sizeof(double));
1466  if (w == NULL)
1467  return(2);
1468 
1469  /* Check that weights are not zero and get the square roots of them to w[] */
1470  for (m = 0; m < M; m++)
1471  {
1472  if (weight[m] <= 1.0e-20)
1473  w[m] = 0.0;
1474  else
1475  w[m] = sqrt(weight[m]);
1476  }
1477 
1478  /* Multiply rows of matrix A and elements of vector b with weights*/
1479  for (m = 0; m < M; m++)
1480  {
1481  for (n = 0; n < N; n++)
1482  {
1483  A[n*M+m] *= w[m];
1484  }
1485  b[m] *= w[m];
1486  }
1487 
1488  free(w);
1489  return(0);
1490 }
void sqrt(Image< double > &op)
doublereal * w
doublereal * b
free((char *) ob)
int * n

◆ nrerror()

void nrerror ( const char  error_text[])

Definition at line 35 of file numerical_recipes.cpp.

36 {
37  fprintf(stderr, "Numerical Recipes run-time error...\n");
38  fprintf(stderr, "%s\n", error_text);
39  fprintf(stderr, "...now exiting to system...\n");
40  exit(1);
41 }
fprintf(glob_prnt.io, "\)

◆ nullvc() [1/6]

nullvc ( nparam  ,
grdpsf   
)

◆ nullvc() [2/6]

nullvc ( nparam  ,
cvec   
)

◆ nullvc() [3/6]

nullvc ( nqpram  ,
x   
)

◆ nullvc() [4/6]

nullvc ( nqpram  ,
param->  mult 
)

◆ nullvc() [5/6]

nullvc ( nparam  ,
delta   
)

◆ nullvc() [6/6]

nullvc ( nparam  ,
eta   
)

◆ polint()

void polint ( double *  xa,
double *  ya,
int  n,
double  x,
double &  y,
double &  dy 
)

Definition at line 9390 of file numerical_recipes.cpp.

9391 {
9392  int i, m, ns = 1;
9393  double den, dif, dift, ho, hp, w;
9394  dif = fabs(x - xa[1]);
9395  std::vector<double> buffer(2*n);
9396  auto *c= buffer.data()-1;
9397  auto *d= c + n;
9398  for (i = 1;i <= n;i++)
9399  {
9400  if ((dift = fabs(x - xa[i])) < dif)
9401  {
9402  ns = i;
9403  dif = dift;
9404  }
9405  c[i] = ya[i];
9406  d[i] = ya[i];
9407  }
9408  y = ya[ns--];
9409  for (m = 1;m < n;m++)
9410  {
9411  for (i = 1;i <= n - m;i++)
9412  {
9413  ho = xa[i] - x;
9414  hp = xa[i+m] - x;
9415  w = c[i+1] - d[i];
9416  if ((den = ho - hp) == 0.0)
9417  {
9418  nrerror("error in routine polint\n");
9419  }
9420  den = w / den;
9421  d[i] = hp * den;
9422  c[i] = ho * den;
9423  }
9424  y += (dy = (2 * ns < (n - m) ? c[ns+1] : d[ns--]));
9425  }
9426 }
doublereal * c
HBITMAP buffer
Definition: svm-toy.cpp:37
static double * y
doublereal * w
void nrerror(const char error_text[])
doublereal * x
#define i
doublereal * d
int * n

◆ powell()

void powell ( double *  p,
double *  xi,
int  n,
double  ftol,
int &  iter,
double &  fret,
double(*)(double *, void *)  func,
void *  prm,
bool  show 
)

Definition at line 877 of file numerical_recipes.cpp.

880 {
881  int i, ibig, j;
882  double t, fptt, fp, del;
883  std::vector<double> buffer(3*n);
884  auto *pt= buffer.data()-1;
885  auto *ptt= pt + n;
886  auto *xit= ptt + n;
887  bool different_from_0;
888 
889  fret = (*func)(p,prm);
890  for (j = 1;j <= n;j++)
891  pt[j] = p[j];
892 
893  for (iter = 1;;(iter)++)
894  {
895  /* By coss ----- */
896  if (show)
897  {
898  std::cout << iter << " (" << p[1];
899  for (int co = 2; co <= n; co++)
900  std::cout << "," << p[co];
901  std::cout << ")--->" << fret << std::endl;
902  }
903  /* ------------- */
904 
905  fp = fret;
906  ibig = 0;
907  del = 0.0;
908  for (i = 1;i <= n;i++)
909  {
910  different_from_0 = false; // CO
911  for (j = 1;j <= n;j++)
912  {
913  xit[j] = xi[j*n+i];
914  if (xit[j] != 0)
915  different_from_0 = true;
916  }
917  if (different_from_0)
918  {
919  fptt = fret;
920  linmin(p, xit, n, fret, func, prm);
921  if (fabs(fptt - fret) > del)
922  {
923  del = fabs(fptt - fret);
924  ibig = i;
925  }
926  /* By coss ----- */
927  if (show)
928  {
929  std::cout << " (";
930  if (i == 1)
931  std::cout << "***";
932  std::cout << p[1];
933  for (int co = 2; co <= n; co++)
934  {
935  std::cout << ",";
936  if (co == i)
937  std::cout << "***";
938  std::cout << p[co];
939  }
940  std::cout << ")--->" << fret << std::endl;
941  }
942  /* ------------- */
943  }
944  }
945  if (2.0*fabs(fp - fret) <= ftol*(fabs(fp) + fabs(fret)) || n==1) return;
946  if (iter == ITMAX)
947  nrerror("Too many iterations in routine POWELL");
948  for (j = 1;j <= n;j++)
949  {
950  ptt[j] = 2.0 * p[j] - pt[j];
951  xit[j] = p[j] - pt[j];
952  pt[j] = p[j];
953  }
954  fptt = (*func)(ptt,prm);
955  if (fptt < fp)
956  {
957 #define SQR(a) ((a)*(a))
958  t = 2.0 * (fp - 2.0 * fret + fptt) * SQR(fp - fret - del) - del * SQR(fp - fptt);
959  if (t < 0.0)
960  {
961  linmin(p, xit, n, fret, func, prm);
962  for (j = 1;j <= n;j++)
963  xi[j*n+ibig] = xit[j];
964  }
965  }
966  }
967 }
double xi
HBITMAP buffer
Definition: svm-toy.cpp:37
float del
void nrerror(const char error_text[])
glob_prnt iter
#define i
#define SQR(a)
void linmin(double *p, double *xi, int n, double &fret, double(*func)(double *, void *), void *prm)
#define ITMAX
#define j
ProgClassifyCL2D * prm
int * n

◆ probks()

double probks ( double  alam)

Definition at line 184 of file numerical_recipes.cpp.

185 {
186  int j;
187  double a2, fac=2.0, sum=0.0, term, termbf=0.0;
188  double EPS1=0.001, EPS2=1.0e-8;
189 
190  a2 = -2.0 * alam * alam;
191  for (j = 1; j<= 100; j++)
192  {
193  term = fac * exp(a2*j*j);
194  sum += term;
195  if (fabs(term) <= EPS1*termbf || fabs(term) <= EPS2*sum)
196  return sum;
197  fac = -fac;
198  termbf = fabs(term);
199  }
200  return 1.0;
201 
202 }
#define j

◆ Pythag()

double Pythag ( double  a,
double  b 
)

Definition at line 1495 of file numerical_recipes.cpp.

1496 {
1497  double absa, absb;
1498  absa = fabs(a);
1499  absb = fabs(b);
1500  if (absb < absa)
1501  return(absa * sqrt(1.0 + absb * absb / (absa * absa)));
1502  else
1503  return((absb == 0.0) ? (0.0) : (absb * sqrt(1.0 + absa * absa / (absb * absb))));
1504 }
void sqrt(Image< double > &op)
doublereal * b
doublereal * a

◆ ql0001_() [1/2]

int ql0001_ ( m  ,
me  ,
mmax  ,
n  ,
nmax  ,
mnn  ,
c  ,
d  ,
a  ,
b  ,
xl  ,
xu  ,
x  ,
u  ,
iout  ,
ifail  ,
iprint  ,
war  ,
lwar  ,
iwar  ,
liwar  ,
eps1   
)

◆ ql0001_() [2/2]

int ql0001_ ( )

◆ ql0002_() [1/3]

int ql0002_ ( )

◆ ql0002_() [2/3]

ql0002_ ( n  ,
m  ,
me  ,
mmax  ,
mn,
mnn  ,
nmax  ,
lql,
a[a_offset],
war[inw1],
d[1],
c[c_offset],
xl[1],
xu[1],
x[1],
nact,
iwar[1],
maxit,
qpeps,
info,
diag,
war[inw2],
lw 
)

◆ ql0002_() [3/3]

int ql0002_ ( n  ,
m  ,
meq  ,
mmax  ,
mn  ,
mnn  ,
nmax  ,
lql  ,
a  ,
b  ,
grad  ,
g  ,
xl  ,
xu  ,
x  ,
nact  ,
iact  ,
maxit  ,
vsmall  ,
info  ,
diag  ,
w  ,
lw   
)

◆ ran1()

double ran1 ( int *  idum)

Definition at line 58 of file numerical_recipes.cpp.

59 {
60  static long ix1, ix2, ix3;
61  static double r[98];
62  double temp;
63  static int iff = 0;
64  int j;
65 
66  if (*idum < 0 || iff == 0)
67  {
68  iff = 1;
69  ix1 = (IC1 - (*idum)) % M1;
70  ix1 = (IA1 * ix1 + IC1) % M1;
71  ix2 = ix1 % M2;
72  ix1 = (IA1 * ix1 + IC1) % M1;
73  ix3 = ix1 % M3;
74  for (j = 1;j <= 97;j++)
75  {
76  ix1 = (IA1 * ix1 + IC1) % M1;
77  ix2 = (IA2 * ix2 + IC2) % M2;
78  r[j] = (ix1 + ix2 * RM2) * RM1;
79  }
80  *idum = 1;
81  }
82  ix1 = (IA1 * ix1 + IC1) % M1;
83  ix2 = (IA2 * ix2 + IC2) % M2;
84  ix3 = (IA3 * ix3 + IC3) % M3;
85  j = 1 + ((97 * ix3) / M3);
86  if (j > 97 || j < 1)
87  nrerror("RAN1: This cannot happen.");
88  temp = r[j];
89  r[j] = (ix1 + ix2 * RM2) * RM1;
90  return temp;
91 }
#define IC2
void nrerror(const char error_text[])
#define M3
#define RM2
#define M2
#define M1
#define RM1
#define j
#define IA2
#define IA3
#define IC1
#define IC3
int idum
#define IA1

◆ sbout1()

sbout1 ( glob_prnt.  io,
nparam  ,
"multipliers for x ,
dummy  ,
param->  mult,
,
 
)

◆ svbksb()

void svbksb ( double *  u,
double *  w,
double *  v,
int  m,
int  n,
double *  b,
double *  x 
)

Definition at line 1791 of file numerical_recipes.cpp.

1792 {
1793  int jj, j, i;
1794  double s;
1795 
1796  std::vector<double> buffer(n);
1797  auto *tmp= buffer.data()-1;
1798  for (j = 1;j <= n;j++)
1799  {
1800  s = 0.0;
1801  if (w[j])
1802  {
1803  for (i = 1;i <= m;i++)
1804  s += u[i*n+j] * b[i];
1805  s /= w[j];
1806  }
1807  tmp[j] = s;
1808  }
1809  for (j = 1;j <= n;j++)
1810  {
1811  s = 0.0;
1812  for (jj = 1;jj <= n;jj++)
1813  s += v[j*n+jj] * tmp[jj];
1814  x[j] = s;
1815  }
1816 }
HBITMAP buffer
Definition: svm-toy.cpp:37
doublereal * w
doublereal * x
#define i
doublereal * b
#define j
doublereal * u
int * n

◆ svdcmp()

void svdcmp ( double *  U,
int  Lines,
int  Columns,
double *  W,
double *  V 
)

Definition at line 1507 of file numerical_recipes.cpp.

1508 {
1509  double Norm, Scale;
1510  double c, f, g, h, s;
1511  double x, y, z;
1512  long i, its, j, jj, k, l = 0L, nm = 0L;
1513  bool Flag;
1514  int MaxIterations = SVDMAXITER;
1515 
1516  std::vector<double> buffer(Columns*Columns);
1517  auto *rv1= buffer.data();
1518  g = Scale = Norm = 0.0;
1519  for (i = 0L; (i < Columns); i++)
1520  {
1521  l = i + 1L;
1522  rv1[i] = Scale * g;
1523  g = s = Scale = 0.0;
1524  if (i < Lines)
1525  {
1526  for (k = i; (k < Lines); k++)
1527  {
1528  Scale += fabs(U[k * Columns + i]);
1529  }
1530  if (Scale != 0.0)
1531  {
1532  for (k = i; (k < Lines); k++)
1533  {
1534  U[k * Columns + i] /= Scale;
1535  s += U[k * Columns + i] * U[k * Columns + i];
1536  }
1537  f = U[i * Columns + i];
1538  g = (0.0 <= f) ? (-sqrt(s)) : (sqrt(s));
1539  h = f * g - s;
1540  U[i * Columns + i] = f - g;
1541  for (j = l; (j < Columns); j++)
1542  {
1543  for (s = 0.0, k = i; (k < Lines); k++)
1544  {
1545  s += U[k * Columns + i] * U[k * Columns + j];
1546  }
1547  f = s / h;
1548  for (k = i; (k < Lines); k++)
1549  {
1550  U[k * Columns + j] += f * U[k * Columns + i];
1551  }
1552  }
1553  for (k = i; (k < Lines); k++)
1554  {
1555  U[k * Columns + i] *= Scale;
1556  }
1557  }
1558  }
1559  W[i] = Scale * g;
1560  g = s = Scale = 0.0;
1561  if ((i < Lines) && (i != (Columns - 1L)))
1562  {
1563  for (k = l; (k < Columns); k++)
1564  {
1565  Scale += fabs(U[i * Columns + k]);
1566  }
1567  if (Scale != 0.0)
1568  {
1569  for (k = l; (k < Columns); k++)
1570  {
1571  U[i * Columns + k] /= Scale;
1572  s += U[i * Columns + k] * U[i * Columns + k];
1573  }
1574  f = U[i * Columns + l];
1575  g = (0.0 <= f) ? (-sqrt(s)) : (sqrt(s));
1576  h = f * g - s;
1577  U[i * Columns + l] = f - g;
1578  for (k = l; (k < Columns); k++)
1579  {
1580  rv1[k] = U[i * Columns + k] / h;
1581  }
1582  for (j = l; (j < Lines); j++)
1583  {
1584  for (s = 0.0, k = l; (k < Columns); k++)
1585  {
1586  s += U[j * Columns + k] * U[i * Columns + k];
1587  }
1588  for (k = l; (k < Columns); k++)
1589  {
1590  U[j * Columns + k] += s * rv1[k];
1591  }
1592  }
1593  for (k = l; (k < Columns); k++)
1594  {
1595  U[i * Columns + k] *= Scale;
1596  }
1597  }
1598  }
1599  Norm = ((fabs(W[i]) + fabs(rv1[i])) < Norm) ? (Norm) : (fabs(W[i]) + fabs(rv1[i]));
1600  }
1601  for (i = Columns - 1L; (0L <= i); i--)
1602  {
1603  if (i < (Columns - 1L))
1604  {
1605  if (g != 0.0)
1606  {
1607  for (j = l; (j < Columns); j++)
1608  {
1609  V[j * Columns + i] = U[i * Columns + j] / (U[i * Columns + l] * g);
1610  }
1611  for (j = l; (j < Columns); j++)
1612  {
1613  for (s = 0.0, k = l; (k < Columns); k++)
1614  {
1615  s += U[i * Columns + k] * V[k * Columns + j];
1616  }
1617  for (k = l; (k < Columns); k++)
1618  {
1619  if (s != 0.0)
1620  {
1621  V[k * Columns + j] += s * V[k * Columns + i];
1622  }
1623  }
1624  }
1625  }
1626  for (j = l; (j < Columns); j++)
1627  {
1628  V[i * Columns + j] = V[j * Columns + i] = 0.0;
1629  }
1630  }
1631  V[i * Columns + i] = 1.0;
1632  g = rv1[i];
1633  l = i;
1634  }
1635  for (i = (Lines < Columns) ? (Lines - 1L) : (Columns - 1L); (0L <= i); i--)
1636  {
1637  l = i + 1L;
1638  g = W[i];
1639  for (j = l; (j < Columns); j++)
1640  {
1641  U[i * Columns + j] = 0.0;
1642  }
1643  if (g != 0.0)
1644  {
1645  g = 1.0 / g;
1646  for (j = l; (j < Columns); j++)
1647  {
1648  for (s = 0.0, k = l; (k < Lines); k++)
1649  {
1650  s += U[k * Columns + i] * U[k * Columns + j];
1651  }
1652  f = s * g / U[i * Columns + i];
1653  for (k = i; (k < Lines); k++)
1654  {
1655  if (f != 0.0)
1656  {
1657  U[k * Columns + j] += f * U[k * Columns + i];
1658  }
1659  }
1660  }
1661  for (j = i; (j < Lines); j++)
1662  {
1663  U[j * Columns + i] *= g;
1664  }
1665  }
1666  else
1667  {
1668  for (j = i; (j < Lines); j++)
1669  {
1670  U[j * Columns + i] = 0.0;
1671  }
1672  }
1673  U[i * Columns + i] += 1.0;
1674  }
1675  for (k = Columns - 1L; (0L <= k); k--)
1676  {
1677  for (its = 1L; (its <= MaxIterations); its++)
1678  {
1679  Flag = true;
1680  for (l = k; (0L <= l); l--)
1681  {
1682  nm = l - 1L;
1683  if ((fabs(rv1[l]) + Norm) == Norm)
1684  {
1685  Flag = false;
1686  break;
1687  }
1688  if ((fabs(W[nm]) + Norm) == Norm)
1689  {
1690  break;
1691  }
1692  }
1693  if (Flag)
1694  {
1695  c = 0.0;
1696  s = 1.0;
1697  for (i = l; (i <= k); i++)
1698  {
1699  f = s * rv1[i];
1700  rv1[i] *= c;
1701  if ((fabs(f) + Norm) == Norm)
1702  {
1703  break;
1704  }
1705  g = W[i];
1706  h = Pythag(f, g);
1707  W[i] = h;
1708  h = 1.0 / h;
1709  c = g * h;
1710  s = -f * h;
1711  for (j = 0L; (j < Lines); j++)
1712  {
1713  y = U[j * Columns + nm];
1714  z = U[j * Columns + i];
1715  U[j * Columns + nm] = y * c + z * s;
1716  U[j * Columns + i] = z * c - y * s;
1717  }
1718  }
1719  }
1720  z = W[k];
1721  if (l == k)
1722  {
1723  if (z < 0.0)
1724  {
1725  W[k] = -z;
1726  for (j = 0L; (j < Columns); j++)
1727  {
1728  V[j * Columns + k] = -V[j * Columns + k];
1729  }
1730  }
1731  break;
1732  }
1733  if (its == MaxIterations) return;
1734  x = W[l];
1735  nm = k - 1L;
1736  y = W[nm];
1737  g = rv1[nm];
1738  h = rv1[k];
1739  f = ((y - z) * (y + z) + (g - h) * (g + h)) / (2.0 * h * y);
1740  g = Pythag(f, 1.0);
1741  f = ((x - z) * (x + z) + h * ((y / (f + ((0.0 <= f) ? (fabs(g))
1742  : (-fabs(g))))) - h)) / x;
1743  c = s = 1.0;
1744  for (j = l; (j <= nm); j++)
1745  {
1746  i = j + 1L;
1747  g = rv1[i];
1748  y = W[i];
1749  h = s * g;
1750  g = c * g;
1751  z = Pythag(f, h);
1752  rv1[j] = z;
1753  c = f / z;
1754  s = h / z;
1755  f = x * c + g * s;
1756  g = g * c - x * s;
1757  h = y * s;
1758  y *= c;
1759  for (jj = 0L; (jj < Columns); jj++)
1760  {
1761  x = V[jj * Columns + j];
1762  z = V[jj * Columns + i];
1763  V[jj * Columns + j] = x * c + z * s;
1764  V[jj * Columns + i] = z * c - x * s;
1765  }
1766  z = Pythag(f, h);
1767  W[j] = z;
1768  if (z != 0.0)
1769  {
1770  z = 1.0 / z;
1771  c = f * z;
1772  s = h * z;
1773  }
1774  f = c * g + s * y;
1775  x = c * y - s * g;
1776  for (jj = 0L; (jj < Lines); jj++)
1777  {
1778  y = U[jj * Columns + j];
1779  z = U[jj * Columns + i];
1780  U[jj * Columns + j] = y * c + z * s;
1781  U[jj * Columns + i] = z * c - y * s;
1782  }
1783  }
1784  rv1[l] = 0.0;
1785  rv1[k] = f;
1786  W[k] = x;
1787  }
1788  }
1789 }
doublereal * c
doublereal * g
void sqrt(Image< double > &op)
HBITMAP buffer
Definition: svm-toy.cpp:37
static double * y
doublereal * x
#define i
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
double * f
double z
#define SVDMAXITER
#define j
double Pythag(double a, double b)

◆ switch()

switch ( (int)  mflag)

Definition at line 3986 of file numerical_recipes.cpp.

3987  {
3988  case 1:
3989  goto L250;
3990  case 2:
3991  goto L610;
3992  }

◆ tdev()

double tdev ( double  nu,
int *  idum 
)

Definition at line 136 of file numerical_recipes.cpp.

137 {
138  static int iset = 0;
139  static double gset;
140  double fac, r, v1, v2;
141 
142  if (iset == 0)
143  {
144  do
145  {
146  v1 = 2.0 * ran1(idum) - 1.0;
147  v2 = 2.0 * ran1(idum) - 1.0;
148  r = v1 * v1 + v2 * v2;
149  }
150  while (r >= 1.0);
151  fac = sqrt(nu*(pow(r,-2.0/nu) -1.0)/r);
152  gset = v1 * fac;
153  iset = 1;
154  return v2*fac;
155  }
156  else
157  {
158  iset = 0;
159  return gset;
160  }
161 }
void sqrt(Image< double > &op)
double v1
double ran1(int *idum)
int idum

◆ temp3()

ql0001_& temp3 ( htemp 1) &

◆ while()

while ( mm  ,
nfs   
)

◆ zero()

ql0001_& zero ( ctemp 1) &

Variable Documentation

◆ __pad0__

L20 __pad0__

Definition at line 2317 of file numerical_recipes.cpp.

◆ __pad10__

L90 __pad10__

Definition at line 2714 of file numerical_recipes.cpp.

◆ __pad11__

L140 __pad11__

Definition at line 2756 of file numerical_recipes.cpp.

◆ __pad12__

L150 __pad12__

Definition at line 2760 of file numerical_recipes.cpp.

◆ __pad13__

L165 __pad13__

Definition at line 2786 of file numerical_recipes.cpp.

◆ __pad14__

L170 __pad14__

Definition at line 2802 of file numerical_recipes.cpp.

◆ __pad15__

L230 __pad15__

Definition at line 2860 of file numerical_recipes.cpp.

◆ __pad16__

L250 __pad16__

Definition at line 2909 of file numerical_recipes.cpp.

◆ __pad17__

L280 __pad17__

Definition at line 2992 of file numerical_recipes.cpp.

◆ __pad18__

L340 __pad18__

Definition at line 3070 of file numerical_recipes.cpp.

◆ __pad19__

L350 __pad19__

Definition at line 3075 of file numerical_recipes.cpp.

◆ __pad1__

L30 __pad1__

Definition at line 2375 of file numerical_recipes.cpp.

◆ __pad20__

L380 __pad20__

Definition at line 3107 of file numerical_recipes.cpp.

◆ __pad21__

L390 __pad21__

Definition at line 3110 of file numerical_recipes.cpp.

◆ __pad22__

L410 __pad22__

Definition at line 3122 of file numerical_recipes.cpp.

◆ __pad23__

L420 __pad23__

Definition at line 3127 of file numerical_recipes.cpp.

◆ __pad24__

L430 __pad24__

Definition at line 3136 of file numerical_recipes.cpp.

◆ __pad25__

L440 __pad25__

Definition at line 3151 of file numerical_recipes.cpp.

◆ __pad26__

L450 __pad26__

Definition at line 3159 of file numerical_recipes.cpp.

◆ __pad27__

L481 __pad27__

Definition at line 3212 of file numerical_recipes.cpp.

◆ __pad28__

L510 __pad28__

Definition at line 3334 of file numerical_recipes.cpp.

◆ __pad29__

L530 __pad29__

Definition at line 3347 of file numerical_recipes.cpp.

◆ __pad2__

L70 __pad2__

Definition at line 2380 of file numerical_recipes.cpp.

◆ __pad30__

L531 __pad30__

Definition at line 3355 of file numerical_recipes.cpp.

◆ __pad31__

L541 __pad31__

Definition at line 3369 of file numerical_recipes.cpp.

◆ __pad32__

L545 __pad32__

Definition at line 3394 of file numerical_recipes.cpp.

◆ __pad33__

L549 __pad33__

Definition at line 3408 of file numerical_recipes.cpp.

◆ __pad34__

L550 __pad34__

Definition at line 3411 of file numerical_recipes.cpp.

◆ __pad35__

L560 __pad35__

Definition at line 3427 of file numerical_recipes.cpp.

◆ __pad36__

L5 __pad36__

Definition at line 3464 of file numerical_recipes.cpp.

◆ __pad37__

L567 __pad37__

Definition at line 3487 of file numerical_recipes.cpp.

◆ __pad38__

L570 __pad38__

Definition at line 3490 of file numerical_recipes.cpp.

◆ __pad39__

L571 __pad39__

Definition at line 3498 of file numerical_recipes.cpp.

◆ __pad3__

L80 __pad3__

Definition at line 2396 of file numerical_recipes.cpp.

◆ __pad40__

L574 __pad40__

Definition at line 3559 of file numerical_recipes.cpp.

◆ __pad41__

L580 __pad41__

Definition at line 3632 of file numerical_recipes.cpp.

◆ __pad42__

L590 __pad42__

Definition at line 3645 of file numerical_recipes.cpp.

◆ __pad43__

L601 __pad43__

Definition at line 3663 of file numerical_recipes.cpp.

◆ __pad44__

L610 __pad44__

Definition at line 3674 of file numerical_recipes.cpp.

◆ __pad45__

L630 __pad45__

Definition at line 3690 of file numerical_recipes.cpp.

◆ __pad46__

L640 __pad46__

Definition at line 3692 of file numerical_recipes.cpp.

◆ __pad47__

L650 __pad47__

Definition at line 3708 of file numerical_recipes.cpp.

◆ __pad48__

L660 __pad48__

Definition at line 3727 of file numerical_recipes.cpp.

◆ __pad49__

L680 __pad49__

Definition at line 3744 of file numerical_recipes.cpp.

◆ __pad4__

L81 __pad4__

Definition at line 2406 of file numerical_recipes.cpp.

◆ __pad50__

L690 __pad50__

Definition at line 3762 of file numerical_recipes.cpp.

◆ __pad51__

L700 __pad51__

Definition at line 3779 of file numerical_recipes.cpp.

◆ __pad52__

L710 __pad52__

Definition at line 3790 of file numerical_recipes.cpp.

◆ __pad53__

L730 __pad53__

Definition at line 3800 of file numerical_recipes.cpp.

◆ __pad54__

L740 __pad54__

Definition at line 3814 of file numerical_recipes.cpp.

◆ __pad55__

L750 __pad55__

Definition at line 3819 of file numerical_recipes.cpp.

◆ __pad56__

L761 __pad56__

Definition at line 3834 of file numerical_recipes.cpp.

◆ __pad57__

L770 __pad57__

Definition at line 3837 of file numerical_recipes.cpp.

◆ __pad58__

L775 __pad58__

Definition at line 3856 of file numerical_recipes.cpp.

◆ __pad59__

L791 __pad59__

Definition at line 3892 of file numerical_recipes.cpp.

◆ __pad5__

L82 __pad5__

Definition at line 2416 of file numerical_recipes.cpp.

◆ __pad60__

case __pad60__

Definition at line 3894 of file numerical_recipes.cpp.

◆ __pad61__

L800 __pad61__

Definition at line 3905 of file numerical_recipes.cpp.

◆ __pad62__

L810 __pad62__

Definition at line 3922 of file numerical_recipes.cpp.

◆ __pad63__

L850 __pad63__

Definition at line 3985 of file numerical_recipes.cpp.

◆ __pad64__

L860 __pad64__

Definition at line 4003 of file numerical_recipes.cpp.

◆ __pad65__

L870 __pad65__

Definition at line 4005 of file numerical_recipes.cpp.

◆ __pad66__

L880 __pad66__

Definition at line 4007 of file numerical_recipes.cpp.

◆ __pad67__

L900 __pad67__

Definition at line 4043 of file numerical_recipes.cpp.

◆ __pad68__

case __pad68__

Definition at line 4045 of file numerical_recipes.cpp.

◆ __pad69__

L910 __pad69__

Definition at line 4056 of file numerical_recipes.cpp.

◆ __pad6__

L40 __pad6__

Definition at line 2426 of file numerical_recipes.cpp.

◆ __pad70__

L930 __pad70__

Definition at line 4094 of file numerical_recipes.cpp.

◆ __pad71__

L510 __pad71__

Definition at line 4824 of file numerical_recipes.cpp.

◆ __pad72__

L310 __pad72__

Definition at line 6553 of file numerical_recipes.cpp.

◆ __pad73__

L1500 __pad73__

Definition at line 7556 of file numerical_recipes.cpp.

◆ __pad74__

L120 __pad74__

Definition at line 8208 of file numerical_recipes.cpp.

◆ __pad75__

Warning __pad75__

Definition at line 8218 of file numerical_recipes.cpp.

◆ __pad76__

nError __pad76__

Definition at line 8233 of file numerical_recipes.cpp.

◆ __pad77__

nError __pad77__

Definition at line 8236 of file numerical_recipes.cpp.

◆ __pad78__

L9000 __pad78__

Definition at line 8253 of file numerical_recipes.cpp.

◆ __pad7__

L90 __pad7__

Definition at line 2437 of file numerical_recipes.cpp.

◆ __pad8__

L45 __pad8__

Definition at line 2648 of file numerical_recipes.cpp.

◆ __pad9__

L70 __pad9__

Definition at line 2701 of file numerical_recipes.cpp.

◆ _param

struct _parameter _param

Definition at line 4639 of file numerical_recipes.cpp.

◆ _viol

struct _violation _viol

Definition at line 5173 of file numerical_recipes.cpp.

◆ a

double * a = a_offset

Definition at line 2230 of file numerical_recipes.cpp.

◆ a_dim1

a_dim1 = *mmax

Definition at line 2264 of file numerical_recipes.cpp.

◆ a_offset

a_offset = a_dim1 + 1

Definition at line 2265 of file numerical_recipes.cpp.

◆ adummy

objective adummy = make_dv(1)

Definition at line 6214 of file numerical_recipes.cpp.

◆ atemp

double * atemp = convert(a, nrowa, nqpram)

Definition at line 5580 of file numerical_recipes.cpp.

◆ b

static void ** b

Definition at line 2230 of file numerical_recipes.cpp.

◆ backup

double * backup = make_dv(nob + ncnstr)

Definition at line 5168 of file numerical_recipes.cpp.

◆ bgbnd

bgbnd = bigbnd

Definition at line 4177 of file numerical_recipes.cpp.

◆ bigbnd

double bigbnd

Definition at line 4413 of file numerical_recipes.cpp.

◆ bj

double * bj = make_dv(nclin)

Definition at line 5583 of file numerical_recipes.cpp.

◆ bl

double * bl = bl[i]

Definition at line 4414 of file numerical_recipes.cpp.

◆ bli

double bli
Initial value:
{
int i
#define i

Definition at line 5467 of file numerical_recipes.cpp.

◆ bu

double * bu = bu[i]

Definition at line 4414 of file numerical_recipes.cpp.

◆ bui

double bui

Definition at line 5467 of file numerical_recipes.cpp.

◆ c

c = c_offset

Definition at line 2230 of file numerical_recipes.cpp.

◆ c_dim1

c_dim1 = *nmax

Definition at line 2268 of file numerical_recipes.cpp.

◆ c_offset

c_offset = c_dim1 + 1

Definition at line 2269 of file numerical_recipes.cpp.

◆ Cbar

double Cbar

Definition at line 5166 of file numerical_recipes.cpp.

◆ cd

void * cd = cd

Definition at line 4416 of file numerical_recipes.cpp.

◆ Ck

double Ck = Cbar = 1.e-2

Definition at line 5166 of file numerical_recipes.cpp.

◆ clamda

double * clamda = make_dv(nctotl + nparam + 1)

Definition at line 5168 of file numerical_recipes.cpp.

◆ cmache_

struct Tcmache cmache_

◆ col

int col

Definition at line 8467 of file numerical_recipes.cpp.

◆ constr

void(* constr)()

Definition at line 4415 of file numerical_recipes.cpp.

◆ cs

struct _constraint * cs

Definition at line 4636 of file numerical_recipes.cpp.

◆ ctemp

ctemp
Initial value:
{
int i, j, zero, one, lwar2, mnn, iout
#define i
#define j
integer * iout
int * mnn
ql0001_ & zero(ctemp+1),(cvec+1),(a+1),(b+1),(bl+1),(bu+1),(x+1),(w+1), &iout, ifail, &zero,(w+3), &lwar2,(iw+1), &leniw, &glob_grd.epsmac

Definition at line 8425 of file numerical_recipes.cpp.

◆ cvec

double * cvec = make_dv(nparam + 1)

Definition at line 5168 of file numerical_recipes.cpp.

◆ d

double * d = make_dv(nparam + 1)

Definition at line 2230 of file numerical_recipes.cpp.

◆ d0

double* d0

Definition at line 7033 of file numerical_recipes.cpp.

◆ d0_is0

glob_log d0_is0 = FALSE

Definition at line 6267 of file numerical_recipes.cpp.

◆ d0nm

* d0nm = 0.e0

Definition at line 5166 of file numerical_recipes.cpp.

◆ d0norm

double d0norm

Definition at line 7942 of file numerical_recipes.cpp.

◆ d__1

d__1
Initial value:

Definition at line 2480 of file numerical_recipes.cpp.

◆ d__2

d__2 = w[ir] / temp

Definition at line 2480 of file numerical_recipes.cpp.

◆ d__3

d__3 = (d__1 = w[ir - 1], abs(d__1))

Definition at line 2480 of file numerical_recipes.cpp.

◆ d__4

d__4 = (d__2 = w[ir], abs(d__2))

Definition at line 2480 of file numerical_recipes.cpp.

◆ dbar

dbar = 5.e0

Definition at line 5166 of file numerical_recipes.cpp.

◆ delta

double delta

Definition at line 7597 of file numerical_recipes.cpp.

◆ delta_s

delta_s = glob_grd.rteps

Definition at line 7607 of file numerical_recipes.cpp.

◆ deriv

directional deriv

Definition at line 7217 of file numerical_recipes.cpp.

◆ dhd

double dhd
Initial value:
{
int i, j, k, ifail, np, mnm, done, display
else display
#define i
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
#define j
integer * ifail

Definition at line 7605 of file numerical_recipes.cpp.

◆ di

double * di = make_dv(nparam + 1)

Definition at line 5168 of file numerical_recipes.cpp.

◆ display

else display = TRUE

Definition at line 5712 of file numerical_recipes.cpp.

◆ dmx

double dmx

Definition at line 6210 of file numerical_recipes.cpp.

◆ dnm

dnm = sqrt(scaprd(nparam, di, di))

Definition at line 6210 of file numerical_recipes.cpp.

◆ dnm1

double dnm1

Definition at line 6210 of file numerical_recipes.cpp.

◆ dnmtil

double dnmtil

Definition at line 6214 of file numerical_recipes.cpp.

◆ done

done = FALSE

Definition at line 7636 of file numerical_recipes.cpp.

◆ dummy

double dummy = 0.e0

Definition at line 4635 of file numerical_recipes.cpp.

◆ dx

double dx

Definition at line 6210 of file numerical_recipes.cpp.

◆ e0

e0

Definition at line 5209 of file numerical_recipes.cpp.

◆ else

else
Initial value:
{
goto L280

Definition at line 2902 of file numerical_recipes.cpp.

◆ eps

double eps = *eps1

Definition at line 2273 of file numerical_recipes.cpp.

◆ eps1

doublereal* eps1

Definition at line 2234 of file numerical_recipes.cpp.

◆ epseqn

double epseqn

Definition at line 4413 of file numerical_recipes.cpp.

◆ epsilon

epsilon
Initial value:
{
int i, j, i_max, index, offset, nineq, display
else display
void nineq
#define i
viol index
#define j

Definition at line 5702 of file numerical_recipes.cpp.

◆ epskt

double epskt

Definition at line 4635 of file numerical_recipes.cpp.

◆ epsmac

glob_grd epsmac = smallNumber()

Definition at line 4701 of file numerical_recipes.cpp.

◆ eta

double * eta

Definition at line 7041 of file numerical_recipes.cpp.

◆ etad

double etad

Definition at line 7605 of file numerical_recipes.cpp.

◆ f

f = f - 1

Definition at line 4414 of file numerical_recipes.cpp.

◆ fbind

fbind = cdone = fdone = eqdone = FALSE

Definition at line 7202 of file numerical_recipes.cpp.

◆ feasb

static void feasb = TRUE

Definition at line 4629 of file numerical_recipes.cpp.

◆ feasbl

feasbl
Initial value:
{
int i, ipp, j, ncnstr, nclin, nctotl, nob, nobL, modem=0, nn,
#define i
#define j
static void nctotl
static void * modem
static void nobL

Definition at line 4629 of file numerical_recipes.cpp.

◆ fii

double fii

Definition at line 7197 of file numerical_recipes.cpp.

◆ first

glob_log first = TRUE

Definition at line 5201 of file numerical_recipes.cpp.

◆ fM

objective fM = fmax

Definition at line 5166 of file numerical_recipes.cpp.

◆ fmax

objective fmax = -bgbnd

Definition at line 5166 of file numerical_recipes.cpp.

◆ fmax1

double fmax1 =0.

Definition at line 7197 of file numerical_recipes.cpp.

◆ fMp

double * fMp = fmax - psf

Definition at line 5166 of file numerical_recipes.cpp.

◆ fmult

double fmult

Definition at line 5702 of file numerical_recipes.cpp.

◆ fmxl

fmxl
Initial value:
{
int i, j, k, kk, ncg, ncf, nqprm0, nclin0, nctot0, infoqp, nqprm1, ncl,
nclin1=0, ncc, nff, nrowa0, nrowa1, ninq, nobb, nobbL,
nncn, ltem1, ltem2, display, need_d1
else display
#define i
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
static void * ncf
#define j

Definition at line 6210 of file numerical_recipes.cpp.

◆ fnext

double fnext

Definition at line 5702 of file numerical_recipes.cpp.

◆ fnow

double fnow

Definition at line 5702 of file numerical_recipes.cpp.

◆ fprev

double fprev

Definition at line 5702 of file numerical_recipes.cpp.

◆ g

double * g = g_offset

Definition at line 2473 of file numerical_recipes.cpp.

◆ g_dim1

g_dim1 = *nmax

Definition at line 2560 of file numerical_recipes.cpp.

◆ g_max

double g_max

Definition at line 5702 of file numerical_recipes.cpp.

◆ g_offset

g_offset = g_dim1 + 1

Definition at line 2561 of file numerical_recipes.cpp.

◆ gamma

double * gamma

Definition at line 7597 of file numerical_recipes.cpp.

◆ gammd

double gammd

Definition at line 7605 of file numerical_recipes.cpp.

◆ get_ne_mult

glob_log get_ne_mult = FALSE

Definition at line 4707 of file numerical_recipes.cpp.

◆ gi

double gi

Definition at line 4635 of file numerical_recipes.cpp.

◆ gLgeps

double gLgeps = -1.e0

Definition at line 1831 of file numerical_recipes.cpp.

◆ glob_grd

struct Tglob_grd glob_grd

◆ glob_info

struct Tglob_info glob_info

◆ glob_log

struct Tglob_log glob_log

◆ glob_prnt

struct Tglob_prnt glob_prnt

◆ gm

double * gm = make_dv(4 * neqn)

Definition at line 5168 of file numerical_recipes.cpp.

◆ gmax

double gmax = -bgbnd

Definition at line 4635 of file numerical_recipes.cpp.

◆ grad

grad

Definition at line 2473 of file numerical_recipes.cpp.

◆ gradcn

void(*)(*)(*)(* gradcn

Definition at line 4415 of file numerical_recipes.cpp.

◆ gradf

double * gradf

Definition at line 8269 of file numerical_recipes.cpp.

◆ gradg

double * gradg

Definition at line 8313 of file numerical_recipes.cpp.

◆ gradob

void(*)(*)(* gradob

Definition at line 4415 of file numerical_recipes.cpp.

◆ grdfd0

double grdfd0

Definition at line 6214 of file numerical_recipes.cpp.

◆ grdfd1

else grdfd1 = 0.e0

Definition at line 6214 of file numerical_recipes.cpp.

◆ grdftd

directional grdftd

Definition at line 5166 of file numerical_recipes.cpp.

◆ grdgd0

double grdgd0

Definition at line 6214 of file numerical_recipes.cpp.

◆ grdgd1

double grdgd1

Definition at line 6214 of file numerical_recipes.cpp.

◆ grdpsf

double * grdpsf = make_dv(nparam)

Definition at line 5168 of file numerical_recipes.cpp.

◆ hd

double * hd

Definition at line 7597 of file numerical_recipes.cpp.

◆ hess

double ** hess = make_dm(nparam, nparam)

Definition at line 5170 of file numerical_recipes.cpp.

◆ hess1

double ** hess1 = make_dm(nparam + 1, nparam + 1)

Definition at line 5170 of file numerical_recipes.cpp.

◆ htemp

double * htemp = convert(hess1, nparam + 1, nparam + 1)

Definition at line 5580 of file numerical_recipes.cpp.

◆ i__1

i__1 = *m

Definition at line 2309 of file numerical_recipes.cpp.

◆ i__2

i__2 = *n

Definition at line 2803 of file numerical_recipes.cpp.

◆ iact

int * iact = knext

Definition at line 2474 of file numerical_recipes.cpp.

◆ ifail

static void * ifail = 0

Definition at line 2231 of file numerical_recipes.cpp.

◆ ikeep

ikeep = nlin - *iskp

Definition at line 7207 of file numerical_recipes.cpp.

◆ index

viol index = 0

Definition at line 5197 of file numerical_recipes.cpp.

◆ indxcn

int * indxcn = make_iv(nineq + neq)

Definition at line 4633 of file numerical_recipes.cpp.

◆ indxob

int * indxob = make_iv(DMAX1(nineq + neq, nf))

Definition at line 4633 of file numerical_recipes.cpp.

◆ infoqp

static void * infoqp
Initial value:
{
free_iv(iw)
int * iw_hold

Definition at line 6957 of file numerical_recipes.cpp.

◆ inform

* inform = glob_prnt.info

Definition at line 4411 of file numerical_recipes.cpp.

◆ initvl

glob_prnt initvl = 1

Definition at line 5200 of file numerical_recipes.cpp.

◆ io

glob_prnt io = stdout

Definition at line 4716 of file numerical_recipes.cpp.

◆ iout

iout = 6

Definition at line 2231 of file numerical_recipes.cpp.

◆ ipd

glob_prnt ipd = 0

Definition at line 7635 of file numerical_recipes.cpp.

◆ ipp

ipp = iprint

Definition at line 4714 of file numerical_recipes.cpp.

◆ iprint

glob_prnt iprint = iprint % 10

Definition at line 2231 of file numerical_recipes.cpp.

◆ iskip

int * iskip = make_iv(glob_info.nnineq + 1)

Definition at line 5163 of file numerical_recipes.cpp.

◆ iskp

static void * iskp

Definition at line 6197 of file numerical_recipes.cpp.

◆ istore

int * istore = make_iv(nineqn + nob + neqn)

Definition at line 5163 of file numerical_recipes.cpp.

◆ iter

n iteration glob_prnt iter = 0

Definition at line 4698 of file numerical_recipes.cpp.

◆ iter_mod

glob_prnt iter_mod = DMAX1(iprint - iprint % 10, 1)

Definition at line 4715 of file numerical_recipes.cpp.

◆ iteration

n The following was calculated during iteration

Definition at line 8201 of file numerical_recipes.cpp.

◆ itry

itry = ii = jj = 1

Definition at line 7200 of file numerical_recipes.cpp.

◆ iw_hold

iw_hold
Initial value:
{
int i, k, ii, jj, iout, j, mnn, zero, temp1, temp3, ncnstr_used, numf_used=0
else temp3
#define i
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
#define j
integer * iout
int * mnn
ql0001_ & zero(ctemp+1),(cvec+1),(a+1),(b+1),(bl+1),(bu+1),(x+1),(w+1), &iout, ifail, &zero,(w+3), &lwar2,(iw+1), &leniw, &glob_grd.epsmac
double temp1

Definition at line 7038 of file numerical_recipes.cpp.

◆ iwar

iwar

Definition at line 2233 of file numerical_recipes.cpp.

◆ L170

goto L170

Definition at line 2751 of file numerical_recipes.cpp.

◆ L440

goto L440

Definition at line 3134 of file numerical_recipes.cpp.

◆ L549

goto L549

Definition at line 3367 of file numerical_recipes.cpp.

◆ L550

goto L550

Definition at line 3392 of file numerical_recipes.cpp.

◆ L570

goto L570

Definition at line 3462 of file numerical_recipes.cpp.

◆ L640

goto L640

Definition at line 3480 of file numerical_recipes.cpp.

◆ L70

goto L70

Definition at line 2780 of file numerical_recipes.cpp.

◆ L710

goto L710

Definition at line 3353 of file numerical_recipes.cpp.

◆ L740

goto L740

Definition at line 3108 of file numerical_recipes.cpp.

◆ L770

goto L770

Definition at line 3817 of file numerical_recipes.cpp.

◆ L775

goto L775

Definition at line 3557 of file numerical_recipes.cpp.

◆ L800

goto L800

Definition at line 3147 of file numerical_recipes.cpp.

◆ L860

goto L860

Definition at line 3422 of file numerical_recipes.cpp.

◆ L880

goto L880

Definition at line 4038 of file numerical_recipes.cpp.

◆ L910

goto L910

Definition at line 3123 of file numerical_recipes.cpp.

◆ L930

goto L930

Definition at line 3071 of file numerical_recipes.cpp.

◆ lambda

lambda = lambda - 1

Definition at line 4414 of file numerical_recipes.cpp.

◆ leniw

int leniw

Definition at line 4215 of file numerical_recipes.cpp.

◆ lenw

int lenw

Definition at line 4215 of file numerical_recipes.cpp.

◆ Linfty

else * Linfty =0

Definition at line 4632 of file numerical_recipes.cpp.

◆ liwar

if liwar
Initial value:
{
goto L81

Definition at line 2233 of file numerical_recipes.cpp.

◆ local

glob_log local = glob_log.update = FALSE

Definition at line 6220 of file numerical_recipes.cpp.

◆ lwar

integer* lwar

Definition at line 2233 of file numerical_recipes.cpp.

◆ lwar2

lwar2 = lenw - 1

Definition at line 8447 of file numerical_recipes.cpp.

◆ m

if m
Initial value:
{
goto L20

Definition at line 2305 of file numerical_recipes.cpp.

◆ max4

objective max4

Definition at line 8120 of file numerical_recipes.cpp.

◆ me

int * me

Definition at line 2229 of file numerical_recipes.cpp.

◆ meq

int * meq

Definition at line 2471 of file numerical_recipes.cpp.

◆ mesh_pts

static void * mesh_pts = mesh_pts - 1

Definition at line 4411 of file numerical_recipes.cpp.

◆ mesh_pts1

mesh_pts1 = mesh_pts

Definition at line 4633 of file numerical_recipes.cpp.

◆ miter

void miter

Definition at line 4411 of file numerical_recipes.cpp.

◆ mm

return mm

Definition at line 8570 of file numerical_recipes.cpp.

◆ mmax

int * mmax

Definition at line 2229 of file numerical_recipes.cpp.

◆ mnn

int * mnn
Initial value:
{
goto L82

Definition at line 2229 of file numerical_recipes.cpp.

◆ mode

static void mode

Definition at line 4411 of file numerical_recipes.cpp.

◆ modec

glob_info modec = 1

Definition at line 5544 of file numerical_recipes.cpp.

◆ modem

void * modem

Definition at line 5462 of file numerical_recipes.cpp.

◆ mult

i<= ncnstr; i++) cs[i].mult = 0.e0; if (nfsip) for (i = 1; i <= nob; i++) { ob[i].mult = 0.e0; ob[i].mult_L = 0.e0; } for (i = 1; i <= nqpram; i++) { ii = k + i; if (clamda[ii] == 0.e0 && clamda[ii+nqpram] == 0.e0) continue; else if (clamda[ii] != 0.e0) clamda[ii] = -clamda[ii]; else clamda[ii] = clamda[ii+nqpram]; } nqnp = nqpram + ncnstr; for (i = 1; i <= nqpram; i++) param-> mult[i] = clamda[k+i]

Definition at line 6988 of file numerical_recipes.cpp.

◆ n

int n

Definition at line 2229 of file numerical_recipes.cpp.

◆ ncallf

ncallf glob_info ncallf = 0

Definition at line 5221 of file numerical_recipes.cpp.

◆ ncallg

ncallg glob_info ncallg

Definition at line 8196 of file numerical_recipes.cpp.

◆ ncc

ncc = ncg + 1

Definition at line 6602 of file numerical_recipes.cpp.

◆ ncf

void * ncf

Definition at line 7183 of file numerical_recipes.cpp.

◆ ncg

static void * ncg = ncf = *iskp = 0

Definition at line 6218 of file numerical_recipes.cpp.

◆ ncl

Definition at line 6219 of file numerical_recipes.cpp.

◆ nclin

static void nclin = ncnstr - nn

Definition at line 4760 of file numerical_recipes.cpp.

◆ nclin0

nclin0 = ncnstr + nobL

Definition at line 6241 of file numerical_recipes.cpp.

◆ ncn

void ncn

Definition at line 7940 of file numerical_recipes.cpp.

◆ ncnst1

ncnst1 = ncnstr - nineqn - neqn

Definition at line 5234 of file numerical_recipes.cpp.

◆ ncnstr

static void ncnstr = nineq + neq

Definition at line 4717 of file numerical_recipes.cpp.

◆ ncnstr_used

ncnstr_used = k

Definition at line 6894 of file numerical_recipes.cpp.

◆ ncsipl

static void ncsipl = ncsrl

Definition at line 4645 of file numerical_recipes.cpp.

◆ ncsipl1

ncsipl1 = ncsrl

Definition at line 4655 of file numerical_recipes.cpp.

◆ ncsipn

static void ncsipn = ncsrn

Definition at line 4646 of file numerical_recipes.cpp.

◆ ncsipn1

ncsipn1 = ncsrn

Definition at line 4656 of file numerical_recipes.cpp.

◆ ncsrl

ncsrl = 0

Definition at line 4411 of file numerical_recipes.cpp.

◆ ncsrn

ncsrn = 0

Definition at line 4411 of file numerical_recipes.cpp.

◆ nctot0

nctot0 = nqprm0 + nclin0

Definition at line 6243 of file numerical_recipes.cpp.

◆ nctotl

static void nctotl

Definition at line 5153 of file numerical_recipes.cpp.

◆ ndima

int ndima

Definition at line 8582 of file numerical_recipes.cpp.

◆ ndimb

int ndimb

Definition at line 8582 of file numerical_recipes.cpp.

◆ need_d1

need_d1 = TRUE

Definition at line 6231 of file numerical_recipes.cpp.

◆ neq

static void neq

Definition at line 4411 of file numerical_recipes.cpp.

◆ neqn

static void neqn

Definition at line 4411 of file numerical_recipes.cpp.

◆ nf

static void nf = nf - nfsr

Definition at line 4411 of file numerical_recipes.cpp.

◆ nfs

static int nfs = 0

Definition at line 5223 of file numerical_recipes.cpp.

◆ nfsip

static void nfsip = nfsr

Definition at line 4644 of file numerical_recipes.cpp.

◆ nfsip1

nfsip1 = nfsr

Definition at line 4648 of file numerical_recipes.cpp.

◆ nfsr

nfsr = 0

Definition at line 4411 of file numerical_recipes.cpp.

◆ nineq

static void nineq = nineq - ncsrl - ncsrn

Definition at line 4411 of file numerical_recipes.cpp.

◆ nineqn

static void nineqn = nineqn - ncsrn

Definition at line 4411 of file numerical_recipes.cpp.

◆ ninq

ninq = nncn = ncg

Definition at line 6604 of file numerical_recipes.cpp.

◆ nlin

Definition at line 7199 of file numerical_recipes.cpp.

◆ nmax

int * nmax

Definition at line 2229 of file numerical_recipes.cpp.

◆ nn

static void nn = nineqn + neqn

Definition at line 4700 of file numerical_recipes.cpp.

◆ nnineq

glob_info nnineq = nineq

Definition at line 4718 of file numerical_recipes.cpp.

◆ nnl

static void nnl

Definition at line 5462 of file numerical_recipes.cpp.

◆ nob

static void nob = 0

Definition at line 4710 of file numerical_recipes.cpp.

◆ nobL

static void nobL

Definition at line 5153 of file numerical_recipes.cpp.

◆ nparam

static void nparam

Definition at line 5153 of file numerical_recipes.cpp.

◆ nppram

nppram = nparam + 1

Definition at line 4747 of file numerical_recipes.cpp.

◆ nqpram

void nqpram

Definition at line 7030 of file numerical_recipes.cpp.

◆ nrowa

static void nrowa = DMAX1(ncnstr + DMAX1(nobL, 1), 1)

Definition at line 5014 of file numerical_recipes.cpp.

◆ nrowa0

nrowa0 = DMAX1(nclin0, 1)

Definition at line 6245 of file numerical_recipes.cpp.

◆ nrows

int nrows

Definition at line 8467 of file numerical_recipes.cpp.

◆ nrst

static void * nrst = glob_prnt.ipd = 0

Definition at line 5202 of file numerical_recipes.cpp.

◆ nstart

static void * nstart = 1

Definition at line 5220 of file numerical_recipes.cpp.

◆ nstop

int nstop = 1

Definition at line 4178 of file numerical_recipes.cpp.

◆ ob

struct _objective * ob

Definition at line 4637 of file numerical_recipes.cpp.

◆ obj

void(* obj)()

Definition at line 4415 of file numerical_recipes.cpp.

◆ objeps

double objeps = -1.e0

Definition at line 1829 of file numerical_recipes.cpp.

◆ objmax

objective objmax

Definition at line 8122 of file numerical_recipes.cpp.

◆ objrep

double objrep = -1.e0

Definition at line 1830 of file numerical_recipes.cpp.

◆ or

or

Definition at line 5499 of file numerical_recipes.cpp.

◆ ostep

ostep = *steps = 1.e0

Definition at line 7197 of file numerical_recipes.cpp.

◆ param

struct _parameter * param

Definition at line 4638 of file numerical_recipes.cpp.

◆ penp

double * penp = make_dv(neqn)

Definition at line 5168 of file numerical_recipes.cpp.

◆ phess

double ** phess

Definition at line 7597 of file numerical_recipes.cpp.

◆ prnt

prnt = FALSE

Definition at line 4629 of file numerical_recipes.cpp.

◆ prod

double prod

Definition at line 7194 of file numerical_recipes.cpp.

◆ prod1

prod1
Initial value:
{
int i, ii, ij, jj, itry, ikeep, j, job, nlin, mnm, ltem1, ltem2, reform,
fbind, cdone, fdone, eqdone, display, sipldone
else display
#define i
#define j

Definition at line 7194 of file numerical_recipes.cpp.

◆ psb

double * psb

Definition at line 7597 of file numerical_recipes.cpp.

◆ psf

double * psf = 0.e0

Definition at line 5166 of file numerical_recipes.cpp.

◆ psfnew

psfnew = 0.e0

Definition at line 7607 of file numerical_recipes.cpp.

◆ psmu

double * psmu = make_dv(neqn)

Definition at line 5168 of file numerical_recipes.cpp.

◆ return

L1500 if steps return
Initial value:
{
*z = x * y + y
static double * y
doublereal * x
double z

Definition at line 2394 of file numerical_recipes.cpp.

◆ rho

if steps rho = rhog

Definition at line 6214 of file numerical_recipes.cpp.

◆ rhog

else rhog = DMIN1(rhol, temp2)

Definition at line 6214 of file numerical_recipes.cpp.

◆ rhol

double rhol

Definition at line 6214 of file numerical_recipes.cpp.

◆ rhol_is1

glob_log rhol_is1 = FALSE

Definition at line 4706 of file numerical_recipes.cpp.

◆ rteps

Definition at line 4704 of file numerical_recipes.cpp.

◆ scvneq

double * scvneq = 0.e0

Definition at line 5166 of file numerical_recipes.cpp.

◆ sign

double sign

Definition at line 6214 of file numerical_recipes.cpp.

◆ signeq

double * signeq = make_dv(neqn)

Definition at line 4634 of file numerical_recipes.cpp.

◆ signgj

double signgj =1.

Definition at line 7607 of file numerical_recipes.cpp.

◆ sip_viol

struct _violation * sip_viol

Definition at line 7190 of file numerical_recipes.cpp.

◆ sipldone

sipldone = (ncsipl == 0)

Definition at line 7204 of file numerical_recipes.cpp.

◆ sktnom

double sktnom = 0.e0

Definition at line 5166 of file numerical_recipes.cpp.

◆ SNECV

double SNECV
Initial value:
{
int i, j, index, display, offset
else display
#define i
viol index
#define j

Definition at line 7947 of file numerical_recipes.cpp.

◆ span

double * span = make_dv(4)

Definition at line 5168 of file numerical_recipes.cpp.

◆ steps

double steps = 0.e0

Definition at line 5166 of file numerical_recipes.cpp.

◆ temp1

temp1 = temp2 = 0.e0

Definition at line 6214 of file numerical_recipes.cpp.

◆ temp2

temp2 = (theta - 1.e0) * grdfd0 / temp1

Definition at line 6214 of file numerical_recipes.cpp.

◆ temp3

else temp3 = k

Definition at line 7134 of file numerical_recipes.cpp.

◆ tempv

double * tempv

Definition at line 5171 of file numerical_recipes.cpp.

◆ termination

nNormal termination

Definition at line 8215 of file numerical_recipes.cpp.

◆ theta

double theta = 0.2e0

Definition at line 6214 of file numerical_recipes.cpp.

◆ thrshd

static int thrshd = tolfea

Definition at line 6214 of file numerical_recipes.cpp.

◆ tolfe

tolfe = 0.e0

Definition at line 7197 of file numerical_recipes.cpp.

◆ tolfea

tolfea = glob_grd.epsmac * 1.e2

Definition at line 4177 of file numerical_recipes.cpp.

◆ tot_actf_sip

Omega_k glob_info tot_actf_sip = glob_info.tot_actg_sip = 0

Definition at line 4642 of file numerical_recipes.cpp.

◆ tot_actg_sip

Xi_k glob_info tot_actg_sip

Definition at line 5953 of file numerical_recipes.cpp.

◆ type

viol type = NONE

Definition at line 5198 of file numerical_recipes.cpp.

◆ u

u

Definition at line 2230 of file numerical_recipes.cpp.

◆ udelta

glob_grd udelta = udelta

Definition at line 4413 of file numerical_recipes.cpp.

◆ v0

double v0

Definition at line 6210 of file numerical_recipes.cpp.

◆ v1

double v1

Definition at line 6210 of file numerical_recipes.cpp.

◆ viol

struct _violation * viol = &_viol

Definition at line 5172 of file numerical_recipes.cpp.

◆ vk

double vk =0.

Definition at line 6214 of file numerical_recipes.cpp.

◆ vsmall

doublereal* vsmall

Definition at line 2475 of file numerical_recipes.cpp.

◆ vv

vv = 0.e0

Definition at line 6210 of file numerical_recipes.cpp.

◆ w

directional w = sum / w[ir]

Definition at line 2477 of file numerical_recipes.cpp.

◆ war

war

Definition at line 2232 of file numerical_recipes.cpp.

◆ x

double * x = x[i]

Definition at line 2230 of file numerical_recipes.cpp.

◆ x0i

double x0i
Initial value:
{
int i, j, infoql, mnn, temp1, iout, zero
#define i
#define j
integer * iout
int * mnn
ql0001_ & zero(ctemp+1),(cvec+1),(a+1),(b+1),(bl+1),(bu+1),(x+1),(w+1), &iout, ifail, &zero,(w+3), &lwar2,(iw+1), &leniw, &glob_grd.epsmac
double temp1

Definition at line 5580 of file numerical_recipes.cpp.

◆ x_is_new

int x_is_new = TRUE

Definition at line 1826 of file numerical_recipes.cpp.

◆ xi

double xi
Initial value:
{
int i
#define i

Definition at line 4635 of file numerical_recipes.cpp.

◆ xl

doublereal * xl

Definition at line 2230 of file numerical_recipes.cpp.

◆ xnew

double * xnew

Definition at line 7187 of file numerical_recipes.cpp.

◆ xu

doublereal * xu

Definition at line 2230 of file numerical_recipes.cpp.

◆ y

void y

Definition at line 8487 of file numerical_recipes.cpp.

◆ z

static void * z
Initial value:
{
int i
#define i

Definition at line 8490 of file numerical_recipes.cpp.