mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-23 18:19:34 +08:00
matrix equality operator
This commit is contained in:
parent
00776d1ba4
commit
4a9e32ae0b
@ -280,7 +280,7 @@ class MatrixBase : public DenseBase<Derived> {
|
||||
* \sa isApprox(), operator!= */
|
||||
template <typename OtherDerived>
|
||||
EIGEN_DEVICE_FUNC inline bool operator==(const MatrixBase<OtherDerived>& other) const {
|
||||
return cwiseEqual(other).all();
|
||||
return (this->rows() == other.rows()) && (this->cols() == other.cols()) && cwiseEqual(other).all();
|
||||
}
|
||||
|
||||
/** \returns true if at least one pair of coefficients of \c *this and \a other are not exactly equal to each other.
|
||||
@ -289,7 +289,7 @@ class MatrixBase : public DenseBase<Derived> {
|
||||
* \sa isApprox(), operator== */
|
||||
template <typename OtherDerived>
|
||||
EIGEN_DEVICE_FUNC inline bool operator!=(const MatrixBase<OtherDerived>& other) const {
|
||||
return cwiseNotEqual(other).any();
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
NoAlias<Derived, Eigen::MatrixBase> EIGEN_DEVICE_FUNC noalias();
|
||||
|
Loading…
x
Reference in New Issue
Block a user