SelfCwiseBinaryOp.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2009-2010 Gael Guennebaud <gael.guennebaud@inria.fr>
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_SELFCWISEBINARYOP_H
11 #define EIGEN_SELFCWISEBINARYOP_H
12 
13 #include "./InternalHeaderCheck.h"
14 
15 namespace Eigen {
16 
17 // TODO generalize the scalar type of 'other'
18 
19 template<typename Derived>
20 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator*=(const Scalar& other)
21 {
22  internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::mul_assign_op<Scalar,Scalar>());
23  return derived();
24 }
25 
26 template<typename Derived>
27 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& ArrayBase<Derived>::operator+=(const Scalar& other)
28 {
29  internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::add_assign_op<Scalar,Scalar>());
30  return derived();
31 }
32 
33 template<typename Derived>
34 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& ArrayBase<Derived>::operator-=(const Scalar& other)
35 {
36  internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::sub_assign_op<Scalar,Scalar>());
37  return derived();
38 }
39 
40 template<typename Derived>
41 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator/=(const Scalar& other)
42 {
43  internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::div_assign_op<Scalar,Scalar>());
44  return derived();
45 }
46 
47 } // end namespace Eigen
48 
49 #endif // EIGEN_SELFCWISEBINARYOP_H
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:883
Derived & operator-=(const Scalar &scalar)
Derived & operator+=(const Scalar &scalar)
Derived & operator*=(const Scalar &other)
internal::traits< Derived >::Scalar Scalar
Definition: DenseBase.h:61
Derived & operator/=(const Scalar &other)
void call_assignment(Dst &dst, const Src &src)
: InteropHeaders
Definition: Core:139