annotate general/numerical/hypdecay.m @ 6:0ce3c2070089
Removed duplicate code and fixed doc in timed_action.
author |
samer |
date |
Mon, 14 Jan 2013 14:33:37 +0000 |
parents |
e44f49929e56 |
children |
|
rev |
line source |
samer@4
|
1 function ret=hypdecay(k,d)
|
samer@4
|
2 % hypdecay - compute interpolation ratio for hyperbolic decay
|
samer@4
|
3 %
|
samer@4
|
4 % hypdecay :: [Size->nonneg], [Size->nonneg] -> [Size->nonneg].
|
samer@4
|
5 % hypdecay :: [Size->nonneg] -> ([Size->nonneg] -> [Size->nonneg]).
|
samer@4
|
6 %
|
samer@4
|
7 % this gives 'hyperbolic' convergence which is more like
|
samer@4
|
8 % a sort of diffusion by Brownian motion. The trick is
|
samer@4
|
9 % to add a constant to the inverse of each natural parameter,
|
samer@4
|
10 % which is like a temperature or variance. The constant
|
samer@4
|
11 % is like a diffusion constant
|
samer@4
|
12 %
|
samer@4
|
13 % This function supports partial application: if only one
|
samer@4
|
14 % argument is supplied, it returns a function handle.
|
samer@4
|
15
|
samer@4
|
16 if nargin==2, ret=1./(1+k*d);
|
samer@4
|
17 else ret=@(d)1./(1+k*d); end
|