mult_hamil_vector_sparse_real Subroutine

public subroutine mult_hamil_vector_sparse_real(this, input_vector, output_vector)

Arguments

Type IntentOptional Attributes Name
type(HamiltonianCalcType), intent(inout) :: this
real(kind=dp), intent(in) :: input_vector(:)
real(kind=dp), intent(out) :: output_vector(:)

Contents


Source Code

    subroutine mult_hamil_vector_sparse_real(this, input_vector, output_vector)
        type(HamiltonianCalcType), intent(inout) :: this
        real(dp), intent(in) :: input_vector(:)
        real(dp), intent(out) :: output_vector(:)
        integer :: i, j

        associate(space_size => this%space_size)
            output_vector = 0.0_dp

            do i = 1, space_size
                do j = 1, sparse_ham(i)%num_elements
                    output_vector(i) = output_vector(i) + real(sparse_ham(i)%elements(j) * input_vector(sparse_ham(i)%positions(j)), dp)
                end do
            end do

        end associate
    end subroutine mult_hamil_vector_sparse_real