Re: [理工] [資結]-一些矩陣的計算問題

看板Grad-ProbAsk作者 (小澤)時間14年前 (2009/12/16 23:54), 編輯推噓3(301)
留言4則, 3人參與, 最新討論串2/2 (看更多)
※ 引述《tryPTT (NULL)》之銘言: : 一、What is the address for a[5][3] for an array declared as a[7][8]? : Assume a row major ordering, 10 units of memory per element, and staring : address is 1000. a[5][3] = 1000 + [ (5-1) * 8 + (3-1) ] * 10 = 1340 : 二、Given A as an N by N array(N>=2) with A[i,j]=0 if |i-j|>2. Then, determine : the maximal number of nonzero elements in A. n + 2(n-1) = 3n-2 : 三、另外想請問一下row/column-major 到底怎麼判斷會比較準? : ex1: A(0,5)=36 A(1,4)=56 A(2,7)=92 是row-major嗎? : ex2: B(2,3)=18 B(3,2)=28 A(1,1)=2 是row-major嗎? ex1 row-major ex2 row-major 看前兩個就能判斷了 另外,在同一篇加問一題....... 帶狀矩陣,A n,a,b 儲存到B[]一維陣列 給B[k] → A[i,j] 跟給A[i,j] → B[k] 這兩個公式怎麼導~? -- ┌這篇文章讓覺得?─────────────────────────────┐ │ │ 一"一 \ / >\\\< ╯ ╰ ∩ ∩ ▁ ▁_< ㄧ ㄧ+ │ ε Δ ╰╯ 北七 亂喔 害羞 莎笅 爽啦 哭爸 XD 科科 └──────────────────────────────────────┘ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 122.116.14.2

12/17 00:00, , 1F
第一題跟我算的一樣..不過第二題我不懂可以解釋一下嗎
12/17 00:00, 1F

12/17 01:24, , 2F
對角線上有n個加上兩旁有n-1個
12/17 01:24, 2F

12/17 11:32, , 3F
但不是規定|i-j|>2嗎? 這樣應該會有對角線跟兩旁兩條?
12/17 11:32, 3F

12/17 18:20, , 4F
恩,那就是 n + 2(n-1) + 2(n-2) 沒看仔細~
12/17 18:20, 4F
文章代碼(AID): #1BAGAfwS (Grad-ProbAsk)
文章代碼(AID): #1BAGAfwS (Grad-ProbAsk)