https://github.com/cran/fields
Revision 67f03a547c0c81321ff18188017dd3becb0e7797 authored by Douglas Nychka on 16 December 2016, 22:26:03 UTC, committed by cran-robot on 16 December 2016, 22:26:03 UTC
1 parent 5c24a1f
Raw File
Tip revision: 67f03a547c0c81321ff18188017dd3becb0e7797 authored by Douglas Nychka on 16 December 2016, 22:26:03 UTC
version 8.10
Tip revision: 67f03a5
rcssr.f
c fields, Tools for spatial data
c Copyright 2015, Institute for Mathematics Applied Geosciences
c University Corporation for Atmospheric Research
c Licensed under the GPL -- www.gpl.org/licenses/gpl.html
 
 
      double precision function rcssr(r,par)
c
c     robust rho function:
c  This is a peicewise polynomial with knots at -C , 0 and C
c  the function is quadratic for -C<u<0 and 0<u<C
c  the function is linear for u<-C and u>C
c  rho is continuous for all u aqnd differentiable for all points 
c  except u=0 when a != 1/2 
c   
c
c    rho(u) =      2*a*u - a*c     for u>C
c                  a*u**2/C        for   0<u< C   
c                  (1-a)*u**2/C    for -C<u<0
c                  2*(1-a)*u - (1-a)*C  for u< -C
c
c        Note a= par(1), C= par(2)
      implicit double precision (a-h, o-z)
      double precision r, par(2),c,a
      c= par(1)     
      if( r.gt.0 ) then 
         a=par(2)
       else
         a =(1-par(2))
         r= -r
      endif 
      if( r.le.c) then
            rcssr= a*r*r/c
      else
           rcssr= 2*a*(r) - a*c
      endif
      return
      end
back to top