Home > source > @penlab > phi2_D.m

# phi2_D

## PURPOSE

Derivative od penalty function for augmented Lagrangian function.

## SYNOPSIS

function [ret] = phi2_D(obj,t)

## DESCRIPTION

      Derivative od penalty function for augmented Lagrangian function.
      function [ret] = phi2_D(t)  ... first derivative of the penalty function
        input can be double scalar/vector/... whatever,
        return values are of the same type

## CROSS-REFERENCE INFORMATION

This function calls:

This function is called by:

- penlab PenLab (Pennon Laboratory for Matlab, previously PennonM)

## SOURCE CODE

    0001   function [ret] = phi2_D(obj,t)
    0002 %  Derivative od penalty function for augmented Lagrangian function.
    0003 %  function [ret] = phi2_D(t)  ... first derivative of the penalty function
    0004 %    input can be double scalar/vector/... whatever,
    0005 %    return values are of the same type
    0006 %
    0007
    0008   R=obj.allopts.phi_R;
    0009
    0010   ret=t;
    0011   if (R < 0)
    0012     ind = t < R;
    0013     ret(ind) = (1+R)^2 ./ (1+2*R-t(ind));
    0014     ret(~ind) = 1. + t(~ind);
    0015   else
    0016     ind = t < R;
    0017     ret(ind) = 1 ./ (1-t(ind));
    0018     ret(~ind) = (1 - 2*R + t(~ind)) / (1 - R) / (1 - R);
    0019   end
    0020
    0021   return;
    0022
    0023