diff options
Diffstat (limited to 'inst/covfcs/stk_materncov32_iso.m')
-rw-r--r-- | inst/covfcs/stk_materncov32_iso.m | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/inst/covfcs/stk_materncov32_iso.m b/inst/covfcs/stk_materncov32_iso.m index 5e5a389..e5b3f43 100644 --- a/inst/covfcs/stk_materncov32_iso.m +++ b/inst/covfcs/stk_materncov32_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_matern32 (D, -1); -elseif diff == 1, +elseif diff == 1 %%% diff wrt param(1) = log(Sigma2) k = Sigma2 * stk_rbf_matern32 (D, -1); -elseif diff == 2, +elseif diff == 2 %%% diff wrt param(3) = - log(invRho) k = D .* (Sigma2 * stk_rbf_matern32 (D, 1)); else @@ -109,6 +114,8 @@ end % function %! x = stk_sampling_randunif (5, dim); %! y = stk_sampling_randunif (5, dim); +%!error K = stk_materncov32_iso ([param; 1.234], x, y); + %!error stk_materncov32_iso (); %!error stk_materncov32_iso (param); %!error stk_materncov32_iso (param, x); |