added Vec Matx::solve(Vec) (ticket #1376)

This commit is contained in:
Vadim Pisarevsky
2012-03-28 15:21:30 +00:00
parent c9efcf8d1f
commit 56f5fcd28c
4 changed files with 23 additions and 17 deletions

View File

@@ -502,7 +502,7 @@ public:
//! solve linear system
template<int l> Matx<_Tp, n, l> solve(const Matx<_Tp, m, l>& rhs, int flags=DECOMP_LU) const;
Matx<_Tp, n, 1> solve(const Matx<_Tp, m, 1>& rhs, int method) const;
Vec<_Tp, n> solve(const Vec<_Tp, m>& rhs, int method) const;
//! multiply two matrices element-wise
Matx<_Tp, m, n> mul(const Matx<_Tp, m, n>& a) const;

View File

@@ -903,6 +903,12 @@ Matx<_Tp, n, l> Matx<_Tp, m, n>::solve(const Matx<_Tp, m, l>& rhs, int method) c
return ok ? x : Matx<_Tp, n, l>::zeros();
}
template<typename _Tp, int m, int n> inline
Vec<_Tp, n> Matx<_Tp, m, n>::solve(const Vec<_Tp, m>& rhs, int method) const
{
Matx<_Tp, n, 1> x = solve(reinterpret_cast<const Matx<_Tp, m, 1>&>(rhs), method);
return reinterpret_cast<Vec<_Tp, n>&>(x);
}
template<typename _Tp, typename _AccTp> static inline
_AccTp normL2Sqr(const _Tp* a, int n)