Add geom::solve for solving simple linear equations
This commit is contained in:
parent
c7b44a6925
commit
5ab15e263a
1 changed files with 8 additions and 0 deletions
|
|
@ -197,6 +197,14 @@ namespace psemek::geom
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T, std::size_t N>
|
||||||
|
std::optional<vector<T, N>> solve(matrix<T, N, N> const & m, vector<T, N> v)
|
||||||
|
{
|
||||||
|
if (!gauss(m, v))
|
||||||
|
return std::nullopt;
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T, std::size_t N>
|
template <typename T, std::size_t N>
|
||||||
std::optional<matrix<T, N, N>> inverse(matrix<T, N, N> m)
|
std::optional<matrix<T, N, N>> inverse(matrix<T, N, N> m)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue