Skip to content

Commit 44db0cf

Browse files
committed
stk_get_input_dim.m: Implement missing methods, fix headers
1 parent 2939325 commit 44db0cf

File tree

4 files changed

+177
-0
lines changed

4 files changed

+177
-0
lines changed

arrays/@stk_iodata/stk_get_input_dim.m

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
1+
% @STK_IODATA/STK_GET_INPUT_DIM [overload STK function]
2+
%
3+
% See also: stk_get_input_dim
4+
5+
% Copyright Notice
6+
%
7+
% Copyright (C) 2020 CentraleSupelec
8+
%
9+
% Author: Julien Bect <julien.bect@centralesupelec.fr>
10+
11+
% Copying Permission Statement
12+
%
13+
% This file is part of
14+
%
15+
% STK: a Small (Matlab/Octave) Toolbox for Kriging
16+
% (http://sourceforge.net/projects/kriging)
17+
%
18+
% STK is free software: you can redistribute it and/or modify it under
19+
% the terms of the GNU General Public License as published by the Free
20+
% Software Foundation, either version 3 of the License, or (at your
21+
% option) any later version.
22+
%
23+
% STK is distributed in the hope that it will be useful, but WITHOUT
24+
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
25+
% or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
26+
% License for more details.
27+
%
28+
% You should have received a copy of the GNU General Public License
29+
% along with STK. If not, see <http://www.gnu.org/licenses/>.
30+
131
function x = stk_get_input_dim (data)
232

333
x = data.input_dim;
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
% @STK_MODEL_/STK_GET_INPUT_DIM [overload STK function]
2+
%
3+
% See also: stk_get_input_dim
4+
5+
% Copyright Notice
6+
%
7+
% Copyright (C) 2020 CentraleSupelec
8+
%
9+
% Author: Julien Bect <julien.bect@centralesupelec.fr>
10+
11+
% Copying Permission Statement
12+
%
13+
% This file is part of
14+
%
15+
% STK: a Small (Matlab/Octave) Toolbox for Kriging
16+
% (http://sourceforge.net/projects/kriging)
17+
%
18+
% STK is free software: you can redistribute it and/or modify it under
19+
% the terms of the GNU General Public License as published by the Free
20+
% Software Foundation, either version 3 of the License, or (at your
21+
% option) any later version.
22+
%
23+
% STK is distributed in the hope that it will be useful, but WITHOUT
24+
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
25+
% or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
26+
% License for more details.
27+
%
28+
% You should have received a copy of the GNU General Public License
29+
% along with STK. If not, see <http://www.gnu.org/licenses/>.
30+
31+
function input_dim = stk_get_input_dim (model) %#ok<INUSD>
32+
33+
% DESIGN NOTE: cf. stk_get_prior_model.m
34+
35+
input_dim = nan;
36+
37+
end % function
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
% @STK_MODEL_GPPOSTERIOR/STK_GET_INPUT_DIM [overload STK function]
2+
%
3+
% See also: stk_get_input_dim
4+
5+
% Copyright Notice
6+
%
7+
% Copyright (C) 2020 CentraleSupelec
8+
%
9+
% Author: Julien Bect <julien.bect@centralesupelec.fr>
10+
11+
% Copying Permission Statement
12+
%
13+
% This file is part of
14+
%
15+
% STK: a Small (Matlab/Octave) Toolbox for Kriging
16+
% (http://sourceforge.net/projects/kriging)
17+
%
18+
% STK is free software: you can redistribute it and/or modify it under
19+
% the terms of the GNU General Public License as published by the Free
20+
% Software Foundation, either version 3 of the License, or (at your
21+
% option) any later version.
22+
%
23+
% STK is distributed in the hope that it will be useful, but WITHOUT
24+
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
25+
% or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
26+
% License for more details.
27+
%
28+
% You should have received a copy of the GNU General Public License
29+
% along with STK. If not, see <http://www.gnu.org/licenses/>.
30+
31+
function input_data = stk_get_input_dim (model)
32+
33+
input_data = stk_get_input_dim (model.data);
34+
35+
end % function
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
% STK_GET_INPUT_DIM returns the input dimension of a model or stk_iodata object
2+
%
3+
% CALL: INPUT_DIM = stk_get_input_dim (MODEL)
4+
%
5+
% returns the input dimension INPUT_DIM of the MODEL.
6+
%
7+
% CALL: INPUT_DIM = stk_get_input_dim (DATA)
8+
%
9+
% returns the input dimension INPUT_DIM of the stk_iodata object DATA,
10+
% i.e. the number of variables in the input data.
11+
%
12+
% See also: stk_get_output_dim
13+
14+
% Copyright Notice
15+
%
16+
% Copyright (C) 2020 CentraleSupelec
17+
%
18+
% Author: Julien Bect <julien.bect@centralesupelec.fr>
19+
20+
% Copying Permission Statement
21+
%
22+
% This file is part of
23+
%
24+
% STK: a Small (Matlab/Octave) Toolbox for Kriging
25+
% (http://sourceforge.net/projects/kriging)
26+
%
27+
% STK is free software: you can redistribute it and/or modify it under
28+
% the terms of the GNU General Public License as published by the Free
29+
% Software Foundation, either version 3 of the License, or (at your
30+
% option) any later version.
31+
%
32+
% STK is distributed in the hope that it will be useful, but WITHOUT
33+
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
34+
% or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
35+
% License for more details.
36+
%
37+
% You should have received a copy of the GNU General Public License
38+
% along with STK. If not, see <http://www.gnu.org/licenses/>.
39+
40+
function input_dim = stk_get_input_dim (model)
41+
42+
stk_assert_model_struct (model);
43+
44+
if isfield (model, 'dim')
45+
46+
input_dim = model.dim;
47+
48+
else
49+
50+
if ischar (model.covariance_type)
51+
covariance_name = model.covariance_type;
52+
else
53+
% Assume that model.covariance_type is a handle
54+
covariance_name = func2str (model.covariance_type);
55+
end
56+
57+
switch covariance_name
58+
59+
% Anisotropic Matern covariance function with unknown regularity
60+
case 'stk_materncov_aniso'
61+
input_dim = length (model.param) - 2;
62+
63+
% Other anisotropic covariance functions
64+
case {'stk_expcov_aniso', 'stk_materncov32_aniso', ...
65+
'stk_materncov52_aniso', 'stk_gausscov_aniso', ...
66+
'stk_sphcov_aniso'}
67+
input_dim = length (model.param) - 1;
68+
69+
otherwise
70+
stk_error ('Unable to guess input dimension', 'IncorrectArgument');
71+
end
72+
73+
end
74+
75+
end % function

0 commit comments

Comments
 (0)