From 2ea8eed9807a4a168a6323e36a647b30f80a5631 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=8B=D1=87=D0=BA=D0=BE=D0=B2=20=D0=90=D0=BD=D0=B4?= =?UTF-8?q?=D1=80=D0=B5=D0=B9?= Date: Wed, 6 Mar 2019 09:06:37 +0000 Subject: [PATCH] git-svn-id: svn://db.shs.com.ru/pip@768 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5 --- src_main/math/pimathmatrix.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src_main/math/pimathmatrix.h b/src_main/math/pimathmatrix.h index 09e6905c..43dab5d1 100644 --- a/src_main/math/pimathmatrix.h +++ b/src_main/math/pimathmatrix.h @@ -536,6 +536,23 @@ inline PIMathVector operator *(const PIMathMatrix & fm, return tv; } + +/// Multiply vector {Rows} on matrix {Rows x Cols}, result is vector {Cols} +template +inline PIMathVector operator *(const PIMathVector & sv, + const PIMathMatrix & fm) { + uint c = fm.cols(), r = fm.rows(); + PIMathVector tv(c); + Type t; + for (uint j = 0; j < c; ++j) { + t = Type(0); + for (uint i = 0; i < r; ++i) + t += fm.element(i, j) * sv[i]; + tv[j] = t; + } + return tv; +} + /// Multiply value(T) on matrix {Rows x Cols}, result is vector {Rows} template inline PIMathMatrix operator *(const Type & x, const PIMathMatrix & v) {