sign_lt Function

public pure function sign_lt(iLutI, iLutJ) result(bLt)

Arguments

Type IntentOptional Attributes Name
integer(kind=n_int), intent(in) :: iLutI(0:)
integer(kind=n_int), intent(in) :: iLutJ(0:)

Return Value logical


Contents

Source Code


Source Code

    pure function sign_lt(ilutI, ilutJ) result(bLt)

        ! This is a comparison function between two bit strings of length
        ! 0:NIfTot, and will return true if absolute value of the sign of
        ! ilutI is less than ilutJ

        integer(n_int), intent(in) :: iLutI(0:), iLutJ(0:)
        logical :: bLt
        real(dp) :: SignI(lenof_sign), SignJ(lenof_sign)
        real(dp) :: WeightI, WeightJ

        call extract_sign(ilutI, SignI)
        call extract_sign(ilutJ, SignJ)

        if (lenof_sign == 1) then
            bLt = abs(SignI(1)) < abs(SignJ(1))
        else
            WeightI = sqrt(real(SignI(1), dp)**2 + &
                           real(SignI(lenof_sign), dp)**2)
            WeightJ = sqrt(real(SignJ(1), dp)**2 + &
                           real(SignJ(lenof_sign), dp)**2)

            bLt = WeightI < WeightJ
        end if
    end function sign_lt