Commit c209f795 authored by Pavel Rojtberg's avatar Pavel Rojtberg

support for NORM_L2SQR in norm(Matx<..>)

parent b4112a58
...@@ -840,9 +840,17 @@ double norm(const Matx<_Tp, m, n>& M) ...@@ -840,9 +840,17 @@ double norm(const Matx<_Tp, m, n>& M)
template<typename _Tp, int m, int n> static inline template<typename _Tp, int m, int n> static inline
double norm(const Matx<_Tp, m, n>& M, int normType) double norm(const Matx<_Tp, m, n>& M, int normType)
{ {
return normType == NORM_INF ? (double)normInf<_Tp, typename DataType<_Tp>::work_type>(M.val, m*n) : switch(normType) {
normType == NORM_L1 ? (double)normL1<_Tp, typename DataType<_Tp>::work_type>(M.val, m*n) : case NORM_INF:
std::sqrt((double)normL2Sqr<_Tp, typename DataType<_Tp>::work_type>(M.val, m*n)); return (double)normInf<_Tp, typename DataType<_Tp>::work_type>(M.val, m*n);
case NORM_L1:
return (double)normL1<_Tp, typename DataType<_Tp>::work_type>(M.val, m*n);
case NORM_L2SQR:
return (double)normL2Sqr<_Tp, typename DataType<_Tp>::work_type>(M.val, m*n);
default:
case NORM_L2:
return std::sqrt((double)normL2Sqr<_Tp, typename DataType<_Tp>::work_type>(M.val, m*n));
}
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment