Tensorex.Analyzer.bidiagonalize

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

Specs

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

Bidiagonalizes a matrix.

Returns a 3-element tuple containing the left-side orthogonal matrix (U), the bidiagonalized matrix (A) and the right-side orthogonal matrix (V). The dot product of them (U·A·V) results to the given matrix.

iex> Tensorex.Analyzer.bidiagonalize(Tensorex.from_list([[1, 3],
...>                                                     [2, 4]]))
{
  %Tensorex{data: %{[0, 0] => -0.4472135954999581, [0, 1] => -0.8944271909999159,
                    [1, 0] => -0.8944271909999159, [1, 1] =>  0.447213595499958 }, shape: [2, 2]},
  %Tensorex{data: %{[0, 0] => -2.23606797749979  , [0, 1] => -4.919349550499538 ,
                                                   [1, 1] => -0.8944271909999157}, shape: [2, 2]},
  %Tensorex{data: %{[0, 0] =>  1,
                                                   [1, 1] =>  1                 }, shape: [2, 2]}
}

iex> Tensorex.Analyzer.bidiagonalize(Tensorex.from_list([[1, 3],
...>                                                     [2, 4],
...>                                                     [8, 7]]))
{
  %Tensorex{data: %{[0, 0] => -0.12038585308576932, [0, 1] => -0.6785172735171086, [0, 2] => -0.7246527140056269 ,
                    [1, 0] => -0.24077170617153842, [1, 1] => -0.6882103774244954, [1, 2] =>  0.6843942298942036 ,
                    [2, 0] => -0.9630868246861537 , [2, 1] =>  0.2568672535457624, [2, 2] => -0.08051696822284758}, shape: [3, 3]},
  %Tensorex{data: %{[0, 0] => -8.306623862918075  , [0, 1] => -8.065852156746537 ,
                                                    [1, 1] => -2.9903225554289703}, shape: [3, 2]},
  %Tensorex{data: %{[0, 0] =>  1                  ,
                                                    [1, 1] =>  1                 }, shape: [2, 2]}
}

iex> Tensorex.Analyzer.bidiagonalize(Tensorex.from_list([[1, 3, 4],
...>                                                     [2, 4, 7],
...>                                                     [6, 8, 9]]))
{
  %Tensorex{data: %{[0, 0] => -0.1561737618886061 , [0, 1] => -0.5866584511916395, [0, 2] => -0.7946330082138469 ,
                    [1, 0] => -0.31234752377721214, [1, 1] => -0.7338871586541569, [1, 2] =>  0.6031986925986929 ,
                    [2, 0] => -0.9370425713316364 , [2, 1] =>  0.3424054614166589, [2, 2] => -0.06862739616392308}, shape: [3, 3]},
  %Tensorex{data: %{[0, 0] => -6.4031242374328485 , [0, 1] => 14.537587950366257 ,
                                                    [1, 1] =>  4.644937425077393 , [1, 2] => -1.277069945154351  ,
                                                                                   [2, 2] =>  0.6724472155230544 }, shape: [3, 3]},
  %Tensorex{data: %{[0, 0] =>  1                  ,
                                                    [1, 1] => -0.6338226109370237, [1, 2] => -0.7734784404655207 ,
                                                    [2, 1] => -0.7734784404655207, [2, 2] =>  0.633822610937024  }, shape: [3, 3]}
}

iex> Tensorex.Analyzer.bidiagonalize(Tensorex.from_list([[2, -4,  8],
...>                                                     [3,  5,  6],
...>                                                     [1,  9, 11],
...>                                                     [7, 12, 13]]))
{
  %Tensorex{data: %{[0, 0] => -0.25197631533948517, [0, 1] =>  0.11018150006547239 , [0, 2] => -0.9605551708365737 , [0, 3] =>  0.041252119101685414,
                    [1, 0] => -0.37796447300922725, [1, 1] =>  0.020828566102646506, [1, 2] =>  0.06187677855532897, [1, 3] => -0.9235151824699903  ,
                    [2, 0] => -0.12598815766974245, [2, 1] => -0.9885657272873108  , [2, 2] => -0.0793161285954799 , [2, 3] =>  0.0239528433493658  ,
                    [3, 0] => -0.881917103688197  , [3, 1] =>  0.1008167184069181  , [3, 2] =>  0.2592565906575201 , [3, 3] =>  0.3805840665510335  }, shape: [4, 4]},
  %Tensorex{data: %{[0, 0] => -7.937253933193772  , [0, 1] => 21.267756353632144   ,
                                                    [1, 1] => 11.647368945587411   , [1, 2] =>  1.3952492335365543 ,
                                                                                     [2, 2] => -8.128629398872933  }, shape: [4, 3]},
  %Tensorex{data: %{[0, 0] =>  1                  ,
                                                    [1, 1] => -0.5923904504775179  , [1, 2] => -0.8056510126494246 ,
                                                    [2, 1] => -0.8056510126494246  , [2, 2] =>  0.592390450477518  }, shape: [3, 3]}
}

iex> Tensorex.Analyzer.bidiagonalize(Tensorex.from_list([[1, 3, 5],
...>                                                     [2, 4, 6]]))
{
  %Tensorex{data: %{[0, 0] => -0.4472135954999581, [0, 1] => -0.8944271909999159,
                    [1, 0] => -0.8944271909999159, [1, 1] =>  0.447213595499958 }, shape: [2, 2]},
  %Tensorex{data: %{[0, 0] => -2.23606797749979  , [0, 1] =>  9.055385138137419 ,
                                                   [1, 1] =>  1.9877674693472376, [1, 2] => -0.22086305214969304}, shape: [2, 3]},
  %Tensorex{data: %{[0, 0] =>  1                 ,
                                                   [1, 1] => -0.5432512781572743, [1, 2] => -0.8395701571521512 ,
                                                   [2, 1] => -0.8395701571521512, [2, 2] =>  0.5432512781572743 }, shape: [3, 3]}
}

iex> Tensorex.Analyzer.bidiagonalize(Tensorex.from_list([[1, 3, 5]]))
{
  %Tensorex{data: %{[0, 0] => 1}, shape: [1, 1]},
  %Tensorex{data: %{[0, 0] => 1, [0, 1] => -5.830951894845301                                }, shape: [1, 3]},
  %Tensorex{data: %{[0, 0] => 1,
                                 [1, 1] => -0.5144957554275265, [1, 2] => -0.8574929257125442,
                                 [2, 1] => -0.8574929257125442, [2, 2] =>  0.5144957554275265}, shape: [3, 3]}
}