next up previous
Next: Aplicaciones Up: Manejo del Jacobiano Previous: Gradientes - Modo Reverso

Ejemplo Modo Reverso

Se utilizará el mismo código de ejemplo antes mostrado.


      SUBROUTINE SUB1_B(first, firstb, other, otherb, third, thirdb, out
     +                  , outb, res, resb)
      REAL first, firstb, other, otherb, out, outb, res, resb, third,
     +     thirdb
      REAL x(14), y
      COMMON /cc/ x, y
      INTRINSIC COS, EXP, SIN
C start mixing all variables :
      out = first * other + 3.0 * third
      res = SIN(first) + COS(other)
      CALL PUSHREAL8(first)
      first = 2.0 * first
      third = 2.0 / other
C now overwrite some values...
      IF (first .GT. other) THEN
        first = COS(out)
        CALL PUSHREAL8(other)
        other = 1.0
        CALL POPREAL8(other)
        outb = outb - SIN(out) * firstb
      ELSE
C ...in one or in all cases
        first = EXP(out)
        CALL PUSHREAL8(other)
        other = 1.0
        CALL POPREAL8(other)
        outb = outb + EXP(out) * firstb
      END IF
      CALL POPREAL8(first)
      otherb = -(2.0*thirdb/other**2) - SIN(other) * resb + first * outb
      firstb = COS(first) * resb + other * outb
      resb = 0.0
      outb = 0.0
      thirdb = 0.0
      END



Mauricio Araya 2003-04-08