Add geom::outer_product
This commit is contained in:
parent
a5812c02c8
commit
ff1c144f25
1 changed files with 10 additions and 0 deletions
|
|
@ -377,6 +377,16 @@ namespace psemek::geom
|
|||
return r;
|
||||
}
|
||||
|
||||
template <typename T, std::size_t N>
|
||||
matrix<T, N, N> outer_product(vector<T, N> const & v1, vector<T, N> const & v2)
|
||||
{
|
||||
matrix<T, N, N> r;
|
||||
for (std::size_t i = 0; i < N; ++i)
|
||||
for (std::size_t j = 0; j < N; ++j)
|
||||
r[i][j] = v1[i] * v2[j];
|
||||
return r;
|
||||
}
|
||||
|
||||
template <typename T, std::size_t R, std::size_t C>
|
||||
std::ostream & operator << (std::ostream & os, matrix<T, R, C> const & m)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue