Skip to content

Commit

Permalink
Manually zero out negative matching entries
Browse files Browse the repository at this point in the history
  • Loading branch information
chrhansk committed Jun 21, 2024
1 parent 1514595 commit 8363779
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/scaling.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1189,7 +1189,7 @@ subroutine hungarian_match(m,n,ptr,row,val,iperm,num,dualu,dualv,st)
if (jperm(j) .ne. 0) cycle
k = k + 1
jdum = int(out(k))
iperm(jdum) = 0
iperm(jdum) = -j
end do
end subroutine hungarian_match

Expand Down Expand Up @@ -1619,7 +1619,7 @@ subroutine match_postproc(m, n, ptr, row, val, rscaling, cscaling, nmatch, &
real(wp), dimension(m), intent(inout) :: rscaling
real(wp), dimension(n), intent(inout) :: cscaling
integer, intent(in) :: nmatch
integer, dimension(m), intent(in) :: match
integer, dimension(m), intent(inout) :: match
integer, intent(inout) :: flag
integer, intent(inout) :: st

Expand All @@ -1628,6 +1628,13 @@ subroutine match_postproc(m, n, ptr, row, val, rscaling, cscaling, nmatch, &
real(wp), dimension(:), allocatable :: rmax, cmax
real(wp) :: ravg, cavg, adjust, colmax, v

! Zero out negative matching entries for
! structurally singular matrices
do i = 1, m
if (match(i) .gt. 0) cycle
match(i) = 0
end do

if (m .eq. n) then
! Square
! Just perform post-processing and magnitude adjustment
Expand Down

0 comments on commit 8363779

Please sign in to comment.