]> SALOME platform Git repositories - modules/adao.git/commitdiff
Salome HOME
Precision support management to fix linalg float128 support (Fedora32)
authorJean-Philippe ARGAUD <jean-philippe.argaud@edf.fr>
Fri, 9 Oct 2020 13:43:36 +0000 (15:43 +0200)
committerJean-Philippe ARGAUD <jean-philippe.argaud@edf.fr>
Fri, 9 Oct 2020 13:43:36 +0000 (15:43 +0200)
src/daComposant/daAlgorithms/EnsembleKalmanFilter.py
src/daComposant/daCore/Persistence.py

index 8905c2146ab933a5599fe688127774a9fc9fe78a..1660d0641a17efded67276fd2b59dbb1df1c2fe7 100644 (file)
@@ -189,8 +189,8 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
                 # --- > Par principe, M = Id, Q = 0
                 Xn_predicted = Xn
             #
-            Xfm = numpy.asmatrix(numpy.ravel(Xn_predicted.mean(axis=1, dtype=mfp))).T
-            Hfm = numpy.asmatrix(numpy.ravel(HX_predicted.mean(axis=1, dtype=mfp))).T
+            Xfm = numpy.asmatrix(numpy.ravel(Xn_predicted.mean(axis=1, dtype=mfp).astype('float'))).T
+            Hfm = numpy.asmatrix(numpy.ravel(HX_predicted.mean(axis=1, dtype=mfp).astype('float'))).T
             #
             PfHT, HPfHT = 0., 0.
             for i in range(__m):
@@ -207,7 +207,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
                 ri = numpy.asmatrix(numpy.random.multivariate_normal(numpy.zeros(__p), Rn, (1,1,1))).T
                 Xn[:,i] = Xn_predicted[:,i] + K * (Ynpu + ri - HX_predicted[:,i])
             #
-            Xa = Xn.mean(axis=1, dtype=mfp)
+            Xa = Xn.mean(axis=1, dtype=mfp).astype('float')
             #
             if self._parameters["StoreInternalVariables"] \
                 or self._toStore("CostFunctionJ") \
index ecaa30405a19dfea13b726bcce618b72b75c94c0..66d3eef349fbe6f924700ac039e11abef6569289 100644 (file)
@@ -280,7 +280,7 @@ class Persistence(object):
         élémentaires numpy.
         """
         try:
-            return [numpy.mean(item, dtype=mfp) for item in self.__values]
+            return [numpy.mean(item, dtype=mfp).astype('float') for item in self.__values]
         except:
             raise TypeError("Base type is incompatible with numpy")
 
@@ -295,9 +295,9 @@ class Persistence(object):
         """
         try:
             if numpy.version.version >= '1.1.0':
-                return [numpy.array(item).std(ddof=ddof) for item in self.__values]
+                return [numpy.array(item).std(ddof=ddof, dtype=mfp).astype('float') for item in self.__values]
             else:
-                return [numpy.array(item).std() for item in self.__values]
+                return [numpy.array(item).std(dtype=mfp).astype('float') for item in self.__values]
         except:
             raise TypeError("Base type is incompatible with numpy")
 
@@ -472,10 +472,7 @@ class Persistence(object):
         les types élémentaires numpy.
         """
         try:
-            if self.__basetype in [int, float]:
-                return float( numpy.mean(self.__values, dtype=mfp) )
-            else:
-                return numpy.mean(self.__values, axis=0, dtype=mfp)
+            return numpy.mean(self.__values, axis=0, dtype=mfp).astype('float')
         except:
             raise TypeError("Base type is incompatible with numpy")
 
@@ -490,9 +487,9 @@ class Persistence(object):
         """
         try:
             if numpy.version.version >= '1.1.0':
-                return numpy.array(self.__values).std(ddof=ddof,axis=0)
+                return numpy.array(self.__values).std(ddof=ddof,axis=0).astype('float')
             else:
-                return numpy.array(self.__values).std(axis=0)
+                return numpy.array(self.__values).std(axis=0).astype('float')
         except:
             raise TypeError("Base type is incompatible with numpy")