用Fortran写矩阵 [英] Write matrix with Fortran

查看:174
本文介绍了用Fortran写矩阵的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要用FORTRAN输出一个矩阵.我有一个可以计算值的有效代码,但我得到的不是矩阵,而是一列.矩阵很大,ixj =〜2000x2000.

I need to output a matrix with FORTRAN. I have a working code that calculates the values, but instead of a matrix, I get single a column. The matrix is huge, ixj = ~2000x2000.

这是我的示例代码:

  open(19, file="results1.txt", status="old", position="rewind", 
 & action="write") 

  do j=0,p
  do i=0,o
  write(19,*) mat_user_yield_surface(d, eps(i), deps(j), 200.0d0)
  end do
  end do

  close(19)

推荐答案

使用隐式do循环:

do j=0,p
   write(19,'(2000g22.14)') (mat_user_yield_surface(d, eps(i), deps(j),200.0d0),i=0,o)
end do

我建议不要使用"o"作为变量名,因为它很容易与零混淆.

I suggest not using "o" as a variable name, since it is easily confused with zero.

这篇关于用Fortran写矩阵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆