summaryrefslogtreecommitdiff
path: root/inst/covfcs/stk_materncov_iso.m
diff options
context:
space:
mode:
Diffstat (limited to 'inst/covfcs/stk_materncov_iso.m')
-rw-r--r--inst/covfcs/stk_materncov_iso.m21
1 files changed, 14 insertions, 7 deletions
diff --git a/inst/covfcs/stk_materncov_iso.m b/inst/covfcs/stk_materncov_iso.m
index ee4bdde..f8a28ad 100644
--- a/inst/covfcs/stk_materncov_iso.m
+++ b/inst/covfcs/stk_materncov_iso.m
@@ -29,7 +29,7 @@
% Copyright Notice
%
-% Copyright (C) 2015, 2016, 2018 CentraleSupelec
+% Copyright (C) 2015, 2016, 2018, 2020 CentraleSupelec
% Copyright (C) 2011-2014 SUPELEC
%
% Authors: Julien Bect <julien.bect@centralesupelec.fr>
@@ -41,7 +41,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
@@ -66,13 +66,18 @@ y = double (y);
if nargin < 4, diff = -1; end
if nargin < 5, pairwise = false; end
+% check param
+if numel (param) ~= 3
+ stk_error ('param should have two elements.', 'InvalidArgument');
+end
+
% extract parameters from the "param" vector
Sigma2 = exp (param(1));
Nu = exp (param(2));
invRho = exp (param(3));
% check parameter values
-if ~ (Sigma2 > 0) || ~ (Nu > 0) || ~ (invRho >= 0),
+if ~ (Sigma2 > 0) || ~ (Nu > 0) || ~ (invRho >= 0)
error ('Incorrect parameter value.');
end
@@ -87,16 +92,16 @@ 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_matern (Nu, D, -1);
-elseif diff == 1,
+elseif diff == 1
%%% diff wrt param(1) = log(Sigma2)
k = Sigma2 * stk_rbf_matern (Nu, D, -1);
-elseif diff == 2,
+elseif diff == 2
%%% diff wrt param(2) = log(Nu)
k = Nu * Sigma2 * stk_rbf_matern (Nu, D, 1);
-elseif diff == 3,
+elseif diff == 3
%%% diff wrt param(3) = - log(invRho)
k = D .* (Sigma2 * stk_rbf_matern (Nu, D, 2));
else
@@ -115,6 +120,8 @@ end % function
%! x = stk_sampling_randunif(5, dim);
%! y = stk_sampling_randunif(5, dim);
+%!error K = stk_materncov_iso ([param; 1.234], x, y);
+
%!error stk_materncov_iso();
%!error stk_materncov_iso(param);
%!error stk_materncov_iso(param, x);