亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? asa_cg.cpp

?? 數學計算程序
?? CPP
?? 第 1 頁 / 共 5 頁
字號:
/* =========================================================================   ============================== ASA_CG ===================================   =========================================================================       ________________________________________________________________      | A Conjugate Gradient (cg_descent) based Active Set Algorithm   |      |                                                                |      |                  Version 1.0  (May 18, 2008)                   |      |                                                                |      |        William W. Hager    and      Hongchao Zhang             |      |        hager@math.ufl.edu         hzhang@math.ufl.edu          |      |  Department of Mathematics      Department of Mathematics      |      |     University of Florida       Louisiana State University     |      |  Gainesville, Florida 32611      Baton Rouge, Louisiana        |      |     352-392-0281 x 244                                         |      |                                                                |      |      Copyright by William W. Hager and Hongchao Zhang          |      |                                                                |      |          http://www.math.ufl.edu/~hager/papers/CG              |      |________________________________________________________________|       ________________________________________________________________      |This program is free software; you can redistribute it and/or   |      |modify it under the terms of the GNU General Public License as  |      |published by the Free Software Foundation; either version 2 of  |      |the License, or (at your option) any later version.             |      |This program is distributed in the hope that it will be useful, |      |but WITHOUT ANY WARRANTY; without even the implied warranty of  |      |MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   |      |GNU General Public License for more details.                    |      |                                                                |      |You should have received a copy of the GNU General Public       |      |License along with this program; if not, write to the Free      |      |Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |      |MA  02110-1301  USA                                             |      |________________________________________________________________|*/#include "asa_user.h"#include <iostream>#include "asa_cg.h"using namespace std;static int iii = 1;int asa_cg /*  return:                      -2 (function value became nan in cg)                      -1 (starting function value is nan in cg)                       0 (convergence tolerance satisfied)                       1 (change in func <= feps*|f| in cg)                       2 (cg iterations in all passes or                          in one pass exceeded their limit)                       3 (slope always negative in line search in cg)                       4 (number secant iterations exceed nsecant in cg)                       5 (search direction not a descent direction in cg)                       6 (line search fails in initial interval in cg)                       7 (line search fails during bisection in cg)                       8 (line search fails during interval update in cg)                       9 (debugger is on and the function value increases in cg)                      10 (out of memory)                      11 (cbb iterations in all passes or                          in one pass exceeded their limit)                      12 (line search failed in cbb iteration)                      13 (search direction in cbb is not descent direction)                      14 (function value became nan in cbb) */(    double            *x, /* input: starting guess, output: the solution */    double           *lo, /* lower bounds */    double           *hi, /* upper bounds */    INT32                n, /* problem dimension */    asa_stat       *Stat, /* structure with statistics (can be NULL) */    asacg_parm    *CParm, /* user parameters, NULL = use default parameters */    asa_parm      *AParm, /* user parameters, NULL = use default parameters */    double      grad_tol, /* |Proj (x_k - g_k) - x_k|_inf <= grad_tol */    double      (*value) (double *, INT32),/* f = value (x, n) */    void         (*grad) (double *, double *, INT32),/* grad (g, x, n) */    double    (*valgrad) (double *, double *, INT32),/* f = valgrad (g, x, n),                          NULL = compute value & gradient using value & grad */    double        *Work  /* either work array of size 7n + memory (m) or NULL */){    int gp, ident, j, nfree, status, *ifree ;    INT32 cbb_totit, cg_totit ;    double alpha, gj, pert_lo, pert_hi, t, tl, th, gnorm, ginorm, pgnorm, xnorm,           xj, xg, xp, *work, *d, *g, *xtemp, *gtemp, *pg ;    asacg_parm *cgParm, cgParmStruc ;    asa_parm *asaParm, asaParmStruc ;    asa_com Com ;/* initialize the parameters */    if ( CParm == NULL )    {        cgParm = &cgParmStruc ;        asa_cg_default (cgParm) ;    }    else cgParm = CParm ;    if ( cgParm->PrintParms ) asa_printcgParms (cgParm) ;    if ( AParm == NULL )    {        asaParm = &asaParmStruc ;        asa_default (asaParm) ;    }    else asaParm = AParm ;    if ( asaParm->PrintParms ) asa_printParms (asaParm) ;    /* abort after maxit iterations of cbb in one pass */    if ( asaParm->maxit_fac == INF ) Com.pgmaxit = INT_INF ;    else Com.pgmaxit = (INT32) (((double) n)*asaParm->maxit_fac) ;    /* abort after totit iterations of cbb in all passes */    if ( asaParm->totit_fac == INF ) cbb_totit = INT_INF ;    else cbb_totit = (INT32) (((double) n)*asaParm->totit_fac) ;    /* abort after maxfunc function evaluation in one pass of cbb */    if ( asaParm->maxfunc_fac == INF ) Com.pgmaxfunc = INT_INF ;    else Com.pgmaxfunc = (INT32) (((double) n)*asaParm->maxfunc_fac) ;    /* abort after totit iterations of cg in all passes */    if ( cgParm->totit_fac == INF ) cg_totit = INT_INF ;    else cg_totit = (INT32) (((double) n)*cgParm->totit_fac) ;    pert_lo = asaParm->pert_lo ;    pert_hi = asaParm->pert_hi ;    Com.tau1 = asaParm->tau1 ;    Com.tau2 = asaParm->tau2 ;    Com.cgParm = cgParm ;    Com.asaParm = asaParm ;    Com.x = x ;    Com.n = n ;             /* problem dimension */    Com.n5 = n % 5 ;    Com.nf = (INT32) 0 ;      /* number of function evaluations */    Com.ng = (INT32) 0 ;      /* number of gradient evaluations */    Com.cbbiter = (INT32) 0 ; /* number of cbb iterations evaluations */    Com.cgiter = (INT32) 0 ;  /* number of cg iterations */    Com.AWolfe = cgParm->AWolfe ; /* do not touch user's AWolfe */    Com.AArmijo = asaParm->AArmijo ; /* do not touch user's AArmijo */    Com.value = value ;    Com.grad = grad ;    Com.valgrad = valgrad ;    Com.DimReduce = FALSE ;    ifree = Com.ifree = (int*)malloc (n*sizeof (int)) ;    if ( Work == NULL ) work = (double*)malloc ((5*n+asaParm->m)*sizeof (double)) ;    else                work = Work ;    if ( work == NULL )    {        printf ("Insufficient memory for specified problem dimension %e\n",                 (double) n) ;        status = 10 ;        return (status) ;    }    d = Com.d = work ;    g = Com.g = d+n ;    xtemp = Com.xtemp = g+n ;    gtemp = Com.gtemp = xtemp+n ;    pg = Com.pg = gtemp+n ;    Com.lastfvalues = pg+n ; /* size asaParm->m */    Com.lo = lo ;    Com.hi = hi ;    Com.cbbiter = 0 ;    Com.cbbfunc = 0 ;    Com.cbbgrad = 0 ;    Com.cgiter = 0 ;    Com.cgfunc = 0 ;    Com.cggrad = 0 ;    ident = FALSE ;    xnorm = ZERO ;    for (j = 0; j < n; j++)    {        t = x [j] ;        if      ( t > hi [j] ) t = hi [j] ;        else if ( t < lo [j] ) t = lo [j] ;        x [j] = t ;        if ( xnorm < fabs (t) ) xnorm = fabs (t) ;    }    Com.f = asa_fg (g, x, &Com) ;    pgnorm = ZERO ;    gnorm = ZERO ;    for (j = 0; j < n; j++)    {        xj = x [j] ;        gj = g [j] ;        xg = xj - gj ;        if      ( xg > hi [j] ) xp = hi [j] - xj ;        else if ( xg < lo [j] ) xp = lo [j] - xj ;        else                    xp = -gj ;        pg [j] = xp ;        pgnorm = MAX (pgnorm, fabs (xp)) ;        gnorm = MAX (gnorm, fabs (gj)) ;    }    if ( asaParm->StopRule ) Com.tol = MAX (pgnorm*asaParm->StopFac, grad_tol) ;    else                     Com.tol = grad_tol ;    Com.pgnorm = Com.pgnorm_start = pgnorm ;    if ( asa_tol (pgnorm, &Com) )    {        status = 0 ;        goto Exit ;    }    if ( xnorm != ZERO ) Com.alpha = alpha = xnorm/gnorm ;    else                 Com.alpha = alpha = ONE/gnorm ;    /* compute gradient norm for inactive variables */    ginorm = ZERO ;    nfree = 0 ;    gp = FALSE ;    for (j = 0; j < n; j++)    {        xj = x [j] ;        tl = lo [j] ;        th = hi [j] ;        gj = g [j] ;        xg = xj - alpha*gj ;        if      ( (xg >= th) && (th-xj > pert_hi) ) gp = TRUE ;        else if ( (xg <= tl) && (xj-tl > pert_lo) ) gp = TRUE ;        if ( (xj-tl > pert_lo) && (th - xj > pert_hi) )        {            ginorm = MAX (ginorm, fabs (gj)) ;            ifree [nfree] = j ;            nfree++ ;        }    }    Com.ginorm = ginorm ;    Com.nfree = nfree ;    if ( asaParm->PrintLevel >= 1 )    {        printf ("\ninitial f = %14.6e pgnorm = %14.6e ginorm = %14.6e\n",                 Com.f, pgnorm, ginorm) ;        printf ("            nfree = %i xnorm = %14.6e gp = %i\n",                 nfree, xnorm, gp) ;    }    if ( (ginorm < Com.tau1*pgnorm) || gp || asaParm->GradProjOnly )    {        Com.cbbfunc = 1 ;        Com.cbbgrad = 1 ;        goto Grad_proj ;    }    else    {        Com.cgfunc = 1 ;        Com.cggrad = 1 ;        goto CG_descent ;    }    Grad_proj:    if ( asaParm->PrintLevel >= 1 ) printf ("\nGradProj:\n") ;    Com.DimReduce = FALSE ;    status = asa_grad_proj(&Com) ;    if ( asaParm->PrintLevel >= 1 )    {        printf ("exit Grad_proj\n") ;    }    if ( Com.cbbiter >= cbb_totit ) status = 11 ;    if ( status >= 0 ) goto Exit ;    /* extract free variable */    nfree = 0 ;    for (j = 0; j < n; j++)    {        xj = x [j] ;        if ( (xj-lo [j] > pert_lo) && (hi [j] - xj > pert_hi) )        {            ifree [nfree] = j ;            nfree++ ;        }    }    Com.nfree = nfree ;    CG_descent:    if ( nfree != n )    {       asa_shrink_all (&Com) ;       asa_copy (xtemp+nfree, x+nfree, n-nfree) ;       Com.DimReduce = TRUE ;    }    else Com.DimReduce = FALSE ;    if ( asaParm->PrintLevel >= 1 ) printf ("\nCG:\n") ;    status = asa_descent (&Com) ;    if ( asaParm->PrintLevel >= 1 )    {        printf ("exit the CG subroutine\n") ;    }    if ( Com.DimReduce ) asa_expand_all (&Com) ;    if ( Com.cgiter >= cg_totit ) status = 2 ;    if ( status >= -2 ) goto Exit ;    /* ginorm < tau2* pgnorm without hitting boundary */    if ( status == -5 )    {        Com.alpha = asa_init_bbstep (&Com) ;        goto Grad_proj ;    }    /* ginorm >= tau2* pgnorm and many components of x hit boundary  */    else if ( status == -4 )    {        ginorm = ZERO ;        nfree = 0 ;        for (j = 0 ; j < n; j++)        {            xj = x [j] ;            if ( (xj-lo [j] > pert_lo) && (hi [j] - xj > pert_hi) )            {                t = fabs (g [j]) ;                ginorm = MAX (ginorm, t) ;                ifree [nfree] = j ;                nfree++ ;            }        }        Com.nfree = nfree ;        Com.ginorm = ginorm ;        if ( ginorm >= Com.tau1*Com.pgnorm ) goto CG_descent ;        else        {           if ( asaParm->PrintLevel >= 1 ) printf ("ginorm < tau1* pgnorm\n") ;           Com.alpha = asa_init_bbstep (&Com) ;           goto Grad_proj ;        }    }    /* ginorm >= tau2* pgnorm and only one component of x hits boundary */    else if ( status == -3 )    {        if ( pgnorm < asaParm->pgdecay*MAX (Com.pgnorm_start, ONE) )        {            ident = asa_identify (x, g, Com.pgnorm, &Com) ;        }        if ( ident )        {            ident = FALSE ;            ginorm = ZERO ;            nfree = 0 ;            for (j = 0 ; j < n; j++)            {                xj = x [j] ;                if ( (xj-lo [j] > pert_lo) && (hi [j] - xj > pert_hi) )                {                    t = fabs (g [j]) ;                    ginorm = MAX (ginorm, t) ;                    ifree [nfree] = j ;                    nfree++ ;                }            }            Com.nfree = nfree ;            Com.ginorm = ginorm ;            if ( ginorm >= Com.tau1*Com.pgnorm ) goto CG_descent ;            else            {               if ( asaParm->PrintLevel >= 1 )                   printf ("ginorm < tau1* pgnorm\n" ) ;               Com.alpha = asa_init_bbstep (&Com) ;               goto Grad_proj ;            }        }        else        {            Com.alpha = asa_init_bbstep (&Com) ;            goto Grad_proj ;        }    }    Exit:    if ( (asaParm->PrintFinal) || (asaParm->PrintLevel >= 1) )    {        const char mess1 [] = "Possible causes of this error message:" ;        const char mess2 [] = "   - your tolerance may be too strict: "                              "grad_tol = " ;        const char mess4 [] = "   - your gradient routine has an error" ;        const char mess5 [] = "   - the parameter epsilon in "                              "asa_descent_c.parm is too small" ;        printf ("\nFinal convergence status = %d\n", status);        if ( status == -2 )        {            printf ("Function value became nan at cg iteration %10.0e\n",                     (double) Com.cgiter) ;        }        else if ( status == -1 )        {            printf ("Function value of starting point is nan at "                     "cg iteration %10.0f\n", (double) Com.cgiter) ;        }        else if ( status == 0 )        {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产永久精品大片wwwapp| 九色综合狠狠综合久久| 日韩精品一区二区三区中文不卡| 国内精品国产三级国产a久久| 国产精品色一区二区三区| 欧美久久久一区| 99九九99九九九视频精品| 免费看日韩a级影片| 亚洲美女免费视频| 中文字幕第一区| 欧美xxxx老人做受| 欧美日韩1区2区| 欧美性色黄大片| 北条麻妃一区二区三区| 国产精品综合视频| 免费看日韩精品| 亚洲成人手机在线| 自拍偷在线精品自拍偷无码专区| 久久天堂av综合合色蜜桃网| 欧美日韩另类一区| 91丝袜美腿高跟国产极品老师| 黄页网站大全一区二区| 日本亚洲视频在线| 亚洲成人在线观看视频| 樱花影视一区二区| 亚洲色图在线看| 中文字幕va一区二区三区| 久久精品视频在线看| 欧美www视频| 欧美一级一级性生活免费录像| 欧美精品在线一区二区三区| 欧美日韩国产综合一区二区| 欧美午夜理伦三级在线观看| 欧洲亚洲精品在线| 色播五月激情综合网| 色一情一乱一乱一91av| 91小视频免费看| www.日韩精品| 99国产精品国产精品久久| jlzzjlzz亚洲女人18| yourporn久久国产精品| 99综合影院在线| 95精品视频在线| 成人国产精品免费观看动漫| 波多野结衣精品在线| av福利精品导航| 99riav久久精品riav| 色婷婷精品久久二区二区蜜臂av | 色久优优欧美色久优优| 99精品视频一区二区| 色综合天天综合网天天看片| 色伊人久久综合中文字幕| 欧美日韩日日夜夜| 欧美一卡二卡三卡| 久久蜜桃香蕉精品一区二区三区| 久久精品亚洲麻豆av一区二区| 国产精品视频yy9299一区| 最新热久久免费视频| 亚洲一区二区三区在线| 三级亚洲高清视频| 国内精品在线播放| 成人看片黄a免费看在线| 91精品免费观看| 国产日韩精品一区二区浪潮av| 色婷婷国产精品综合在线观看| 国产成人高清在线| 国产综合久久久久久鬼色| 蜜臀av国产精品久久久久| 日韩国产一二三区| 成人av高清在线| 国产欧美一区二区三区在线看蜜臀 | 国产精品国产a| 亚洲精选视频在线| 亚洲成人第一页| 韩国女主播成人在线观看| av影院午夜一区| 欧美人狂配大交3d怪物一区 | 亚洲一区二三区| 秋霞国产午夜精品免费视频| 粉嫩久久99精品久久久久久夜| 色菇凉天天综合网| 精品国产一区二区三区四区四| 国产精品国产三级国产三级人妇 | 日韩va欧美va亚洲va久久| 国产麻豆午夜三级精品| 欧洲一区二区三区在线| 久久久久久久久99精品| 亚洲国产视频网站| 高清久久久久久| 在线播放91灌醉迷j高跟美女 | 一区二区三区蜜桃网| 久久99精品久久久久久动态图 | 国产精品少妇自拍| 全国精品久久少妇| 色婷婷综合激情| 久久久久亚洲蜜桃| 天天色图综合网| 成人午夜激情片| 日韩一级二级三级| 亚洲午夜精品在线| 成人激情视频网站| 欧美精品一区二| 丝袜美腿高跟呻吟高潮一区| 99re视频这里只有精品| 亚洲精品一区二区三区在线观看| 亚洲午夜国产一区99re久久| 成人黄色免费短视频| 2024国产精品视频| 日韩中文字幕一区二区三区| 91在线观看成人| 久久久久9999亚洲精品| 日本伊人色综合网| 欧美日韩国产大片| 亚洲一区二区不卡免费| 色婷婷亚洲婷婷| 亚洲品质自拍视频| 99久久久免费精品国产一区二区 | 国产清纯美女被跳蛋高潮一区二区久久w | 亚洲精品视频在线| 暴力调教一区二区三区| 精品国产一区二区三区四区四| 石原莉奈在线亚洲二区| 欧美日韩激情在线| 五月开心婷婷久久| 欧美日韩一区二区三区四区| 一区二区三区国产| 91蝌蚪国产九色| 亚洲色大成网站www久久九九| av午夜精品一区二区三区| 国产精品高潮呻吟久久| 成+人+亚洲+综合天堂| 中文字幕精品一区二区三区精品| 国产福利精品一区| 久久久国产精品午夜一区ai换脸| 久久国产婷婷国产香蕉| 精品国产亚洲在线| 国产尤物一区二区| 中文字幕乱码日本亚洲一区二区| 懂色av噜噜一区二区三区av| 久久久高清一区二区三区| 成人丝袜18视频在线观看| 最新日韩在线视频| 日本高清无吗v一区| 亚洲一二三四在线| 欧美高清视频不卡网| 美女网站一区二区| 国产视频在线观看一区二区三区| 国产精品影视天天线| 欧美韩国日本不卡| 色综合色狠狠综合色| 亚洲高清一区二区三区| 欧美一级生活片| 国产不卡在线播放| 亚洲乱码精品一二三四区日韩在线| 一本一本大道香蕉久在线精品| 亚洲丰满少妇videoshd| 欧美精品久久99久久在免费线| 热久久一区二区| 久久精品一区蜜桃臀影院| 不卡一卡二卡三乱码免费网站| 亚洲九九爱视频| 日韩欧美一区二区视频| 成人做爰69片免费看网站| 一个色综合av| 欧美一级一区二区| 丁香另类激情小说| 亚洲国产精品一区二区www| 日韩欧美综合在线| 91婷婷韩国欧美一区二区| 日韩av电影免费观看高清完整版| 久久久久久久久岛国免费| 色天使色偷偷av一区二区| 蜜臀av性久久久久蜜臀aⅴ流畅| 国产精品三级av在线播放| 欧美少妇bbb| 国产大陆a不卡| 亚洲gay无套男同| 国产无遮挡一区二区三区毛片日本| 色综合久久中文字幕| 韩国一区二区在线观看| 一区二区三区四区中文字幕| 日韩精品一区二区三区视频在线观看 | 国产欧美视频一区二区三区| 欧美性猛交xxxxxx富婆| 精品亚洲成av人在线观看| 亚洲精品乱码久久久久久日本蜜臀| 日韩视频一区二区三区| 91在线无精精品入口| 精品亚洲国产成人av制服丝袜| 一区二区免费在线| 中文字幕精品综合| 日韩欧美www| 欧美午夜一区二区三区 | 色综合天天性综合| 国产在线精品一区在线观看麻豆| 亚洲狠狠丁香婷婷综合久久久| 久久综合狠狠综合久久激情| 欧美日韩国产一区| 91性感美女视频| 成人综合激情网|