1 //                                               -*- C++ -*-
2 /**
3  *  @brief The test file of class FixedExperiment for standard methods
4  *
5  *  Copyright 2005-2021 Airbus-EDF-IMACS-ONERA-Phimeca
6  *
7  *  This library is free software: you can redistribute it and/or modify
8  *  it under the terms of the GNU Lesser General Public License as published by
9  *  the Free Software Foundation, either version 3 of the License, or
10  *  (at your option) any later version.
11  *
12  *  This library is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU Lesser General Public License for more details.
16  *
17  *  You should have received a copy of the GNU Lesser General Public License
18  *  along with this library.  If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 #include "openturns/OT.hxx"
22 #include "openturns/OTtestcode.hxx"
23 
24 using namespace OT;
25 using namespace OT::Test;
26 
main(int,char * [])27 int main(int, char *[])
28 {
29   TESTPREAMBLE;
30   OStream fullprint(std::cout);
31 
32   try
33   {
34     UnsignedInteger size = 5;
35     UnsignedInteger dim = 6;
36     Sample refSample(size, dim);
37     for (UnsignedInteger i = 0; i < size; ++i)
38       for (UnsignedInteger j = 0; j < dim; ++j)
39         refSample[i][j] = i + j;
40     fullprint << "ref. sample=" << refSample << std::endl;
41     FixedExperiment experiment(refSample);
42     fullprint << "experiment = " << experiment << std::endl;
43     Point weights(0);
44     Sample sample(experiment.generateWithWeights(weights));
45     fullprint << "sample = " << sample << std::endl;
46     fullprint << "weights = " << weights << std::endl;
47   }
48   catch (TestFailed & ex)
49   {
50     std::cerr << ex << std::endl;
51     return ExitCode::Error;
52   }
53 
54   return ExitCode::Success;
55 }
56