ProgrameR

Fortran Intrinsic Function for Lasso thresholding rule

Posted in Statistics by emeryyi on May 22, 2010

In Lasso solution, the thresholding rule is

Which can be achieved in Fortran by

sign(dim(abs(a),b),a)

as easy as original function.

DIM(X, Y)

  1. If X > Y, the value of the result is X – Y.
  2. If X <= Y, the value of the result is zero.

SIGN(A, B)

The result is sgn*|A|, where:

  1. sgn = -1, if either of the following is true:
    1. B < 0
    2. B is a REAL(4) or REAL(8) number with a value of negative 0, and you have specified the -qxlf90=signedzero option
  2. sgn = 1, otherwise.
Tagged with: ,

Leave a comment