get_elem_sparse Function

private function get_elem_sparse(this, index) result(element)

Retrieve an element from the 6-index integrals stored in sparse format @param[in] index contiguous index of the element to be retrieved @return element value of the element with the given contiguous index

Type Bound



Type IntentOptional Attributes Name
class(sparse_lMat_t), intent(in) :: this
integer(kind=int64), intent(in) :: index

Return Value real(kind=dp)


Source Code

Source Code

    function get_elem_sparse(this, index) result(element)
        class(sparse_lMat_t), intent(in) :: this
        integer(int64), intent(in) :: index
        HElement_t(dp) :: element

        integer(int64) :: lower, upper, i, pos
        logical :: t_found

        ! Lookup the element
        call this%htable%lookup(index, pos, t_found)
        ! If it is there, return the entry
        if (t_found) then
            element = this%nonzero_vals%ptr(pos)
            ! Else, return 0 (zero matrix element)
            element = 0.0_dp
        end if

    end function get_elem_sparse