I am new to Fortran and what I want is that my size of the matrix depends on if N is even or odd, Naively I would try something like below, but this doesnt compile, if I remove the if statement it works fine though,
subroutine f(fMatrix,oMatrix,N)
implicit none;
integer,intent(in)::N
integer::d2
if(mod(N,2)==0) then ! if N is even then 1 type of size
parameter(d2=1)
else
parameter(d2=2)
endif
double precision,intent(in),dimension(N, d2):: fMatrix
double precision,intent(out),dimension(N, d2):: oMatrix
!do stuff here with fMatrix
oMatrix = fMatrix
end subroutine f
What would be possible workaround for this? without going to allocate? I am working with f2py, so any specifics in that way would be convenient.