Skip to content

Commit

Permalink
fix: Ensure tempering level state is initialized
Browse files Browse the repository at this point in the history
  • Loading branch information
abensonca committed Dec 6, 2024
1 parent 2b575f3 commit 10b99e5
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,18 @@ function is heated up and cooled down to allow chains to more easily walk throug
Implementation of a posterior sampling simulation class which implements a tempered differential evolution algorithm.
!!}
private
integer :: untemperedStepCount , temperingLevelCount , &
integer :: untemperedStepCount , temperingLevelCount , &
& stepsPerLevel
integer :: temperingStep , temperingLevelMonotonic
integer :: temperingStep , temperingLevelMonotonic
double precision :: temperatureMaximum
class (posteriorSampleDffrntlEvltnPrpslSzTmpExpClass), pointer :: posteriorSampleDffrntlEvltnPrpslSzTmpExp_ => null()
double precision , allocatable, dimension(:) :: temperatures
class (posteriorSampleStateClass ), allocatable, dimension(:) :: temperedStates
contains
!![
<methods>
<method description="Return the current tempering level." method="initialize" />
<method description="Return the current tempering level." method="level" />
<method method="initialize" description="Return the current tempering level."/>
<method method="level" description="Return the current tempering level."/>
</methods>
!!]
final :: temperedDifferentialEvolutionDestructor
Expand Down Expand Up @@ -186,6 +186,8 @@ subroutine temperedDifferentialEvolutionInitialize(self,posteriorSampleDffrntlEv
self%untemperedStepCount = untemperedStepCount
self%stepsPerLevel = stepsPerLevel
self%temperatureMaximum = temperatureMaximum
self%temperingLevelMonotonic = 0
self%temperingStep = 0
allocate(self%temperatures(temperingLevelCount))
allocate(posteriorSampleStateSimple :: self%temperedStates(temperingLevelCount))
do i=1,temperingLevelCount
Expand Down Expand Up @@ -328,10 +330,10 @@ integer function temperedDifferentialEvolutionLevel(self)
class(posteriorSampleSimulationTemperedDffrntlEvltn), intent(inout) :: self

temperedDifferentialEvolutionLevel=self%temperingLevelMonotonic
if (self%temperingLevelMonotonic > self%temperingLevelCount) &
& temperedDifferentialEvolutionLevel= 2 &
& *self%temperingLevelCount &
& -self%temperingLevelMonotonic
if (self%temperingLevelMonotonic > self%temperingLevelCount) &
& temperedDifferentialEvolutionLevel=+2 &
& *self%temperingLevelCount &
& -self%temperingLevelMonotonic
return
end function temperedDifferentialEvolutionLevel

Expand Down

0 comments on commit 10b99e5

Please sign in to comment.