From d7834b1e0cba2463cac19c4390d7ca1e1d39053c Mon Sep 17 00:00:00 2001 From: Jean-Philippe ARGAUD Date: Mon, 15 Oct 2012 23:51:31 +0200 Subject: [PATCH] Performance improvement of A covariance calculation --- src/daComposant/daAlgorithms/3DVAR.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/daComposant/daAlgorithms/3DVAR.py b/src/daComposant/daAlgorithms/3DVAR.py index e343c64..50a104c 100644 --- a/src/daComposant/daAlgorithms/3DVAR.py +++ b/src/daComposant/daAlgorithms/3DVAR.py @@ -255,16 +255,18 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): # Calcul de la covariance d'analyse # --------------------------------- if "APosterioriCovariance" in self._parameters["StoreSupplementaryCalculations"]: - Ht = H["Tangent"].asMatrix(ValueForMethodForm = Xa) - Ht = Ht.reshape(-1,len(Xa.A1)) # ADAO + HtM = H["Tangent"].asMatrix(ValueForMethodForm = Xa) + HtM = HtM.reshape(len(Y),len(Xa.A1)) # ADAO & check shape + HaM = H["Adjoint"].asMatrix(ValueForMethodForm = Xa) + HaM = HaM.reshape(len(Xa.A1),len(Y)) # ADAO & check shape HessienneI = [] nb = len(Xa.A1) for i in range(nb): _ee = numpy.matrix(numpy.zeros(nb)).T _ee[i] = 1. - _HtEE = Ht * _ee + _HtEE = numpy.dot(HtM,_ee) _HtEE = numpy.asmatrix(numpy.ravel( _HtEE )).T - HessienneI.append( ( BI*_ee + Ha((Xa,RI*_HtEE)) ).A1 ) + HessienneI.append( numpy.ravel( numpy.dot(BI,_ee) + numpy.dot(HaM,numpy.dot(RI,_HtEE)) ) ) HessienneI = numpy.matrix( HessienneI ) A = HessienneI.I if min(A.shape) != max(A.shape): -- 2.39.2