Skip to content

Commit 9e9db18

Browse files
authored
Determinant example documentation fix
The determinant of the example is supposed to be zero, which is the output of `xt::linalg::det(a)`. And for zero determinant matrices, the sign is 0 and logdet is -inf.
1 parent 303bb5b commit 9e9db18

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/source/usage.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ For example, calculating a determinant:
3737
{
3838
xt::xarray<double> a = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
3939
auto d = xt::linalg::det(a);
40-
std::cout << d << std::endl; // 6.661338e-16
40+
std::cout << d << std::endl; // 0.0
4141
}
4242
4343
We can also try to compute the same determinant using the ``slogdet`` function, which
@@ -49,7 +49,7 @@ returning a ``std::tuple``, which can be unpacked using ``std::get<N>(tuple)``.
4949
5050
xt::xarray<double> a = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
5151
auto d = xt::linalg::slogdet(a);
52-
std::cout << std::get<0>(d) << ", " << std::get<1>(d) << std::endl; // 1, -34.9450...
52+
std::cout << std::get<0>(d) << ", " << std::get<1>(d) << std::endl; // 0.0, -inf
5353
5454
Returning tuples is used throughout the xlinalg package.
5555

0 commit comments

Comments
 (0)