append_I Subroutine

public subroutine append_I(vec, val)

Arguments

Type IntentOptional Attributes Name
integer, intent(inout), dimension(:), allocatable :: vec
integer, intent(in) :: val

Called by

proc~~append_i~~CalledByGraph proc~append_i append_I interface~append append interface~append->proc~append_i none~insert sparse_dmatrix_csr%insert none~insert->interface~append none~insert~2 sparse_zmatrix_csr%insert none~insert~2->interface~append none~insert~3 sparse_dmatrix_csc%insert none~insert~3->interface~append none~insert~4 sparse_zmatrix_csc%insert none~insert~4->interface~append proc~dmatmul_csc_csc dmatmul_csc_csc proc~dmatmul_csc_csc->none~insert~3 proc~dmatmul_csc_csr_2csc dmatmul_csc_csr_2csc proc~dmatmul_csc_csr_2csc->none~insert~3 proc~dmatmul_csc_csr_2csr dmatmul_csc_csr_2csr proc~dmatmul_csc_csr_2csr->none~insert proc~dmatmul_csr_csr dmatmul_csr_csr proc~dmatmul_csr_csr->none~insert proc~zmatmul_csc_csc zmatmul_csc_csc proc~zmatmul_csc_csc->none~insert~4 proc~zmatmul_csc_csr_2csc zmatmul_csc_csr_2csc proc~zmatmul_csc_csr_2csc->none~insert~4 proc~zmatmul_csc_csr_2csr zmatmul_csc_csr_2csr proc~zmatmul_csc_csr_2csr->none~insert~2 proc~zmatmul_csr_csr zmatmul_csr_csr proc~zmatmul_csr_csr->none~insert~2 interface~matmul~2 matmul interface~matmul~2->proc~dmatmul_csc_csc interface~matmul~2->proc~dmatmul_csc_csr_2csc interface~matmul~2->proc~dmatmul_csc_csr_2csr interface~matmul~2->proc~dmatmul_csr_csr interface~matmul~2->proc~zmatmul_csc_csc interface~matmul~2->proc~zmatmul_csc_csr_2csc interface~matmul~2->proc~zmatmul_csc_csr_2csr interface~matmul~2->proc~zmatmul_csr_csr

Source Code

  subroutine append_I(vec,val)
    integer,dimension(:),allocatable,intent(inout) :: vec
    integer,intent(in)                             :: val  
    integer,dimension(:),allocatable               :: tmp
    integer                                        :: n
    !
    if (allocated(vec)) then
       n = size(vec)
       allocate(tmp(n+1))
       tmp(:n) = vec
       call move_alloc(tmp,vec)
       n = n + 1
    else
       n = 1
       allocate(vec(n))
    end if
    !
    !Put val as last entry:
    vec(n) = val
    !
    if(allocated(tmp))deallocate(tmp)
  end subroutine append_I