I have an nxn matrix A where n is a power of 2. The matrix A is divided into 4 equal sized sub-matrices. How can I reference matrices the sub-matrices A11, A12, A21 and A22 in java? I am attempting a divide and conquer matrix multiplication algorithm (Strassen)
A11 | A12
A --> ---------
A21 | A22
EDIT: The matrix is stored as integer array: int[][].
Algorithm. Step 1 − Create a DP matrix of size (n+1)*(n+1). Step 2 − For each element of the matrix, find the sum till the current index. Step 3 − For all indexes from 0 to n, find the sum of sub-matrix of size size*size.
The number of submatrices There are (n – k + 1) sequences of consecutive rows of length k, such as 1:k, 2:(k+1), and so forth. Similarly, there are (m – k + 1) sequences of consecutive columns of length k. So the following SAS/IML function counts the number of submatrices of order k.
DEFINITION 1. 3. 4 A matrix obtained by deleting some of the rows and/or columns of a matrix is said to be a submatrix of the given matrix. For example, if a few submatrices of are. But the matrices and are not submatrices of.
(ˈsʌbˌmeɪtrɪks ) noun. a matrix formed from parts of a larger matrix.
Well, if i
and j
are your indices, then A11 is obtained for i = 0..(n/2)-1, j = 0..(n/2)-1.
Then, A12 is for i = 0..(n/2)-1 and j = n/2..n-1 and so on.
To 'reference' them, you just need an "i_min, i_max, j_min, j_max" and instead of running indices from 0 to n-1, run them from min to max.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With