deallocate_sparse_ham Subroutine

public subroutine deallocate_sparse_ham(sparse_matrix, sparse_tags)

Arguments

Type IntentOptional Attributes Name
type(sparse_matrix_real), intent(inout), allocatable :: sparse_matrix(:)
integer(kind=TagIntType), intent(inout), allocatable :: sparse_tags(:,:)

Contents

Source Code


Source Code

    subroutine deallocate_sparse_ham(sparse_matrix, sparse_tags)

        ! Deallocate the whole array, and remove all rows from the memory manager.

        type(sparse_matrix_real), intent(inout), allocatable :: sparse_matrix(:)
        integer(TagIntType), intent(inout), allocatable :: sparse_tags(:, :)
        integer :: sparse_matrix_size, i, ierr
        character(len=*), parameter :: t_r = "deallocate_sparse_ham"

        sparse_matrix_size = size(sparse_matrix)

        do i = sparse_matrix_size, 1, -1

            deallocate(sparse_matrix(i)%elements, stat=ierr)
            !call LogMemDealloc(t_r, sparse_tags(1,i), ierr)

            deallocate(sparse_matrix(i)%positions, stat=ierr)
            !call LogMemDealloc(t_r, sparse_tags(2,i), ierr)

        end do

        if (allocated(sparse_tags)) deallocate(sparse_tags)
        if (allocated(sparse_matrix)) deallocate(sparse_matrix)

    end subroutine deallocate_sparse_ham