<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic how to index submatrices? in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-index-submatrices/m-p/673884#M5221</link>
    <description>&lt;P&gt;When using SAS/IML, I sometimes need to form submatrices from a given matrix. For example, when I am given 16 x 16 square matrix, say matrix A, I would probably want to subdivide the matrix into four 4x4 submatrices and apply the same data process. In this case, it would probably be more convenient if we can make an index for the submatrices, such as A_1, A_2, A_3, A_4, or A_{1,1}, A_{1,2}, A_{2,1}, A_{2,2}.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I write a code for making these submatrices?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 01 Aug 2020 10:08:57 GMT</pubDate>
    <dc:creator>SASingaKorean</dc:creator>
    <dc:date>2020-08-01T10:08:57Z</dc:date>
    <item>
      <title>how to index submatrices?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-index-submatrices/m-p/673884#M5221</link>
      <description>&lt;P&gt;When using SAS/IML, I sometimes need to form submatrices from a given matrix. For example, when I am given 16 x 16 square matrix, say matrix A, I would probably want to subdivide the matrix into four 4x4 submatrices and apply the same data process. In this case, it would probably be more convenient if we can make an index for the submatrices, such as A_1, A_2, A_3, A_4, or A_{1,1}, A_{1,2}, A_{2,1}, A_{2,2}.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I write a code for making these submatrices?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 01 Aug 2020 10:08:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-index-submatrices/m-p/673884#M5221</guid>
      <dc:creator>SASingaKorean</dc:creator>
      <dc:date>2020-08-01T10:08:57Z</dc:date>
    </item>
    <item>
      <title>Re: how to index submatrices?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-index-submatrices/m-p/673891#M5222</link>
      <description>&lt;P&gt;You can &lt;A href="https://blogs.sas.com/content/iml/2015/11/25/extract-elements-matrix.html" target="_self"&gt;specify a submatrix by using the row and column subscripts.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;For example, if you have a 6 x 6 matrix, you can get the four 3 x 3 submatrices as follows&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
A = toeplitz(6:1);
print A;

/*   A[rows, cols] */
A1 = A[1:3, 1:3];
A2 = A[1:3, 4:6];
A3 = A[4:6, 1:3];
A4 = A[4:6, 4:6];

print A1, A2, A3, A4;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How you use this depends on what you are trying to accomplish. It's not clear what you want to do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also loop over the submatrices and extract each one as part of a loop. For example, the following loop that iterates over the four submatrices:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;cutPts = {0, 3, 6};
do i = 1 to 2;
   rows = (1+cutPts[i]) : cutPts[i+1];
   do j = 1 to 2;
      cols = (1+cutPts[j]) : cutPts[j+1];
      A_ij = A[rows, cols];
      det = det(A_ij);
      print i j det;
   end;
end;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 01 Aug 2020 10:51:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-index-submatrices/m-p/673891#M5222</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2020-08-01T10:51:53Z</dc:date>
    </item>
    <item>
      <title>Re: how to index submatrices?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-index-submatrices/m-p/674264#M5228</link>
      <description>Thank you for your reply. It was very useful.</description>
      <pubDate>Tue, 04 Aug 2020 04:06:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-index-submatrices/m-p/674264#M5228</guid>
      <dc:creator>SASingaKorean</dc:creator>
      <dc:date>2020-08-04T04:06:43Z</dc:date>
    </item>
  </channel>
</rss>

