parent
e7cf89a903
commit
3e2e6f253c
14 changed files with 169 additions and 65 deletions
|
|
@ -18,6 +18,7 @@ namespace rotgen::tests
|
|||
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());
|
||||
|
|
@ -26,10 +27,28 @@ namespace rotgen::tests
|
|||
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(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>());
|
||||
|
||||
if constexpr(T::IsVectorAtCompileTime)
|
||||
{
|
||||
EigenMatrix e_norm = ref.normalized();
|
||||
using mat_t = rotgen::matrix<typename T::value_type,rotgen::Dynamic,rotgen::Dynamic,T::storage_order>;
|
||||
mat_t norm_ref(input.rows(), input.cols());
|
||||
prepare([&](auto r, auto c) { return e_norm(r,c); }, norm_ref);
|
||||
|
||||
TTS_EQUAL(input.normalized(), norm_ref);
|
||||
TTS_EQUAL(normalized(input), norm_ref);
|
||||
auto m_norm = input;
|
||||
m_norm.normalize();
|
||||
TTS_EQUAL(m_norm, norm_ref);
|
||||
|
||||
auto f_norm = input;
|
||||
normalize(f_norm);
|
||||
TTS_EQUAL(f_norm, norm_ref);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue