# [R] Changing a matrix based on eigen value

David Winsemius dwinsemius at comcast.net
Thu Jul 21 05:57:34 CEST 2011

```On Jul 20, 2011, at 11:17 PM, B. Jonathan B. Jonathan wrote:

> It is not any homework problem. I just need some pointer. Given that
> I think
> I would be able to carry forward.

Then what kind of problem _is_ it? You say:

"nearest matrix"   ... using what measure for distance or similarity?

"... keep all other properties (whatever are those) of my original
matrix "mat" as unaltered as possible."

... this really does leave your question looking ... what would
be kind? ... perhaps the word "nebulous" would be apt? How are we
supposed to make choices for you in the absence of any goals?

--
David

>
> Thanks,
>
> On Thu, Jul 21, 2011 at 4:52 AM, Bert Gunter
> <gunter.berton at gene.com> wrote:
>
>> A homework problem?
>> -- Bert
>>
>> On Wed, Jul 20, 2011 at 10:06 AM, B. Jonathan B. Jonathan
>> <bkheijonathan at gmail.com> wrote:
>>> Dear all, my question is not directly related to R, however I
>>> believe
>> that
>>> experts here would not mind anything to have a look on my problem.
>>>
>>> Please consider a symmetric matrix and it's eigen values:
>>>
>>>> set.seed(1)
>>>> mat <- matrix(rnorm(36), 6)
>>>> mat <- mat %*% t(mat) # symmetric matrix
>>>> mat
>>>         [,1]       [,2]        [,3]       [,4]       [,5]        [,
>>> 6]
>>> [1,]  3.920570  1.9339770  1.29012167 -1.4627174 -1.5655953
>>> -1.82083435
>>> [2,]  1.933977  5.8501784 -1.70504980  0.7195951  1.4252209
>>> -3.11543738
>>> [3,]  1.290122 -1.7050498  3.31434984 -0.6324029  0.1860666
>>> -0.08234236
>>> [4,] -1.462717  0.7195951 -0.63240294  5.4179467  0.9003576
>>> -3.61864495
>>> [5,] -1.565595  1.4252209  0.18606662  0.9003576  4.5248002
>>> 0.52702347
>>> [6,] -1.820834 -3.1154374 -0.08234236 -3.6186449  0.5270235
>>> 6.02038872
>>>> eigen(mat)\$values
>>> [1] 11.4213448  7.3302845  5.7033748  3.9863332  0.4827576
>>> 0.1241385
>>>
>>> Here my goal is to find the "nearest matrix" of "mat" for which the
>> minimum
>>> eigen value is 0.20 (I would rather want to fix some arbitrary
>>> value).
>> While
>>> finding that nearest matrix, I would like to keep all other
>>> properties
>>> (whatever are those) of my original matrix "mat" as unaltered as
>> possible.
>>>
>>> Is there any algorithm to achieve that?
>>>
>>> Thanks for your help.

David Winsemius, MD
West Hartford, CT

```