Perturbations = [ 10**i for i in range(self._parameters["EpsilonMinimumExponent"],1) ]
Perturbations.reverse()
#
- X = numpy.asmatrix(numpy.ravel( Xb )).T
+ X = numpy.ravel( Xb ).reshape((-1,1))
NormeX = numpy.linalg.norm( X )
if Y is None:
- Y = numpy.asmatrix(numpy.ravel( Hm( X ) )).T
- Y = numpy.asmatrix(numpy.ravel( Y )).T
+ Y = numpy.ravel( Hm( X ) ).reshape((-1,1))
+ Y = numpy.ravel( Y ).reshape((-1,1))
NormeY = numpy.linalg.norm( Y )
if self._toStore("CurrentState"):
- self.StoredVariables["CurrentState"].store( numpy.ravel(X) )
+ self.StoredVariables["CurrentState"].store( X )
if self._toStore("SimulatedObservationAtCurrentState"):
- self.StoredVariables["SimulatedObservationAtCurrentState"].store( numpy.ravel(Y) )
+ self.StoredVariables["SimulatedObservationAtCurrentState"].store( Y )
#
if len(self._parameters["InitialDirection"]) == 0:
dX0 = []
- for v in X.A1:
+ for v in X:
if abs(v) > 1.e-8:
dX0.append( numpy.random.normal(0.,abs(v)) )
else:
dX0.append( numpy.random.normal(0.,X.mean()) )
else:
- dX0 = numpy.asmatrix(numpy.ravel( self._parameters["InitialDirection"] ))
+ dX0 = self._parameters["InitialDirection"]
#
- dX0 = float(self._parameters["AmplitudeOfInitialDirection"]) * numpy.matrix( dX0 ).T
+ dX0 = float(self._parameters["AmplitudeOfInitialDirection"]) * numpy.ravel( dX0 )
#
# Entete des resultats
# --------------------
dX = amplitude * dX0
NormedX = numpy.linalg.norm( dX )
#
- TangentFXdX = numpy.asmatrix( Ht( (X,dX) ) )
- AdjointFXY = numpy.asmatrix( Ha( (X,Y) ) )
+ TangentFXdX = numpy.ravel( Ht( (X,dX) ) )
+ AdjointFXY = numpy.ravel( Ha( (X,Y) ) )
#
- Residu = abs(float(numpy.dot( TangentFXdX.A1 , Y.A1 ) - numpy.dot( dX.A1 , AdjointFXY.A1 )))
+ Residu = abs(float(numpy.dot( TangentFXdX, Y ) - numpy.dot( dX, AdjointFXY )))
#
msg = " %2i %5.0e %9.3e %9.3e %9.3e | %9.3e"%(i,amplitude,NormeX,NormeY,NormedX,Residu)
msgs += "\n" + __marge + msg
Perturbations = [ 10**i for i in range(self._parameters["EpsilonMinimumExponent"],1) ]
Perturbations.reverse()
#
- X = numpy.asmatrix(numpy.ravel( Xb )).T
- FX = numpy.asmatrix(numpy.ravel( Hm( X ) )).T
+ X = numpy.ravel( Xb ).reshape((-1,1))
+ FX = numpy.ravel( Hm( X ) ).reshape((-1,1))
NormeX = numpy.linalg.norm( X )
NormeFX = numpy.linalg.norm( FX )
if self._toStore("CurrentState"):
- self.StoredVariables["CurrentState"].store( numpy.ravel(X) )
+ self.StoredVariables["CurrentState"].store( X )
if self._toStore("SimulatedObservationAtCurrentState"):
- self.StoredVariables["SimulatedObservationAtCurrentState"].store( numpy.ravel(FX) )
+ self.StoredVariables["SimulatedObservationAtCurrentState"].store( FX )
#
if len(self._parameters["InitialDirection"]) == 0:
dX0 = []
- for v in X.A1:
+ for v in X:
if abs(v) > 1.e-8:
dX0.append( numpy.random.normal(0.,abs(v)) )
else:
else:
dX0 = numpy.ravel( self._parameters["InitialDirection"] )
#
- dX0 = float(self._parameters["AmplitudeOfInitialDirection"]) * numpy.matrix( dX0 ).T
+ dX0 = float(self._parameters["AmplitudeOfInitialDirection"]) * numpy.ravel( dX0 ).reshape((-1,1))
#
if self._parameters["ResiduFormula"] in ["Taylor", "TaylorOnNorm"]:
dX1 = float(self._parameters["AmplitudeOfTangentPerturbation"]) * dX0
GradFxdX = Ht( (X, dX1) )
- GradFxdX = numpy.asmatrix(numpy.ravel( GradFxdX )).T
+ GradFxdX = numpy.ravel( GradFxdX ).reshape((-1,1))
GradFxdX = float(1./self._parameters["AmplitudeOfTangentPerturbation"]) * GradFxdX
#
# Entete des resultats
dX = amplitude * dX0
#
FX_plus_dX = Hm( X + dX )
- FX_plus_dX = numpy.asmatrix(numpy.ravel( FX_plus_dX )).T
+ FX_plus_dX = numpy.ravel( FX_plus_dX ).reshape((-1,1))
#
if self._toStore("CurrentState"):
self.StoredVariables["CurrentState"].store( numpy.ravel(X + dX) )
#
# Calcul du point courant
# -----------------------
- Xn = numpy.asmatrix(numpy.ravel( Xb )).T
- FX = numpy.asmatrix(numpy.ravel( Hm( Xn ) )).T
+ Xn = numpy.ravel( Xb ).reshape((-1,1))
+ FX = numpy.ravel( Hm( Xn ) ).reshape((-1,1))
NormeX = numpy.linalg.norm( Xn )
NormeFX = numpy.linalg.norm( FX )
if self._toStore("CurrentState"):
# ---------------------------------------------
if len(self._parameters["InitialDirection"]) == 0:
dX0 = []
- for v in Xn.A1:
+ for v in Xn:
if abs(v) > 1.e-8:
dX0.append( numpy.random.normal(0.,abs(v)) )
else:
else:
dX0 = numpy.ravel( self._parameters["InitialDirection"] )
#
- dX0 = float(self._parameters["AmplitudeOfInitialDirection"]) * numpy.matrix( dX0 ).T
+ dX0 = float(self._parameters["AmplitudeOfInitialDirection"]) * numpy.ravel( dX0 ).reshape((-1,1))
#
# Calcul du gradient au point courant X pour l'increment dX
# ---------------------------------------------------------
if self._parameters["ResiduFormula"] in ["Taylor", "NominalTaylor", "NominalTaylorRMS"]:
dX1 = float(self._parameters["AmplitudeOfTangentPerturbation"]) * dX0
GradFxdX = Ht( (Xn, dX1) )
- GradFxdX = numpy.asmatrix(numpy.ravel( GradFxdX )).T
+ GradFxdX = numpy.ravel( GradFxdX ).reshape((-1,1))
GradFxdX = float(1./self._parameters["AmplitudeOfTangentPerturbation"]) * GradFxdX
#
# Entete des resultats
#
if self._parameters["ResiduFormula"] == "CenteredDL":
if self._toStore("CurrentState"):
- self.StoredVariables["CurrentState"].store( numpy.ravel(Xn + dX) )
- self.StoredVariables["CurrentState"].store( numpy.ravel(Xn - dX) )
+ self.StoredVariables["CurrentState"].store( Xn + dX )
+ self.StoredVariables["CurrentState"].store( Xn - dX )
#
- FX_plus_dX = numpy.asmatrix(numpy.ravel( Hm( Xn + dX ) )).T
- FX_moins_dX = numpy.asmatrix(numpy.ravel( Hm( Xn - dX ) )).T
+ FX_plus_dX = numpy.ravel( Hm( Xn + dX ) ).reshape((-1,1))
+ FX_moins_dX = numpy.ravel( Hm( Xn - dX ) ).reshape((-1,1))
#
if self._toStore("SimulatedObservationAtCurrentState"):
- self.StoredVariables["SimulatedObservationAtCurrentState"].store( numpy.ravel(FX_plus_dX) )
- self.StoredVariables["SimulatedObservationAtCurrentState"].store( numpy.ravel(FX_moins_dX) )
+ self.StoredVariables["SimulatedObservationAtCurrentState"].store( FX_plus_dX )
+ self.StoredVariables["SimulatedObservationAtCurrentState"].store( FX_moins_dX )
#
Residu = numpy.linalg.norm( FX_plus_dX + FX_moins_dX - 2 * FX ) / NormeFX
#
#
if self._parameters["ResiduFormula"] == "Taylor":
if self._toStore("CurrentState"):
- self.StoredVariables["CurrentState"].store( numpy.ravel(Xn + dX) )
+ self.StoredVariables["CurrentState"].store( Xn + dX )
#
- FX_plus_dX = numpy.asmatrix(numpy.ravel( Hm( Xn + dX ) )).T
+ FX_plus_dX = numpy.ravel( Hm( Xn + dX ) ).reshape((-1,1))
#
if self._toStore("SimulatedObservationAtCurrentState"):
- self.StoredVariables["SimulatedObservationAtCurrentState"].store( numpy.ravel(FX_plus_dX) )
+ self.StoredVariables["SimulatedObservationAtCurrentState"].store( FX_plus_dX )
#
Residu = numpy.linalg.norm( FX_plus_dX - FX - amplitude * GradFxdX ) / NormeFX
#
#
if self._parameters["ResiduFormula"] == "NominalTaylor":
if self._toStore("CurrentState"):
- self.StoredVariables["CurrentState"].store( numpy.ravel(Xn + dX) )
- self.StoredVariables["CurrentState"].store( numpy.ravel(Xn - dX) )
- self.StoredVariables["CurrentState"].store( numpy.ravel(dX) )
+ self.StoredVariables["CurrentState"].store( Xn + dX )
+ self.StoredVariables["CurrentState"].store( Xn - dX )
+ self.StoredVariables["CurrentState"].store( dX )
#
- FX_plus_dX = numpy.asmatrix(numpy.ravel( Hm( Xn + dX ) )).T
- FX_moins_dX = numpy.asmatrix(numpy.ravel( Hm( Xn - dX ) )).T
- FdX = numpy.asmatrix(numpy.ravel( Hm( dX ) )).T
+ FX_plus_dX = numpy.ravel( Hm( Xn + dX ) ).reshape((-1,1))
+ FX_moins_dX = numpy.ravel( Hm( Xn - dX ) ).reshape((-1,1))
+ FdX = numpy.ravel( Hm( dX ) ).reshape((-1,1))
#
if self._toStore("SimulatedObservationAtCurrentState"):
- self.StoredVariables["SimulatedObservationAtCurrentState"].store( numpy.ravel(FX_plus_dX) )
- self.StoredVariables["SimulatedObservationAtCurrentState"].store( numpy.ravel(FX_moins_dX) )
- self.StoredVariables["SimulatedObservationAtCurrentState"].store( numpy.ravel(FdX) )
+ self.StoredVariables["SimulatedObservationAtCurrentState"].store( FX_plus_dX )
+ self.StoredVariables["SimulatedObservationAtCurrentState"].store( FX_moins_dX )
+ self.StoredVariables["SimulatedObservationAtCurrentState"].store( FdX )
#
Residu = max(
numpy.linalg.norm( FX_plus_dX - amplitude * FdX ) / NormeFX,
#
if self._parameters["ResiduFormula"] == "NominalTaylorRMS":
if self._toStore("CurrentState"):
- self.StoredVariables["CurrentState"].store( numpy.ravel(Xn + dX) )
- self.StoredVariables["CurrentState"].store( numpy.ravel(Xn - dX) )
- self.StoredVariables["CurrentState"].store( numpy.ravel(dX) )
+ self.StoredVariables["CurrentState"].store( Xn + dX )
+ self.StoredVariables["CurrentState"].store( Xn - dX )
+ self.StoredVariables["CurrentState"].store( dX )
#
- FX_plus_dX = numpy.asmatrix(numpy.ravel( Hm( Xn + dX ) )).T
- FX_moins_dX = numpy.asmatrix(numpy.ravel( Hm( Xn - dX ) )).T
- FdX = numpy.asmatrix(numpy.ravel( Hm( dX ) )).T
+ FX_plus_dX = numpy.ravel( Hm( Xn + dX ) ).reshape((-1,1))
+ FX_moins_dX = numpy.ravel( Hm( Xn - dX ) ).reshape((-1,1))
+ FdX = numpy.ravel( Hm( dX ) ).reshape((-1,1))
#
if self._toStore("SimulatedObservationAtCurrentState"):
- self.StoredVariables["SimulatedObservationAtCurrentState"].store( numpy.ravel(FX_plus_dX) )
- self.StoredVariables["SimulatedObservationAtCurrentState"].store( numpy.ravel(FX_moins_dX) )
- self.StoredVariables["SimulatedObservationAtCurrentState"].store( numpy.ravel(FdX) )
+ self.StoredVariables["SimulatedObservationAtCurrentState"].store( FX_plus_dX )
+ self.StoredVariables["SimulatedObservationAtCurrentState"].store( FX_moins_dX )
+ self.StoredVariables["SimulatedObservationAtCurrentState"].store( FdX )
#
Residu = max(
RMS( FX, FX_plus_dX - amplitude * FdX ) / NormeFX,
HXb = HO["AppliedInX"]["HXb"]
else:
HXb = Ht @ Xb
- HXb = numpy.asmatrix(numpy.ravel( HXb )).T
+ HXb = numpy.ravel( HXb ).reshape((-1,1))
if Y.size != HXb.size:
raise ValueError("The size %i of observations Y and %i of observed calculation H(X) are different, they have to be identical."%(Y.size,HXb.size))
if max(Y.shape) != max(HXb.shape):
#
# Calcul du point courant
# -----------------------
- Xn = numpy.asmatrix(numpy.ravel( Xb )).T
- FX = numpy.asmatrix(numpy.ravel( Hm( Xn ) )).T
+ Xn = numpy.ravel( Xb ).reshape((-1,1))
+ FX = numpy.ravel( Hm( Xn ) ).reshape((-1,1))
NormeX = numpy.linalg.norm( Xn )
NormeFX = numpy.linalg.norm( FX )
if self._toStore("CurrentState"):
- self.StoredVariables["CurrentState"].store( numpy.ravel(Xn) )
+ self.StoredVariables["CurrentState"].store( Xn )
if self._toStore("SimulatedObservationAtCurrentState"):
- self.StoredVariables["SimulatedObservationAtCurrentState"].store( numpy.ravel(FX) )
+ self.StoredVariables["SimulatedObservationAtCurrentState"].store( FX )
#
# Fabrication de la direction de l'increment dX
# ---------------------------------------------
if len(self._parameters["InitialDirection"]) == 0:
dX0 = []
- for v in Xn.A1:
+ for v in Xn:
if abs(v) > 1.e-8:
dX0.append( numpy.random.normal(0.,abs(v)) )
else:
else:
dX0 = numpy.ravel( self._parameters["InitialDirection"] )
#
- dX0 = float(self._parameters["AmplitudeOfInitialDirection"]) * numpy.matrix( dX0 ).T
+ dX0 = float(self._parameters["AmplitudeOfInitialDirection"]) * numpy.ravel( dX0 ).reshape((-1,1))
#
# Calcul du gradient au point courant X pour l'increment dX
# qui est le tangent en X multiplie par dX
# ---------------------------------------------------------
dX1 = float(self._parameters["AmplitudeOfTangentPerturbation"]) * dX0
GradFxdX = Ht( (Xn, dX1) )
- GradFxdX = numpy.asmatrix(numpy.ravel( GradFxdX )).T
+ GradFxdX = numpy.ravel( GradFxdX ).reshape((-1,1))
GradFxdX = float(1./self._parameters["AmplitudeOfTangentPerturbation"]) * GradFxdX
NormeGX = numpy.linalg.norm( GradFxdX )
#
dX = amplitude * dX0
#
if self._parameters["ResiduFormula"] == "Taylor":
- FX_plus_dX = numpy.asmatrix(numpy.ravel( Hm( Xn + dX ) )).T
+ FX_plus_dX = numpy.ravel( Hm( Xn + dX ) ).reshape((-1,1))
#
Residu = numpy.linalg.norm( FX_plus_dX - FX ) / (amplitude * NormeGX)
#