brucebowler Guest
|
Posted: Fri May 19, 2006 7:48 am Post subject: Problem with log and allocatable arrays? |
|
|
Simple example...
real x(2),y(2)
real s,i
interface
subroutine exponentialFit(x,y,slope,intercept)
implicit none
real,intent(in),dimension( :: x
real,intent(in),dimension( :: y
real,intent(out) :: slope
real,intent(out) :: intercept
end subroutine
end interface
x(1) = 310.35417
x(2) = 317.3125
y(1) = 0.0108
y(2) = 0.7
call exponentialFit(x,y,s,i)
stop
end
subroutine exponentialFit(x,y,slope,intercept)
implicit none
real,intent(in),dimension( :: x
real,intent(in),dimension( :: y
real,intent(out) :: slope
real,intent(out) :: intercept
real, dimension(, allocatable :: logy
allocate (logy(size(y)))
logy=log(y)
return
end
in wsdbg, after the logy=log(y)
logy(1) = -1064245481
logy(2) = -1095328230
If I fix the dimension of logy to 2 (ie don't deal with the allocate, allocatable etc), the values in logy are the correct ones.
What am I doing wrong? |
|