git-svn-id: svn://db.shs.com.ru/pip@768 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2019-03-06 09:06:37 +00:00
parent a2cd119e32
commit 2ea8eed980

View File

@@ -536,6 +536,23 @@ inline PIMathVector<Type> operator *(const PIMathMatrix<Type> & fm,
return tv; return tv;
} }
/// Multiply vector {Rows} on matrix {Rows x Cols}, result is vector {Cols}
template<typename Type>
inline PIMathVector<Type> operator *(const PIMathVector<Type> & sv,
const PIMathMatrix<Type> & fm) {
uint c = fm.cols(), r = fm.rows();
PIMathVector<Type> 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} /// Multiply value(T) on matrix {Rows x Cols}, result is vector {Rows}
template<typename Type> template<typename Type>
inline PIMathMatrix<Type> operator *(const Type & x, const PIMathMatrix<Type> & v) { inline PIMathMatrix<Type> operator *(const Type & x, const PIMathMatrix<Type> & v) {