# [R] Diagonal Submatrices Extraction

Bruno C. bruno.c at inwind.it
Thu Jul 26 18:31:01 CEST 2007

```Yes you are right ... an example is mandatory.

So ... I have a matrix of 0 with just a single 1 per row and per column
I need to extract all maximal 'diagonal' submatrices

Let's say I have the following matrix

A B C D E
a 0 1 0 0 0
b 1 0 0 0 0
c 0 0 1 0 0
d 0 0 0 1 0
e 0 0 0 0 1

well I would like to get, for this example, the two following submatrices
A B                 C D E
a 0 1               c 1 0 0
b 1 0               d 0 1 0
e 0 0 1
Of course some of the extracted submatrices will have in some situations dim=c(1,1) ...

Bruno
> Hi :  I think you need to give an example because I don't understand
> below and my guess is that, since noone else replied,
> I don't think they understood it either. I don't mean to be rude. I've
> just noticed  from being on the list
> That, if something is not clear, people won't even tell you. They just
> won't respond. The list is great
> But people don't want to spend time trying to figure out what you want.
> An example and possibly code is really
>
>
>
>
>
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Bruno C.
> Sent: Thursday, July 26, 2007 4:47 AM
> To: R-help
> Subject: [R] Submatrices Extraction
>
> Hello,
> Given a submatrix containing 0 or 1
> I need to extract the indexes of all the diagonal submatrices so one of
> the two diagonals must contains only 1 for each submatrix ...
> Any help?
>
> Bruno
>
>
> ------------------------------------------------------
> canone Telecom
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> --------------------------------------------------------
>
> This is not an offer (or solicitation of an offer) to buy/sell the securities/instruments mentioned or an official confirmation.  Morgan Stanley may deal as principal in or own or act as market maker for securities/instruments mentioned or may advise the issuers.  This is not research and is not from MS Research but it may refer to a research analyst/research report.  Unless indicated, these views are the author's and may differ from those of Morgan Stanley research or others in the Firm.  We do not represent this is accurate or complete and we may not update this.  Past performance is not indicative of future returns.  For additional information, research reports and important disclosures, contact me or see https://secure.ms.com/servlet/cls.  You should not use e-mail to request, authorize or effect the purchase or sale of any security or instrument, to send transfer instructions, or to effect any other transactions.  We cannot guarantee that any such requests received via e-mail will be processed in a timely manner.  This communication is solely for the addressee(s) and may contain confidential information.  We do not waive confidentiality by mistransmission.  Contact me if you do not wish to receive these communications.  In the UK, this communication is directed in the UK to those persons who are market counterparties or intermediate customers (as defined in the UK Financial Services Authority's rules).
>

------------------------------------------------------
Scegli infostrada: ADSL gratis per tutta l’estate e telefoni senza canone Telecom

```