Dear Rxperts,

Can "Jordan decomposition" of submatrices be useful to determine size of sub
blocks? "http://en.wikipedia.org/wiki/Jordan_normal_form";..

Thanks for the ideas/suggestions.
.
I have another similar situation, where at least one of the off diagonal
elements of the lower triangle submatrices (as mentioned in the previous
example) may be zero.. and based on the visual inspection, the block size of
those square submatrices should be the same as in the previous example. How
do I resolve this one?

m1 <- structure(c(1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), .Dim = c(11L,
11L))

Also, in the vector below is there a simple way to separate out contiguous
blocks (for identification purposes)? Please see the inserted "0" in the
vector below to identify the next block  ...

>> rowSums(m) + colSums(m) - 1
>>  [1]  2  2  1 -1  3  3  3  0  3  3  3 -1   # the elements in this vector
are the TRUE sizes of submatrices (zero is inserted to separate contiguous
blocks of same size)

Regards,
Santosh

On Wed, Apr 27, 2011 at 6:41 AM, Santosh <santosh2...@gmail.com> wrote:

> Thanks, David! That is another interesting perspective to (sub/super)
> diagonal story! For now I was looking only at block sizes of lower triangle
> submatrices as Dennis suggested.
>
> Regards,
> Santosh
>
>
> On Wed, Apr 27, 2011 at 5:57 AM, David Winsemius 
> <dwinsem...@comcast.net>wrote:
>
>>
>> On Apr 27, 2011, at 12:07 AM, Dennis Murphy wrote:
>>
>>  Hi:
>>>
>>> Maybe this can help get you started. Reading your data into a matrix m,
>>>
>>> m <- structure(c(1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
>>> 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
>>> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
>>> 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
>>> 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0,
>>> 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), .Dim =
>>> c(11L,
>>> 11L))
>>>
>>> rowSums(m) + colSums(m) - 1
>>> [1]  2  2  1 -1  3  3  3  3  3  3 -1
>>>
>>> The pair of 2's => a 2 x 2 block, 1 => a 1 x 1 matrix with value 1, -1
>>> => a 1 x 1 matrix with entry 0, a triplet of 3's => a 3 x 3 subblock,
>>> etc. You should be able to figure out the rows and columns for each
>>> submatrix from the indices of the vector above; the values provide an
>>> indication of matrix size as well as position.
>>>
>>>
>> If we are in the stage of providing potentially useful but incomplete
>> ideas, this would be my notion. Use the row and col functions with "[" to
>> locate non-zero elements in the diagonal and subdiagonal:
>>
>> Diagonal:  (My matrix was named `mm`)
>> > mm[row(mm)==col(mm)]
>>  [1] 1 1 1 0 1 1 1 1 1 1 0
>> First subdiagonal:
>> > mm[row(mm)==col(mm)+1]
>>
>>  [1] 0 0 0 0 0 0 0 0 0 0
>> First superdiagonal:
>> > mm[row(mm)==col(mm)-1]
>>  [1] 1 0 0 0 1 1 0 1 1 0
>>
>> Perhaps a combination of the two? It seems as though the rowSums/colSums
>> approach might be insensitive to whether triangular blocks were sub or super
>> diagonal:
>>
>> > rowSums(mm) + colSums(mm) - 1
>>
>>  [1]  2  2  1 -1  3  3  3  3  3  3 -1
>> > mm[1,2]<-0
>> > mm[2,1]<-1
>> > rowSums(mm) + colSums(mm) - 1
>>
>>  [1]  2  2  1 -1  3  3  3  3  3  3 -1
>>
>>  HTH,
>>> Dennis
>>>
>>>
>>>
>>> On Tue, Apr 26, 2011 at 5:13 PM, Santosh <santosh2...@gmail.com> wrote:
>>>
>>>> Dear Rxperts
>>>>
>>>> Below is a small vector of values of zeros and non-zeros... was
>>>> wondering if
>>>> there is an efficient way to get the block sizes of submatrices of a big
>>>> matrix similar to the one shown below? diagonal elements can be zero
>>>> too.
>>>> Rows with only a diagonal element may be considered as a unit block
>>>> size.
>>>>
>>>> c(1,0,0,0,0,0,0,0,0,0,0,
>>>>  1,1,0,0,0,0,0,0,0,0,0,
>>>>  0,0,1,0,0,0,0,0,0,0,0,
>>>>  0,0,0,0,0,0,0,0,0,0,0,
>>>>  0,0,0,0,1,0,0,0,0,0,0,
>>>>  0,0,0,0,1,1,0,0,0,0,0,
>>>>  0,0,0,0,1,1,1,0,0,0,0,
>>>>  0,0,0,0,0,0,0,1,0,0,0,
>>>>  0,0,0,0,0,0,0,1,1,0,0,
>>>>  0,0,0,0,0,0,0,1,1,1,0,
>>>>  0,0,0,0,0,0,0,0,0,0,0)
>>>>
>>>> Thanks much!
>>>> Santosh
>>>>
>>>>       [[alternative HTML version deleted]]
>>>>
>>>> ______________________________________________
>>>> R-help@r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting guide
>>>> http://www.R-project.org/posting-guide.html
>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>
>>>>
>>> ______________________________________________
>>> R-help@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>> David Winsemius, MD
>> West Hartford, CT
>>
>>
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to