Redian新闻
>
fortran给数组赋初值一问
avatar
fortran给数组赋初值一问# Computation - 科学计算
g*s
1
matlab中为x=-100:2:100;请问用fortran该怎么写?先谢了!BOW!
avatar
C*S
2
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 的大作中提到】
: matlab中为x=-100:2:100;请问用fortran该怎么写?先谢了!BOW!
avatar
g*s
3
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!

【在 C***S 的大作中提到】
: 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.

avatar
C*S
4
if you need to do FT, you better choose matlab. I do not know wether you can
find the library for FT under Fortran.
Also, since you are dealing matrix, matlab is a good choice.
If not too many loops, and you vectorized your program of matlab, it should
not be very slow.
Unix will have gcc, and mostly support fortran77.
You can check the help for detail, like man gcc

any

【在 g******s 的大作中提到】
: 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!

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。