|
|
|
|
@ -151,20 +151,12 @@ template<std::size_t size, class T> class Vector: public RectangularMatrix<1, si
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Multiply vector component-wise |
|
|
|
|
* |
|
|
|
|
* @see operator*=(const Vector<size, U>&) |
|
|
|
|
*/ |
|
|
|
|
template<class U> inline Vector<size, T> operator*(const Vector<size, U>& other) const { |
|
|
|
|
return Vector<size, T>(*this)*=other; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Multiply vector component-wise and assign |
|
|
|
|
* |
|
|
|
|
* More efficient than operator*(const Vector<size, U>&) const, |
|
|
|
|
* because it does the computation in-place. |
|
|
|
|
* The computation is done in-place. @f[ |
|
|
|
|
* \boldsymbol a_i = \boldsymbol a_i \boldsymbol b_i |
|
|
|
|
* @f] |
|
|
|
|
*/ |
|
|
|
|
template<class U> Vector<size, T>& operator*=(const Vector<size, U>& other) { |
|
|
|
|
for(std::size_t i = 0; i != size; ++i) |
|
|
|
|
@ -174,19 +166,20 @@ template<std::size_t size, class T> class Vector: public RectangularMatrix<1, si
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Divide vector component-wise |
|
|
|
|
* @brief Multiply vector component-wise |
|
|
|
|
* |
|
|
|
|
* @see operator/=(const Vector<size, U>&) |
|
|
|
|
* @see operator*=(const Vector<size, U>&) |
|
|
|
|
*/ |
|
|
|
|
template<class U> inline Vector<size, T> operator/(const Vector<size, U>& other) const { |
|
|
|
|
return Vector<size, T>(*this)/=other; |
|
|
|
|
template<class U> inline Vector<size, T> operator*(const Vector<size, U>& other) const { |
|
|
|
|
return Vector<size, T>(*this)*=other; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Divide vector component-wise and assign |
|
|
|
|
* |
|
|
|
|
* More efficient than operator/(const Vector<size, U>&) const, |
|
|
|
|
* because it does the computation in-place. |
|
|
|
|
* The computation is done in-place. @f[ |
|
|
|
|
* \boldsymbol a_i = \frac{\boldsymbol a_i}{\boldsymbol b_i} |
|
|
|
|
* @f] |
|
|
|
|
*/ |
|
|
|
|
template<class U> Vector<size, T>& operator/=(const Vector<size, U>& other) { |
|
|
|
|
for(std::size_t i = 0; i != size; ++i) |
|
|
|
|
@ -195,6 +188,15 @@ template<std::size_t size, class T> class Vector: public RectangularMatrix<1, si
|
|
|
|
|
return *this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Divide vector component-wise |
|
|
|
|
* |
|
|
|
|
* @see operator/=(const Vector<size, U>&) |
|
|
|
|
*/ |
|
|
|
|
template<class U> inline Vector<size, T> operator/(const Vector<size, U>& other) const { |
|
|
|
|
return Vector<size, T>(*this)/=other; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Dot product of the vector |
|
|
|
|
* |
|
|
|
|
|