FORTRAN 77 - 交换
使用 FORTRAN 77 是否可以在两个数组上执行交换,就像在 C++ 中交换一样?
我有两个大数组,例如 v1 和 v2,并且希望在每次迭代结束时交换 v1 和 v2,以便 v2 始终是最后一次迭代,而 v1 是工作数组。在 F77 中如何做到这一点?
With FORTRAN 77 is it possible to perform a swap on two arrays, in the same way swap works in c++?
I have two large arrays, e.g. v1 and v2, and would like to swap v1 and v2 at the end of each iteration such that v2 is always the last iteration and v1 is the working array. How does one do this in F77?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我明白了,你想做以下事情:
我认为这实际上不太可行,因为这样做的一个好方法是使用指针在数组之间切换,而这在 Fortran 77 中不可用。
难道不能在每次迭代中对子例程进行两次调用吗?
If I get it, you want to do the following kind of thing:
I would think this isn't really feasible, since a nice way to do this would be to use pointers to switch between arrays, which are not available in Fortran 77.
Can't you just do a double call to a the subroutine in each iteration?