fortran

再见 Python,Hello Julia!

核能气质少年 提交于 2020-07-27 08:42:51
云栖号资讯:【 点击查看更多行业资讯 】 在这里您可以找到不同行业的第一手的上云资讯,还在等什么,快来! 导读: 随着Python的停滞不前,一个新的热门竞争对手崛起了。 如果Julia对你来说仍是个谜,别担心。 不要误会我的意思。Python的流行仍然受到计算机科学家、数据科学家、人工智能专家,以及他们组成的稳固社区的坚定支持。 但是,如果你曾经和这些人一起共进过晚餐,那么你就应该知道他们对于Python的弱点有多少抱怨。从速度缓慢到需要过多的测试,再到尽管进行了先前的测试仍然会产生很多运行时错误 - 这些已经足够让人恼火了。 这就是为什么越来越多的程序员开始采用其他语言的原因,这些语言中最受欢迎的是Julia、Go和Rust。Julia非常适合数学和技术任务,Go非常适合模块化程序,而Rust是系统编程的首选。 由于数据科学家和人工智能专家需要处理许多数学问题,因此Julia成为他们的赢家。即使经过严格的审视,Julia仍然具有Python无法战胜的优势。 01 Python的禅与Julia的贪婪 当人们创建一种新的编程语言时,他们这样做的目的是希望保留旧语言中的好特性,并修复其坏特性。 从这个意义上讲,Guido van Rossum在20世纪80年代后期创建Python的目的是为了改进ABC(Abstract Base Class - 抽象基类)

Repeatedly used 2D array in a Fortran 90 subroutine

徘徊边缘 提交于 2020-07-23 06:33:24
问题 I have a Fortran 90 program that is of the structure shown below. The step compute the 2D array myMatrix(1:N,1:N) in the subroutinne A is expensive. It depends only on the global variable N and it needs to be computed only once; the "other steps" in the subroutine will not change the value of myMatrix. Currently, myMatrix will be calculated whenever the subroutine is called. Is there a way to write the program in a way that the 2D array myMatrix is calculated only once? module constants

Repeatedly used 2D array in a Fortran 90 subroutine

安稳与你 提交于 2020-07-23 06:31:30
问题 I have a Fortran 90 program that is of the structure shown below. The step compute the 2D array myMatrix(1:N,1:N) in the subroutinne A is expensive. It depends only on the global variable N and it needs to be computed only once; the "other steps" in the subroutine will not change the value of myMatrix. Currently, myMatrix will be calculated whenever the subroutine is called. Is there a way to write the program in a way that the 2D array myMatrix is calculated only once? module constants

Fortran interface to itself produces annoying error

白昼怎懂夜的黑 提交于 2020-07-19 03:53:50
问题 This problem has been around for a few years, but I never heard of a good solution to it. If a Fortran subroutine includes a module with an interface to itself subroutine stuff(nz,z,dt) use allinterfaces ... an error occurs Error: 'stuff' of module 'allinterfaces', imported at (1), is also the name of the current program unit To fix it I have to declare subroutine stuff(nz,z,dt) use allinterfaces, except_this_one => stuff ... This is absurd behavior and annoying since I like to include all

Repeatedly used 2D array in a Fortran 90 subroutine

馋奶兔 提交于 2020-07-16 06:43:42
问题 I have a Fortran 90 program that is of the structure shown below. The step compute the 2D array myMatrix(1:N,1:N) in the subroutinne A is expensive. It depends only on the global variable N and it needs to be computed only once; the "other steps" in the subroutine will not change the value of myMatrix. Currently, myMatrix will be calculated whenever the subroutine is called. Is there a way to write the program in a way that the 2D array myMatrix is calculated only once? module constants

Reading Binary on different Architectures - Fortran runtime error: I/O past end of record on unformatted file

折月煮酒 提交于 2020-07-10 10:27:19
问题 I am having some issues on reading a binary (unformatted restart file ~2GB ) written within a Fortran program, by the call here below: open(unit=1,file=opfile,status="unknown",form="unformatted") ! write(1) t ! write(1) Rho, Rho_ut, Rho_ur, Rho_uz, Rho_Ya ! close(1) that has been compiled with ifort on an Intel Xeon Phi 7250 CPU (KNL) architecture. When the same code, that has now been compiled with gfortran on an IBM POWER9 AC922 architecture, read this file with the call here below: open

R nlminb What does false convergence actually mean?

爷,独闯天下 提交于 2020-07-05 02:39:44
问题 I'm using the function nlminb to maximise a function and got convergence (convergence =0 ) with the message false-convergence. I tried the documentation but no answer. I tried to get the port documentation on the function and could find the function nlminb Can anyone point me to the port documentation of nlminb or explain what does false convergence mean please ? I also tried other optimization function but though nlminb is a bit obscure, it seems to converge faster than any other function to

gfortran complains about rank of element in structure constructor for allocatable component

女生的网名这么多〃 提交于 2020-07-03 07:41:29
问题 Consider the following code: subroutine tao_show_this () implicit none type b_struct integer, pointer :: good_user => null() end type type a_struct type (b_struct), allocatable :: value_ptr(:) end type type (a_struct) a a = a_struct() end subroutine Compiling with gfortran 5 or 7 gives: gfortran -c test.f90 test.f90:4:13: type b_struct 1 Error: The rank of the element in the structure constructor at (1) does not match that of the component (0/1) This code compiles fine with ifort. Is this a

BLAS LDB using DGEMM

亡梦爱人 提交于 2020-06-29 05:54:19
问题 I want to multiply matrices by D*W', where W' is a transposed version of W. While I'll use DGEMM I'l figured out with the help of @IanBush that the LDB in this case should be number of rows of matrix W instead of number of columns. The code for this case is Call dgemm('n', 't', N1, M1, N1, 1.0_wp, D, N1, W, M1, 0.0_wp, c, n1) where n1 and m1 are dimensions of my matrices Dimensions of the matrices: W = M1*N1 D = N1*N1 As in official documentation it says LDB is INTEGER On entry, LDB specifies

Fortran subroutine/function arguments names and declaration

此生再无相见时 提交于 2020-06-28 08:13:52
问题 I have some general questions regarding the arguments passed to a subroutine/function in Fortran, in particolar when it comes to naming of non-local variables. Given this main program program xfunc implicit none real, dimension(5) :: var1, var2 integer, var3 ... call my_subroutine(var1(i),var2,var3) SUBROUTINE my_subroutine(arg1,var2,arg3) !inout variable not matching the var1 declared in main real, intent(inout) :: arg1 !matches the name and dimension of variable in main, is this needed?