Skip to content

Commit

Permalink
Reverted erroneous commit to master
Browse files Browse the repository at this point in the history
  • Loading branch information
williamjameshandley committed Dec 19, 2023
1 parent 1310be2 commit e0965a5
Showing 1 changed file with 18 additions and 27 deletions.
45 changes: 18 additions & 27 deletions src/polychord/run_time_info.f90
Original file line number Diff line number Diff line change
Expand Up @@ -606,8 +606,8 @@ subroutine calculate_covmats(settings,RTI)
type(program_settings), intent(in) :: settings !> Program settings
type(run_time_info),intent(inout) :: RTI !> Run time information

integer :: i, i_cluster ! cluster iterator
real(dp), dimension(settings%nDims) :: mean, var ! The mean of a given cluster
integer :: i_cluster ! cluster iterator
real(dp), dimension(settings%nDims) :: mean ! The mean of a given cluster

! For each cluster:
do i_cluster = 1,RTI%ncluster
Expand All @@ -616,34 +616,25 @@ subroutine calculate_covmats(settings,RTI)
+ sum(RTI%phantom(settings%h0:settings%h1,:RTI%nphantom(i_cluster),i_cluster),dim=2) ) &
/ (RTI%nlive(i_cluster) + RTI%nphantom(i_cluster) )

var = ( sum((RTI%live(settings%h0:settings%h1,:RTI%nlive(i_cluster),i_cluster)-spread(mean,dim=2, ncopies=RTI%nlive(i_cluster)))**2,dim=2) &
+ sum((RTI%phantom(settings%h0:settings%h1,:RTI%nphantom(i_cluster),i_cluster)-spread(mean,dim=2,ncopies=RTI%nphantom(i_cluster)))**2,dim=2) ) &
/ (RTI%nlive(i_cluster) + RTI%nphantom(i_cluster) )


do i=1,settings%nDims
RTI%covmat(i,i,i_cluster) = var(i)
RTI%cholesky(i,i,i_cluster) = var(i)**0.5
end do
! Calculate the covariance by using a matrix multiplication
!RTI%covmat(:,:,i_cluster) =( &
! matmul(&
! RTI%live(settings%h0:settings%h1,:RTI%nlive(i_cluster),i_cluster) &
! - spread(mean,dim=2,ncopies=RTI%nlive(i_cluster)) , &
! transpose( RTI%live(settings%h0:settings%h1,:RTI%nlive(i_cluster),i_cluster) &
! - spread(mean,dim=2,ncopies=RTI%nlive(i_cluster)) ) &
! )&
! +&
! matmul(&
! RTI%phantom(settings%h0:settings%h1,:RTI%nphantom(i_cluster),i_cluster) &
! - spread(mean,dim=2,ncopies=RTI%nphantom(i_cluster)) , &
! transpose( RTI%phantom(settings%h0:settings%h1,:RTI%nphantom(i_cluster),i_cluster) &
! - spread(mean,dim=2,ncopies=RTI%nphantom(i_cluster)) ) &
! ) &
! )/ (RTI%nlive(i_cluster) + RTI%nphantom(i_cluster) )
RTI%covmat(:,:,i_cluster) =( &
matmul(&
RTI%live(settings%h0:settings%h1,:RTI%nlive(i_cluster),i_cluster) &
- spread(mean,dim=2,ncopies=RTI%nlive(i_cluster)) , &
transpose( RTI%live(settings%h0:settings%h1,:RTI%nlive(i_cluster),i_cluster) &
- spread(mean,dim=2,ncopies=RTI%nlive(i_cluster)) ) &
)&
+&
matmul(&
RTI%phantom(settings%h0:settings%h1,:RTI%nphantom(i_cluster),i_cluster) &
- spread(mean,dim=2,ncopies=RTI%nphantom(i_cluster)) , &
transpose( RTI%phantom(settings%h0:settings%h1,:RTI%nphantom(i_cluster),i_cluster) &
- spread(mean,dim=2,ncopies=RTI%nphantom(i_cluster)) ) &
) &
)/ (RTI%nlive(i_cluster) + RTI%nphantom(i_cluster) )

! Calculate the cholesky decomposition
!RTI%cholesky(:,:,i_cluster) = calc_cholesky(RTI%covmat(:,:,i_cluster))
RTI%cholesky(:,:,i_cluster) = calc_cholesky(RTI%covmat(:,:,i_cluster))
end do


Expand Down

2 comments on commit e0965a5

@AdamOrmondroyd
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Time for some branch protection rules?

@williamjameshandley
Copy link
Member Author

@williamjameshandley williamjameshandley commented on e0965a5 Jan 2, 2024 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.