35 lines
1.5 KiB
C++
35 lines
1.5 KiB
C++
//==================================================================================================
|
|
/*
|
|
ROTGEN - Runtime Overlay for Eigen
|
|
Copyright : CODE RECKONS
|
|
SPDX-License-Identifier: BSL-1.0
|
|
*/
|
|
//==================================================================================================
|
|
#include <rotgen/rotgen.hpp>
|
|
#include <Eigen/Dense>
|
|
#include <vector>
|
|
#include <tuple>
|
|
|
|
namespace rotgen::tests
|
|
{
|
|
template<typename T>
|
|
void check_norms_functions(const T& input)
|
|
{
|
|
using EigenMatrix = Eigen::Matrix<typename T::value_type, Eigen::Dynamic, Eigen::Dynamic>;
|
|
|
|
EigenMatrix ref(input.rows(), input.cols());
|
|
prepare([&](auto r, auto c) { return input(r,c); }, ref);
|
|
|
|
TTS_EQUAL(input.norm() , ref.norm());
|
|
TTS_EQUAL(input.squaredNorm() , ref.squaredNorm());
|
|
TTS_EQUAL(input.template lpNorm<1>() , ref.template lpNorm<1>());
|
|
TTS_EQUAL(input.template lpNorm<2>() , ref.template lpNorm<2>());
|
|
TTS_EQUAL(input.template lpNorm<rotgen::Infinity>() , ref.template lpNorm<Eigen::Infinity>());
|
|
|
|
TTS_EQUAL(norm(input) , ref.norm());
|
|
TTS_EQUAL(squaredNorm(input) , ref.squaredNorm());
|
|
TTS_EQUAL(lpNorm<1>(input) , ref.template lpNorm<1>());
|
|
TTS_EQUAL(lpNorm<2>(input) , ref.template lpNorm<2>());
|
|
TTS_EQUAL(lpNorm<rotgen::Infinity>(input) , ref.template lpNorm<Eigen::Infinity>());
|
|
}
|
|
}
|