96 lines
3.6 KiB
C++
96 lines
3.6 KiB
C++
//==================================================================================================
|
|
/*
|
|
ROTGEN - Runtime Overlay for Eigen
|
|
Copyright : CODE RECKONS
|
|
SPDX-License-Identifier: BSL-1.0
|
|
*/
|
|
//==================================================================================================
|
|
#pragma once
|
|
|
|
namespace rotgen
|
|
{
|
|
std::size_t rows(concepts::entity auto const& arg) { return arg.rows(); }
|
|
std::size_t cols(concepts::entity auto const& arg) { return arg.cols(); }
|
|
std::size_t size(concepts::entity auto const& arg) { return arg.size(); }
|
|
|
|
template<concepts::entity E>
|
|
void resize(E& arg, int new_rows, int new_cols)
|
|
requires(E::RowsAtCompileTime == -1 && E::ColsAtCompileTime == -1)
|
|
{
|
|
arg.resize(new_rows, new_cols);
|
|
}
|
|
|
|
template<concepts::entity E>
|
|
void conservativeResize(E& arg, int new_rows, int new_cols)
|
|
requires(E::RowsAtCompileTime == -1 && E::ColsAtCompileTime == -1)
|
|
{
|
|
arg.conservativeResize(new_rows, new_cols);
|
|
}
|
|
|
|
decltype(auto) transpose(concepts::entity auto const& arg) { return arg.transpose(); }
|
|
decltype(auto) conjugate(concepts::entity auto const& arg) { return arg.conjugate(); }
|
|
decltype(auto) adjoint (concepts::entity auto const& arg) { return arg.adjoint(); }
|
|
|
|
void transposeInPlace(concepts::entity auto& arg) { arg.transposeInPlace(); }
|
|
void adjointInPlace(concepts::entity auto& arg) { arg.adjointInPlace(); }
|
|
|
|
auto abs(concepts::entity auto const& arg) { return arg.cwiseAbs(); }
|
|
auto abs2(concepts::entity auto const& arg) { return arg.cwiseAbs2(); }
|
|
auto rec(concepts::entity auto const& arg) { return arg.cwiseInverse(); }
|
|
auto sqrt(concepts::entity auto const& arg) { return arg.cwiseSqrt(); }
|
|
|
|
#if defined(ROTGEN_ENABLE_EXPRESSION_TEMPLATES)
|
|
decltype(auto) abs(concepts::eigen_compatible auto const& arg) { return arg.cwiseAbs(); }
|
|
decltype(auto) abs2(concepts::eigen_compatible auto const& arg) { return arg.cwiseAbs2(); }
|
|
decltype(auto) rec(concepts::eigen_compatible auto const& arg) { return arg.cwiseInverse(); }
|
|
decltype(auto) sqrt(concepts::eigen_compatible auto const& arg) { return arg.cwiseSqrt(); }
|
|
#endif
|
|
|
|
auto trace(concepts::entity auto const& arg) { return arg.trace(); }
|
|
auto squaredNorm(concepts::entity auto const& arg) { return arg.squaredNorm(); }
|
|
auto norm(concepts::entity auto const& arg) { return arg.norm(); }
|
|
auto sum(concepts::entity auto const& arg) { return arg.sum(); }
|
|
auto prod(concepts::entity auto const& arg) { return arg.prod(); }
|
|
auto mean(concepts::entity auto const& arg) { return arg.mean(); }
|
|
|
|
auto maxCoeff(auto const& arg)
|
|
requires( requires{ arg.maxCoeff(); } )
|
|
{
|
|
return arg.maxCoeff();
|
|
}
|
|
|
|
auto minCoeff(concepts::entity auto const& arg) { return arg.minCoeff(); }
|
|
auto maxCoeff(concepts::entity auto const& arg, Index* row, Index* col)
|
|
{
|
|
return arg.maxCoeff(row, col);
|
|
}
|
|
auto minCoeff(concepts::entity auto const& arg, Index* row, Index* col)
|
|
{
|
|
return arg.minCoeff(row, col);
|
|
}
|
|
|
|
template<int P>
|
|
auto lpNorm(concepts::entity auto const& arg)
|
|
{
|
|
static_assert(P == 1 || P == 2 || P == Infinity);
|
|
return arg.template lpNorm<P>();
|
|
}
|
|
|
|
template<typename T>
|
|
decltype(auto) noalias(T&& t) requires( requires{std::forward<T>(t).noalias();} )
|
|
{
|
|
return std::forward<T>(t).noalias();
|
|
}
|
|
|
|
template<typename T>
|
|
auto evaluate(T&& t) requires( requires{std::forward<T>(t).evaluate();} )
|
|
{
|
|
return std::forward<T>(t).evaluate();
|
|
}
|
|
|
|
template<typename T>
|
|
auto evaluate(T&& t) requires( requires{std::forward<T>(t).eval();} )
|
|
{
|
|
return std::forward<T>(t).eval();
|
|
}
|
|
}
|