这两行Fortran代表Fortran宏吗? [英] Do these 2 lines of Fortran represent a Fortran macro?

查看:254
本文介绍了这两行Fortran代表Fortran宏吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将一些Fortran代码转换为C,我不明白这里发生了什么。



这段代码来自TOMS,Transaction on Mathematical Software,所以我不认为这是错误的一行代码。



除了我在这里展示的内容外,ZCOS和A在文件中没有其他定义。这是一种用于将ZCOS定义为COS的Fortran技术,如果是这样,它完成了什么?

  REAL ZCOS 
ZCOS(A)= COS(A)
C(I)= ONE /(TWO * ZCOS(C(I)* PI / DBLE(N + N))


解决方案

这是一个声明函数,多次解释 ZCOS 是一个真正的函数,并且在前两行定义。



第一行定义 ZCOS



第二行定义了函数本身。

<第三行可以是数组访问或另一个语句函数。注意:通常情况下, ZCOS 是<$ c $的特定函数。
< c> COS 泛型,采用双复杂参数。这是一个非标准的扩展,你的代码不会使用这个内在的。

I am converting some Fortran code to C and I don't understand what is going on here.

This code came from TOMS, Transactions on Mathematical Software, so I don't believe this is an errant line of code.

ZCOS and A have no other definitions in the file other than what I am showing here. Is this a Fortran technique for defining ZCOS as COS, and if so, what does it accomplish?

REAL ZCOS
ZCOS(A) = COS(A)      
C(I) = ONE / (TWO * ZCOS ( C(I) * PI / DBLE(N+N) ))

解决方案

This is a statement function, explained many times on SO. ZCOS is a real function and is defined in the first 2 lines.

The first line define the type of ZCOS.

The second line defines the function itself.

The third line could be an array access or another statement function. It cannot be decided without context.

Remark: Often, ZCOS is a specific functions for the COS generic, taking a double complex argument. It is a non-standard extension and your code does not use this intrinsic.

这篇关于这两行Fortran代表Fortran宏吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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