Eigen  3.4.90 (git rev 9589cc4e7fd8e4538bedef80dd36c7738977a8be)
 
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
Loading...
Searching...
No Matches
SparseFuzzy.h
1// This file is part of Eigen, a lightweight C++ template library
2// for linear algebra.
3//
4// Copyright (C) 2008-2014 Gael Guennebaud <gael.guennebaud@inria.fr>
5//
6// This Source Code Form is subject to the terms of the Mozilla
7// Public License v. 2.0. If a copy of the MPL was not distributed
8// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
10#ifndef EIGEN_SPARSE_FUZZY_H
11#define EIGEN_SPARSE_FUZZY_H
12
13// IWYU pragma: private
14#include "./InternalHeaderCheck.h"
15
16namespace Eigen {
17
18template <typename Derived>
19template <typename OtherDerived>
20bool SparseMatrixBase<Derived>::isApprox(const SparseMatrixBase<OtherDerived>& other, const RealScalar& prec) const {
21 const typename internal::nested_eval<Derived, 2, PlainObject>::type actualA(derived());
22 std::conditional_t<bool(IsRowMajor) == bool(OtherDerived::IsRowMajor),
23 const typename internal::nested_eval<OtherDerived, 2, PlainObject>::type, const PlainObject>
24 actualB(other.derived());
25
26 return (actualA - actualB).squaredNorm() <= prec * prec * numext::mini(actualA.squaredNorm(), actualB.squaredNorm());
27}
28
29} // end namespace Eigen
30
31#endif // EIGEN_SPARSE_FUZZY_H
Base class of any sparse matrices or sparse expressions.
Definition SparseMatrixBase.h:30
Namespace containing all symbols from the Eigen library.
Definition B01_Experimental.dox:1