Re: Re: Similar matrices->similar eigenvectors?
- To: mathgroup at smc.vnet.net
- Subject: [mg80537] Re: [mg80519] Re: Similar matrices->similar eigenvectors?
- From: DrMajorBob <drmajorbob at bigfoot.com>
- Date: Sun, 26 Aug 2007 02:50:45 -0400 (EDT)
- References: <14594541.1187598542998.JavaMail.root@m35> <29244674.1187940243127.JavaMail.root@m35>
- Reply-to: drmajorbob at bigfoot.com
If there were a standard way to make Eigensystem stable in that sense, I
suspect WRI would be using it already. What those guys don't know about
algebra is rarely worth knowing.
Bobby
On Fri, 24 Aug 2007 00:58:23 -0500, Yaroslav Bulatov
<yaroslavvb at gmail.com> wrote:
> I've tried both approaches, and they seem to remove some of the
> jittering, but now I realize that the problem is more fundamental --
> spectral decomposition of a matrix with degenerate eigenvalues is ill-
> posed. As a result, Eigenvectors, and SingularValueDecomposition are
> unstable for inputs in the vicinity of those points.
>
> Is there a standard approach for regularizing the problem so that
> eigenvector finding becomes stable?
>
> Yaroslav
>
>
> On Aug 21, 2:15 am, DrMajorBob <drmajor... at bigfoot.com> wrote:
>> I don't think it's possible to eliminate all discontinuities, but this
>> may
>> improve things:
>>
>> Clear[normalize, eigensystem]
>> normalize[v : {(0.) ..., x_?Negative, ___}] := -v/Norm[v]
>> normalize[v_?VectorQ] := v/Norm[v]
>> normalize[m_?MatrixQ] := normalize /@ m
>> eigensystem[m_?MatrixQ] := Module[{e, vecs, vals, o},
>> {vals, vecs} = Eigensystem[m];
>> vecs = normalize@vecs;
>> o = Reverse@Ordering@vals;
>> {vals[[o]], vecs[[o]]}
>> ]
>> eigensystem[m_?MatrixQ, k_Integer?Positive] :=
>> eigensystem[m][[All, ;; k]]
>>
>> distances2points[d_] := (n = Length[d];
>> h = IdentityMatrix[n] - Table[1, {n, n}]/n;
>> b = -h.(d*d/2).h;
>> {vals, vecs} = eigensystem[b, 2];
>> Point[Re[#]] & /@ Transpose[vecs*Sqrt[vals]])
>> Clear[d1, d2, d3, d4, d5, d6]; limits = {{{d1, 0, "1->2"}, 0,
>> 1}, {{d2, 0, "1->3"}, 0, 1}, {{d3, 0, "1->4"}, 0,
>> 1}, {{d4, 0, "2->3"}, 0, 1}, {{d5, 0, "2->4"}, 0,
>> 1}, {{d6, 0, "3->4"}, 0, 1}};
>> Manipulate[
>> Graphics[distances2points[{{0, d1, d2, d3}, {d1, 0, d4, d5}, {d2, d4,
>> 0, d6}, {d3, d5, d6, 0}}], PlotRange -> {{-1, 1}, {-1, 1}}],
>> Evaluate[Sequence @@ limits], LocalizeVariables -> False]
>>
>> Replace eigensystem with Eigensystem in "distances2points", to get the
>> original behavior.
>>
>> Bobby
>>
>> On Mon, 20 Aug 2007 02:38:50 -0500, Yaroslav Bulatov
>>
>>
>>
>> <yarosla... at gmail.com> wrote:
>> > In the default implementation of "Eigenvectors", the orientations seem
>> > arbitrary. Changing the matrix slightly could end up flipping the
>> > eigenvectors 180 degrees. A simple fix of telling eigenvectors to
>> > always be on one side of some arbitrary plane doesn't work because it
>> > will flip eigenvectors that are near-parallel to the plane with small
>> > changes in the matrix.
>>
>> > I'm trying to make a demo of multi-dimensional scaling, and the result
>> > is that as I drag the slider, the points flip back and forth
>> > erratically.
>>
>> > Basically I'd like to get a function g[mat] which returns eigenvectors
>> > of mat, and is continuous, what is the simplest way of achieving this?
>>
>> > -----------
>> > distances2points[d_] := (n = Length[d];
>> > (*nxn matrix of ones*)j = Table[1, {n, n}];
>> > (*centering matrix*)h = IdentityMatrix[n] - j/n;
>> > a = -d*d/2;
>> > b = h.a.h;
>> > (*Eigenvectors are returned with arbitrary orientation,
>> > orient them to point in the same halfplane*)
>> > orient[v_, orientvec_] := ((*1,1,1,1 halfplane is often ambiguous,
>> > use random halfplane*)(*SeedRandom[0];
>> > orientvec=RandomReal[{0,1},Length[v]];*)
>> > If[Round[v, .1].orientvec > 0, -v, v]);
>> > vecs = Eigenvectors[b][[1 ;; 2]];
>> > (*vecs=orient[#,b[[1]]]&/@vecs;*)
>> > vals = Eigenvalues[b][[1 ;; 2]];
>> > Point[Re[#]] & /@ Transpose[vecs*Sqrt[vals]])
>> > Clear[d1, d2, d3, d4, d5, d6]; limits = {{{d1, 0, "1->2"}, 0,
>> > 1}, {{d2, 0, "1->3"}, 0, 1}, {{d3, 0, "1->4"}, 0,
>> > 1}, {{d4, 0, "2->3"}, 0, 1}, {{d5, 0, "2->4"}, 0,
>> > 1}, {{d6, 0, "3->4"}, 0, 1}};
>> > Manipulate[
>> > Graphics[distances2points[{{0, d1, d2, d3}, {d1, 0, d4, d5}, {d2, d4,
>> > 0, d6}, {d3, d5, d6, 0}}], PlotRange -> {{-1, 1}, {-1, 1}}],
>> > Evaluate[Sequence @@ limits], LocalizeVariables -> False]
>>
>> --
>>
>> DrMajor... at bigfoot.com
>
>
>
>
--
DrMajorBob at bigfoot.com