4,238 views

2 Answers

2 2 votes
If  int A[l][m][n] denotes any array where  l= number of rows ,m =number of columns,n=number of planes then we can find address of any location A[i][j][k] by using row major formulas as follows

Add(A[i][j][k])=Base Address+(i*m*n+j*n+k)*w where w is the size occupied by each word or integer

column major

Add(A[i][j][k])=Base address +(k*l*m+j*l+i)*w
1 1 vote


Let A[L, M, N] be the 3D array given, 'S' be the size of each element, 'B' denote the Base Address of the 3D array then, the offset of an element A[i, j, k] is given as:

RMO: (i*M*N + j*N + k) * S + B

CMO: (i*M*N + j + k*M) * S + B

Here,

  • " i*M*N " is done to traverse through all the frames to reach the i'th frame (i.e. we travel through all the 2D arrays to reach the required 2D array).

  • Remaining part is simply either RMO or CMO as in a 2D array of size A[M][N]

If array indices start from 1 then, the formula becomes:

RMO: ((i-1)*M*N + (j-1)*N + (k-1)) * S + B

CMO: ((i-1)*M*N + (j-1) + (k-1)*M) * S + B

Position:
Show:

Related questions

2 2 votes
1 1 answer
1.4k
1.4k views
pC asked Dec 23, 2015
1,435 views
There has to be a general method in deriving equations based on RMO and CMO .Could any one explain me how to derive formula of RMO and CMO of important matrices likeUpper...
2 2 votes
2 2 answers
2.7k
2.7k views
supraja asked Apr 21, 2015
2,724 views
Does any one know the formula for Row major order and column major order of symmetric square band matrix
0 0 votes
1 1 answer
959
959 views
viral8702 asked Apr 29, 2022
959 views
A frame buffer array is addressed in row major order for a monitor with pixel locations starting from (0,0) and ending with (100,100). What is address of the pixel(6,10)?...