1 //                                               -*- C++ -*-
2 /**
3  *  @brief The test file for the IdentityMatrix class
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   IdentityMatrix matrix1(2);
33   matrix1.setName("matrix1");
34   fullprint << "matrix1 = " << matrix1 << std::endl;
35 
36   Point pt ;
37   pt.add(5.) ;
38   pt.add(0.) ;
39   fullprint << "pt = " << pt << std::endl;
40 
41   Point result ;
42   result = matrix1.solveLinearSystem(pt);
43   fullprint << "result = " << result << std::endl;
44 
45   Scalar determinant ;
46   determinant = matrix1.computeDeterminant();
47   fullprint << "determinant = " << determinant << std::endl;
48 
49   Collection<Scalar> ev(2);
50   ev = matrix1.computeEigenValues().getCollection();
51   fullprint << "ev = " << ev << std::endl;
52 
53   bool isSPD = matrix1.isPositiveDefinite();
54   fullprint << "isSPD = " << isSPD << std::endl;
55 
56   SquareMatrix matrix2 = matrix1.computeCholesky();
57   fullprint << "matrix2 = " << matrix2 << std::endl;
58 
59   return ExitCode::Success;
60 }
61