1c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath// This file is part of Eigen, a lightweight C++ template library
2c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath// for linear algebra.
3c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath//
4c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
5c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath//
6c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath// This Source Code Form is subject to the terms of the Mozilla
7c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath// Public License v. 2.0. If a copy of the MPL was not distributed
8c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
10c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#ifndef EIGEN_SPARSE_FUZZY_H
11c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#define EIGEN_SPARSE_FUZZY_H
12c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
13c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath// template<typename Derived>
14c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath// template<typename OtherDerived>
15c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath// bool SparseMatrixBase<Derived>::isApprox(
16c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath//   const OtherDerived& other,
17c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath//   typename NumTraits<Scalar>::Real prec
18c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath// ) const
19c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath// {
20c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath//   const typename internal::nested<Derived,2>::type nested(derived());
21c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath//   const typename internal::nested<OtherDerived,2>::type otherNested(other.derived());
22c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath//   return    (nested - otherNested).cwise().abs2().sum()
23c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath//          <= prec * prec * (std::min)(nested.cwise().abs2().sum(), otherNested.cwise().abs2().sum());
24c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath// }
25c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
26c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#endif // EIGEN_SPARSE_FUZZY_H
27