1// This file is part of Eigen, a lightweight C++ template library 2// for linear algebra. 3// 4// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr> 5// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com> 6// 7// This Source Code Form is subject to the terms of the Mozilla 8// Public License v. 2.0. If a copy of the MPL was not distributed 9// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 11// This file is a base class plugin containing common coefficient wise functions. 12 13/** \returns an expression of the difference of \c *this and \a other 14 * 15 * \note If you want to substract a given scalar from all coefficients, see Cwise::operator-(). 16 * 17 * \sa class CwiseBinaryOp, operator-=() 18 */ 19EIGEN_MAKE_CWISE_BINARY_OP(operator-,internal::scalar_difference_op) 20 21/** \returns an expression of the sum of \c *this and \a other 22 * 23 * \note If you want to add a given scalar to all coefficients, see Cwise::operator+(). 24 * 25 * \sa class CwiseBinaryOp, operator+=() 26 */ 27EIGEN_MAKE_CWISE_BINARY_OP(operator+,internal::scalar_sum_op) 28 29/** \returns an expression of a custom coefficient-wise operator \a func of *this and \a other 30 * 31 * The template parameter \a CustomBinaryOp is the type of the functor 32 * of the custom operator (see class CwiseBinaryOp for an example) 33 * 34 * Here is an example illustrating the use of custom functors: 35 * \include class_CwiseBinaryOp.cpp 36 * Output: \verbinclude class_CwiseBinaryOp.out 37 * 38 * \sa class CwiseBinaryOp, operator+(), operator-(), cwiseProduct() 39 */ 40template<typename CustomBinaryOp, typename OtherDerived> 41EIGEN_STRONG_INLINE const CwiseBinaryOp<CustomBinaryOp, const Derived, const OtherDerived> 42binaryExpr(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other, const CustomBinaryOp& func = CustomBinaryOp()) const 43{ 44 return CwiseBinaryOp<CustomBinaryOp, const Derived, const OtherDerived>(derived(), other.derived(), func); 45} 46 47