a program in Fortran90 -
this question has answer here:
i have code in fortran 90 think code not have problem,
program xfitexy ! driver routine fitexy use nrtype use nr use ran_state, : ran_seed implicit none integer(i4b), parameter :: npt=30 real(sp) :: a,b,chi2,harvest,q,sa,sb,siga,sigb real(sp), dimension(npt) :: x,y,dx,dy,dz integer(i4b) :: call ran_seed(sequence=1411) dz(:)=0.0 i=1,npt call ran1(harvest) dx(i)=0.1_sp+harvest call ran1(harvest) dy(i)=0.1_sp+harvest call gasdev(harvest) x(i)=10.0_sp+10.0_sp*harvest call gasdev(harvest) y(i)=2.0_sp*x(i)-5.0_sp+dy(i)*harvest call gasdev(harvest) x(i)=x(i)+dx(i)*harvest end write(*,*) 'values of a,b,siga,sigb,chi2,q:' write(*,*) 'fit x , y errors gives:' call fitexy(x,y,dx,dy,a,b,siga,sigb,chi2,q) write(*,'(1x,6f12.6)') a,b,siga,sigb,chi2,q write(*,*) write(*,*) 'setting x errors 0 gives:' call fitexy(x,y,dz,dy,a,b,siga,sigb,chi2,q) write(*,'(1x,6f12.6)') a,b,siga,sigb,chi2,q write(*,*) '...to compared fit result:' call fit(x,y,a,b,siga,sigb,chi2,q,dy) sa=sqrt(siga**2+sigb**2*(a/b)**2)/b sb=sigb/b**2 write(*,'(1x,6f12.6)') -a/b,1./b,sa,sb,chi2,q end program xfitexy
when compile following error:
use nrtype; use nrutil 1 fatal error: can't open module file 'nrtype.mod' reading @ (1): no such file or directory
could please tell me how can solve thank much
i may wrong, guessing copied program other source. don't me wrong, emulation way start learning code, because causes learning mistakes this. use command instructs compiler file called module contains multiples subprograms (functions or subroutines) must stored in same file program being compiled. modules titled nrtype.f90, nr.f90 , ran_state.f90 must in same file xfitxy program compiler can transform them nrtype.mod, nr.mod , ran_state.mod files compiled single program main program.
Comments
Post a Comment