| 5 | 1/1 | 返回列表 |
| 查看: 1118 | 回復(fù): 2 | |||
| 當(dāng)前只顯示滿足指定條件的回帖,點(diǎn)擊這里查看本話題的所有回帖 | |||
mplanck至尊木蟲 (職業(yè)作家)
之上又是啥子蟲蟲?
|
[交流]
【求助】fortran 程序windows 下編譯正確,而linux下出錯(cuò) 已有2人參與
|
||
|
如題,一個(gè)cpc上下的程序,windows 下編譯得到結(jié)果正確, 放在linux下就出問題: 用f77, fort77 編譯,在兩個(gè)sub模塊結(jié)尾提示 Error on line 1679: Declaration error for rvv: adjustable dimension on non- argument Error on line 1679: wr_ardecls: nonconstant array size 但我的數(shù)組沒問題呀 再用gfortran,f95編譯,編譯通過,但結(jié)果不對(duì) 再用ifort編譯,編譯也通過,又出來一個(gè)不對(duì)的新結(jié)果 真搞不懂為什么這樣? 麻煩蟲蟲門指點(diǎn)下,謝謝! 附出錯(cuò)部分代碼: 其中報(bào)錯(cuò)的一個(gè)sub模塊代碼如下,1679行對(duì)應(yīng)于最后一行,即‘end’所在行;再就是 整個(gè)代碼中沒有找到wr_ardecls這個(gè)東西,不知道咋搞的。非常感謝! c------------------------------------------------------------------------ subroutine dcludcmp(a,n,np,indx,d,ierror) c this is the double complex version of the homonyme sbr. from Numerical c Recipes implicit double complex(a-h,o-q,s-z) implicit double precision (r) parameter (tiny=(1.0d-30,1.0d-30)) dimension a(np,np),indx(n),rvv(n) d=dcmplx(1.d0,0.d0) ierror=0 do 12 i=1,n raamax=0.d0 do 11 j=1,n if (cdabs(a(i,j)).gt.raamax) raamax=cdabs(a(i,j)) 11 continue if (raamax.eq.0.d0)then write (*,*) 'singular matrix in dcludcmp' ierror=1 return endif rvv(i)=1.d0/raamax 12 continue do 19 j=1,n if (j.gt.1) then do 14 i=1,j-1 sum=a(i,j) if (i.gt.1)then do 13 k=1,i-1 sum=sum-a(i,k)*a(k,j) 13 continue a(i,j)=sum endif 14 continue endif raamax=0.d0 do 16 i=j,n sum=a(i,j) if (j.gt.1)then do 15 k=1,j-1 sum=sum-a(i,k)*a(k,j) 15 continue a(i,j)=sum endif rdum=rvv(i)*cdabs(sum) if (rdum.ge.raamax) then imax=i raamax=rdum endif 16 continue if (j.ne.imax)then do 17 k=1,n dum=a(imax,k) a(imax,k)=a(j,k) a(j,k)=dum 17 continue d=-d rvv(imax)=rvv(j) endif indx(j)=imax if(j.ne.n)then if(cdabs(a(j,j)).eq.0.d0) a(j,j)=tiny dum=1.d0/a(j,j) do 18 i=j+1,n a(i,j)=a(i,j)*dum 18 continue endif 19 continue if(cdabs(a(n,n)).eq.0.d0) a(n,n)=tiny return end c--------------------------------------------------------------------------- |

至尊木蟲 (職業(yè)作家)
之上又是啥子蟲蟲?

至尊木蟲 (職業(yè)作家)
|
不要用 f2c 編譯你的程序,用 gfortran 或其它正宗的 Fortran 編譯器,呵呵 用第二個(gè)錯(cuò)誤提示 google 一下,你會(huì)發(fā)現(xiàn),你不是遇到這個(gè)錯(cuò)誤的第一人,呵呵…… f2c does not support automatic arrays; g77 does, as do most other f77 compilers (and all f90+). 至于結(jié)果不同,最大的可能是一些 local variable 沒有賦值,這在 Fortran,尤其是一些老的程序中是非常常見的。用 gfortran 編譯時(shí)加上 -fno-automatic -finit-local-zero 之類的參數(shù)試試…… |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 一志愿哈爾濱工業(yè)大學(xué)材料與化工方向336分 +10 | 辰沐5211314 2026-03-26 | 10/500 |
|
|---|---|---|---|---|
|
[考研] 294分080500材料科學(xué)與工程求調(diào)劑 +8 | 柳溪邊 2026-03-26 | 8/400 |
|
|
[考研] 340求調(diào)劑 +6 | Amber00 2026-03-26 | 6/300 |
|
|
[考研] 356求調(diào)劑 +4 | gysy?s?a 2026-03-28 | 4/200 |
|
|
[考研] 295求調(diào)劑 +4 | wei-5 2026-03-26 | 4/200 |
|
|
[考研] 一志愿中南大學(xué)化學(xué)0703總分337求調(diào)劑 +5 | niko- 2026-03-27 | 5/250 |
|
|
[考研] 308求調(diào)劑 +7 | 墨墨漠 2026-03-27 | 7/350 |
|
|
[考博] 26申博 +3 | 加油沖! 2026-03-26 | 3/150 |
|
|
[考研] 085601 材料工程 313分 求調(diào)劑 +5 | Ong3 2026-03-27 | 5/250 |
|
|
[考研] 333求調(diào)劑 +3 | question挽風(fēng) 2026-03-23 | 3/150 |
|
|
[考研] 276求調(diào)劑。有半年電池和半年高分子實(shí)習(xí)經(jīng)歷 +10 | 材料學(xué)257求調(diào)劑 2026-03-23 | 11/550 |
|
|
[考研] 一志愿陜師大生物學(xué)071000,298分,求調(diào)劑 +5 | SYA! 2026-03-23 | 5/250 |
|
|
[考研]
|
鐘llll 2026-03-26 | 4/200 |
|
|
[考研] 343求調(diào)劑 +4 | 贈(zèng)我一本書 2026-03-23 | 4/200 |
|
|
[考研] 289求調(diào)劑 +17 | 碩星赴 2026-03-23 | 17/850 |
|
|
[考研] 材料科學(xué)與工程 317求調(diào)劑 +4 | JKSOIID 2026-03-26 | 4/200 |
|
|
[考研] 化學(xué)調(diào)劑一志愿上海交通大學(xué)336分-本科上海211 +4 | 小魚愛有機(jī) 2026-03-25 | 4/200 |
|
|
[考研] 334分 一志愿武理-080500 材料求調(diào)劑 +4 | 李李不服輸 2026-03-25 | 4/200 |
|
|
[考研] 290分調(diào)劑求助 +3 | 吉祥止止陳 2026-03-25 | 3/150 |
|
|
[考研] 一志愿武理085500機(jī)械專業(yè)總分300求調(diào)劑 +3 | an10101 2026-03-24 | 7/350 |
|