作者polomoss (小泽)
看板Grad-ProbAsk
标题Re: [理工] [资结]-一些矩阵的计算问题
时间Wed Dec 16 23:54:14 2009
※ 引述《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
1F:推 assassin88:第一题跟我算的一样..不过第二题我不懂可以解释一下吗 12/17 00:00
2F:推 sakuraai:对角线上有n个加上两旁有n-1个 12/17 01:24
3F:推 assassin88:但不是规定|i-j|>2吗? 这样应该会有对角线跟两旁两条? 12/17 11:32
4F:→ polomoss:恩,那就是 n + 2(n-1) + 2(n-2) 没看仔细~ 12/17 18:20