annotate general/numerical/safe_exp.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 [y,k]=safe_exp(x,l)
|
samer@4
|
2 % safe_exp - high dynamic range exponential
|
samer@4
|
3 %
|
samer@4
|
4 % safe_exp :: X:[[N,M]] -> [[N,M]], [[1,M]].
|
samer@4
|
5 %
|
samer@4
|
6 % returns y and k such that exp(X) = y * exp(k) and
|
samer@4
|
7 % maximum value in y is 1.
|
samer@4
|
8
|
samer@4
|
9 k=max(x,[],1);
|
samer@4
|
10 y=exp(x-repmat(k,size(x,1),1));
|
samer@4
|
11
|