Lines Matching refs:stp
10 static PetscErrorCode Tao_mcstep(TaoLineSearch ls, PetscReal *stx, PetscReal *fx, PetscReal *dx, PetscReal *sty, PetscReal *fy, PetscReal *dy, PetscReal *stp, PetscReal *fp, PetscReal *dp);
312 value. the parameter stp contains the current step. it is
320 subroutine mcstep(stx,fx,dx,sty,fy,dy,stp,fp,dp,bracket,
328 of the step, that is, dx and stp-stx must have opposite
336 stp, fp, and dp are variables which specify the step,
338 If bracket is set true then on input stp must be
339 between stx and sty. On output stp is set to the new step.
363 static PetscErrorCode Tao_mcstep(TaoLineSearch ls, PetscReal *stx, PetscReal *fx, PetscReal *dx, PetscReal *sty, PetscReal *fy, PetscReal *dy, PetscReal *stp, PetscReal *fp, PetscReal *dp)
372 PetscCheck(!mtP->bracket || (*stp > PetscMin(*stx, *sty) && *stp < PetscMax(*stx, *sty)), PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "bad stp in bracket");
373 PetscCheck(*dx * (*stp - *stx) < 0.0, PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "dx * (stp-stx) >= 0.0");
387 theta = 3 * (*fx - *fp) / (*stp - *stx) + *dx + *dp;
391 if (*stp < *stx) gamma1 = -gamma1;
396 stpc = *stx + r * (*stp - *stx);
397 stpq = *stx + ((*dx / ((*fx - *fp) / (*stp - *stx) + *dx)) * 0.5) * (*stp - *stx);
410 theta = 3 * (*fx - *fp) / (*stp - *stx) + *dx + *dp;
414 if (*stp > *stx) gamma1 = -gamma1;
418 stpc = *stp + r * (*stx - *stp);
419 stpq = *stp + (*dp / (*dp - *dx)) * (*stx - *stp);
421 if (PetscAbsReal(stpc - *stp) > PetscAbsReal(stpq - *stp)) stpf = stpc;
429 is beyond stp. Otherwise the cubic step is defined to be
436 theta = 3 * (*fx - *fp) / (*stp - *stx) + *dx + *dp;
443 if (*stp > *stx) gamma1 = -gamma1;
447 if (r < 0.0 && gamma1 != 0.0) stpc = *stp + r * (*stx - *stp);
448 else if (*stp > *stx) stpc = ls->stepmax;
450 stpq = *stp + (*dp / (*dp - *dx)) * (*stx - *stp);
453 if (PetscAbsReal(*stp - stpc) < PetscAbsReal(*stp - stpq)) stpf = stpc;
456 if (PetscAbsReal(*stp - stpc) > PetscAbsReal(*stp - stpq)) stpf = stpc;
468 theta = 3 * (*fp - *fy) / (*sty - *stp) + *dy + *dp;
472 if (*stp > *sty) gamma1 = -gamma1;
476 stpc = *stp + r * (*sty - *stp);
478 } else if (*stp > *stx) {
489 *sty = *stp;
498 *stx = *stp;
506 *stp = stpf;
508 if (*sty > *stx) *stp = PetscMin(*stx + 0.66 * (*sty - *stx), *stp);
509 else *stp = PetscMax(*stx + 0.66 * (*sty - *stx), *stp);