Fortran - lbound throws error 6366 "The shapes of the array expressions do not conform" -


so i've been confounded again fortran. go figure. anyway, i'm trying write pretty simple routine strips values off end of array. complicated works fine, except want write subroutine such don't have pass lower bound of input array it. here subroutine:

    subroutine strip(list,lstart, index)                 implicit none          integer :: i, index, isize, tsize, lstart, istart         real, dimension(:), allocatable, intent(inout) :: list         real, dimension(:), allocatable :: tlist                      isize = size(list)                      tsize = index-1                         print *, 'index', index          print *, 'isize', isize         print*, 'lbound', int(lbound(list))         print*, 'tsize', tsize               istart = lbound(list) !<---- lines throws error          !these commented out because below here works          !allocate(tlist(lstart:tsize))         !tlist = list(lstart:index-1)         !deallocate(list)          !call move_alloc(tlist,list)      end subroutine strip  

right i'm passing lower bound of input list subroutine (lstart), i'd not that. anyway, code doesn't compile, compiler throws error 6366: shapes of array expressions not conform [istart]

i don't know how fix this. suggestions?

lbound() returns array! read fortran manual (rtfm) @ https://gcc.gnu.org/onlinedocs/gfortran/lbound.html

it returns array many elements rank ("dimension" 1d,2d,...) of array.

to single number, specific dimension, use optional argument dim.

istart = lbound(list, 1) 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -