From: Jean-Philippe ARGAUD Date: Thu, 28 May 2015 20:33:54 +0000 (+0200) Subject: Minor source corrections for calculation precision control X-Git-Tag: V7_6_0~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=59b589cfc4d5f8fd53230bda363fe11b250bcc50;p=modules%2Fadao.git Minor source corrections for calculation precision control --- diff --git a/src/daComposant/daAlgorithms/Blue.py b/src/daComposant/daAlgorithms/Blue.py index 7e05f14..069e937 100644 --- a/src/daComposant/daAlgorithms/Blue.py +++ b/src/daComposant/daAlgorithms/Blue.py @@ -150,6 +150,9 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): # --------------------------------- if "APosterioriCovariance" in self._parameters["StoreSupplementaryCalculations"] or \ "SimulationQuantiles" in self._parameters["StoreSupplementaryCalculations"]: + if (Y.size <= Xb.size) and (Y.size > 100): K = B * Ha * (R + Hm * B * Ha).I + elif (Y.size > Xb.size) and (Y.size > 100): K = (BI + Ha * RI * Hm).I * Ha * RI + else: pass # K deja calcule A = B - K * Hm * B if min(A.shape) != max(A.shape): raise ValueError("The %s 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, please check it."%(self._name,str(A.shape))) diff --git a/src/daComposant/daAlgorithms/ExtendedKalmanFilter.py b/src/daComposant/daAlgorithms/ExtendedKalmanFilter.py index f9e2c81..fdc69cc 100644 --- a/src/daComposant/daAlgorithms/ExtendedKalmanFilter.py +++ b/src/daComposant/daAlgorithms/ExtendedKalmanFilter.py @@ -166,8 +166,10 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): if Cm is not None and Un is not None: # Attention : si Cm est aussi dans H, doublon ! d = d - Cm * Un # + _A = R + Ht * Pn_predicted * Ha + _u = numpy.linalg.solve( _A , d ) + Xn = Xn_predicted + Pn_predicted * Ha * _u Kn = Pn_predicted * Ha * (R + Ht * Pn_predicted * Ha).I - Xn = Xn_predicted + Kn * d Pn = Pn_predicted - Kn * Ht * Pn_predicted # self.StoredVariables["Analysis"].store( Xn.A1 ) diff --git a/src/daComposant/daAlgorithms/KalmanFilter.py b/src/daComposant/daAlgorithms/KalmanFilter.py index d1d50b9..9695541 100644 --- a/src/daComposant/daAlgorithms/KalmanFilter.py +++ b/src/daComposant/daAlgorithms/KalmanFilter.py @@ -137,8 +137,10 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): if Cm is not None and Un is not None: # Attention : si Cm est aussi dans H, doublon ! d = d - Cm * Un # + _A = R + Ht * Pn_predicted * Ha + _u = numpy.linalg.solve( _A , d ) + Xn = Xn_predicted + Pn_predicted * Ha * _u Kn = Pn_predicted * Ha * (R + Ht * Pn_predicted * Ha).I - Xn = Xn_predicted + Kn * d Pn = Pn_predicted - Kn * Ht * Pn_predicted # self.StoredVariables["Analysis"].store( Xn.A1 )