fortran

gfortran compilation error: Size of 'put' argument of 'random_seed' intrinsic at (1) too small [duplicate]

孤人 提交于 2021-01-24 07:38:35
问题 This question already has an answer here : What's wrong with my random number generator in Fortran 95 please? (1 answer) Closed 5 years ago . I am trying to compile the following code with gfortran program perm_field implicit double precision(a-h,o-z) parameter (pi=3.14159) allocatable :: perm(:),alog_perm_all(:),u(:),xi(:),& perm_zone(:),alog_perm(:) integer :: seed(2) external dgemm open(unit=1,file='input.dat') open(unit=3,file='random_log_perm.dat',access='append') open(unit=31,file=

gfortran compilation error: Size of 'put' argument of 'random_seed' intrinsic at (1) too small [duplicate]

南笙酒味 提交于 2021-01-24 07:35:51
问题 This question already has an answer here : What's wrong with my random number generator in Fortran 95 please? (1 answer) Closed 5 years ago . I am trying to compile the following code with gfortran program perm_field implicit double precision(a-h,o-z) parameter (pi=3.14159) allocatable :: perm(:),alog_perm_all(:),u(:),xi(:),& perm_zone(:),alog_perm(:) integer :: seed(2) external dgemm open(unit=1,file='input.dat') open(unit=3,file='random_log_perm.dat',access='append') open(unit=31,file=

Fortran interface to call a C function that returns a pointer to an array

a 夏天 提交于 2021-01-23 11:05:55
问题 After much searching, I found what I believe to be the closest answer to my problem is on Stack Overflow (SO) at Fortran interface to call a C function that return a pointer, (posted nearly 10 years ago!) I quote this because using that example keeps the code simple and still illustrates my problem. I want to return an array that has been created/memory allocated in C++ and be able to analyse the answer in Fortran, because that is where the bulk of the code for this application lies. My

Installing gfortran in Cygwin

淺唱寂寞╮ 提交于 2021-01-21 10:44:05
问题 I am trying to compile a modelling program in Cygwin using either a gfortran or g95 compiler. I have installed both compilers, but when I go to configure the program, it checks for the compilers and does not find then ( error : Fortran compiler cannot create executables) . I am new to Cygwin-- I suspect it is something with how/where I installed the compilers...Any ideas? Thank you, L. 回答1: This problem is common for beginners with autotools. It can be: missing libraries; this can be missing

Error when reading in float in Fortran

五迷三道 提交于 2021-01-20 07:26:26
问题 This should be quite simple, but I can't manage to read in a floating point number in Fortran. My program test.f looks like this: PROGRAM TEST open(UNIT=1,FILE='test.inp') read(1,'(f3.0)')line STOP END The input file test.inp simply contains a single float: 1.2 Now the compiling of my testfile goes fine, but when I run it I get an error: At line 4 of file test.f (unit = 1, file = 'test.inp') Fortran runtime error: Expected REAL for item 1 in formatted transfer, got INTEGER (f3.0) ^ I've tried

Fortran passing parameters with brackets prevents changes

拟墨画扇 提交于 2021-01-20 05:16:22
问题 In this question I asked about a method to explicitly prevent passed arguments to change. An obvious solutions is defining copys of the arguments and operate the algorithm on those copys. However in the comment I was pointed to the fact, that I could call the function and wrapp the argument I didn't want to change in brackets. This would have the same effect as creating a copy of that passed variables so that it would not change. But I don't understand how it works and what the brackets are

Fortran passing parameters with brackets prevents changes

孤街浪徒 提交于 2021-01-20 05:13:27
问题 In this question I asked about a method to explicitly prevent passed arguments to change. An obvious solutions is defining copys of the arguments and operate the algorithm on those copys. However in the comment I was pointed to the fact, that I could call the function and wrapp the argument I didn't want to change in brackets. This would have the same effect as creating a copy of that passed variables so that it would not change. But I don't understand how it works and what the brackets are

NumPy索引切片

北慕城南 提交于 2021-01-12 08:31:52
索引,切片 和迭代 一维 数组可以被索引,切片和迭代,就像 列表 和其他Python序列一样。 代码实例解析数组中的索引切片 >>> import numpy as np #导入numpy 别名为np >>> a = np. arange( 10) ** 3 >>> a array([ 0, 1, 8, 27, 64, 125, 216, 343, 512, 729]) >>> a[ 2] #数组的索引从下标0开始 8 >>> a[ 2: 5] #数组的索引包含首不包含尾 array([ 8, 27, 64]) >>> a[: 6: 2] = - 1000 # 指索引[0:6]步长为2的值都赋值为1000 >>> a array([ - 1000, 1, - 1000, 27, - 1000, 125, 216, 343, 512, 729]) >>> a[ : : - 1] # 将 a 逆序 array([ 729, 512, 343, 216, 125, - 1000, 27, - 1000, 1, - 1000]) >>> for i in a: ... print( i **( 1 / 3.)) ... nan 1.0 nan 3.0 nan 5.0 6.0 7.0 8.0 9.0 多维 数组每个轴可以有一个索引。这些索引以逗号分隔的元组给出: >>> def f( x,

历年NOIP提高组初赛选择解析

眉间皱痕 提交于 2021-01-03 14:21:09
碎片知识点 编译型语言是编译一次就可以转成计算机可以直接运行的机器语言程序(如.exe文件)但是由于他们是直接编译的,依赖于计算机的不同,所以跨平台能力比较差,但是运行速度高。 解释性语言则是每次运行前编译,先解释再运行,导致运行效率降低,但是因为其依托于虚拟机/解释器所以跨平台性能好。 高级语言还可分为面向过程语言和面向对象语言。(区别自然是有没有对象) 于 1967 年出现的 Simula67 是历史上第一个面向对象语言 Smalltalk 被公认为第二个面向对象的程序设计语言,和第一个IDE C 和 Pascal 是纯面向过程语言 就算没有对象也可以学面向对象的程序设计语言 C++ 第一个高级语言是fortran,Ada是美国军方发明的语言,取名Ada是为了纪念第一个女程序员 第一个支持面向对象的语言是simula67 1、 (NOIP-2004–T19-多选)下列哪个(些)程序设计语言支持面向对象程序设计方法( ABDE )。 A. C++ B. Object Pascal C. C D. Smalltalk E. Java C++,object Pascal,VB,smalltalk(第一个支持动态类型的语言),simula67(第一个面向对象的语言),Java是面向对象的 free Pascal,C是面向过程的 题型一:数学 1.1 组合数学 模型: Catalan数

Better way to mask a Fortran array?

别来无恙 提交于 2020-12-29 14:14:05
问题 I am wanting to mask a Fortran array. Here's the way I am currently doing it... where (my_array <=15.0) mask_array = 1 elsewhere mask_array = 0 end where So then I get my masked array with: masked = my_array * mask_array Is there a more concise way to do this? 回答1: Use the MERGE intrinsic function: masked = my_array * merge(1,0,my_array<=15.0) 回答2: Or, sticking with where , masked = 0 where (my_array <=15.0) masked = my_array I expect that there are differences, in speed and memory