Tensorex.Analyzer.lu_decomposition

You're seeing just the function lu_decomposition, go back to Tensorex.Analyzer module for more information.
Link to this function

lu_decomposition(matrix)

View Source

Specs

lu_decomposition(Tensorex.t()) :: {Tensorex.t(), Tensorex.t(), Tensorex.t()}

Decomposites a square matrix into a pair of triangular matrices.

Returns a 3-element tuple containing a row pivot matrix (P), a lower triangular matrix (L) and an upper triangular matrix (U). The dot product of them (P·L·U) results to the given matrix.

iex> Tensorex.Analyzer.lu_decomposition(Tensorex.from_list([[10, 13, 15],
...>                                                        [ 5,  7,  9],
...>                                                        [ 9, 11, 13]]))
{
  %Tensorex{data: %{[0, 0] =>  1  ,
                                                                   [1, 2] =>  1                 ,
                                    [2, 1] =>  1                                                }, shape: [3, 3]},
  %Tensorex{data: %{[0, 0] =>  1  ,
                    [1, 0] =>  0.9, [1, 1] =>  1                 ,
                    [2, 0] =>  0.5, [2, 1] => -0.7142857142857132, [2, 2] =>  1                 }, shape: [3, 3]},
  %Tensorex{data: %{[0, 0] => 10  , [0, 1] => 13                 , [0, 2] => 15                 ,
                                    [1, 1] => -0.7000000000000011, [1, 2] => -0.5               ,
                                                                   [2, 2] =>  1.1428571428571435}, shape: [3, 3]}
}

iex> Tensorex.Analyzer.lu_decomposition(Tensorex.from_list([[ 0, 13, 15],
...>                                                        [ 5,  7,  9],
...>                                                        [ 9, 11, 13]]))
{
  %Tensorex{data: %{                              [0, 1] =>  1                  ,
                                                                                  [1, 2] =>  1                 ,
                    [2, 0] => 1                                                                                }, shape: [3, 3]},
  %Tensorex{data: %{[0, 0] => 1                 ,
                                                  [1, 1] =>  1                  ,
                    [2, 0] => 0.5555555555555556, [2, 1] =>  0.06837606837606834, [2, 2] =>  1                 }, shape: [3, 3]},
  %Tensorex{data: %{[0, 0] => 9                 , [0, 1] => 11                  , [0, 2] => 13                 ,
                                                  [1, 1] => 13                  , [1, 2] => 15                 ,
                                                                                  [2, 2] =>  0.7521367521367526}, shape: [3, 3]}
}