Salome HOME
Correcting A-shape verification
authorJean-Philippe ARGAUD <jean-philippe.argaud@edf.fr>
Mon, 15 Oct 2012 11:50:49 +0000 (13:50 +0200)
committerJean-Philippe ARGAUD <jean-philippe.argaud@edf.fr>
Mon, 15 Oct 2012 11:50:49 +0000 (13:50 +0200)
src/daComposant/daAlgorithms/3DVAR.py
src/daComposant/daAlgorithms/Blue.py

index 18d7ef2f0efdef7c357b57513ad151ae09fb5221..e343c6450748211d2460c8cd06a52eb1878bfee6 100644 (file)
@@ -258,7 +258,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
             Ht = H["Tangent"].asMatrix(ValueForMethodForm = Xa)
             Ht = Ht.reshape(-1,len(Xa.A1)) # ADAO
             HessienneI = []
-            nb = len(Xini)
+            nb = len(Xa.A1)
             for i in range(nb):
                 _ee    = numpy.matrix(numpy.zeros(nb)).T
                 _ee[i] = 1.
@@ -267,6 +267,8 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
                 HessienneI.append( ( BI*_ee + Ha((Xa,RI*_HtEE)) ).A1 )
             HessienneI = numpy.matrix( HessienneI )
             A = HessienneI.I
+            if min(A.shape) != max(A.shape):
+                raise ValueError("The 3DVAR a posteriori covariance matrix A is of shape %s, despites it has to be a squared matrix. There is an error in the observation operator."%str(A.shape))
             if logging.getLogger().level < logging.WARNING: # La verification n'a lieu qu'en debug
                 try:
                     L = numpy.linalg.cholesky( A )
index b2a426e3b00c8b60fcb90d070a069322e6da81a6..6e68214dcffbd6782c298f987cc11e3f4b689c7f 100644 (file)
@@ -109,6 +109,8 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
         # ---------------------------------
         if "APosterioriCovariance" in self._parameters["StoreSupplementaryCalculations"]:
             A = B - K * Hm * B
+            if min(A.shape) != max(A.shape):
+                raise ValueError("The 3DVAR a posteriori covariance matrix A is of shape %s, despites it has to be a squared matrix. There is an error in the observation operator."%str(A.shape))
             if logging.getLogger().level < logging.WARNING: # La verification n'a lieu qu'en debug
                 try:
                     L = numpy.linalg.cholesky( A )