0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / math / math_Jacobi.hxx
CommitLineData
42cf5bc1 1// Created on: 1991-05-14
2// Created by: Laurent PAINNOT
3// Copyright (c) 1991-1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
5//
6// This file is part of Open CASCADE Technology software library.
7//
8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _math_Jacobi_HeaderFile
18#define _math_Jacobi_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <Standard_Boolean.hxx>
25#include <math_Matrix.hxx>
26#include <Standard_Integer.hxx>
27#include <math_Vector.hxx>
28#include <Standard_Real.hxx>
29#include <Standard_OStream.hxx>
30class StdFail_NotDone;
31class math_Matrix;
32
33
34
35//! This class implements the Jacobi method to find the eigenvalues and
36//! the eigenvectors of a real symmetric square matrix.
37//! A sort of eigenvalues is done.
38class math_Jacobi
39{
40public:
41
42 DEFINE_STANDARD_ALLOC
43
44
45
46 //! Given a Real n X n matrix A, this constructor computes all its
47 //! eigenvalues and eigenvectors using the Jacobi method.
48 //! The exception NotSquare is raised if the matrix is not square.
49 //! No verification that the matrix A is really symmetric is done.
50 Standard_EXPORT math_Jacobi(const math_Matrix& A);
51
52 //! Returns true if the computations are successful, otherwise returns false.
53 Standard_Boolean IsDone() const;
54
55 //! Returns the eigenvalues vector.
56 //! Exception NotDone is raised if calculation is not done successfully.
57 const math_Vector& Values() const;
58
59 //! returns the eigenvalue number Num.
60 //! Eigenvalues are in the range (1..n).
61 //! Exception NotDone is raised if calculation is not done successfully.
62 Standard_Real Value (const Standard_Integer Num) const;
63
64 //! returns the eigenvectors matrix.
65 //! Exception NotDone is raised if calculation is not done successfully.
66 const math_Matrix& Vectors() const;
67
68 //! Returns the eigenvector V of number Num.
69 //! Eigenvectors are in the range (1..n).
70 //! Exception NotDone is raised if calculation is not done successfully.
71 void Vector (const Standard_Integer Num, math_Vector& V) const;
72
73 //! Prints information on the current state of the object.
74 //! Is used to redefine the operator <<.
75 Standard_EXPORT void Dump (Standard_OStream& o) const;
76
77
78
79
80protected:
81
82
83
84
85
86private:
87
88
89
90 Standard_Boolean Done;
91 math_Matrix AA;
92 Standard_Integer NbRotations;
93 math_Vector EigenValues;
94 math_Matrix EigenVectors;
95
96
97};
98
99
100#include <math_Jacobi.lxx>
101
102
103
104
105
106#endif // _math_Jacobi_HeaderFile