]> SALOME platform Git repositories - modules/adao.git/blob - src/daComposant/daAlgorithms/LinearLeastSquares.py
Salome HOME
- Nouvelle version de Jean-Philippe ARGAUD
[modules/adao.git] / src / daComposant / daAlgorithms / LinearLeastSquares.py
1 #-*-coding:iso-8859-1-*-
2 #
3 #  Copyright (C) 2008-2010  EDF R&D
4 #
5 #  This library is free software; you can redistribute it and/or
6 #  modify it under the terms of the GNU Lesser General Public
7 #  License as published by the Free Software Foundation; either
8 #  version 2.1 of the License.
9 #
10 #  This library is distributed in the hope that it will be useful,
11 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 #  Lesser General Public License for more details.
14 #
15 #  You should have received a copy of the GNU Lesser General Public
16 #  License along with this library; if not, write to the Free Software
17 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
18 #
19 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #
21 __doc__ = """
22     Algorithme de moindre carres pondérés (analyse sans ebauche)
23 """
24 __author__ = "Sophie RICCI, Jean-Philippe ARGAUD - Septembre 2008"
25
26 import logging
27 from daCore import BasicObjects, PlatformInfo
28 m = PlatformInfo.SystemUsage()
29
30 # ==============================================================================
31 class ElementaryAlgorithm(BasicObjects.Algorithm):
32     def __init__(self):
33         BasicObjects.Algorithm.__init__(self)
34         self._name = "LINEARLEASTSQUARES"
35
36     def run(self, Xb=None, Y=None, H=None, M=None, R=None, B=None, Q=None, Par=None):
37         """
38         Calcul de l'estimateur au sens des moindres carres sans ebauche
39         """
40         logging.debug("%s Lancement"%self._name)
41         logging.debug("%s Taille mémoire utilisée de %.1f Mo"%(self._name, m.getUsedMemory("Mo")))
42         #
43         Hm = H["Direct"].asMatrix()
44         Ht = H["Adjoint"].asMatrix()
45         #
46         K =  (Ht * R.I * Hm ).I * Ht * R.I
47         Xa =  K * Y
48         #
49         self.StoredVariables["Analysis"].store( Xa.A1 )
50         #
51         logging.debug("%s Taille mémoire utilisée de %.1f Mo"%(self._name, m.getUsedMemory("Mo")))
52         logging.debug("%s Terminé"%self._name)
53         #
54         return 0
55
56 # ==============================================================================
57 if __name__ == "__main__":
58     print '\n AUTODIAGNOSTIC \n'
59
60