Tensorex.Analyzer.eigen_decomposition
You're seeing just the function
eigen_decomposition
, go back to Tensorex.Analyzer module for more information.
Specs
eigen_decomposition(Tensorex.t()) :: {Tensorex.t(), Tensorex.t()}
Diagonalizes a square matrix.
Returns a 2-element tuple containing the diagonalized matrix (D
) and the square matrix (P
)
composed of eigen vectors of the given matrix. The dot product of (P·D·P^-1
) results to the
given matrix.
iex> Tensorex.Analyzer.eigen_decomposition(Tensorex.from_list([[8, 1],
...> [4, 5]]))
{
%Tensorex{data: %{[0, 0] => 9.0 ,
[1, 1] => 4.0 }, shape: [2, 2]},
%Tensorex{data: %{[0, 0] => 0.7071067811865475, [0, 1] => 0.24253562503633297,
[1, 0] => 0.7071067811865475, [1, 1] => -0.9701425001453319 }, shape: [2, 2]}
}
iex> Tensorex.Analyzer.eigen_decomposition(Tensorex.from_list([[2, 0],
...> [0, 3]]))
{
%Tensorex{data: %{[0, 0] => 2,
[1, 1] => 3}, shape: [2, 2]},
%Tensorex{data: %{[0, 0] => 1,
[1, 1] => 1}, shape: [2, 2]}
}
iex> Tensorex.Analyzer.eigen_decomposition(Tensorex.from_list([[2, 0],
...> [4, 3]]))
{
%Tensorex{data: %{[0, 0] => 3.0,
[1, 1] => 2.0 }, shape: [2, 2]},
%Tensorex{data: %{ [0, 1] => -0.24253562503633297,
[1, 0] => 1 , [1, 1] => 0.9701425001453319 }, shape: [2, 2]}
}
iex> Tensorex.Analyzer.eigen_decomposition(Tensorex.from_list([[ 1, 8, 4],
...> [-3, 2, -6],
...> [ 8, -9, 11]]))
{
%Tensorex{data: %{[0, 0] => 15.303170410844274 ,
[1, 1] => -3.3868958657320674,
[2, 2] => 2.0837254548877966 }, shape: [3, 3]},
%Tensorex{data: %{[0, 0] => 0.022124491408649645, [0, 1] => 0.8133941080334768, [0, 2] => 0.8433114989223975 ,
[1, 0] => -0.4151790326348706 , [1, 1] => -0.1674957147614615, [1, 2] => 0.32735161385148664,
[2, 0] => 0.909470657987536 , [2, 1] => -0.5570773829127975, [2, 2] => -0.4262236932575271 }, shape: [3, 3]}
}
iex> Tensorex.Analyzer.eigen_decomposition(Tensorex.from_list([[ 1, 8, 4, -8, 6],
...> [ 8, 2, -6, 15, 4],
...> [ 4, -6, 11, 7, 9],
...> [-8, 15, 7, 3, 2],
...> [ 6, 4, 9, 2, 6]]))
{
%Tensorex{data: %{[0, 0] => 22.48141136723747 ,
[1, 1] => -21.990125946333524 ,
[2, 2] => 15.981743258501801 ,
[3, 3] => 9.870440666608177 ,
[4, 4] => -3.3434693460139164 }, shape: [5, 5]},
%Tensorex{data: %{[0, 0] => 0.22485471488273154, [0, 1] => 0.4533959138705312 , [0, 2] => 0.15613132580124428, [0, 3] => 0.6959350745397415 , [0, 4] => 0.48494317564991224 ,
[1, 0] => 0.3411622703810978 , [1, 1] => -0.5996180449764692 , [1, 2] => -0.6337681498982659 , [1, 3] => 0.31120102182464826, [1, 4] => 0.15986982703698566 ,
[2, 0] => 0.5907934013280463 , [2, 1] => -0.3000622953270929 , [2, 2] => 0.5126463927515507 , [2, 3] => -0.38215013214304583, [2, 4] => 0.38997529200213504 ,
[3, 0] => 0.4381110287686999 , [3, 1] => 0.5856554959326528 , [3, 2] => -0.5216463205486719 , [3, 3] => -0.4370125068120504 , [3, 4] => 0.044402158764973956,
[4, 0] => 0.5404355150079331 , [4, 1] => 0.043134724190818236, [4, 2] => 0.19758475025904781, [4, 3] => 0.2860238476658191 , [4, 4] => -0.7649963886964449 }, shape: [5, 5]}
}