v4 kernel_density_estimate.m: replaced calls to inline() by anonymous functions (much faster)

git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1871 ac1d8469-bf42-47a9-8791-bf33cf982152
time-shift
sebastien 2008-06-12 14:42:16 +00:00
parent 974fb1bab2
commit 87c27433f6
1 changed files with 7 additions and 7 deletions

View File

@ -39,19 +39,19 @@ end
%% Kernel specification.
if strcmpi(kernel_function,'gaussian')
kernel = inline('inv(sqrt(2*pi))*exp(-0.5*x.^2)');
kernel = @(x) inv(sqrt(2*pi))*exp(-0.5*x.^2);
elseif strcmpi(kernel_function,'uniform')
kernel = inline('0.5*(abs(x) <= 1)');
kernel = @(x) 0.5*(abs(x) <= 1);
elseif strcmpi(kernel_function,'triangle')
kernel = inline('(1-abs(x)).*(abs(x) <= 1)');
kernel = @(x) (1-abs(x)).*(abs(x) <= 1);
elseif strcmpi(kernel_function,'epanechnikov')
kernel = inline('0.75*(1-x.^2).*(abs(x) <= 1)');
kernel = @(x) 0.75*(1-x.^2).*(abs(x) <= 1);
elseif strcmpi(kernel_function,'quartic')
kernel = inline('0.9375*((1-x.^2).^2).*(abs(x) <= 1)');
kernel = @(x) 0.9375*((1-x.^2).^2).*(abs(x) <= 1);
elseif strcmpi(kernel_function,'triweight')
kernel = inline('1.09375*((1-x.^2).^3).*(abs(x) <= 1)');
kernel = @(x) 1.09375*((1-x.^2).^3).*(abs(x) <= 1);
elseif strcmpi(kernel_function,'cosinus')
kernel = inline('(pi/4)*cos((pi/2)*x).*(abs(x) <= 1)');
kernel = @(x) (pi/4)*cos((pi/2)*x).*(abs(x) <= 1);
end
%% Non parametric estimation (Gaussian kernel should be used (FFT)).