Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reference sub-matrices within a matrix

Tags:

java

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[][].

like image 966
softwarematter Avatar asked Nov 29 '10 04:11

softwarematter


People also ask

How do you find the sub of a matrix?

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.

How many Submatrix are in a matrix?

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.

What is sub matrix with example?

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.

What is meant by sub Matrix?

(ˈsʌbˌmeɪtrɪks ) noun. a matrix formed from parts of a larger matrix.


1 Answers

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.

like image 139
Lagerbaer Avatar answered Sep 23 '22 04:09

Lagerbaer