Make max/minCoeff templated on index type
See merge request oss/rotgen!23
This commit is contained in:
parent
c40a947daa
commit
d667fd28b5
12 changed files with 157 additions and 18 deletions
|
|
@ -195,6 +195,29 @@ namespace rotgen
|
|||
return *this;
|
||||
}
|
||||
|
||||
auto minCoeff() const { return parent::minCoeff(); }
|
||||
auto maxCoeff() const { return parent::maxCoeff(); }
|
||||
|
||||
template<std::integral IndexType>
|
||||
auto minCoeff(IndexType* row, IndexType* col) const
|
||||
{
|
||||
Index r,c;
|
||||
auto result = parent::minCoeff(&r, &c);
|
||||
*row = r;
|
||||
*col = c;
|
||||
return result;
|
||||
}
|
||||
|
||||
template<std::integral IndexType>
|
||||
auto maxCoeff(IndexType* row, IndexType* col) const
|
||||
{
|
||||
Index r,c;
|
||||
auto result = parent::maxCoeff(&r, &c);
|
||||
*row = r;
|
||||
*col = c;
|
||||
return result;
|
||||
}
|
||||
|
||||
static concrete_type Zero()
|
||||
requires (Rows != -1 && Cols != -1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -181,6 +181,29 @@ namespace rotgen
|
|||
return *this;
|
||||
}
|
||||
|
||||
auto minCoeff() const { return parent::minCoeff(); }
|
||||
auto maxCoeff() const { return parent::maxCoeff(); }
|
||||
|
||||
template<std::integral IndexType>
|
||||
auto minCoeff(IndexType* row, IndexType* col) const
|
||||
{
|
||||
Index r,c;
|
||||
auto result = parent::minCoeff(&r, &c);
|
||||
*row = r;
|
||||
*col = c;
|
||||
return result;
|
||||
}
|
||||
|
||||
template<std::integral IndexType>
|
||||
auto maxCoeff(IndexType* row, IndexType* col) const
|
||||
{
|
||||
Index r,c;
|
||||
auto result = parent::maxCoeff(&r, &c);
|
||||
*row = r;
|
||||
*col = c;
|
||||
return result;
|
||||
}
|
||||
|
||||
static auto Zero() requires( requires {Ref::Zero();} )
|
||||
{
|
||||
return Ref::Zero();
|
||||
|
|
|
|||
|
|
@ -175,6 +175,29 @@ namespace rotgen
|
|||
return *this;
|
||||
}
|
||||
|
||||
auto minCoeff() const { return parent::minCoeff(); }
|
||||
auto maxCoeff() const { return parent::maxCoeff(); }
|
||||
|
||||
template<std::integral IndexType>
|
||||
auto minCoeff(IndexType* row, IndexType* col) const
|
||||
{
|
||||
Index r,c;
|
||||
auto result = parent::minCoeff(&r, &c);
|
||||
*row = r;
|
||||
*col = c;
|
||||
return result;
|
||||
}
|
||||
|
||||
template<std::integral IndexType>
|
||||
auto maxCoeff(IndexType* row, IndexType* col) const
|
||||
{
|
||||
Index r,c;
|
||||
auto result = parent::maxCoeff(&r, &c);
|
||||
*row = r;
|
||||
*col = c;
|
||||
return result;
|
||||
}
|
||||
|
||||
static matrix Ones() requires (Rows != -1 && Cols != -1)
|
||||
{
|
||||
return parent::Ones(Rows, Cols);
|
||||
|
|
|
|||
|
|
@ -345,13 +345,35 @@ namespace rotgen
|
|||
using parent::prod;
|
||||
using parent::mean;
|
||||
using parent::trace;
|
||||
using parent::maxCoeff;
|
||||
using parent::minCoeff;
|
||||
using parent::squaredNorm;
|
||||
using parent::norm;
|
||||
using parent::sum;
|
||||
using parent::data;
|
||||
|
||||
|
||||
auto minCoeff() const { return parent::minCoeff(); }
|
||||
auto maxCoeff() const { return parent::maxCoeff(); }
|
||||
|
||||
template<std::integral IndexType>
|
||||
auto minCoeff(IndexType* row, IndexType* col) const
|
||||
{
|
||||
Index r,c;
|
||||
auto result = parent::minCoeff(&r, &c);
|
||||
*row = r;
|
||||
*col = c;
|
||||
return result;
|
||||
}
|
||||
|
||||
template<std::integral IndexType>
|
||||
auto maxCoeff(IndexType* row, IndexType* col) const
|
||||
{
|
||||
Index r,c;
|
||||
auto result = parent::maxCoeff(&r, &c);
|
||||
*row = r;
|
||||
*col = c;
|
||||
return result;
|
||||
}
|
||||
|
||||
Index startRow() const { return base().startRow(); }
|
||||
Index startCol() const { return base().startCol(); }
|
||||
|
||||
|
|
|
|||
|
|
@ -268,11 +268,33 @@ namespace rotgen
|
|||
using parent::mean;
|
||||
using parent::prod;
|
||||
using parent::trace;
|
||||
using parent::maxCoeff;
|
||||
using parent::minCoeff;
|
||||
using parent::norm;
|
||||
using parent::squaredNorm;
|
||||
|
||||
|
||||
auto minCoeff() const { return parent::minCoeff(); }
|
||||
auto maxCoeff() const { return parent::maxCoeff(); }
|
||||
|
||||
template<std::integral IndexType>
|
||||
auto minCoeff(IndexType* row, IndexType* col) const
|
||||
{
|
||||
Index r,c;
|
||||
auto result = parent::minCoeff(&r, &c);
|
||||
*row = r;
|
||||
*col = c;
|
||||
return result;
|
||||
}
|
||||
|
||||
template<std::integral IndexType>
|
||||
auto maxCoeff(IndexType* row, IndexType* col) const
|
||||
{
|
||||
Index r,c;
|
||||
auto result = parent::maxCoeff(&r, &c);
|
||||
*row = r;
|
||||
*col = c;
|
||||
return result;
|
||||
}
|
||||
|
||||
template<int P> value_type lpNorm() const
|
||||
{
|
||||
static_assert(P == 1 || P == 2 || P == Infinity);
|
||||
|
|
|
|||
|
|
@ -289,13 +289,35 @@ namespace rotgen
|
|||
using parent::prod;
|
||||
using parent::mean;
|
||||
using parent::trace;
|
||||
using parent::maxCoeff;
|
||||
using parent::minCoeff;
|
||||
using parent::squaredNorm;
|
||||
using parent::norm;
|
||||
using parent::sum;
|
||||
using parent::data;
|
||||
|
||||
|
||||
auto minCoeff() const { return parent::minCoeff(); }
|
||||
auto maxCoeff() const { return parent::maxCoeff(); }
|
||||
|
||||
template<std::integral IndexType>
|
||||
auto minCoeff(IndexType* row, IndexType* col) const
|
||||
{
|
||||
Index r,c;
|
||||
auto result = parent::minCoeff(&r, &c);
|
||||
*row = r;
|
||||
*col = c;
|
||||
return result;
|
||||
}
|
||||
|
||||
template<std::integral IndexType>
|
||||
auto maxCoeff(IndexType* row, IndexType* col) const
|
||||
{
|
||||
Index r,c;
|
||||
auto result = parent::maxCoeff(&r, &c);
|
||||
*row = r;
|
||||
*col = c;
|
||||
return result;
|
||||
}
|
||||
|
||||
matrix& setOnes()
|
||||
{
|
||||
*this = parent::Ones(rows(),cols());
|
||||
|
|
|
|||
|
|
@ -60,11 +60,15 @@ namespace rotgen
|
|||
}
|
||||
|
||||
auto minCoeff(concepts::entity auto const& arg) { return arg.minCoeff(); }
|
||||
auto maxCoeff(concepts::entity auto const& arg, Index* row, Index* col)
|
||||
|
||||
template<std::integral IndexType>
|
||||
auto maxCoeff(concepts::entity auto const& arg, IndexType* row, IndexType* col)
|
||||
{
|
||||
return arg.maxCoeff(row, col);
|
||||
}
|
||||
auto minCoeff(concepts::entity auto const& arg, Index* row, Index* col)
|
||||
|
||||
template<std::integral IndexType>
|
||||
auto minCoeff(concepts::entity auto const& arg, IndexType* row, IndexType* col)
|
||||
{
|
||||
return arg.minCoeff(row, col);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,8 +66,8 @@ class ROTGEN_EXPORT CLASSNAME
|
|||
TYPE trace() const;
|
||||
TYPE maxCoeff() const;
|
||||
TYPE minCoeff() const;
|
||||
TYPE maxCoeff(std::ptrdiff_t* row, std::ptrdiff_t* col) const;
|
||||
TYPE minCoeff(std::ptrdiff_t* row, std::ptrdiff_t* col) const;
|
||||
TYPE maxCoeff(Index* row, Index* col) const;
|
||||
TYPE minCoeff(Index* row, Index* col) const;
|
||||
|
||||
TYPE squaredNorm() const;
|
||||
TYPE norm() const;
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@ class ROTGEN_EXPORT CLASSNAME
|
|||
TYPE trace() const;
|
||||
TYPE maxCoeff() const;
|
||||
TYPE minCoeff() const;
|
||||
TYPE maxCoeff(std::ptrdiff_t* row, std::ptrdiff_t* col) const;
|
||||
TYPE minCoeff(std::ptrdiff_t* row, std::ptrdiff_t* col) const;
|
||||
TYPE maxCoeff(Index* row, Index* col) const;
|
||||
TYPE minCoeff(Index* row, Index* col) const;
|
||||
|
||||
TYPE squaredNorm() const;
|
||||
TYPE norm() const;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue