mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 07:33:33 +08:00
Add operator* and operator/ for slice with type
This commit is contained in:
committed by
Mathieu Bresciani
parent
38b3acce96
commit
674bd99f3b
@@ -184,6 +184,24 @@ public:
|
||||
return operator*=(Type(1) / other);
|
||||
}
|
||||
|
||||
Matrix<Type, P, Q> operator*(const Type& other)
|
||||
{
|
||||
Slice<Type, P, Q, M, N>& self = *this;
|
||||
Matrix<Type, P, Q> res;
|
||||
for (size_t i = 0; i < P; i++) {
|
||||
for (size_t j = 0; j < Q; j++) {
|
||||
res(i, j) = self(i, j) * other;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
Matrix<Type, P, Q> operator/(const Type& other)
|
||||
{
|
||||
Slice<Type, P, Q, M, N>& self = *this;
|
||||
return self * (Type(1) / other);
|
||||
}
|
||||
|
||||
template<size_t R, size_t S>
|
||||
const Slice<Type, R, S, M, N> slice(size_t x0, size_t y0) const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user