Function Repository Resource:

DefinitePencilReduce

Source Notebook

Convert a Hermitian-definite matrix pencil into a matrix with the same eigenvalues

Contributed by: Jan Mangaldan

ResourceFunction["DefinitePencilReduce"][{m,a}]

yields a list of matrices {s,t}, where s is a Hermitian matrix with the same eigenvalues as the Hermitian definite matrix pencil {m,a}, and t is a transformation matrix that transforms the eigenvectors of s into the eigenvectors of {m,a}.

Details and Options

An eigenvector of the pencil {m,a} can be obtained from LinearSolve[t,v], where v is an eigenvector of s.
ResourceFunction["DefinitePencilReduce"] takes the option Method. Possible settings for Method include "Cholesky" and "Eigensystem", with the default being Automatic.
With Method"Cholesky", ResourceFunction["DefinitePencilReduce"] uses the Cholesky decomposition to transform the pencil.
With Method"Eigensystem", ResourceFunction["DefinitePencilReduce"] uses an eigendecomposition to transform the pencil.

Examples

Basic Examples (2) 

A symmetric definite pencil:

In[1]:=
{m, a} = {Array[Min, {3, 3}], HilbertMatrix[3]};

Reduce the pencil:

In[2]:=
{sy, tr} = ResourceFunction["DefinitePencilReduce"][{m, a}]
Out[2]=

Compute the eigenvalues of the transformed matrix:

In[3]:=
Eigenvalues[sy]
Out[3]=

These are the same as the eigenvalues of the original pencil:

In[4]:=
ResourceFunction["InheritedBlock"][{Solve}, SetOptions[Solve, Cubics -> False, Quartics -> False]; Eigenvalues[{m, a}]]
Out[4]=

Compute the normalized eigenvectors of the transformed matrix:

In[5]:=
(#/Last[#] &)@*LinearSolve[tr] /@ Eigenvectors[sy, Cubics -> False, Quartics -> False] // RootReduce
Out[5]=

These are the same as the eigenvectors of the original pencil, up to a normalization constant:

In[6]:=
ResourceFunction["InheritedBlock"][{Solve}, SetOptions[Solve, Cubics -> False, Quartics -> False]; Eigenvectors[{m, a}]] // RootReduce
Out[6]=

A machine precision symmetric definite pencil:

In[7]:=
{m, a} = N[{Array[Min, {3, 3}], HilbertMatrix[3]}];

Reduce the pencil:

In[8]:=
{sy, tr} = ResourceFunction["DefinitePencilReduce"][{m, a}]
Out[8]=

Compute the eigenvalues of the transformed matrix:

In[9]:=
Eigenvalues[sy]
Out[9]=

These are the same as the eigenvalues of the original pencil:

In[10]:=
Eigenvalues[{m, a}]
Out[10]=

Compute the normalized eigenvectors of the transformed matrix:

In[11]:=
Normalize@*LinearSolve[tr] /@ Eigenvectors[sy]
Out[11]=

These are the same as the eigenvectors of the original pencil, up to a normalization constant:

In[12]:=
Eigenvectors[{m, a}]
Out[12]=

Scope (3) 

Reduce an exact symmetric definite pencil:

In[13]:=
MatrixForm /@ ResourceFunction["DefinitePencilReduce"][{( {
     {2, 3, 4},
     {3, 1, 2},
     {4, 2, 3}
    } ), ( {
     {3, 1, 1},
     {1, 3, -1},
     {1, -1, 3}
    } )}]
Out[13]=

Reduce a symmetric definite pencil with 24-digit precision arithmetic::

In[14]:=
ResourceFunction["DefinitePencilReduce"][N[{( {
     {2, 3, 4},
     {3, 1, 2},
     {4, 2, 3}
    } ), ( {
     {3, 1, 1},
     {1, 3, -1},
     {1, -1, 3}
    } )}, 24]]
Out[14]=

A random symmetric definite pencil:

In[15]:=
{m, a} = {RandomVariate[GaussianOrthogonalMatrixDistribution[4]], ConjugateTranspose[#] . # &@
   RandomVariate[GaussianOrthogonalMatrixDistribution[4]]}
Out[15]=

Reduce the pencil:

In[16]:=
ResourceFunction["DefinitePencilReduce"][{m, a}]
Out[16]=

A random Hermitian definite pencil:

In[17]:=
{m, a} = {RandomVariate[GaussianUnitaryMatrixDistribution[4]], ConjugateTranspose[#] . # &@
   RandomVariate[GaussianUnitaryMatrixDistribution[4]]}
Out[17]=

Reduce the pencil:

In[18]:=
ResourceFunction["DefinitePencilReduce"][{m, a}]
Out[18]=

Options (2) 

Method (2) 

Use the "Cholesky" method to reduce the definite pencil:

In[19]:=
ResourceFunction["DefinitePencilReduce"][
 N[{Array[Min, {3, 3}], HilbertMatrix[3]}], Method -> "Cholesky"]
Out[19]=

Use the "Eigensystem" method to reduce the definite pencil:

In[20]:=
ResourceFunction["DefinitePencilReduce"][
 N[{Array[Min, {3, 3}], HilbertMatrix[3]}], Method -> "Eigensystem"]
Out[20]=

Properties and Relations (4) 

A definite pencil:

In[21]:=
{m, a} = N[{( {
      {2, 3, 4},
      {3, 1, 2},
      {4, 2, 3}
     } ), ( {
      {3, 1, 1},
      {1, 3, -1},
      {1, -1, 3}
     } )}];

Reduce the definite pencil:

In[22]:=
{s, t} = ResourceFunction["DefinitePencilReduce"][{m, a}]
Out[22]=

Verify that m is given by ConjugateTranspose[t].s.t:

In[23]:=
Chop[ConjugateTranspose[t] . s . t - m]
Out[23]=

Verify that a is given by ConjugateTranspose[t].t:

In[24]:=
Chop[ConjugateTranspose[t] . t - a]
Out[24]=

Possible Issues (1) 

DefinitePencilReduce is left unevaluated if the argument is not a definite pencil:

In[25]:=
ResourceFunction["DefinitePencilReduce"][{( {
    {2, 3, 4},
    {3, 1, 2},
    {4, 2, 3}
   } ), ( {
    {1, 1, 1},
    {1, 1, -1},
    {1, -1, 1}
   } )}]
Out[25]=
In[26]:=
PositiveDefiniteMatrixQ[( {
   {1, 1, 1},
   {1, 1, -1},
   {1, -1, 1}
  } )]
Out[26]=

Version History

  • 1.0.0 – 08 January 2021

Source Metadata

Related Resources

License Information