From: Jean-Philippe ARGAUD Date: Mon, 15 Oct 2012 11:50:49 +0000 (+0200) Subject: Correcting A-shape verification X-Git-Tag: V6_6_0~16 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=01022e867e0565b15e57ec3643f9fc8b25346402;p=modules%2Fadao.git Correcting A-shape verification --- diff --git a/src/daComposant/daAlgorithms/3DVAR.py b/src/daComposant/daAlgorithms/3DVAR.py index 18d7ef2..e343c64 100644 --- a/src/daComposant/daAlgorithms/3DVAR.py +++ b/src/daComposant/daAlgorithms/3DVAR.py @@ -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 ) diff --git a/src/daComposant/daAlgorithms/Blue.py b/src/daComposant/daAlgorithms/Blue.py index b2a426e..6e68214 100644 --- a/src/daComposant/daAlgorithms/Blue.py +++ b/src/daComposant/daAlgorithms/Blue.py @@ -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 )