![]() |
Eigen
3.3.3
|
00001 // This file is part of Eigen, a lightweight C++ template library 00002 // for linear algebra. 00003 // 00004 // Copyright (C) 2009-2010 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_SELFCWISEBINARYOP_H 00011 #define EIGEN_SELFCWISEBINARYOP_H 00012 00013 namespace Eigen { 00014 00015 // TODO generalize the scalar type of 'other' 00016 00017 template<typename Derived> 00018 EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator*=(const Scalar& other) 00019 { 00020 typedef typename Derived::PlainObject PlainObject; 00021 internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::mul_assign_op<Scalar,Scalar>()); 00022 return derived(); 00023 } 00024 00025 template<typename Derived> 00026 EIGEN_STRONG_INLINE Derived& ArrayBase<Derived>::operator+=(const Scalar& other) 00027 { 00028 typedef typename Derived::PlainObject PlainObject; 00029 internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::add_assign_op<Scalar,Scalar>()); 00030 return derived(); 00031 } 00032 00033 template<typename Derived> 00034 EIGEN_STRONG_INLINE Derived& ArrayBase<Derived>::operator-=(const Scalar& other) 00035 { 00036 typedef typename Derived::PlainObject PlainObject; 00037 internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::sub_assign_op<Scalar,Scalar>()); 00038 return derived(); 00039 } 00040 00041 template<typename Derived> 00042 EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator/=(const Scalar& other) 00043 { 00044 typedef typename Derived::PlainObject PlainObject; 00045 internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::div_assign_op<Scalar,Scalar>()); 00046 return derived(); 00047 } 00048 00049 } // end namespace Eigen 00050 00051 #endif // EIGEN_SELFCWISEBINARYOP_H