From: Jean-Philippe ARGAUD Date: Sat, 28 May 2016 20:12:39 +0000 (+0200) Subject: Minor source corrections for syntax and efficiency X-Git-Tag: V7_8_0~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9286d9df331338c6bb9709c27ea1ac950d181dd1;p=modules%2Fadao.git Minor source corrections for syntax and efficiency --- diff --git a/src/daComposant/daAlgorithms/3DVAR.py b/src/daComposant/daAlgorithms/3DVAR.py index d8b2863..70ea844 100644 --- a/src/daComposant/daAlgorithms/3DVAR.py +++ b/src/daComposant/daAlgorithms/3DVAR.py @@ -137,7 +137,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): # Utilisation éventuelle d'un vecteur H(Xb) précalculé (sans cout) # ---------------------------------------------------------------- if HO["AppliedToX"] is not None and HO["AppliedToX"].has_key("HXb"): - HXb = HO["AppliedToX"]["HXb"] + HXb = Hm( Xb, HO["AppliedToX"]["HXb"]) else: HXb = Hm( Xb ) HXb = numpy.asmatrix(numpy.ravel( HXb )).T diff --git a/src/daComposant/daAlgorithms/ExtendedBlue.py b/src/daComposant/daAlgorithms/ExtendedBlue.py index 7ef3b47..70fb69f 100644 --- a/src/daComposant/daAlgorithms/ExtendedBlue.py +++ b/src/daComposant/daAlgorithms/ExtendedBlue.py @@ -87,7 +87,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): # Utilisation éventuelle d'un vecteur H(Xb) précalculé # ---------------------------------------------------- if HO["AppliedToX"] is not None and HO["AppliedToX"].has_key("HXb"): - HXb = HO["AppliedToX"]["HXb"] + HXb = H( Xb, HO["AppliedToX"]["HXb"]) else: HXb = H( Xb ) HXb = numpy.asmatrix(numpy.ravel( HXb )).T diff --git a/src/daComposant/daAlgorithms/NonLinearLeastSquares.py b/src/daComposant/daAlgorithms/NonLinearLeastSquares.py index 281288d..68fc422 100644 --- a/src/daComposant/daAlgorithms/NonLinearLeastSquares.py +++ b/src/daComposant/daAlgorithms/NonLinearLeastSquares.py @@ -110,7 +110,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): # Utilisation éventuelle d'un vecteur H(Xb) précalculé # ---------------------------------------------------- if HO["AppliedToX"] is not None and HO["AppliedToX"].has_key("HXb"): - HXb = HO["AppliedToX"]["HXb"] + HXb = Hm( Xb, HO["AppliedToX"]["HXb"]) else: HXb = Hm( Xb ) HXb = numpy.asmatrix(numpy.ravel( HXb )).T diff --git a/src/daComposant/daAlgorithms/QuantileRegression.py b/src/daComposant/daAlgorithms/QuantileRegression.py index 149a50b..eeb7499 100644 --- a/src/daComposant/daAlgorithms/QuantileRegression.py +++ b/src/daComposant/daAlgorithms/QuantileRegression.py @@ -94,7 +94,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): # Utilisation éventuelle d'un vecteur H(Xb) précalculé # ---------------------------------------------------- if HO["AppliedToX"] is not None and HO["AppliedToX"].has_key("HXb"): - HXb = HO["AppliedToX"]["HXb"] + HXb = Hm( Xb, HO["AppliedToX"]["HXb"]) else: HXb = Hm( Xb ) HXb = numpy.asmatrix(numpy.ravel( HXb )).T diff --git a/src/daComposant/daCore/BasicObjects.py b/src/daComposant/daCore/BasicObjects.py index d36104c..ca25024 100644 --- a/src/daComposant/daCore/BasicObjects.py +++ b/src/daComposant/daCore/BasicObjects.py @@ -142,7 +142,7 @@ class Operator(object): "Renvoie le type" return self.__Type - def appliedTo(self, xValue): + def appliedTo(self, xValue, HValue = None): """ Permet de restituer le résultat de l'application de l'opérateur à un argument xValue. Cette méthode se contente d'appliquer, son argument @@ -150,23 +150,28 @@ class Operator(object): Arguments : - xValue : argument adapté pour appliquer l'opérateur """ - if self.__AvoidRC: - __alreadyCalculated, __HxV = Operator.CM.wasCalculatedIn(xValue) - else: - __alreadyCalculated = False - # - if __alreadyCalculated: - self.__addOneCacheCall() - HxValue = __HxV - else: - if self.__Matrix is not None: - self.__addOneMatrixCall() - HxValue = self.__Matrix * xValue - else: - self.__addOneMethodCall() - HxValue = self.__Method( xValue ) + if HValue is not None: + HxValue = numpy.asmatrix( numpy.ravel( HValue ) ).T if self.__AvoidRC: Operator.CM.storeValueInX(xValue,HxValue) + else: + if self.__AvoidRC: + __alreadyCalculated, __HxV = Operator.CM.wasCalculatedIn(xValue) + else: + __alreadyCalculated = False + # + if __alreadyCalculated: + self.__addOneCacheCall() + HxValue = __HxV + else: + if self.__Matrix is not None: + self.__addOneMatrixCall() + HxValue = self.__Matrix * xValue + else: + self.__addOneMethodCall() + HxValue = self.__Method( xValue ) + if self.__AvoidRC: + Operator.CM.storeValueInX(xValue,HxValue) # return HxValue