mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-04 18:54:00 +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!= */
|
* \sa isApprox(), operator!= */
|
||||||
template <typename OtherDerived>
|
template <typename OtherDerived>
|
||||||
EIGEN_DEVICE_FUNC inline bool operator==(const MatrixBase<OtherDerived>& other) const {
|
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.
|
/** \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== */
|
* \sa isApprox(), operator== */
|
||||||
template <typename OtherDerived>
|
template <typename OtherDerived>
|
||||||
EIGEN_DEVICE_FUNC inline bool operator!=(const MatrixBase<OtherDerived>& other) const {
|
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();
|
NoAlias<Derived, Eigen::MatrixBase> EIGEN_DEVICE_FUNC noalias();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user