Ë L i“bãó(—ddlZ Gd„d«Zd„Zy)éNcó$—eZdZdZd„Zdd„Zd„Zy)ÚDCSRCHa- Parameters ---------- phi : callable phi(alpha) Function at point `alpha` derphi : callable phi'(alpha) Objective function derivative. Returns a scalar. ftol : float A nonnegative tolerance for the sufficient decrease condition. gtol : float A nonnegative tolerance for the curvature condition. xtol : float A nonnegative relative tolerance for an acceptable step. The subroutine exits with a warning if the relative difference between sty and stx is less than xtol. stpmin : float A nonnegative lower bound for the step. stpmax : A nonnegative upper bound for the step. Notes ----- This subroutine finds a step that satisfies a sufficient decrease condition and a curvature condition. Each call of the subroutine updates an interval with endpoints stx and sty. The interval is initially chosen so that it contains a minimizer of the modified function psi(stp) = f(stp) - f(0) - ftol*stp*f'(0). If psi(stp) <= 0 and f'(stp) >= 0 for some step, then the interval is chosen so that it contains a minimizer of f. The algorithm is designed to find a step that satisfies the sufficient decrease condition f(stp) <= f(0) + ftol*stp*f'(0), and the curvature condition abs(f'(stp)) <= gtol*abs(f'(0)). If ftol is less than gtol and if, for example, the function is bounded below, then there is always a step which satisfies both conditions. If no step can be found that satisfies both conditions, then the algorithm stops with a warning. In this case stp only satisfies the sufficient decrease condition. A typical invocation of dcsrch has the following outline: Evaluate the function at stp = 0.0d0; store in f. Evaluate the gradient at stp = 0.0d0; store in g. Choose a starting step stp. task = 'START' 10 continue call dcsrch(stp,f,g,ftol,gtol,xtol,task,stpmin,stpmax, isave,dsave) if (task .eq. 'FG') then Evaluate the function and the gradient at stp go to 10 end if NOTE: The user must not alter work arrays between calls. The subroutine statement is subroutine dcsrch(f,g,stp,ftol,gtol,xtol,stpmin,stpmax, task,isave,dsave) where stp is a double precision variable. On entry stp is the current estimate of a satisfactory step. On initial entry, a positive initial estimate must be provided. On exit stp is the current estimate of a satisfactory step if task = 'FG'. If task = 'CONV' then stp satisfies the sufficient decrease and curvature condition. f is a double precision variable. On initial entry f is the value of the function at 0. On subsequent entries f is the value of the function at stp. On exit f is the value of the function at stp. g is a double precision variable. On initial entry g is the derivative of the function at 0. On subsequent entries g is the derivative of the function at stp. On exit g is the derivative of the function at stp. ftol is a double precision variable. On entry ftol specifies a nonnegative tolerance for the sufficient decrease condition. On exit ftol is unchanged. gtol is a double precision variable. On entry gtol specifies a nonnegative tolerance for the curvature condition. On exit gtol is unchanged. xtol is a double precision variable. On entry xtol specifies a nonnegative relative tolerance for an acceptable step. The subroutine exits with a warning if the relative difference between sty and stx is less than xtol. On exit xtol is unchanged. task is a character variable of length at least 60. On initial entry task must be set to 'START'. On exit task indicates the required action: If task(1:2) = 'FG' then evaluate the function and derivative at stp and call dcsrch again. If task(1:4) = 'CONV' then the search is successful. If task(1:4) = 'WARN' then the subroutine is not able to satisfy the convergence conditions. The exit value of stp contains the best point found during the search. If task(1:5) = 'ERROR' then there is an error in the input arguments. On exit with convergence, a warning or an error, the variable task contains additional information. stpmin is a double precision variable. On entry stpmin is a nonnegative lower bound for the step. On exit stpmin is unchanged. stpmax is a double precision variable. On entry stpmax is a nonnegative upper bound for the step. On exit stpmax is unchanged. isave is an integer work array of dimension 2. dsave is a double precision work array of dimension 13. Subprograms called MINPACK-2 ... dcstep MINPACK-1 Project. June 1983. Argonne National Laboratory. Jorge J. More' and David J. Thuente. MINPACK-2 Project. November 1993. Argonne National Laboratory and University of Minnesota. Brett M. Averick, Richard G. Carter, and Jorge J. More'. có*—d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_ d|_ d|_ d|_ d|_ ||_||_||_||_||_||_||_y)N)ÚstageÚginitÚgtestÚgxÚgyÚfinitÚfxÚfyÚstxÚstyÚstminÚstmaxÚwidthÚwidth1ÚftolÚgtolÚxtolÚstpminÚstpmaxÚphiÚderphi)Úselfrrrrrrrs ú\/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/scipy/optimize/_dcsrch.pyÚ__init__zDCSRCH.__init__®s—€ØˆŒ ؈Œ ؈Œ ؈ŒØˆŒØˆŒ ؈ŒØˆŒØˆŒØˆŒØˆŒ ؈Œ ؈Œ ؈Œ ðˆŒ ØˆŒ ؈Œ ؈Œ ؈Œ àˆŒØˆ óNcóv—|€|jd«}|€|jd«}|}|}d}t|«D]d}|j||||«\} }}}t j | «sd}d} n4|dddk(r%| }|j| «}|j| «}Œdnd} d}|ddd k(s|dd dk(rd} | |||fS) a Parameters ---------- alpha1 : float alpha1 is the current estimate of a satisfactory step. A positive initial estimate must be provided. phi0 : float the value of `phi` at 0 (if known). derphi0 : float the derivative of `derphi` at 0 (if known). maxiter : int Returns ------- alpha : float Step size, or None if no suitable step was found. phi : float Value of `phi` at the new point `alpha`. phi0 : float Value of `phi` at `alpha=0`. task : bytes On exit task indicates status information. If task[:4] == b'CONV' then the search is successful. If task[:4] == b'WARN' then the subroutine is not able to satisfy the convergence conditions. The exit value of stp contains the best point found during the search. If task[:5] == b'ERROR' then there is an error in the input arguments. NçóSTARTóWARNéóFGs6WARNING: dcsrch did not converge within max iterationséóERRORé)rrÚrangeÚ_iterateÚnpÚisfinite) rÚalpha1Úphi0Úderphi0ÚmaxiterÚphi1Úderphi1ÚtaskÚiÚstps rÚ__call__zDCSRCH.__call__Ésõ€ðB ˆ<Ø—8‘8˜C“=ˆDØ ˆ?Ø—k‘k #Ó&ˆGàˆØˆàˆÜw“ò MˆAØ'+§}¡}ؘ˜g tó(Ñ $ˆCw ô—;‘;˜sÔ#ØØÙàBQˆx˜5Ò ØØ—x‘x “}ØŸ+™+ cÓ*‘áð Mð$ˆCØLˆDà ˆ8xÒ  4¨¨ 8¨wÒ#6؈CàD˜$ Ð$Ð$rcó(—d}d}d}d}|dddk(rp||jkrd}||jkDrd }|d k\rd }|jd krd }|jd krd }|jd krd}|jd krd}|j|jkrd}|dddk(r||||fSd|_d|_||_||_|j|jz|_ |j|jz |_ |j|z |_ d|_ |j|_ |j|_d|_|j|_|j|_d |_|||zz|_d}||||fS|j||jzz} |j dk(r|| kr |d k\rd|_|j r ||j$ks||j&k\rd}|j r5|j&|j$z |j|j&zkrd}||jk(r|| kr||jkrd}||jk(r|| kDs||jk\rd}|| kr(t)|«|j|j zkrd}|dddk(s|dddk(r||||fS|j dk(r¢||jkr’|| kDrŒ|||jzz } |j|j|jzz } |j |j|jzz } ||jz } |j|jz }|j"|jz }t+j,dd¬ «5t/|j| ||j| ||| | |j |j$|j&« }|\|_ } }|_} }}|_ddd«| |j|jzz|_ | |j|jzz|_||jz|_||jz|_n¾t+j,dd¬ «5t/|j|j|j|j|j |j"||||j |j$|j&« }ddd«\|_ |_ |_|_|_|_}|_|j r“t)|j|jz «||jzk\r)|j||j|jz zz}|j|_ t)|j|jz «|_ |j rKt1|j|j«|_t3|j|j«|_n4||||jz zz|_||||jz zz|_t+j4||j|j«}|j r||j$ksN||j&k\s?|j r?|j&|j$z |j|j&zkr |j}d}||||fS#1swYŒxYw#1swYŒxYw)!aÙ Parameters ---------- stp : float The current estimate of a satisfactory step. On initial entry, a positive initial estimate must be provided. f : float On first call f is the value of the function at 0. On subsequent entries f should be the value of the function at stp. g : float On initial entry g is the derivative of the function at 0. On subsequent entries g is the derivative of the function at stp. task : bytes On initial entry task must be set to 'START'. On exit with convergence, a warning or an error, the variable task contains additional information. Returns ------- stp, f, g, task: tuple stp : float the current estimate of a satisfactory step if task = 'FG'. If task = 'CONV' then stp satisfies the sufficient decrease and curvature condition. f : float the value of the function at stp. g : float the derivative of the function at stp. task : bytes On exit task indicates the required action: If task(1:2) == b'FG' then evaluate the function and derivative at stp and call dcsrch again. If task(1:4) == b'CONV' then the search is successful. If task(1:4) == b'WARN' then the subroutine is not able to satisfy the convergence conditions. The exit value of stp contains the best point found during the search. If task(1:5) == b'ERROR' then there is an error in the input arguments. gà?ç…ëQ¸å?gš™™™™™ñ?g@Nr%r!sERROR: STP .LT. STPMINsERROR: STP .GT. STPMAXrsERROR: INITIAL G .GE. ZEROsERROR: FTOL .LT. ZEROsERROR: GTOL .LT. ZEROsERROR: XTOL .LT. ZEROsERROR: STPMIN .LT. ZEROsERROR: STPMAX .LT. STPMINr&Fér r$r#s)WARNING: ROUNDING ERRORS PREVENT PROGRESSsWARNING: XTOL TEST SATISFIEDsWARNING: STP = STPMAXsWARNING: STP = STPMINs CONVERGENCEr'r"sCONVÚignore)ÚinvalidÚover)rrrrrÚbracktrr rrrrrr r rr r rrÚabsr*ÚerrstateÚdcstepÚminÚmaxÚclip)rr4ÚfÚgr2Úp5Úp66ÚxtraplÚxtrapuÚftestÚfmÚfxmÚfymÚgmÚgxmÚgymÚtups rr)zDCSRCH._iterate s€ð^ˆØˆØˆØˆà ˆ8xÓ ØT—[‘[Ò Ø0ØT—[‘[Ò Ø0ØAŠvØ4Øy‰y˜1Š}Ø/Øy‰y˜1Š}Ø/Øy‰y˜1Š}Ø/Ø{‰{˜QŠØ1Ø{‰{˜TŸ[™[Ò(Ø3àBQˆx˜8Ò#ؘA˜q $Ð&ð ˆDŒK؈DŒJ؈DŒJ؈DŒJØŸ™ T§Z¡ZÑ/ˆDŒJØŸ™ t§{¡{Ñ2ˆDŒJØŸ*™* r™/ˆDŒKðˆDŒHØ—j‘jˆDŒGØ—j‘jˆDŒG؈DŒHØ—j‘jˆDŒGØ—j‘jˆDŒG؈DŒJؘv¨™|Ñ+ˆDŒJ؈Dؘ˜1˜d?Ð "ð— ‘ ˜S 4§:¡:Ñ-Ñ-ˆà :‰:˜Š?˜q Ešz¨a°1ªf؈DŒJð ;Š;˜C 4§:¡:Ò-°¸¿ ¹ Ò1BØ?ˆDØ ;Š;˜4Ÿ:™:¨¯ © Ñ2°d·i±iÀ$Ç*Á*Ñ6LÒLØ2ˆDØ $—+‘+Ò  ! u¢*°°d·j±j²Ø+ˆDØ $—+‘+Ò  1 u¢9°°T·Z±Z²Ø+ˆDð Š:œ#˜a›& D§I¡I°·±° Ñ$;Ò;Ø!ˆDð ˆ8wÒ  $ r¨ (¨gÒ"5ؘ˜1˜d?Ð "ð :‰:˜‹?˜q D§G¡G›|°°E³ àS˜4Ÿ:™:Ñ%Ñ%ˆBØ—'‘'˜DŸH™H t§z¡zÑ1Ñ1ˆCØ—'‘'˜DŸH™H t§z¡zÑ1Ñ1ˆCØT—Z‘Z‘ˆBØ—'‘'˜DŸJ™JÑ&ˆCØ—'‘'˜DŸJ™JÑ&ˆCô —‘ X°HÔ=ñ OÜØ—H‘HØØØ—H‘HØØØØØØ—K‘KØ—J‘JØ—J‘Jó ðLOÑH”˜#˜s D¤H¨c°3¸¸T¼[÷ Oð$˜DŸH™H t§z¡zÑ1Ñ1ˆDŒGؘDŸH™H t§z¡zÑ1Ñ1ˆDŒGؘDŸJ™JÑ&ˆDŒGؘDŸJ™JÑ&ˆDGô—‘ X°HÔ=ñ ÜØ—H‘HØ—G‘GØ—G‘GØ—H‘HØ—G‘GØ—G‘GØØØØ—K‘KØ—J‘JØ—J‘Jó ÷ ð0ñ Ø”Ø”Ø”Ø”Ø”Ø”ØØ” ð ;Š;Ü4—8‘8˜dŸh™hÑ&Ó'¨3°·±Ñ+<Ò<Ø—h‘h  t§x¡x°$·(±(Ñ':Ñ!;Ñ;ØŸ*™*ˆDŒKܘTŸX™X¨¯©Ñ0Ó1ˆDŒJð ;Š;ܘTŸX™X t§x¡xÓ0ˆDŒJܘTŸX™X t§x¡xÓ0ˆDJà˜v¨¨t¯x©x©Ñ8Ñ8ˆDŒJؘv¨¨t¯x©x©Ñ8Ñ8ˆDŒJôg‰gc˜4Ÿ;™;¨¯ © Ó4ˆð KŠKؘŸ ™ Ò" c¨T¯Z©ZÒ&7à— ’ Ø—J‘J §¡Ñ+¨t¯y©y¸4¿:¹:Ñ/EÒEð—(‘(ˆCðˆØAq˜$ˆÐ÷m Oñ Oú÷8 ñ úsÎA#[:ÒA1\Û:\Ü\)NNéd)Ú__name__Ú __module__Ú __qualname__Ú__doc__rr5r)©rrrrs„ñZòxó6B%óHfrrc ó(—tj|«} tj|«} | | z}||kDrßd||z z||z z |z|z}tt|«t|«t|««}|tj||z dz||z ||z zz «z}||kr|dz}||z |z}||z |z|z}||z }||||z zz}||||z ||z z |zz dz ||z zz}t||z «t||z «kr|}n |||z dz z}d} n×|dkrÊd||z z||z z |z|z}tt|«t|«t|««}|tj||z dz||z ||z zz «z}||kDr|dz}||z |z}||z |z|z}||z }||||z zz}||||z z ||z zz}t||z «t||z «kDr|}n|}d} nt|«t|«krPd||z z||z z |z|z}tt|«t|«t|««}|tjtd||z dz||z ||z zz ««z}||kDr| }||z |z}|||z z|z}||z }|dkr|dk7r ||||z zz}n ||kDr| }n| }||||z z ||z zz}| rSt||z «t||z «kr|}n|}||kDrt |d ||z zz|«}nðt|d ||z zz|«}nÚt||z «t||z «kDr|}n|}tj || | «}n | r”d||z z||z z |z|z}tt|«t|«t|««}|tj||z dz||z ||z zz «z}||kDr| }||z |z}||z |z|z}||z }||||z zz}|}n ||kDr| }n| }||kDr|}|}|}n|dkr|}|}|}|}|}|}|}|||||||| fS) a¯ Subroutine dcstep This subroutine computes a safeguarded step for a search procedure and updates an interval that contains a step that satisfies a sufficient decrease and a curvature condition. The parameter stx contains the step with the least function value. If brackt is set to .true. then a minimizer has been bracketed in an interval with endpoints stx and sty. The parameter stp contains the current step. The subroutine assumes that if brackt is set to .true. then min(stx,sty) < stp < max(stx,sty), and that the derivative at stx is negative in the direction of the step. The subroutine statement is subroutine dcstep(stx,fx,dx,sty,fy,dy,stp,fp,dp,brackt, stpmin,stpmax) where stx is a double precision variable. On entry stx is the best step obtained so far and is an endpoint of the interval that contains the minimizer. On exit stx is the updated best step. fx is a double precision variable. On entry fx is the function at stx. On exit fx is the function at stx. dx is a double precision variable. On entry dx is the derivative of the function at stx. The derivative must be negative in the direction of the step, that is, dx and stp - stx must have opposite signs. On exit dx is the derivative of the function at stx. sty is a double precision variable. On entry sty is the second endpoint of the interval that contains the minimizer. On exit sty is the updated endpoint of the interval that contains the minimizer. fy is a double precision variable. On entry fy is the function at sty. On exit fy is the function at sty. dy is a double precision variable. On entry dy is the derivative of the function at sty. On exit dy is the derivative of the function at the exit sty. stp is a double precision variable. On entry stp is the current step. If brackt is set to .true. then on input stp must be between stx and sty. On exit stp is a new trial step. fp is a double precision variable. On entry fp is the function at stp On exit fp is unchanged. dp is a double precision variable. On entry dp is the derivative of the function at stp. On exit dp is unchanged. brackt is an logical variable. On entry brackt specifies if a minimizer has been bracketed. Initially brackt must be set to .false. On exit brackt specifies if a minimizer has been bracketed. When a minimizer is bracketed brackt is set to .true. stpmin is a double precision variable. On entry stpmin is a lower bound for the step. On exit stpmin is unchanged. stpmax is a double precision variable. On entry stpmax is an upper bound for the step. On exit stpmax is unchanged. MINPACK-1 Project. June 1983 Argonne National Laboratory. Jorge J. More' and David J. Thuente. MINPACK-2 Project. November 1993. Argonne National Laboratory and University of Minnesota. Brett M. Averick and Jorge J. More'. g@r#éÿÿÿÿg@Tr érr7)r*ÚsignrAr=Úsqrtr@rB)rr Údxrr Údyr4ÚfpÚdpr<rrÚsgn_dpÚsgn_dxÚsgndÚthetaÚsÚgammaÚpÚqÚrÚstpcÚstpqÚstpfs rr?r?ös€ôxW‰WR‹[€FÜ W‰WR‹[€Fð F‰?€Dð  ˆB‚wØr˜B‘w‘ 3¨¡9Ñ-°Ñ2°RÑ7ˆÜ ”E“ œC ›G¤S¨£WÓ -ˆØ”B—G‘G˜U Q™Y¨1Ñ,°°Q±¸2À¹6Ñ/BÑBÓCÑCˆØ Š9Ø R‰KˆEØ R‰Z˜5Ñ ˆØb‰j˜EÑ ! RÑ 'ˆØ ‰EˆØQ˜# ™)‘_Ñ$ˆØr˜b 2™g¨#°©)Ñ4°rÑ9Ñ:¸cÑAÀcÈCÁiÑPÑPˆÜ ˆtc‰z‹?œc $¨¡*›oÒ -؉Dà˜4 $™;¨#Ñ-Ñ-ˆDØŠØ Šð R˜"‘W‘   s¡Ñ+¨bÑ0°2Ñ5ˆÜ ”E“ œC ›G¤S¨£WÓ -ˆØ”B—G‘G˜U Q™Y¨1Ñ,°°Q±¸2À¹6Ñ/BÑBÓCÑCˆØ Š9Ø R‰KˆEØ R‰Z˜5Ñ ˆØb‰j˜EÑ ! RÑ 'ˆØ ‰EˆØQ˜# ™)‘_Ñ$ˆØb˜B ™G‘n¨¨s©Ñ3Ñ3ˆÜ ˆtc‰z‹?œS ¨¡›_Ò ,؉DàˆDØŠÜ ˆR‹”3r“7Ó ðR˜"‘W‘   s¡Ñ+¨bÑ0°2Ñ5ˆÜ ”E“ œC ›G¤S¨£WÓ -ˆð”B—G‘GœC  E¨A¡I°!Ñ#3°r¸A±vÀ"ÀqÁ&Ñ6IÑ#IÓJÓKÑKˆØ Š9ØFˆEØ R‰Z˜5Ñ ˆØ b˜2‘gÑ  %Ñ 'ˆØ ‰EˆØ ˆqŠ5U˜a’Zؘ˜c C™i™Ñ(‰DØ 3ŠY؉DàˆDØb˜B ™G‘n¨¨s©Ñ3Ñ3ˆá ô4˜#‘:‹¤ T¨C¡Z£Ò0Ø‘ààSŠyܘ3 ¨¨s©Ñ!3Ñ3°TÓ:‘ä˜3 ¨¨s©Ñ!3Ñ3°TÓ:‘ô 4˜#‘:‹¤ T¨C¡Z£Ò0Ø‘àÜ—7‘7˜4 ¨Ó0‰Dñ ؘ2 ™7‘O s¨S¡yÑ1°BÑ6¸Ñ;ˆEÜ”C˜“J¤ B£¬¨R«Ó1ˆAØœŸ™ ¨¡¨qÑ 0°B¸±F¸rÀA¹vÑ3FÑ FÓGÑGˆEØSŠyؘؘ‘˜uÑ$ˆAؘ"‘* Ñ%¨Ñ+ˆAØA‘ˆAؘ˜c C™i™Ñ(ˆD؉DØ 3ŠY؉DàˆDð ˆB‚wØˆØ ˆØ ‰à !Š8؈C؈B؈BØˆØ ˆØ ˆð €Cà B˜˜R  S¨&Ð 0Ð0r)Únumpyr*rr?rVrrúrms ðÛð ÷bñbóJb1r