(整理)FORTRAN 函数列表.
- 格式:docx
- 大小:26.82 KB
- 文档页数:7
FORTRAN 90标准函数(一)(2012-07-03 17:14:57)转载▼分类:学习标签:fortran函数教育符号约定:●I代表整型;R代表实型;C代表复型;CH代表字符型;S代表字符串;L代表逻辑型;A代表数组;P代表指针;T代表派生类型;AT为任意类型。
●s:P表示s类型为P类型(任意kind值)。
s:P(k)表示s类型为P类型(kind值=k)。
●[…]表示可选参数。
●*表示常用函数。
注:三角函数名前有C、D的函数为复数、双精度型函数。
注:指数函数名、平方根函数名、对数函数名前有C、D的函数为复数、双精度型函数。
表4 参数查询函数atan2函数的值域是多少?我从网上找到一个fortran函数的日志,说此值域是-π~π,但正常反正切函数的值域应该是-π/2~π/2。
对atan2函数不够了解,所以不知道你的答案对不对,我个人认为不对。
我是用正常的反正切函数atan(v/u)来算的:FORTRAN:if (u>0..and.v>0.) dir=270-atan(v/u)*180/piif (u<0..and.v>0.) dir=90-atan(v/u)*180/piif (u<0..and.v<0.) dir=90-atan(v/u)*180/piif (u>0..and.v<0.) dir=270-atan(v/u)*180/piif (u==0..and.v>0.) dir=180if (u==0..and.v<0.) dir=0if (u>0..and.v==0.) dir=270if (u<0..and.v==0.) dir=90if (u==0..and.v==0.) dir=999其中uv等于零的五种情况要单独挑出来,不然程序会有瑕疵。
atan函数换成atand函数的话直接是度数,不用*180/pi我四个象限和轴都试了,应该没错。
1、RANDOM_NUMBERSyntax ['sintæks] n. 语法CALL RANDOM_NUMBER (harvest结果)Intrinsic Subroutine(固有子程序):Returns a pseudorandom number greater than or equal to zero and less than one from the uniform distribution.返回大于或等于0且小于1,服从均匀分布的随机数2、RNNOA/ DRNNOA (Single/Double precision)Generate pseudorandom numbers from a standard normal distribution using an acceptance/rejection method.产生服从标准正态分布的随机数Usage(用法)CALL RNNOA (NR, R)Arguments(参数)NR— Number of random numbers to generate. (Input) 要产生随机数的个数R— Vector of length NR containing the random standard normal deviates. (Output)输出长度为NR,随机正态分布的向量Comments(注解)The routine RNSET can be used to initialize the seed of the random number generator. The routine RNOPT can be used to select the form of the generator.程序RNSET可以用来初始化随机数发生器的种子ExampleIn this example, RNNOA is used to generate five pseudorandom deviates from a standard normal distribution.INTEGER ISEED, NOUT, NRREAL R(5)EXTERNAL RNNOA, RNSET, UMACHCCALL UMACH (2, NOUT)NR = 5ISEED = 123457CALL RNSET (ISEED)CALL RNNOA (NR, R)WRITE (NOUT,99999) R99999 FORMAT (' Standard normal random deviates: ', 5F8.4)ENDOutputStandard normal random deviates: 2.0516 1.0833 0.0826 1.2777 -1.22603、RESHAPEIntrinsic Function(内部函数)Constructs an array of a specified shape from the elements of another array. 构造规定形式的数组Syntax(语法)result = RESHAPE (source, shape [ , pad][ , order])source(Input) Any type. Array whose elements will be taken in standard Fortran array order (see Remarks), and then placed into a new array.shape(Input) Integer. One-dimensional array that describes the shape of the output array created from elements of source. 描述输出数组的大小的一维数组,The elements of shape are the sizes of the dimensions of the reshaped array in order. If pad is omitted 省略, the total size specified by shape must be less than or equal to source.pad 可选参数(Optional; input) Same type as source. Must be an array. If there are not enough elements in source to fill the result array, elements of pad are added in standardFortran array order. If necessary, extra copies of pad are used to fill the array.order 可选参数(Optional; input) Integer. One-dimensional array. Must be the same length as shape.Permutes the order of dimensions in the result array. The value of order must be a permutation of (1, 2,...n) where n is the size of shape.Return Value(返回值)The result is an array the same data type and kind as source and a shape as defined in shape.ExamplesINTEGER AR1( 2, 5)REAL F(5,3,8)REAL C(8,3,5)AR1 = RESHAPE((/1,2,3,4,5,6/),(/2,5/),(/0,0/),(/2,1/))! returns 1 2 3 4 5! 6 0 0 0 0!! Change Fortran array order to C array orderC = RESHAPE(F, (/8,3,5/), ORDER = (/3, 2, 1/))END4、SUMIntrinsic Function(内部函数)Sums elements of an array or the elements along an optional dimension. The elements summed can be selected by an optional mask.将数组中的元素求和Syntax(语法)result = SUM (array [ , dim] [ , mask])array(Input) Integer, real, or complex. Array whose elements are to be summed.dim 可选参数(Optional; input) Integer. Dimension along which elements are summed.1 ≤dim≤n, where n is the number of dimensions in array.mask 可选参数(Optional; input) Logical. Must be same shape as array. If mask is specified, only elements in array that correspond to .TRUE. elements in mask are summed.Return Value(返回值)Same type and kind as array and equal to the sum of all elements in array or the sum of elements along dimension dim. If mask is specified, only elements that correspondto .TRUE. elements in mask are summed. Returns a scalar if dim is omitted or array is one-dimensional. Otherwise, returns an array one dimension smaller than array.ExamplesINTEGER array (2, 3), i, j(3)array = RESHAPE((/1, 2, 3, 4, 5, 6/), (/2, 3/))! array is 1 3 5! 2 4 6i = SUM((/ 1, 2, 3 /)) ! returns 6j = SUM(array, DIM = 1) ! returns [3 7 11]WRITE(*,*) i, jEND5、SEEDRun-Time Subroutine Changes the starting point of the pseudorandom number generator. 改变随机数发生器的起始点ModuleUSE MSFLIBSyntax(语法)CALL SEED (iseed)iseed(Input) INTEGER(4). Starting point for RANDOM.Remarks(注解)SEED uses iseed to establish the starting point of the pseudorandom number generator.A given seed always produces the same sequence of values from RANDOM.If SEED is not called before the first call to RANDOM, RANDOM always begins with a seed value of one. If a program must have a different pseudorandom sequence each time it runs, pass the constant RND$TIMESEED (defined in MSFLIB.F90) to the SEED routine before the first call to RANDOM.ExampleUSE MSFLIBREAL randCALL SEED(7531)CALL RANDOM(rand)6、RANDOMPurposeRun-Time Subroutine Returns a pseudorandom number greater than or equal to zero and less than one from the uniform distribution. 返回大于或等于0且小于1,服从均匀分布的随机数ModuleUSE MSFLIBSyntaxCALL RANDOM (ranval)ranval(Output) REAL(4). Pseudorandom number, 0 ≤ranval< 1, from the uniformdistribution.RemarksA given seed always produces the same sequence of values from RANDOM.If SEED is not called before the first call to RANDOM, RANDOM begins with a seed value of one. If a program must have a different pseudorandom sequence each time it runs, pass the constant RND$TIMESEED (defined in MSFLIB.F90) to SEED before the first call to RANDOM.All the random procedures (RANDOM, RAN, and RANDOM_NUMBER, and the PortLib functions DRAND, DRANDM, RAND, IRANDM, RAND, and RANDOM) use the same algorithms and thus return the same answers. They are all compatible and can be used interchangeably. (The algorithm used is a “Prime Modulus M Multiplicative Linear Congruential Generator,” a modified version of t he random number generator by Park and Miller in “Random Number Generators: Good Ones Are Hard to Find,” CACM, October 1988, Vol. 31, No. 10.)CompatibilityCONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIBExampleUSE MSFLIBREAL(4) ranCALL SEED(1995)CALL RANDOM(ran)7、FFT2BCompute the inverse Fourier transform of a complex periodic two-dimensional array.计算二维复数数组的逆傅里叶变换Usage(用法)CALL FFT2B (NRCOEF, NCCOEF, COEF, LDCOEF, A, LDA)Arguments(参数)NRCOEF— The number of rows of COEF. (Input) 数组COEF的行数NCCOEF— The number of columns of COEF. (Input) 数组COEF的列数COEF—NRCOEF by NCCOEF complex array containing the Fourier coefficients to be transformed. (Input) NRCOEF行NCCOEF列数组LDCOEF— Leading dimension of COEF exactly as specified in the dimension statement of the calling program. (Input)A—NRCOEF by NCCOEF complex array containing the Inverse Fourier coefficients of COEF. (Output) NRCOEF行NCCOEF列复数数组,包含数组COEF的逆傅里叶系数LDA— Leading dimension of A exactly as specified in the dimension statement of the calling program. (Input)Comments(注解)1.Automatic workspace usage isFFT2B4 * (NRCOEF + NCCOEF) + 32 + 2 *MAX(NRCOEF, NCCOEF) units, orDFFT2B8 * (NRCOEF + NCCOEF ) + 64 + 4 *MAX(NRCOEF, NCCOEF) units.Workspace may be explicitly provided, if desired, by use of F2T2B/DF2T2B. The reference isCALL F2T2B (NRCOEF, NCCOEF, A, LDA, COEF, LDCOEF,WFF1, WFF2, CWK, CPY)The additional arguments are as follows:WFF1— Real array of length 4 *NRCOEF + 15 initialized by FFTCI. The initialization depends on NRCOEF. (Input)WFF2— Real array of length 4 *NCCOEF + 15 initialized by FFTCI. The initialization depends on NCCOEF. (Input)CWK— Complex array of length 1. (Workspace)CPY— Real array of length 2 *MAX(NRCOEF, NCCOEF). (Workspace)2.The routine FFT2B is most efficient when NRCOEF and NCCOEF are the product of small primes.3.The arrays COEF and A may be the same.4.If FFT2D/FFT2B is used repeatedly, with the same values for NRCOEF and NCCOEF, then use FFTCI to fill WFF1(N = NRCOEF) and WFF2(N = NCCOEF). Follow this with repeated calls to F2T2D/F2T2B. This is more efficient than repeated calls toFFT2D/FFT2B.AlgorithmThe routine FFT2B computes the inverse discrete complex Fourier transform of a complex two-dimensional array of size (NRCOEF = N) ⨯ (NCCOEF = M). The method used is a variant of the Cooley-Tukey algorithm , which is most efficient when N and M are both products of small prime factors. If N and M satisfy this condition, then the computational effort is proportional to N M log N M. This considerable savings has historically led people to refer to this algorithm as the "fast Fourier transform" or FFT.Specifically, given an N⨯M array c = COEF, FFT2B returns in aFurthermore, a vector of Euclidean norm S is mapped into a vector of normFinally, note that an unnormalized inverse is implemented in FFT2D. The routine FFT2B is based on the complex FFT in FFTPACK. The package FFTPACK was developed by Paul Swarztrauber at the National Center for Atmospheric Research.ExampleIn this example, we first compute the Fourier transform of the 5 ⨯ 4 arrayfor 1 ≤n≤ 5 and 1 ≤m≤ 4 using the IMSL routine FFT2D. The resultis then inverted by a call to FFT2B. Note that the result is an array a satisfying a = (5)(4)x = 20x. In general, FFT2B is an unnormalized inverse with expansion factor N M.INTEGER LDA, LDCOEF, M, N, NCA, NRACOMPLEX CMPLX, X(5,4), A(5,4), COEF(5,4)CHARACTER TITLE1*26, TITLE2*26, TITLE3*26INTRINSIC CMPLXEXTERNAL FFT2B, FFT2D, WRCRNCTITLE1 = 'The input matrix is below 'TITLE2 = 'After FFT2D 'TITLE3 = 'After FFT2B 'NRA = 5NCA = 4LDA = 5LDCOEF = 5C Fill X with initial dataDO 20 N=1, NRADO 10 M=1, NCAX(N,M) = CMPLX(FLOAT(N+5*M-5),0.0)10 CONTINUE20 CONTINUECCALL WRCRN (TITLE1, NRA, NCA, X, LDA, 0)CCALL FFT2D (NRA, NCA, X, LDA, COEF, LDCOEF)CCALL WRCRN (TITLE2, NRA, NCA, COEF, LDCOEF, 0)CCALL FFT2B (NRA, NCA, COEF, LDCOEF, A, LDA)CCALL WRCRN (TITLE3, NRA, NCA, A, LDA, 0)CENDOutputThe input matrix is below1 2 3 41 ( 1.00, 0.00) ( 6.00, 0.00) ( 11.00, 0.00) ( 16.00, 0.00)2 ( 2.00, 0.00) ( 7.00, 0.00) ( 12.00, 0.00) ( 17.00, 0.00)3 ( 3.00, 0.00) ( 8.00, 0.00) ( 13.00, 0.00) ( 18.00, 0.00)4 ( 4.00, 0.00) ( 9.00, 0.00) ( 14.00, 0.00) ( 19.00, 0.00)5 ( 5.00, 0.00) ( 10.00, 0.00) ( 15.00, 0.00) ( 20.00, 0.00) After FFT2D1 2 3 41 ( 210.0, 0.0) ( -50.0, 50.0) ( -50.0, 0.0) ( -50.0, -50.0)2 ( -10.0, 13.8) ( 0.0, 0.0) ( 0.0, 0.0) ( 0.0, 0.0)3 ( -10.0, 3.2) ( 0.0, 0.0) ( 0.0, 0.0) ( 0.0, 0.0)4 ( -10.0, -3.2) ( 0.0, 0.0) ( 0.0, 0.0) ( 0.0, 0.0)5 ( -10.0, -13.8) ( 0.0, 0.0) ( 0.0, 0.0) ( 0.0, 0.0) After FFT2B1 2 3 41 ( 20.0, 0.0) ( 120.0, 0.0) ( 220.0, 0.0) ( 320.0, 0.0)2 ( 40.0, 0.0) ( 140.0, 0.0) ( 240.0, 0.0) ( 340.0, 0.0)3 ( 60.0, 0.0) ( 160.0, 0.0) ( 260.0, 0.0) ( 360.0, 0.0)4 ( 80.0, 0.0) ( 180.0, 0.0) ( 280.0, 0.0) ( 380.0, 0.0)5 ( 100.0, 0.0) ( 200.0, 0.0) ( 300.0, 0.0) ( 400.0, 0.0)8、TIMEFPurposePortLib Function Returns the number of seconds since the first time it is called, or zero.ModuleUSE PORTLIBSyntaxresult=TIMEF ( )Return ValueREAL(8). Number of seconds that have elapsed since the first time TIMEF( ) was called. The first time called, TIMEF returns 0.0D0.CompatibilityCONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIBExampleUSE PORTLIBINTEGER i, jREAL(8) elapsed_timeelapsed_time = TIMEF() DO i = 1, 100000j = j + 1END DOelapsed_time = TIMEF() PRINT *, elapsed_time END。
附录 FORTRAN 90标准函数符号约定:●I代表整型;R代表实型;C代表复型;CH代表字符型;S代表字符串;L代表逻辑型;A代表数组;P代表指针;T代表派生类型;AT为任意类型。
●s:P表示s类型为P类型(任意kind值)。
s:P(k)表示s类型为P类型(kind 值=k)。
●[…]表示可选参数。
●*表示常用函数。
表1 数值和类型转换函数函数名 说明ABS(x)* 求x的绝对值∣x∣。
x:I、R, 结果类型同x; x:C, 结果:RAIMAG(x) 求x的实部。
x:C, 结果:RAINT(x[,kind])* 对x取整,并转换为实数(kind)。
x:R, kind:I, 结果:R(kind)AMAX0(x1,x2,x3,…)* 求x1,x2,x3,…中最大值。
x I:I, 结果:RAMIN0(x1,x2,x3,…)* 求x1,x2,x3,…中最小值。
x I:I, 结果:RANINT(x[,kind])* 对x四舍五入取整,并转换为实数(kind)。
x:R, kind:I, 结果:R(kind) CEILING(x)* 求大于等于x的最小整数。
x:R, 结果:ICMPLX(x[,y][,kind])) 将参数转换为x、(x,0.0)或(x,y)。
x:I、R、C, y:I、R,kind:I, 结果:C(kind) CONJG(x) 求x的共轭复数。
x:C, 结果:CDBLE(x)* 将x转换为双精度实数。
x:I、R、C, 结果:R(8)DCMPLX(x[,y]) 将参数转换为x、(x,0.0)或(x,y)。
x:I、R、C, y:I、R, 结果:C(8) DFLOAT(x) 将x转换为双精度实数。
x:I, 结果:R(8)DIM(x,y)* 求x-y和0中最大值, 即MAX(x-y,0)。
x:I、R, y的类型同x,结果类型同x DPROD(x,y) 求x和y的乘积,并转换为双精度实数。
x:R, y:R, 结果:R(8)FLOAT(x)* 将x转换为单精度实数。
附录C 部分函数指令表(c). .(注解:本指令表只收集了部分常用指令, 有关全部指令请参照文档文件) + 加- 减* 矩阵乘数组乘 *.1. 通用指令^ 矩阵乘方数组乘方 ^.\ 反斜杠或左除在线帮助/ 斜杠或右除文档中关键词搜寻或.\ 数组除/.缺省变量名以及最新表达式的运算结果等号不等号从内存中清除变量和函数< 小于关闭> 大于退出<= 小于或等于把内存变量存入磁盘>= 大于或等于运行脚本文件逻辑与文件运行中的显示格式逻辑或显示版本逻辑非浮点运算溢出显示模式选择: 冒号列出工作内存中的变量名( ) 园括号文件编辑器[ ] 方括号变量类型{ } 花括号列出基本命令小数点 .设置数据输出格式, 逗号改变当前工作目录; 分号给出环境值注释号创建目录= 赋值符号显示当前工作目录' 引号执行表达式' 复数转置号转置号 '.最新表达式的运算结果2.运算符和特殊算符浮点误差容限, =2 -52≈2.22×10-16虚数单位= √(-1)正无穷大圆周率,π=3.14....3. 编程语言结构中止计算或循环终止最内循环同一起使用将控制转交给外层的或循环同一起使用同一起使用结束,,语句按规定次数重复执行语句条件执行语句可同一起使用暂停模式返回多个条件分支同一起使用不确定次数重复执行语句特定值计算函数特定值计算或多变量计算函数文件头定义全局变量检测变量是否为全局变量显示错误信息显示最近的错误信息按格式把数字转换为串显示警告信息4.基本数学函数反余弦反双曲余弦反余切反双曲余切反余割反双曲余割反正弦反双曲正弦反正切反双曲正切余弦双曲余弦余切双曲余切正弦双曲正弦正切双曲正切指数自然对数10 常用对数2 以2为底的对数平方根绝对值复数共轭复数虚部复数实部向上(正无穷大方向)取整向零方向取整向下(负无穷大方向)取整四舍五入取整符号函数降次排序误差函数补误差函数函数插值函数线性插值函数样条插值函数样条平滑函数样条函数方波函数符号函数将整数转换为双精度浮点数5.基本矩阵函数和操作单位阵全零矩阵全1 矩阵均匀分布随机阵生成随机矩阵线性等分向量对数等分向量矩阵对数运算矩阵元素累计乘矩阵元素累计和矩阵显示矩阵和文字内容确定向量的长度确定矩阵的维数创建对角阵或抽取对角向量找出非零元素1的下标矩阵变维90 矩阵逆时针旋转90度2 据全下标换算出单下标抽取下三角阵抽取上三角阵共轭矩阵伴随矩阵行列式的值矩阵或向量范数矩阵中非零元素个数清空向量或矩阵中的某个元素正交基矩阵秩矩阵迹矩阵条件数逆矩阵条件数矩阵的逆分解或高斯消元法伪逆分解变换求解线性方程方程矩阵特征多项式分解矩阵指数1 矩阵指数的逼近2 用泰勒级数求矩阵指数3 通过特征值和特征向量求矩阵指数计算一般矩阵函数矩阵对数矩阵平方根6. 特性值与奇异值矩阵特征值矩阵束特征值块矩阵, 广义特征向量正则化特征向量特征空间投影奇异值分解奇异值分解近似7. 矩阵元素运算元素累计积元素累计和统计频数直方图最大值平均值中值最小值元素积由大到小排序标准差元素和梯形数值积分求相关系数或方差8. 稀疏矩阵运算稀疏矩阵(只存储非零元素) 2 邻接矩阵转换为稀疏矩阵稀疏矩阵转换为全矩阵将稀疏矩阵转换为稀疏矩阵格式2 稀疏矩阵转换为邻接矩阵稀疏矩阵方式单位阵稀疏矩阵方式随机矩阵稀疏矩阵方式全零阵稀疏矩阵分解稀疏矩阵方程求解稀疏矩阵分解9. 输入输出函数生成屏幕文本记录变量显示文件管理用户键盘输入读已存的变量关闭文件读二进制文件按行读码文件读字符串中单个字打开文件写二进制文件读码文件将变量记录为文件读矩阵变量存变量为二进制文件启动文件按格式存文件对话方式获取文件路径建立参数输入对话框得到文件变量执行文件10. 函数与函数库操作在线定义函数函数编辑器打开函数定义函数或对象在给定目录下建立所有文件的函数库读函数库的文件存储目录路径读函数库中的全部文件在文件中定义一个函数函数库定义函数或对象输入变量个数输出变量个数11. 字符串操作2 将数码转换为字符串字母大小转换清空字符串搜寻相同字符串字符提取2 将字符串转换为数码字符串转换对象, 字符串连接字符字符串的字符位置搜寻字符串中的字符替换12. 日期与时间日期读日期与时间时间计时13. 二维图形函数2d 直角坐标下线性刻度曲线2 维向量场1 由颜色箭头表示的2维向量场2d 等高线图曲线上增加误差范围框线条应用颜色表示的表面画坐标网格线统计频数直方图散点图阵列14. 三维图形函数3d 三维表面3d1 用颜色或灰度表示的三维表面3d 三维中单曲线3d1 三维中多曲线三维表面上的等高线图3d 三维表示的统计频数直方图3d 三维向二维上的投影15. 线条类图形单线条或单多边形多线条或多各多边形正多边形非连接线段单个多边形内填充多个多边形内填充矩形单个矩形内填充多个矩形内填充单个弧线段或弧园多个弧线段或弧园单个弧线段或弧园填充多个弧线段或弧园填充多箭头16. 图形注释, 变换图形中字符框内字符图形标题图形加框并画坐标网格线等尺寸比例显示(原图形窗口不改变)等尺寸比例显示(原图形窗口改变)设置小窗口转换实数为图形象素坐标值设置多个子窗口17. 图形颜色及图形文字应用颜色图交互式选择颜色图增加新色于颜色图线性灰度图热色(红到黄色)颜色图图形显示方式设定读当前图形显示方式设定交互式选择符号和尺寸18. 图形文件及图形文字将图形存储为文件从磁盘中读出图形文件将图形按文件打印或存储为文件2 将图形生成格式文件取消图形窗及其相关内容清空图形窗选择图形驱动器图形驱动器初始化关闭图形图形刷新更改显示范围后的图形刷新关闭图形改变当前图形窗名称19. 控制分析用图形伯德图坐标幅值图坐标(伯德图中的幅值图)奈奎斯特图M-圆图尼库拉斯图-图s 平面图零-极点图z 平面图20. 图形应用中的其它指令图形库指令表等待鼠标在图形上的点击输入由鼠标点击读入图形中的多点位置坐标由鼠标点击读入图形中的当前点位置坐标21. 系统与控制状态空间矩阵可控矩阵线性系统时域响应状态空间的离散时域响应反馈操作符时域响应(离散、采样系统〕2 基于传递函数的频域响应频域响应幅值裕量2 基于状态空间的脉冲响应线性化操作滤波器补偿器补偿器基于状态空间的离散时域响应基于观测器的控制器观测器观测矩阵相位裕量相位与幅值计算极点配置频域响应方程基于传递函数的离散时域响应2 系统矩阵到状态空间变换2 反馈连接的状态空间到状态空间变换2 状态空间到传递函数变换稳定性计算2 传递函数到状态空间变换系统最小方差辨识22. 鲁棒控制被控对象增广操作矩阵近似H∞控制器离散H∞范数h2 H2 范数闭环矩阵H∞控制器H∞范数矩阵奇异值H∞控制器的增益无穷范数矩阵敏感函数23. 动态系统模型2p 基于模型中获得多项式矩阵辨识系统仿真噪声信号发生器常微分方程仿真检测伪随机二进制序列发生器线性拟合24. 系统与控制实例动态系统鱼群人口发展的离散时域模型具有观测器的动态系统相位图生物链模型渔业模型登陆火箭问题吸引子采矿问题可控可观系统3d 三维相位图二维相位图双线性回归方程动态系统动态系统的线性化动态系统的交互初始化25. 非线性工具(优化与仿真〕边界值问题的常微分方程隐式微分方程过零解代数微分方程基于测量数据的参数辨识导数计算非线性函数过零解线性微分方程2d 二维定积分3d 三维定积分不定积分非线性最小二乘法线性规划线性不等矩阵常微分方程离散常微分方程常微分方程根解连续/离散常微分方程非线性优化线性二次型规划半正定规划26. 多项式计算多项式系数多项式矩阵逆多项式阶数分母项有理矩阵求导矩阵行列式值因式分解型多项式计算有理矩阵逆最小公倍数多项式矩阵长除分子项多项式矩阵除2 多项式矩阵到表达式变换2 多项式到字符串变换最小因式余量多项式根多项式化简系统矩阵27. 信号处理椭圆积分完全椭圆积分椭圆函数模拟量低通滤波器滤波器响应倒谱计算1 一型响应2 二型响应多项式卷积相关, 协方差谱估计(应用相关法)离散富立叶变换快速富立叶变换滤波器建模滤波器设计协方差矩阵到矩阵变换变换数字滤波器信号采样率更改滤波器更新最大熵谱估计多维快速富立叶变换频率响应拟合过程滤波器平方根稳态滤波器观测更新线性相位滤波器(维纳)滤波器对称窗函数最小二乘滤波器模拟滤波器1 模拟滤波器28. 音频信号音频信号频域图读* 音频文件写* 音频文件2 将线性信号转换为μ率码信号取* 音频文件音频信号图示2 将μ率码信号转换为线性信号音频信号播放存* 音频文件读* 音频文件写* 音频文件29. 语言与数据转换工具字符串的码2 读格式的文件2 将函数生成码2 将的M 格式文件转换为格式文件取第4版本文件中变量按第4 版本文件格式存变量2 将多项式转换为格式2 将函数转换为格式文件按格式输出对象将子目录下的所有文件转换为文件格式。
第3 章FORTRAN 77 和VMS 内函数本章列出了FORTRAN 77 f95 接受的一系列内函数,旨在帮助将传统的FORTRAN 77 程序迁移至Fortran 95。
在f95 中,本章列出的所有FORTRAN 77 和VMS 函数以及前一章列出的所有Fortran 95 函数都识别为内函数。
为了帮助从传统的FORTRAN 77 程序迁移至f95,使用-f77=intrinsics 进行编译会让编译器只将FORTRAN 77 和VMS 函数识别为内函数,但Fortran 95 函数不会识别为内函数。
属于Sun 扩展的ANSI FORTRAN 77 标准的内函数标有¤ 符号。
使用非标准内函数和库函数的程序可能无法移植到其他平台。
内函数在接受多种数据类型的参数时,有通用名称和专用名称。
通常,通用名称返回与参数具有相同数据类型的值。
但也有一些例外,如类型转换函数(表3–2)和查询函数(表3–7)。
这些函数也可以通过函数的某个专用名称进行调用,以便处理专用参数数据类型。
对于处理多个数据项的函数(例如sign(a1,a2)),所有数据参数的类型必须相同。
下表按以下几方面列出FORTRAN 77 内函数:内函数-描述函数的作用定义-数学定义参数数量-函数接受的参数的数量通用名称-函数的通用名称专用名称-函数的专用名称参数类型-与每个专用名称关联的数据类型函数类型-针对专用参数数据类型返回的数据类型注–编译器选项-xtypemap 会更改变量的缺省大小,并且对内在引用产生影响。
请参见3.4 备注以及《Fortran 用户指南》中有关缺省大小和对齐方式的介绍。
3.1 算术和数学函数本节详细介绍算术函数、类型转换函数、三角函数以及其他函数。
“a”代表函数的单个参数,“a1”和“a2”代表两个参数函数的第一个参数和第二个参数,“ar”和“ai”代表函数的复数参数的实部和虚部。
3.1.1 算术函数3.1.2 类型转换函数表3–2 Fortran 77 类型转换函数在ASCII 平台上(包括Sun 系统):ACHAR 是CHAR 的非标准同义词IACHAR 是ICHAR 的非标准同义词在非ASCII 平台上,ACHAR 和IACHAR 专门用于提供一种直接处理ASCII 的方法。
附录C SCILAB 部分函数指令表(c)LIAMA. All rights reserved.(注解:本指令表只收集了部分常用指令, 有关全部指令请参照文档文件) + 加- 减* 矩阵乘数组乘 *.1. 通用指令^ 矩阵乘方数组乘方 ^.\ 反斜杠或左除help 在线帮助/ 斜杠或右除apropos 文档中关键词搜寻或.\ 数组除/.ans 缺省变量名以及最新表达式的运算结果== 等号~= 不等号clear 从内存中清除变量和函数< 小于exit 关闭SCILAB> 大于quit 退出SCILAB<= 小于或等于save 把内存变量存入磁盘>= 大于或等于exec 运行脚本文件&,and 逻辑与mode 文件运行中的显示格式|,or 逻辑或getversion 显示SCILAB 版本~,not 逻辑非ieee 浮点运算溢出显示模式选择: 冒号who 列出工作内存中的变量名( ) 园括号edit 文件编辑器[ ] 方括号type 变量类型{ } 花括号what 列出SCILAB 基本命令小数点 .format 设置数据输出格式, 逗号chdir 改变当前工作目录; 分号getenv 给出环境值// 注释号mkdir 创建目录= 赋值符号pwd 显示当前工作目录' 引号evstr 执行表达式' 复数转置号转置号 '.ans 最新表达式的运算结果2.运算符和特殊算符%eps 浮点误差容限, =2 -52≈2.22×10-16%i 虚数单位= √(-1)%inf 正无穷大%pi 圆周率,π=3.1415926535897....3. 编程语言结构abort 中止计算或循环break 终止最内循环case 同select 一起使用continue 将控制转交给外层的for或while循环else 同if一起使用elseif 同if一起使用end 结束for,while,if 语句for 按规定次数重复执行语句if 条件执行语句otherwise 可同switch 一起使用pause 暂停模式return 返回select 多个条件分支then 同if一起使用while 不确定次数重复执行语句eval 特定值计算feval 函数特定值计算或多变量计算function 函数文件头global 定义全局变量isglobal 检测变量是否为全局变量error 显示错误信息lasterror 显示最近的错误信息sprintf 按格式把数字转换为串warning 显示警告信息4.基本数学函数acos 反余弦acosh 反双曲余弦acot 反余切acoth 反双曲余切acsc 反余割acsch 反双曲余割asin 反正弦asinh 反双曲正弦atan 反正切atanh 反双曲正切cos 余弦cosh 双曲余弦cotg 余切coth 双曲余切sin 正弦sinh 双曲正弦tan 正切tanh 双曲正切exp 指数log 自然对数log10 常用对数log2 以2为底的对数sqrt 平方根abs 绝对值conj 复数共轭imag 复数虚部real 复数实部ceil 向上(正无穷大方向)取整fix 向零方向取整floor 向下(负无穷大方向)取整round 四舍五入取整sign 符号函数gsort 降次排序erf 误差函数erfc 补误差函数gamma gamma 函数interp 插值函数interpln 线性插值函数intsplin 样条插值函数smooth 样条平滑函数spline 样条函数quarewave 方波函数sign 符号函数double 将整数转换为双精度浮点数5.基本矩阵函数和操作eye 单位阵zeros 全零矩阵ones 全1 矩阵rand 均匀分布随机阵genmarkov 生成随机Markov 矩阵linspace 线性等分向量logspace 对数等分向量logm 矩阵对数运算cumprod 矩阵元素累计乘cumsum 矩阵元素累计和toeplitz Toeplitz 矩阵disp 显示矩阵和文字内容length 确定向量的长度size 确定矩阵的维数diag 创建对角阵或抽取对角向量find 找出非零元素1的下标matrix 矩阵变维rot90 矩阵逆时针旋转90度sub2ind 据全下标换算出单下标tril 抽取下三角阵triu 抽取上三角阵conj 共轭矩阵companion 伴随矩阵det 行列式的值norm 矩阵或向量范数nnz 矩阵中非零元素个数null 清空向量或矩阵中的某个元素orth 正交基rank 矩阵秩trace 矩阵迹cond 矩阵条件数rcond 逆矩阵条件数inv 矩阵的逆lu LU分解或高斯消元法pinv 伪逆qr QR分解givens Givens 变换linsolve 求解线性方程lyap Lyapunov 方程hess Hessenberg 矩阵poly 特征多项式schur Schur 分解expm 矩阵指数expm1 矩阵指数的Pade逼近expm2 用泰勒级数求矩阵指数expm3 通过特征值和特征向量求矩阵指数funm 计算一般矩阵函数logm 矩阵对数sqrtm 矩阵平方根6. 特性值与奇异值spec 矩阵特征值gspec 矩阵束特征值bdiag 块矩阵, 广义特征向量eigenmarkov 正则化Markov 特征向量pbig 特征空间投影svd 奇异值分解sva 奇异值分解近似7. 矩阵元素运算cumprod 元素累计积cumsum 元素累计和hist 统计频数直方图max 最大值mean 平均值median 中值min 最小值prod 元素积sort 由大到小排序std 标准差sum 元素和trapz 梯形数值积分corr 求相关系数或方差8. 稀疏矩阵运算sparse 稀疏矩阵(只存储非零元素)adj2sp 邻接矩阵转换为稀疏矩阵full 稀疏矩阵转换为全矩阵mtlb_sparse 将SCILAB 稀疏矩阵转换为MATLAB稀疏矩阵格式sp2adj 稀疏矩阵转换为邻接矩阵speye 稀疏矩阵方式单位阵sprand 稀疏矩阵方式随机矩阵spzeros 稀疏矩阵方式全零阵lufact 稀疏矩阵LU分解lusolve 稀疏矩阵方程求解spchol 稀疏矩阵Cholesky分解9. 输入输出函数diary 生成屏幕文本记录disp 变量显示file 文件管理input 用户键盘输入load 读已存的变量mclose 关闭文件mget 读二进制文件mgetl 按行读ASCII码文件mgetstr 读字符串中单个字mopen 打开文件mput 写二进制文件mfscanf 读ASCII 码文件print 将变量记录为文件read 读矩阵变量save 存变量为二进制文件strartup 启动文件write 按格式存文件xgetfile 对话方式获取文件路径x_dialog 建立Xwindow参数输入对话框Tk_Getvar 得到Tk文件变量Tk_EvalFile 执行Tk 文件10. 函数与函数库操作deff 在线定义函数edit 函数编辑器function 打开函数定义functions SCILAB 函数或对象genlib 在给定目录下建立所有文件的函数库get_function_path 读函数库的文件存储目录路径getd 读函数库中的全部文件getf 在文件中定义一个函数lib 函数库定义macro SCILAB函数或对象macrovar 输入变量个数newfun 输出变量个数11. 字符串操作code2str 将SCILAB数码转换为字符串convstr 字母大小转换emptystr 清空字符串grep 搜寻相同字符串part 字符提取str2code 将字符串转换为SCILAB数码string 字符串转换strings SCILAB 对象, 字符串strcat 连接字符strindex 字符串的字符位置搜寻strsubst 字符串中的字符替换12. 日期与时间date 日期getdate 读日期与时间timer CPU时间计时13. 二维图形函数plot2d 直角坐标下线性刻度曲线champ 2 维向量场champ1 由颜色箭头表示的2维向量场contour2d 等高线图errbar 曲线上增加误差范围框线条grayplot 应用颜色表示的表面xgrid 画坐标网格线histplot 统计频数直方图Matplot 散点图阵列14. 三维图形函数plot3d 三维表面plot3d1 用颜色或灰度表示的三维表面param3d 三维中单曲线param3d1 三维中多曲线contour 三维表面上的等高线图hist3d 三维表示的统计频数直方图geom3d 三维向二维上的投影15. 线条类图形xpoly 单线条或单多边形xpolys 多线条或多各多边形xrpoly 正多边形xsegs 非连接线段xfpoly 单个多边形内填充xfpolys 多个多边形内填充xrect 矩形xfrect 单个矩形内填充xrects 多个矩形内填充xarc 单个弧线段或弧园xarcs 多个弧线段或弧园xfarc 单个弧线段或弧园填充xfarcs 多个弧线段或弧园填充xarrows 多箭头16. 图形注释, 变换xstring 图形中字符xstringb 框内字符xtitle 图形标题xaxis 轴名标注plotframe 图形加框并画坐标网格线isoview 等尺寸比例显示(原图形窗口不改变)square 等尺寸比例显示(原图形窗口改变)xsetech 设置小窗口xchange 转换实数为图形象素坐标值subplot 设置多个子窗口17. 图形颜色及图形文字colormap 应用颜色图getcolor 交互式选择颜色图addcolor 增加新色于颜色图graycolormap 线性灰度图hotcolormap 热色(红到黄色)颜色图xset 图形显示方式设定xget 读当前图形显示方式设定getsymbol 交互式选择符号和尺寸18. 图形文件及图形文字xsave 将图形存储为文件xload 从磁盘中读出图形文件xbasimp 将图形按PS文件打印或存储为文件xs2fig 将图形生成Xfig 格式文件xbasc 取消图形窗及其相关内容xclear 清空图形窗driver 选择图形驱动器xinit 图形驱动器初始化xend 关闭图形xbasr 图形刷新replot 更改显示范围后的图形刷新xdel 关闭图形xname 改变当前图形窗名称19. 控制分析用图形bode 伯德图坐标gainplot 幅值图坐标(伯德图中的幅值图)nyquist 奈奎斯特图m_circle M-圆图chart 尼库拉斯图black Black-图evans 根轨迹图sgrid s 平面图plzr 零-极点图zgrid z 平面图20. 图形应用中的其它指令graphics 图形库指令表xclick 等待鼠标在图形上的点击输入locate 由鼠标点击读入图形中的多点位置坐标xgetmouse 由鼠标点击读入图形中的当前点位置坐标21. 系统与控制abcd 状态空间矩阵cont_mat 可控矩阵csim 线性系统时域响应dsimul 状态空间的离散时域响应feedback 反馈操作符flts 时域响应(离散、采样系统〕frep2tf 基于传递函数的频域响应freq 频域响应g_margin 幅值裕量imrep2ss 基于状态空间的脉冲响应lin 线性化操作lqe Kalman 滤波器lqg LQG补偿器lqr LQ补偿器ltitr 基于状态空间的离散时域响应obscont 基于观测器的控制器observer 观测器obsv_mat 观测矩阵p_margin 相位裕量phasemag 相位与幅值计算ppol 极点配置repfreq 频域响应ricc Riccati 方程rtitr 基于传递函数的离散时域响应sm2ss 系统矩阵到状态空间变换ss2ss 反馈连接的状态空间到状态空间变换ss2tf 状态空间到传递函数变换stabil 稳定性计算tf2ss 传递函数到状态空间变换time_id SISO系统最小方差辨识22. 鲁棒控制augment 被控对象增广操作bstap Hankel 矩阵近似ccontrg H∞控制器dhnorm 离散H∞范数h2norm H2 范数h_cl 闭环矩阵h_inf H∞控制器h_norm H∞范数hankelsv Hankel 矩阵奇异值leqr H∞控制器的LQ增益linf 无穷范数riccati Riccati 矩阵sensi 敏感函数23. 动态系统arma ARMA 模型arma2p 基于AR模型中获得多项式矩阵armac ARMAX 辨识arsimul ARMAX系统仿真noisegen 噪声信号发生器odedi 常微分方程仿真检测prbs_a 伪随机二进制序列发生器reglin 线性拟合24. 系统与控制实例artest Arnold 动态系统bifish 鱼群人口发展的离散时域模型boucle 具有观测器的动态系统相位图chaintest 生物链模型gpech 渔业模型fusee 登陆火箭问题lotest Lorennz 吸引子mine 采矿问题obscontl 可控可观系统portr3d 三维相位图portrait 二维相位图recur 双线性回归方程systems 动态系统tangent 动态系统的线性化tadinit 动态系统的交互初始化25. 非线性工具(优化与仿真〕bvode 边界值问题的常微分方程dasrt 隐式微分方程过零解dassl 代数微分方程datafit 基于测量数据的参数辨识derivative 导数计算fsolve 非线性函数过零解impl 线性微分方程int2d 二维定积分int3d 三维定积分intg 不定积分leastsq 非线性最小二乘法linpro 线性规划lmisolver 线性不等矩阵ode 常微分方程ode_discrete 离散常微分方程ode_root 常微分方程根解odedc 连续/离散常微分方程optim 非线性优化quapro 线性二次型规划semidef 半正定规划26. 多项式计算coeff 多项式系数coffg 多项式矩阵逆degree 多项式阶数denom 分母项derivat 有理矩阵求导determ 矩阵行列式值factors 因式分解hermit Hermit 型horner 多项式计算invr 有理矩阵逆lcm 最小公倍数ldiv 多项式矩阵长除numer 分子项pdiv 多项式矩阵除pol2des 多项式矩阵到表达式变换pol2str 多项式到字符串变换polfact 最小因式residu 余量roots 多项式根simp 多项式化简systmat 系统矩阵27. 信号处理%asn 椭圆积分%k Jacobi 完全椭圆积分%sn Jacobi 椭圆函数analpf 模拟量低通滤波器buttmag Butterworth 滤波器响应cepstrum 倒谱计算cheb1mag Chebyshev 一型响应cheb2mag Chebyshev 二型响应chepol Chebyshev 多项式convol 卷积corr 相关, 协方差cspect 谱估计(应用相关法)dft 离散富立叶变换fft 快速富立叶变换filter 滤波器建模fsfirlin FIR滤波器设计hank 协方差矩阵到Hankel矩阵变换hilb Hilbert 变换iir IIR数字滤波器intdec 信号采样率更改kalm Kalman 滤波器更新mese 最大熵谱估计mfft 多维快速富立叶变换mrfit 频率响应拟合phc Markov 过程srkf Kalman 滤波器平方根sskf 稳态Kalman 滤波器system 观测更新wfir 线性相位FIR滤波器weiener Weiener(维纳)滤波器window 对称窗函数yulewalk 最小二乘滤波器zpbutt Buthererworth 模拟滤波器zpch1 Chebyshev 模拟滤波器28. 音频信号analyze 音频信号频域图auread 读*.au 音频文件auwrite 写*.au 音频文件lin2mu 将线性信号转换为μ率码信号loadwave 取*.wav 音频文件mapsound 音频信号图示mu2lin 将μ率码信号转换为线性信号playsnd 音频信号播放savewave 存*.wav 音频文件wavread 读*.wav 音频文件wavwrite 写*.wav 音频文件29. 语言与数据转换工具ascii 字符串的ASCII码excel2sci 读ASCII 格式的Excel 文件fun2string 将SCILAB 函数生成ASCII 码mfile2sci 将MATLAB 的M 格式文件转换为SCI格式文件mtlb_load 取MATLAB第4版本文件中变量matlb_save 按MATLAB 第4 版本文件格式存变量pol2tex 将多项式转换为TeX格式sci2for 将SCILAB 函数转换为FORTRAN格式文件texprint 按TeX 格式输出SCILAB 对象translatepaths 将子目录下的所有MATLAB文件转换为SCI文件格式。
1、RANDOM_NUMBERSyntax ['sintæks] n. 语法CALL RANDOM_NUMBER (harvest结果)Intrinsic Subroutine(固有子程序):Returns a pseudorandom number greater than or equal to zero and less than one from the uniform distribution.返回大于或等于0且小于1,服从均匀分布的随机数2、RNNOA/ DRNNOA (Single/Double precision)Generate pseudorandom numbers from a standard normal distribution using an acceptance/rejection method.产生服从标准正态分布的随机数Usage(用法)CALL RNNOA (NR, R)Arguments(参数)NR— Number of random numbers to generate. (Input) 要产生随机数的个数R— Vector of length NR containing the random standard normal deviates. (Output)输出长度为NR,随机正态分布的向量Comments(注解)The routine RNSET can be used to initialize the seed of the random number generator. The routine RNOPT can be used to select the form of the generator.程序RNSET可以用来初始化随机数发生器的种子ExampleIn this example, RNNOA is used to generate five pseudorandom deviates from a standard normal distribution.INTEGER ISEED, NOUT, NRREAL R(5)EXTERNAL RNNOA, RNSET, UMACHCCALL UMACH (2, NOUT)NR = 5ISEED = 123457CALL RNSET (ISEED)CALL RNNOA (NR, R)WRITE (NOUT,99999) R99999 FORMAT (' Standard normal random deviates: ', 5F8.4)ENDOutputStandard normal random deviates: 2.0516 1.0833 0.0826 1.2777 -1.22603、RESHAPEIntrinsic Function(内部函数)Constructs an array of a specified shape from the elements of another array. 构造规定形式的数组Syntax(语法)result = RESHAPE (source, shape [ , pad][ , order])source(Input) Any type. Array whose elements will be taken in standard Fortran array order (see Remarks), and then placed into a new array.shape(Input) Integer. One-dimensional array that describes the shape of the output array created from elements of source. 描述输出数组的大小的一维数组,The elements of shape are the sizes of the dimensions of the reshaped array in order. If pad is omitted 省略, the total size specified by shape must be less than or equal to source.pad 可选参数(Optional; input) Same type as source. Must be an array. If there are not enough elements in source to fill the result array, elements of pad are added in standardFortran array order. If necessary, extra copies of pad are used to fill the array.order 可选参数(Optional; input) Integer. One-dimensional array. Must be the same length as shape.Permutes the order of dimensions in the result array. The value of order must be a permutation of (1, 2,...n) where n is the size of shape.Return Value(返回值)The result is an array the same data type and kind as source and a shape as defined in shape.ExamplesINTEGER AR1( 2, 5)REAL F(5,3,8)REAL C(8,3,5)AR1 = RESHAPE((/1,2,3,4,5,6/),(/2,5/),(/0,0/),(/2,1/))! returns 1 2 3 4 5! 6 0 0 0 0!! Change Fortran array order to C array orderC = RESHAPE(F, (/8,3,5/), ORDER = (/3, 2, 1/))END4、SUMIntrinsic Function(内部函数)Sums elements of an array or the elements along an optional dimension. The elements summed can be selected by an optional mask.将数组中的元素求和Syntax(语法)result = SUM (array [ , dim] [ , mask])array(Input) Integer, real, or complex. Array whose elements are to be summed.dim 可选参数(Optional; input) Integer. Dimension along which elements are summed.1 ≤dim≤n, where n is the number of dimensions in array.mask 可选参数(Optional; input) Logical. Must be same shape as array. If mask is specified, only elements in array that correspond to .TRUE. elements in mask are summed.Return Value(返回值)Same type and kind as array and equal to the sum of all elements in array or the sum of elements along dimension dim. If mask is specified, only elements that correspondto .TRUE. elements in mask are summed. Returns a scalar if dim is omitted or array is one-dimensional. Otherwise, returns an array one dimension smaller than array.ExamplesINTEGER array (2, 3), i, j(3)array = RESHAPE((/1, 2, 3, 4, 5, 6/), (/2, 3/))! array is 1 3 5! 2 4 6i = SUM((/ 1, 2, 3 /)) ! returns 6j = SUM(array, DIM = 1) ! returns [3 7 11]WRITE(*,*) i, jEND5、SEEDRun-Time Subroutine Changes the starting point of the pseudorandom number generator. 改变随机数发生器的起始点ModuleUSE MSFLIBSyntax(语法)CALL SEED (iseed)iseed(Input) INTEGER(4). Starting point for RANDOM.Remarks(注解)SEED uses iseed to establish the starting point of the pseudorandom number generator.A given seed always produces the same sequence of values from RANDOM.If SEED is not called before the first call to RANDOM, RANDOM always begins with a seed value of one. If a program must have a different pseudorandom sequence each time it runs, pass the constant RND$TIMESEED (defined in MSFLIB.F90) to the SEED routine before the first call to RANDOM.ExampleUSE MSFLIBREAL randCALL SEED(7531)CALL RANDOM(rand)6、RANDOMPurposeRun-Time Subroutine Returns a pseudorandom number greater than or equal to zero and less than one from the uniform distribution. 返回大于或等于0且小于1,服从均匀分布的随机数ModuleUSE MSFLIBSyntaxCALL RANDOM (ranval)ranval(Output) REAL(4). Pseudorandom number, 0 ≤ranval< 1, from the uniformdistribution.RemarksA given seed always produces the same sequence of values from RANDOM.If SEED is not called before the first call to RANDOM, RANDOM begins with a seed value of one. If a program must have a different pseudorandom sequence each time it runs, pass the constant RND$TIMESEED (defined in MSFLIB.F90) to SEED before the first call to RANDOM.All the random procedures (RANDOM, RAN, and RANDOM_NUMBER, and the PortLib functions DRAND, DRANDM, RAND, IRANDM, RAND, and RANDOM) use the same algorithms and thus return the same answers. They are all compatible and can be used interchangeably. (The algorithm used is a “Prime Modulus M Multiplicative Linear Congruential Generator,” a modified version of t he random number generator by Park and Miller in “Random Number Generators: Good Ones Are Hard to Find,” CACM, October 1988, Vol. 31, No. 10.)CompatibilityCONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIBExampleUSE MSFLIBREAL(4) ranCALL SEED(1995)CALL RANDOM(ran)7、FFT2BCompute the inverse Fourier transform of a complex periodic two-dimensional array.计算二维复数数组的逆傅里叶变换Usage(用法)CALL FFT2B (NRCOEF, NCCOEF, COEF, LDCOEF, A, LDA)Arguments(参数)NRCOEF— The number of rows of COEF. (Input) 数组COEF的行数NCCOEF— The number of columns of COEF. (Input) 数组COEF的列数COEF—NRCOEF by NCCOEF complex array containing the Fourier coefficients to be transformed. (Input) NRCOEF行NCCOEF列数组LDCOEF— Leading dimension of COEF exactly as specified in the dimension statement of the calling program. (Input)A—NRCOEF by NCCOEF complex array containing the Inverse Fourier coefficients of COEF. (Output) NRCOEF行NCCOEF列复数数组,包含数组COEF的逆傅里叶系数LDA— Leading dimension of A exactly as specified in the dimension statement of the calling program. (Input)Comments(注解)1.Automatic workspace usage isFFT2B4 * (NRCOEF + NCCOEF) + 32 + 2 *MAX(NRCOEF, NCCOEF) units, orDFFT2B8 * (NRCOEF + NCCOEF ) + 64 + 4 *MAX(NRCOEF, NCCOEF) units.Workspace may be explicitly provided, if desired, by use of F2T2B/DF2T2B. The reference isCALL F2T2B (NRCOEF, NCCOEF, A, LDA, COEF, LDCOEF,WFF1, WFF2, CWK, CPY)The additional arguments are as follows:WFF1— Real array of length 4 *NRCOEF + 15 initialized by FFTCI. The initialization depends on NRCOEF. (Input)WFF2— Real array of length 4 *NCCOEF + 15 initialized by FFTCI. The initialization depends on NCCOEF. (Input)CWK— Complex array of length 1. (Workspace)CPY— Real array of length 2 *MAX(NRCOEF, NCCOEF). (Workspace)2.The routine FFT2B is most efficient when NRCOEF and NCCOEF are the product of small primes.3.The arrays COEF and A may be the same.4.If FFT2D/FFT2B is used repeatedly, with the same values for NRCOEF and NCCOEF, then use FFTCI to fill WFF1(N = NRCOEF) and WFF2(N = NCCOEF). Follow this with repeated calls to F2T2D/F2T2B. This is more efficient than repeated calls toFFT2D/FFT2B.AlgorithmThe routine FFT2B computes the inverse discrete complex Fourier transform of a complex two-dimensional array of size (NRCOEF = N) ⨯ (NCCOEF = M). The method used is a variant of the Cooley-Tukey algorithm , which is most efficient when N and M are both products of small prime factors. If N and M satisfy this condition, then the computational effort is proportional to N M log N M. This considerable savings has historically led people to refer to this algorithm as the "fast Fourier transform" or FFT.Specifically, given an N⨯M array c = COEF, FFT2B returns in aFurthermore, a vector of Euclidean norm S is mapped into a vector of normFinally, note that an unnormalized inverse is implemented in FFT2D. The routine FFT2B is based on the complex FFT in FFTPACK. The package FFTPACK was developed by Paul Swarztrauber at the National Center for Atmospheric Research.ExampleIn this example, we first compute the Fourier transform of the 5 ⨯ 4 arrayfor 1 ≤n≤ 5 and 1 ≤m≤ 4 using the IMSL routine FFT2D. The resultis then inverted by a call to FFT2B. Note that the result is an array a satisfying a = (5)(4)x = 20x. In general, FFT2B is an unnormalized inverse with expansion factor N M.INTEGER LDA, LDCOEF, M, N, NCA, NRACOMPLEX CMPLX, X(5,4), A(5,4), COEF(5,4)CHARACTER TITLE1*26, TITLE2*26, TITLE3*26INTRINSIC CMPLXEXTERNAL FFT2B, FFT2D, WRCRNCTITLE1 = 'The input matrix is below 'TITLE2 = 'After FFT2D 'TITLE3 = 'After FFT2B 'NRA = 5NCA = 4LDA = 5LDCOEF = 5C Fill X with initial dataDO 20 N=1, NRADO 10 M=1, NCAX(N,M) = CMPLX(FLOAT(N+5*M-5),0.0)10 CONTINUE20 CONTINUECCALL WRCRN (TITLE1, NRA, NCA, X, LDA, 0)CCALL FFT2D (NRA, NCA, X, LDA, COEF, LDCOEF)CCALL WRCRN (TITLE2, NRA, NCA, COEF, LDCOEF, 0)CCALL FFT2B (NRA, NCA, COEF, LDCOEF, A, LDA)CCALL WRCRN (TITLE3, NRA, NCA, A, LDA, 0)CENDOutputThe input matrix is below1 2 3 41 ( 1.00, 0.00) ( 6.00, 0.00) ( 11.00, 0.00) ( 16.00, 0.00)2 ( 2.00, 0.00) ( 7.00, 0.00) ( 12.00, 0.00) ( 17.00, 0.00)3 ( 3.00, 0.00) ( 8.00, 0.00) ( 13.00, 0.00) ( 18.00, 0.00)4 ( 4.00, 0.00) ( 9.00, 0.00) ( 14.00, 0.00) ( 19.00, 0.00)5 ( 5.00, 0.00) ( 10.00, 0.00) ( 15.00, 0.00) ( 20.00, 0.00) After FFT2D1 2 3 41 ( 210.0, 0.0) ( -50.0, 50.0) ( -50.0, 0.0) ( -50.0, -50.0)2 ( -10.0, 13.8) ( 0.0, 0.0) ( 0.0, 0.0) ( 0.0, 0.0)3 ( -10.0, 3.2) ( 0.0, 0.0) ( 0.0, 0.0) ( 0.0, 0.0)4 ( -10.0, -3.2) ( 0.0, 0.0) ( 0.0, 0.0) ( 0.0, 0.0)5 ( -10.0, -13.8) ( 0.0, 0.0) ( 0.0, 0.0) ( 0.0, 0.0) After FFT2B1 2 3 41 ( 20.0, 0.0) ( 120.0, 0.0) ( 220.0, 0.0) ( 320.0, 0.0)2 ( 40.0, 0.0) ( 140.0, 0.0) ( 240.0, 0.0) ( 340.0, 0.0)3 ( 60.0, 0.0) ( 160.0, 0.0) ( 260.0, 0.0) ( 360.0, 0.0)4 ( 80.0, 0.0) ( 180.0, 0.0) ( 280.0, 0.0) ( 380.0, 0.0)5 ( 100.0, 0.0) ( 200.0, 0.0) ( 300.0, 0.0) ( 400.0, 0.0)8、TIMEFPurposePortLib Function Returns the number of seconds since the first time it is called, or zero.ModuleUSE PORTLIBSyntaxresult=TIMEF ( )Return ValueREAL(8). Number of seconds that have elapsed since the first time TIMEF( ) was called. The first time called, TIMEF returns 0.0D0.CompatibilityCONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIBExampleUSE PORTLIBINTEGER i, jREAL(8) elapsed_timeelapsed_time = TIMEF() DO i = 1, 100000j = j + 1END DOelapsed_time = TIMEF() PRINT *, elapsed_time END。