Eigen  5.0.1
 
Loading...
Searching...
No Matches
SelfCwiseBinaryOp.h
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// SPDX-License-Identifier: MPL-2.0
10
11#ifndef EIGEN_SELFCWISEBINARYOP_H
12#define EIGEN_SELFCWISEBINARYOP_H
13
14// IWYU pragma: private
15#include "./InternalHeaderCheck.h"
16
17namespace Eigen {
18
19template <typename Derived>
20EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator*=(const Scalar& other) {
21 using ConstantExpr = typename internal::plain_constant_type<Derived, Scalar>::type;
22 using Op = internal::mul_assign_op<Scalar>;
23 internal::call_assignment(derived(), ConstantExpr(rows(), cols(), other), Op());
24 return derived();
25}
26
27template <typename Derived>
28template <bool Enable, typename>
29EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator*=(const RealScalar& other) {
30 realView() *= other;
31 return derived();
32}
33
34template <typename Derived>
35EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator/=(const Scalar& other) {
36 using ConstantExpr = typename internal::plain_constant_type<Derived, Scalar>::type;
37 using Op = internal::div_assign_op<Scalar>;
38 internal::call_assignment(derived(), ConstantExpr(rows(), cols(), other), Op());
39 return derived();
40}
41
42template <typename Derived>
43template <bool Enable, typename>
44EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator/=(const RealScalar& other) {
45 realView() /= other;
46 return derived();
47}
48
49} // end namespace Eigen
50
51#endif // EIGEN_SELFCWISEBINARYOP_H