Home | History | Annotate | Download | only in Eigen2Support
      1 // This file is part of Eigen, a lightweight C++ template library
      2 // for linear algebra.
      3 //
      4 // Copyright (C) 2008 Benoit Jacob <jacob.benoit.1 (at) gmail.com>
      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_LAZY_H
     11 #define EIGEN_LAZY_H
     12 
     13 namespace Eigen {
     14 
     15 /** \deprecated it is only used by lazy() which is deprecated
     16   *
     17   * \returns an expression of *this with added flags
     18   *
     19   * Example: \include MatrixBase_marked.cpp
     20   * Output: \verbinclude MatrixBase_marked.out
     21   *
     22   * \sa class Flagged, extract(), part()
     23   */
     24 template<typename Derived>
     25 template<unsigned int Added>
     26 inline const Flagged<Derived, Added, 0>
     27 MatrixBase<Derived>::marked() const
     28 {
     29   return derived();
     30 }
     31 
     32 /** \deprecated use MatrixBase::noalias()
     33   *
     34   * \returns an expression of *this with the EvalBeforeAssigningBit flag removed.
     35   *
     36   * Example: \include MatrixBase_lazy.cpp
     37   * Output: \verbinclude MatrixBase_lazy.out
     38   *
     39   * \sa class Flagged, marked()
     40   */
     41 template<typename Derived>
     42 inline const Flagged<Derived, 0, EvalBeforeAssigningBit>
     43 MatrixBase<Derived>::lazy() const
     44 {
     45   return derived();
     46 }
     47 
     48 
     49 /** \internal
     50   * Overloaded to perform an efficient C += (A*B).lazy() */
     51 template<typename Derived>
     52 template<typename ProductDerived, typename Lhs, typename Rhs>
     53 Derived& MatrixBase<Derived>::operator+=(const Flagged<ProductBase<ProductDerived, Lhs,Rhs>, 0,
     54                                                        EvalBeforeAssigningBit>& other)
     55 {
     56   other._expression().derived().addTo(derived()); return derived();
     57 }
     58 
     59 /** \internal
     60   * Overloaded to perform an efficient C -= (A*B).lazy() */
     61 template<typename Derived>
     62 template<typename ProductDerived, typename Lhs, typename Rhs>
     63 Derived& MatrixBase<Derived>::operator-=(const Flagged<ProductBase<ProductDerived, Lhs,Rhs>, 0,
     64                                                        EvalBeforeAssigningBit>& other)
     65 {
     66   other._expression().derived().subTo(derived()); return derived();
     67 }
     68 
     69 } // end namespace Eigen
     70 
     71 #endif // EIGEN_LAZY_H
     72