mult_hamil_vector_sparse_complex Subroutine

public subroutine mult_hamil_vector_sparse_complex(this, input_vector, output_vector)

Arguments

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

Contents


Source Code

    subroutine mult_hamil_vector_sparse_complex(this, input_vector, output_vector)
        type(HamiltonianCalcType), intent(inout) :: this
        complex(dp), intent(in) :: input_vector(:)
        complex(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) + sparse_ham(i)%elements(j) * input_vector(sparse_ham(i)%positions(j))
                end do
            end do

        end associate
    end subroutine mult_hamil_vector_sparse_complex