% Method of optiGTest class L. LAURENT -- 15/04/2018 -- luc.laurent@lecnam.net
0001 %% Method of optiGTest class 0002 % L. LAURENT -- 15/04/2018 -- luc.laurent@lecnam.net 0003 0004 % sources available here: 0005 % https://bitbucket.org/luclaurent/optigtest/ 0006 % https://github.com/luclaurent/optigtest/ 0007 0008 % optiGTest - set of testing functions A toolbox to easy manipulate functions. 0009 % Copyright (C) 2018 Luc LAURENT <luc.laurent@lecnam.net> 0010 % 0011 % This program is free software: you can redistribute it and/or modify 0012 % it under the terms of the GNU General Public License as published by 0013 % the Free Software Foundation, either version 3 of the License, or 0014 % (at your option) any later version. 0015 % 0016 % This program is distributed in the hope that it will be useful, 0017 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0018 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0019 % GNU General Public License for more details. 0020 % 0021 % You should have received a copy of the GNU General Public License 0022 % along with this program. If not, see <http://www.gnu.org/licenses/>. 0023 0024 %% prepare the sample point for evaluation 0025 %% show 1D function 0026 % INPUTS: 0027 % - XX: input sample points (not prepared for evaluation) [optional] 0028 % OUTPUTS: 0029 % - Xeval: sample points ready for evaluation 0030 0031 function Xeval=prepX(obj,XX) 0032 %load sizes 0033 sX=[size(XX,1) size(XX,2) size(XX,3)]; 0034 %different cases 0035 if sX(3)==1&&sX(2)==1 0036 nbVar=1; 0037 elseif sX(3)==1&&sX(2)>1 0038 nbVar=sX(2); 0039 else 0040 nbVar=sX(3); 0041 end 0042 %check dimension 0043 if ~any(isinf(obj.dimAvailable)) 0044 if ~any(nbVar==obj.dimAvailable) 0045 error(['Wrong size of sample points (' mfilename ')']); 0046 end 0047 end 0048 %load dimension 0049 obj.dim=nbVar; 0050 0051 if nbVar==1 0052 obj.Xeval=XX(:); 0053 else 0054 if sX(3)==1 0055 obj.Xeval=reshape(XX,[],1,sX(2)); 0056 else 0057 obj.Xeval=XX; 0058 end 0059 end 0060 0061 Xeval=obj.Xeval; 0062 end