| 5 | 1/1 | 返回列表 |
| 查看: 1110 | 回復(fù): 5 | ||
| 當(dāng)前只顯示滿足指定條件的回帖,點(diǎn)擊這里查看本話題的所有回帖 | ||
songjunann銅蟲 (小有名氣)
|
[求助]
幫忙看一下,這兩個(gè)程序(關(guān)于點(diǎn)積的)講的是什么,為什么要寫的這么繁瑣
|
|
|
dot.f程序: function dot (x,y,n) cc-begin c c----------------------------------------------------------------------- c c dot (x,y,n) c c c purpose c ------- c c dot calculates the dot product of the two n-vectors c x and y. c cc-doc c input arguments c --------------- c c x = vector of length n. c y = vector of length n. c n = dimension of x and y. c c output arguments c ---------------- c c dot = value of the function, i.e. dot product of x and y. c c notes c ----- c c 1. dot contains a test for n = 0. c c----------------------------------------------------------------------- cc-end c implicit real*8 (a-h,o-z) dimension x(*),y(*) c dot = 0. if (n .le. 0) return c do 100 i = 1,n c dot = dot + x(i)*y(i) c 100 continue dot = ddot(n,x,1,y,1) end %%%%%%%%%%%%%%%%%%%%%%%%% 其中ddot.f子程序?yàn)椋?br /> DOUBLE PRECISION FUNCTION DDOT(N,DX,INCX,DY,INCY) * .. Scalar Arguments .. INTEGER INCX,INCY,N * .. * .. Array Arguments .. DOUBLE PRECISION DX(*),DY(*) * .. * * Purpose * ======= * * DDOT forms the dot product of two vectors. * uses unrolled loops for increments equal to one. * * Further Details * =============== * * jack dongarra, linpack, 3/11/78. * modified 12/3/93, array(1) declarations changed to array(*) * * ===================================================================== * * .. Local Scalars .. DOUBLE PRECISION DTEMP INTEGER I,IX,IY,M,MP1 * .. * .. Intrinsic Functions .. INTRINSIC MOD * .. DDOT = 0.0d0 DTEMP = 0.0d0 IF (N.LE.0) RETURN IF (INCX.EQ.1 .AND. INCY.EQ.1) THEN * * code for both increments equal to 1 * * * clean-up loop * M = MOD(N,5) IF (M.NE.0) THEN DO I = 1,M DTEMP = DTEMP + DX(I)*DY(I) END DO IF (N.LT.5) THEN DDOT=DTEMP RETURN END IF END IF MP1 = M + 1 DO I = MP1,N,5 DTEMP = DTEMP + DX(I)*DY(I) + DX(I+1)*DY(I+1) + $ DX(I+2)*DY(I+2) + DX(I+3)*DY(I+3) + DX(I+4)*DY(I+4) END DO ELSE * * code for unequal increments or equal increments * not equal to 1 * IX = 1 IY = 1 IF (INCX.LT.0) IX = (-N+1)*INCX + 1 IF (INCY.LT.0) IY = (-N+1)*INCY + 1 DO I = 1,N DTEMP = DTEMP + DX(IX)*DY(IY) IX = IX + INCX IY = IY + INCY END DO END IF DDOT = DTEMP RETURN END 個(gè)人感覺不就是兩個(gè)向量的點(diǎn)積,為什么兩個(gè)程序要寫的這么復(fù)雜呢,有什么特別的地方嗎,請大家多多指教,謝謝! |
銅蟲 (小有名氣)
至尊木蟲 (職業(yè)作家)
至尊木蟲 (職業(yè)作家)
銅蟲 (小有名氣)
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 299求調(diào)劑 +8 | 15188958825 2026-03-25 | 8/400 |
|
|---|---|---|---|---|
|
[考研] 0856求調(diào)劑 +6 | 楒桉 2026-03-28 | 6/300 |
|
|
[考研] 一志愿太原理工安全工程300分,求調(diào)劑 +5 | 0857求調(diào)劑. 2026-03-24 | 6/300 |
|
|
[考研] 315求調(diào)劑 +4 | akie... 2026-03-28 | 5/250 |
|
|
[考研] 083000學(xué)碩274求調(diào)劑 +8 | Li李魚 2026-03-26 | 8/400 |
|
|
[考研] 347求調(diào)劑 +3 | 山頂見α 2026-03-25 | 3/150 |
|
|
[考研] 265求調(diào)劑 +8 | 小木蟲085600 2026-03-27 | 8/400 |
|
|
[考研]
|
18419759900 2026-03-25 | 8/400 |
|
|
[考研] 07化學(xué)280分求調(diào)劑 +10 | 722865 2026-03-23 | 10/500 |
|
|
[考研] 一志愿211,335分,0856,求調(diào)劑院校和導(dǎo)師 +4 | 傾____蕭 2026-03-27 | 5/250 |
|
|
[考研] 324求調(diào)劑 +5 | hanamiko 2026-03-26 | 5/250 |
|
|
[考研] 359求調(diào)劑 +4 | 王了個(gè)楠 2026-03-25 | 4/200 |
|
|
[考研] 求調(diào)劑 +6 | 林之夕 2026-03-24 | 6/300 |
|
|
[考研] 中國科學(xué)院深圳先進(jìn)技術(shù)研究院-光纖傳感課題組招生-中國科學(xué)院大學(xué)、深圳理工大學(xué)聯(lián)培 +5 | YangTyu1 2026-03-26 | 5/250 |
|
|
[考研] 352求調(diào)劑 +4 | 大米飯! 2026-03-22 | 4/200 |
|
|
[考研] 一志愿天津大學(xué)339材料與化工求調(diào)劑 +3 | 江往賣魚 2026-03-26 | 3/150 |
|
|
[考研] 一志愿南航 335分 | 0856材料化工 | GPA 4.07 | 有科研經(jīng)歷 +6 | cccchenso 2026-03-23 | 6/300 |
|
|
[考研] 296求調(diào)劑 +4 | 汪?! 2026-03-25 | 7/350 |
|
|
[考研] 【2026考研調(diào)劑】制藥工程 284分 求相關(guān)專業(yè)調(diào)劑名額 +4 | 袁奐奐 2026-03-25 | 8/400 |
|
|
[考研] 材料/農(nóng)業(yè)專業(yè),07/08開頭均可,過線就行 +3 | 呵唔哦豁 2026-03-23 | 4/200 |
|