#$=head1 NAME #$ #$irls - weighting functions #$ #$=head1 SYNOPSIS #$ #$C #$ #$C #$ #$=head1 PARAMETERS #$ #$=over 4 #$ #$=item res - C #$ #$ Residual #$ #$=item weight - C #$ #$ Resulting weighting function #$ #$=back #$ #$=head1 DESCRIPTION #$ #$Weighting function to apply to cgmethods (warning stability #$is not guaranteed when using these). #$ #$L1 - weight=1/abs(1+ res/rbar) #$CAUCHY- weight=1/sqrt(1+res/rbar**2) #$ #$ #$=head1 SEE ALSO #$ #$L #$ #$=head1 LIBRARY #$ #$B #$ #$=cut module irls { use quantile_mod contains integer function l1 (res, weight) { real, dimension (:) :: res, weight real :: rbar rbar = quantile( int( 0.5*size(res)), abs (res)) # median weight = 1. / sqrt( sqrt (1. + (res/rbar)**2)); l1 = 0 } integer function cauchy (res, weight) { real, dimension (:) :: res, weight real :: rbar rbar = quantile( int( 0.5*size(res)), abs (res)) # median weight = 1. / sqrt (1. + (res/rbar)**2); cauchy = 0 } }