![]() |
Eigen
3.3.3
|
00001 // This file is part of Eigen, a lightweight C++ template library 00002 // for linear algebra. 00003 // 00004 // Copyright (C) 2008-2014 Gael Guennebaud <gael.guennebaud@inria.fr> 00005 // 00006 // This Source Code Form is subject to the terms of the Mozilla 00007 // Public License v. 2.0. If a copy of the MPL was not distributed 00008 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 00009 00010 #ifndef EIGEN_SPARSE_FUZZY_H 00011 #define EIGEN_SPARSE_FUZZY_H 00012 00013 namespace Eigen { 00014 00015 template<typename Derived> 00016 template<typename OtherDerived> 00017 bool SparseMatrixBase<Derived>::isApprox(const SparseMatrixBase<OtherDerived>& other, const RealScalar &prec) const 00018 { 00019 const typename internal::nested_eval<Derived,2,PlainObject>::type actualA(derived()); 00020 typename internal::conditional<bool(IsRowMajor)==bool(OtherDerived::IsRowMajor), 00021 const typename internal::nested_eval<OtherDerived,2,PlainObject>::type, 00022 const PlainObject>::type actualB(other.derived()); 00023 00024 return (actualA - actualB).squaredNorm() <= prec * prec * numext::mini(actualA.squaredNorm(), actualB.squaredNorm()); 00025 } 00026 00027 } // end namespace Eigen 00028 00029 #endif // EIGEN_SPARSE_FUZZY_H