-
Notifications
You must be signed in to change notification settings - Fork 0
/
setmap.m
31 lines (24 loc) · 964 Bytes
/
setmap.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
function [formap,invmap,dformap,dinvmap] = setmap(map,alpha)
% SETMAP set the map from the following list of standard possibilities:
% 'E' : the standard one-sided exponential map
% 'DE' : the one-sided double-exponential map
% Mark Richardson, August 2012.
if strcmpi(map,'E')
formap = @(x) log(x);
invmap = @(s) exp(s);
dformap = @(x) 1./x;
dinvmap = @(s) exp(s);
elseif strcmpi(map,'DE')
formap = @(x) -log(1-log(x));
invmap = @(t) exp(1-exp(-t));
dformap = @(x) 1./x.*1./(1-log(x));
dinvmap = @(t) exp(-t).*exp(1-exp(-t));
elseif strcmpi(map,'slit')
gamma = alpha/pi*log(expm1(pi/alpha));
formap = @(x) alpha/pi*log(expm1(pi/alpha*x))-gamma;
invmap = @(s) alpha/pi*log1p(exp(pi/alpha*(s+gamma)));
dformap = @(x) exp(pi/alpha*x)./expm1(pi/alpha*x);
dinvmap = []; % work this out at some point (need for mapop)
else
error('require map preference to be one of: ''E'', ''DE'' ')
end