Implements reductions visitors broadcasting

Co-authored-by: kallore <kkaspar@codereckons.com>

See merge request oss/rotgen!6
This commit is contained in:
Karen Kaspar 2025-05-22 09:03:21 +02:00 committed by Joel Falcou
parent 9164c02c47
commit d5146ee19f
4 changed files with 86 additions and 0 deletions

View file

@ -52,6 +52,10 @@ namespace rotgen
double minCoeff(std::ptrdiff_t* row, std::ptrdiff_t* col) const;
double trace() const;
double squaredNorm() const;
double norm() const;
double lpNorm(int p) const;
double& operator()(std::size_t i, std::size_t j);
double const& operator()(std::size_t i, std::size_t j) const;

View file

@ -13,6 +13,8 @@
namespace rotgen
{
inline constexpr int Infinity = -1;
template< typename Scalar, int Rows = -1 , int Cols = -1
, int Options = 0, int MaxRows = Rows, int MaxCols = Cols
>
@ -170,6 +172,13 @@ namespace rotgen
if constexpr(Cols != -1) assert(cols == Cols && "Mismatched between dynamic and static column size");
return parent::Identity(rows, cols);
}
template<int P>
double lpNorm() const {
assert(P == 1 || P == 2 || P == Infinity);
return parent::lpNorm(P);
}
};
template<typename S, int R, int C, int O, int MR, int MC>