summaryrefslogtreecommitdiff
path: root/inst/covfcs/stk_expcov_iso.m
diff options
context:
space:
mode:
Diffstat (limited to 'inst/covfcs/stk_expcov_iso.m')
-rw-r--r--inst/covfcs/stk_expcov_iso.m19
1 files changed, 13 insertions, 6 deletions
diff --git a/inst/covfcs/stk_expcov_iso.m b/inst/covfcs/stk_expcov_iso.m
index 9f00faf..190cf73 100644
--- a/inst/covfcs/stk_expcov_iso.m
+++ b/inst/covfcs/stk_expcov_iso.m
@@ -27,7 +27,7 @@
% Copyright Notice
%
-% Copyright (C) 2016, 2018 CentraleSupelec
+% Copyright (C) 2016, 2018, 2020 CentraleSupelec
% Copyright (C) 2011-2014 SUPELEC
%
% Authors: Julien Bect <julien.bect@centralesupelec.fr>
@@ -39,7 +39,7 @@
% This file is part of
%
% STK: a Small (Matlab/Octave) Toolbox for Kriging
-% (http://sourceforge.net/projects/kriging)
+% (https://github.com/stk-kriging/stk/)
%
% STK is free software: you can redistribute it and/or modify it under
% the terms of the GNU General Public License as published by the Free
@@ -64,12 +64,17 @@ y = double (y);
if nargin < 4, diff = -1; end
if nargin < 5, pairwise = false; end
+% check param
+if numel (param) ~= 2
+ stk_error ('param should have two elements.', 'InvalidArgument');
+end
+
% extract parameters from the "param" vector
Sigma2 = exp (param(1));
invRho = exp (param(2));
% check parameter values
-if ~ (Sigma2 > 0) || ~ (invRho >= 0),
+if ~ (Sigma2 > 0) || ~ (invRho >= 0)
error ('Incorrect parameter value.');
end
@@ -84,13 +89,13 @@ if isempty (x0) || isempty (y0) || isempty (param0) ...
x0 = x; y0 = y; param0 = param; pairwise0 = pairwise;
end
-if diff == -1,
+if diff == -1
%%% compute the value (not a derivative)
k = Sigma2 * stk_rbf_exponential (D, -1);
-elseif diff == 1,
+elseif diff == 1
%%% diff wrt param(1) = log(Sigma2)
k = Sigma2 * stk_rbf_exponential (D, -1);
-elseif diff == 2,
+elseif diff == 2
%%% diff wrt param(3) = - log(invRho)
k = D .* (Sigma2 * stk_rbf_exponential (D, 1));
else
@@ -109,6 +114,8 @@ end % function
%! x = stk_sampling_randunif (5, dim);
%! y = stk_sampling_randunif (5, dim);
+%!error K = stk_expcov_iso ([param; 1.234], x, y);
+
%!error stk_expcov_iso ();
%!error stk_expcov_iso (param);
%!error stk_expcov_iso (param, x);