由买买提看人间百态

topics

全部话题 - 话题: fortran90
首页 上页 1 2 (共2页)
C***S
发帖数: 175
1
来自主题: Computation版 - fortran给数组赋初值一问
It depends what fortran you are using.
do xi=-100,100,2
x(i)=xi
end do
in Fortran90 or Fortran95, you may find something easier.
like
INTEGER D(3)
D = (/1:5:2/) ! Triplet form
D = (/(I, I=1, 5, 2)/) ! Implied-do loop form
check you fortran help file, coz this could also be version dependable.
Different companis have some specific function or syntax on this.
g******s
发帖数: 733
2
来自主题: Computation版 - fortran给数组赋初值一问
thanks a lot! I am using Unix system. Matlab is too slow for me and I am
changing my matlab codes to Fortran.
Does Unix have Fortran90 or 95 compiler? How can I know if Unix have the
compiler or not? I have to do matrix adding, comlex, fourier tranform etc, any
good book recommend?
Thanks a lot!
g******s
发帖数: 733
3
多谢! 但是fortran90中整型4种,kind=1,2,4,8,分别对应1,2,4,8 byte integer,
( http://www.ifw-dresden.de/~ulrike/intel/lim_kind.htm ) 他们有什么区别呢?
g******s
发帖数: 733
4
来自主题: Computation版 - fortran90的超级怪问题
程序如下
PROGRAM MAIN
IMPLICIT NONE
real aa
aa=1023.0/2.0*1.0e-4
print*,aa
END PROGRAM
用f90 filename.f90 -o filename之后,filename出来的结果是0.051149997
用f77,把1023.0改成1021.0或1025.0,或者把*1.0e-4改成/1.0e4都对。
什么原因?先谢了!
f****r
发帖数: 27
5
来自主题: Computation版 - fortran90的超级怪问题
It's called truncation error
g******s
发帖数: 733
6
来自主题: Computation版 - fortran90的超级怪问题
i don't think it's truncation error. Even using double precision, the error
doesnot change. I believe sth is wrong in the codes or somewhere.
r****y
发帖数: 1437
7
来自主题: Computation版 - fortran90的超级怪问题
For single precision, the machine precision is about 1e-7. Your result
is correct within machine precision.
For double precision, if you explicitly use 2.0D0, 1.0D-4. You will
get higher precision than single precision. If just 2.0, then your compiler
might convert it to 2.0000011111.
Different compilers can be a problem as well. Recently I have a code
working perfectly on SGI, Sun UNIX, Linux gnu compiler, but Linux PGI compiler
will give me a wrong answer.
g******s
发帖数: 733
8
来自主题: Computation版 - fortran90的超级怪问题
Thanks a lot for your post, it's very helpful. I just found the problem you
said, and another very similar problem is coming for double double precision,
or real*16 (kind=16). Say I want to give pi a value 3.1415926536, the value
would not change if I explicitly use "D0". However, if I declare pi to be kind
=16, the value will change even when I explicitely used "D0".
Here is the code,
PROGRAM MAIN
IMPLICIT NONE
real(kind=16) pi
pi=3.1415926536d0
print*,pi
END
the value will change to 3.14159265
r****y
发帖数: 1437
9
来自主题: Computation版 - fortran90的超级怪问题
real (kind=16) is not double precision, it is quadraple precision. That's
why
your 3.14159***D0 failed.
if you really have to consider the precision proble up to kind=16, then most
time it means your code is not well written. There must be other way to do it
.
Usually, should not specify inside code, just write down
real a
**********
Then when you compile, use switch -r8, or -r16. This would be better than
your in-code declaration.
Seems you are such a rookie. Hehe.

,
kind
g******s
发帖数: 733
10
来自主题: Computation版 - fortran90的超级怪问题
thanks a lot! But I don't know how to separate the compiling and link commands
. I use "f90 filename.f90 -o filename" which has put the compiling and link
together; or "f77 -c [-O4] filename.f" which doesn't recognize the switch "-r8
" or "-r16". What kind of compile and link commands shall I use if I want to
add the switch -r8 or -r16?

most
it
l******n
发帖数: 9344
11
来自主题: Computation版 - fortran90的超级怪问题
write a makefile

commands
r8
b*******d
发帖数: 87
12
来自主题: Computation版 - 有关Fortran90的一个问题!
有个问题不知道怎么解决,请教一下这里的fortran高手:
我的一个程序在编译的时候用O5优化选项和不用的时候运行结果差别很大,超出了可接受
范围,但是用优化选项在时间上可以加快很多,到底哪一种编译方式的结果是准确的呢?
还是我的程序本身有问题?
非常感谢!
r****y
发帖数: 1437
13
来自主题: Computation版 - 俺当年的糗事
fortran90? hehe.
k*********g
发帖数: 791
14
来自主题: Computation版 - c++ versus fortran
1 功能
c++什么都能做,早期fortran只能做数值计算,现在能做非数值的东西,但还是远没有
c++完备;
其实,fortran77是个好东西:专项、简单;从fortran90开始,哲学出了问题;
2 软件开发
c++是开发软件的最好语言,很大程度是因为它的“面向对象”的特点,其实就是“鼓
励”、“帮助”庞大的程序群的“创造”、“管理”;
用fortran写软件,不仅仅有些功能(如,对计算机软硬件的操作)没法办,而且整个
软件会被管理得一塌糊涂;用c++,10个人1年就能搞定的东西,if用frotran,同样10
个人估计需要5年;
3 软件工程
即便不是做软件,而是写个1万行数量级的程序,c++也因为promotes优良的编程习惯而
战胜fortran;
4 super c
如果没有那么多的“object”,不需要++,那么可以不用c++的那些oop东西,把它当作
一个改进的c,有人称之super c,来用;这样,c++和fortran都是command oriented的
结构化语言; 用super c 写的程序,将来能比较迅速地upgrade成软件,if fortran,
k*********g
发帖数: 791
15
来自主题: Computation版 - c++ versus fortran
1 功能
c++什么都能做,早期fortran只能做数值计算,现在能做非数值的东西,但还是远没有
c++完备;
其实,fortran77是个好东西:专项、简单;从fortran90开始,哲学出了问题;
2 软件开发
c++是开发软件的最好语言,很大程度是因为它的“面向对象”的特点,其实就是“鼓
励”、“帮助”庞大的程序群的“创造”、“管理”;
用fortran写软件,不仅仅有些功能(如,对计算机软硬件的操作)没法办,而且整个
软件会被管理得一塌糊涂;用c++,10个人1年就能搞定的东西,if用frotran,同样10
个人估计需要5年;
3 软件工程
即便不是做软件,而是写个1万行数量级的程序,c++也因为promotes优良的编程习惯而
战胜fortran;
4 super c
如果没有那么多的“object”,不需要++,那么可以不用c++的那些oop东西,把它当作
一个改进的c,有人称之super c,来用;这样,c++和fortran都是command oriented的
结构化语言; 用super c 写的程序,将来能比较迅速地upgrade成软件,if fortran,
得... 阅读全帖
j**f
发帖数: 7403
16
来自主题: Computation版 - 弱问:FORTRAN90调用子程序问题
假如,主程序中调用了 call suba(a, b, c, na, nb, nx) 一共6个变量,
分别为REAL,INT等类型。
而子程序的动议里 subroutine suba(a,b,na,nb,nx)和主程序不对应,差一点点。
怎么样,能让系统自动的告诉我出错?好像我的程序不告诉我出错,类似的
BUG需要好长时间才能发现。怎么办呢?是要改MAKEFILE么?
多谢回答!
x*****u
发帖数: 3419
17
来自主题: Computation版 - 弱问:FORTRAN90调用子程序问题
你写一个完整的小程序上来看看?
l***s
发帖数: 1405
18
来自主题: Computation版 - 弱问:FORTRAN90调用子程序问题
intel 的compiler似乎可以发现的
t*****z
发帖数: 812
19
来自主题: Computation版 - 弱问:FORTRAN90调用子程序问题
ftn check
l*******G
发帖数: 1191
20
来自主题: Computation版 - fortran90 奇怪的格式问题
对于自己定义的数据(结构)的成员打印格式居然出问题。有兴趣的看一下为何主程序
最后两行打印结果不一样?gfortran and ifort give same results on linux.
=====save to test.f90, and then "ifort test.f90" and then "./a.out" to run=====
module numz
integer, parameter:: b8 = selected_real_kind(14)
integer,allocatable :: a_gene(:),many_genes(:,:)
end module
module galapagos
use numz
... 阅读全帖
l*******G
发帖数: 1191
21
来自主题: Computation版 - fortran90 奇怪的格式问题
对于自己定义的数据(结构)的成员打印格式居然出问题。有兴趣的看一下为何主程序
最后两行打印结果不一样?gfortran and ifort give same results on linux.
=====save to test.f90, and then "ifort test.f90" and then "./a.out" to run=====
module numz
integer, parameter:: b8 = selected_real_kind(14)
integer,allocatable :: a_gene(:),many_genes(:,:)
end module
module galapagos
use numz
... 阅读全帖
a******1
发帖数: 47
22
来自主题: Computation版 - fortran90 奇怪的格式问题
you results(j)%index is equal to 35.00
f10.8 means 10 positions (including all digits and decimal point) to be used
and 8 digits to the right of decimal point. You can revise this format into
f10.7 or f11.8
l*******G
发帖数: 1191
23
来自主题: Computation版 - fortran90 奇怪的格式问题
thanks, I overlooked that...
j***n
发帖数: 1471
24
来自主题: ME版 - job opening in Houston (转载)
【 以下文字转载自 JobHunting 讨论区 】
发信人: soccerdad (soccerdad), 信区: JobHunting
标 题: job opening in Houston
发信站: BBS 未名空间站 (Fri Aug 12 11:54:40 2011, 美东)
nonprofit company
CFD engineer
Minimum Requirements:
Ph.D.
Fortran90
Other Requirements:
parallel computation
Star-CCM+
Fluent
If you are interested, drop me your resume: k****[email protected]
Thanks,
d****i
发帖数: 11
25
来自主题: Science版 - 大家说完了,我就来作合集
IDL 是什么东东?哪里有得download?
Matlab 还是爽啊。几行code搞定。
现在的 Fortran 还要不要求 code 逮从第 7 column 开始之类的?
请Fortran90/77大侠们不吝赐教。
m****r
发帖数: 111
26
来自主题: Statistics版 - FORTRAN新手自学求助
照着网上搜来的一个fortran90 introduction抄来的
program mult1
implicit none
integer i,j,k
i=5
j=8
k=i*j
write(*,*)i,j,k
stop
end program mult1
多谢!
首页 上页 1 2 (共2页)