From bb7379079ba3a6950c976987522f9ffb066952a9 Mon Sep 17 00:00:00 2001 From: Jean-Philippe ARGAUD Date: Mon, 17 Jun 2013 10:32:18 +0200 Subject: [PATCH] Improving robustness of the BLUE algorithm --- src/daComposant/daAlgorithms/Blue.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/daComposant/daAlgorithms/Blue.py b/src/daComposant/daAlgorithms/Blue.py index 915c51f..f4fe6a9 100644 --- a/src/daComposant/daAlgorithms/Blue.py +++ b/src/daComposant/daAlgorithms/Blue.py @@ -96,11 +96,22 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): # -------------------------------------------- if Y.size <= Xb.size: if self._parameters["R_scalar"] is not None: - R = self._parameters["R_scalar"] * numpy.eye(len(Y), dtype=numpy.float) - K = B * Ha * (Hm * B * Ha + R).I + R = self._parameters["R_scalar"] * numpy.eye(Y.size, dtype=numpy.float) + if Y.size > 100: # len(R) + _A = Hm * B * Ha + R + _u = numpy.linalg.solve( _A , d ) + Xa = Xb + B * Ha * _u + else: + K = B * Ha * (Hm * B * Ha + R).I + Xa = Xb + K*d else: - K = (Ha * RI * Hm + BI).I * Ha * RI - Xa = Xb + K*d + if Y.size > 100: # len(R) + _A = Ha * RI * Hm + BI + _u = numpy.linalg.solve( _A , Ha * RI * d ) + Xa = Xb + _u + else: + K = (Ha * RI * Hm + BI).I * Ha * RI + Xa = Xb + K*d self.StoredVariables["Analysis"].store( Xa.A1 ) # # Calcul de la fonction coût -- 2.39.2