| 6 | 1/1 | 返回列表 |
| 查看: 1101 | 回復(fù): 5 | ||
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è)作家)
銅蟲 (小有名氣)
至尊木蟲 (職業(yè)作家)
| 6 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 354求調(diào)劑 +4 | Tyoumou 2026-03-18 | 7/350 |
|
|---|---|---|---|---|
|
[考研] 328求調(diào)劑,英語六級(jí)551,有科研經(jīng)歷 +3 | 生物工程調(diào)劑 2026-03-17 | 7/350 |
|
|
[考研]
|
.6lL 2026-03-18 | 4/200 |
|
|
[考研] 314求調(diào)劑 +8 | 無懈可擊的巨人 2026-03-12 | 8/400 |
|
|
[考研] 08工科 320總分 求調(diào)劑 +5 | 梨花珞晚風(fēng) 2026-03-17 | 5/250 |
|
|
[考研] 311求調(diào)劑 +6 | 26研0 2026-03-15 | 6/300 |
|
|
[考研] 311求調(diào)劑 +11 | 冬十三 2026-03-15 | 12/600 |
|
|
[考研] 331求調(diào)劑(0703有機(jī)化學(xué) +7 | ZY-05 2026-03-13 | 8/400 |
|
|
[考研] 0703化學(xué)調(diào)劑 +4 | pupcoco 2026-03-17 | 7/350 |
|
|
[考研] 265求調(diào)劑 +3 | 梁梁校校 2026-03-17 | 3/150 |
|
|
[考博] 26博士申請 +3 | 1042136743 2026-03-17 | 3/150 |
|
|
[考研] 268求調(diào)劑 +8 | 一定有學(xué)上- 2026-03-14 | 9/450 |
|
|
[考研] 考研化學(xué)學(xué)碩調(diào)劑,一志愿985 +4 | 張vvvv 2026-03-15 | 6/300 |
|
|
[考研] 材料工程專碩274一志愿211求調(diào)劑 +6 | 薛云鵬 2026-03-15 | 6/300 |
|
|
[考研] 一志愿南京大學(xué),080500材料科學(xué)與工程,調(diào)劑 +4 | Jy? 2026-03-16 | 4/200 |
|
|
[考研] 0854控制工程 359求調(diào)劑 可跨專業(yè) +3 | 626776879 2026-03-14 | 9/450 |
|
|
[考博] 東華理工大學(xué)化材專業(yè)26屆碩士博士申請 +6 | zlingli 2026-03-13 | 6/300 |
|
|
[考研] 288求調(diào)劑 +4 | 奇點(diǎn)0314 2026-03-14 | 4/200 |
|
|
[考研] 招收0805(材料)調(diào)劑 +3 | 18595523086 2026-03-13 | 3/150 |
|
|
[考研] 考研調(diào)劑 +4 | 芬達(dá)46 2026-03-12 | 4/200 |
|