Eigne Matrix Class Library

Dependents:   Eigen_test Odometry_test AttitudeEstimation_usingTicker MPU9250_Quaternion_Binary_Serial ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers CommonCwiseBinaryOps.h Source File

CommonCwiseBinaryOps.h

00001 // This file is part of Eigen, a lightweight C++ template library
00002 // for linear algebra.
00003 //
00004 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>
00005 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
00006 //
00007 // This Source Code Form is subject to the terms of the Mozilla
00008 // Public License v. 2.0. If a copy of the MPL was not distributed
00009 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
00010 
00011 // This file is a base class plugin containing common coefficient wise functions.
00012 
00013 /** \returns an expression of the difference of \c *this and \a other
00014   *
00015   * \note If you want to substract a given scalar from all coefficients, see Cwise::operator-().
00016   *
00017   * \sa class CwiseBinaryOp, operator-=()
00018   */
00019 EIGEN_MAKE_CWISE_BINARY_OP(operator-,internal::scalar_difference_op)
00020 
00021 /** \returns an expression of the sum of \c *this and \a other
00022   *
00023   * \note If you want to add a given scalar to all coefficients, see Cwise::operator+().
00024   *
00025   * \sa class CwiseBinaryOp, operator+=()
00026   */
00027 EIGEN_MAKE_CWISE_BINARY_OP(operator+,internal::scalar_sum_op)
00028 
00029 /** \returns an expression of a custom coefficient-wise operator \a func of *this and \a other
00030   *
00031   * The template parameter \a CustomBinaryOp is the type of the functor
00032   * of the custom operator (see class CwiseBinaryOp for an example)
00033   *
00034   * Here is an example illustrating the use of custom functors:
00035   * \include class_CwiseBinaryOp.cpp
00036   * Output: \verbinclude class_CwiseBinaryOp.out
00037   *
00038   * \sa class CwiseBinaryOp, operator+(), operator-(), cwiseProduct()
00039   */
00040 template<typename CustomBinaryOp, typename OtherDerived>
00041 EIGEN_STRONG_INLINE const CwiseBinaryOp<CustomBinaryOp, const Derived, const OtherDerived>
00042 binaryExpr(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other, const CustomBinaryOp& func = CustomBinaryOp()) const
00043 {
00044   return CwiseBinaryOp<CustomBinaryOp, const Derived, const OtherDerived>(derived(), other.derived(), func);
00045 }