Eigen  5.0.1-dev+60122df6
 
Loading...
Searching...
No Matches
Select.h
1// This file is part of Eigen, a lightweight C++ template library
2// for linear algebra.
3//
4// Copyright (C) 2008-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_SELECT_H
11#define EIGEN_SELECT_H
12
13// IWYU pragma: private
14#include "./InternalHeaderCheck.h"
15
16namespace Eigen {
17
32template <typename ConditionMatrixType, typename ThenMatrixType, typename ElseMatrixType>
36 ThenMatrixType, ElseMatrixType, ConditionMatrixType>;
37
46template <typename Derived>
47template <typename ThenDerived, typename ElseDerived>
48inline EIGEN_DEVICE_FUNC CwiseTernaryOp<
49 internal::scalar_boolean_select_op<typename DenseBase<ThenDerived>::Scalar, typename DenseBase<ElseDerived>::Scalar,
51 ThenDerived, ElseDerived, Derived>
52DenseBase<Derived>::select(const DenseBase<ThenDerived>& thenMatrix, const DenseBase<ElseDerived>& elseMatrix) const {
53 return Select<Derived, ThenDerived, ElseDerived>(thenMatrix.derived(), elseMatrix.derived(), derived());
54}
55
60template <typename Derived>
61template <typename ThenDerived>
62inline EIGEN_DEVICE_FUNC CwiseTernaryOp<
63 internal::scalar_boolean_select_op<typename DenseBase<ThenDerived>::Scalar, typename DenseBase<ThenDerived>::Scalar,
65 ThenDerived, typename DenseBase<ThenDerived>::ConstantReturnType, Derived>
66DenseBase<Derived>::select(const DenseBase<ThenDerived>& thenMatrix,
67 const typename DenseBase<ThenDerived>::Scalar& elseScalar) const {
68 using ElseConstantType = typename DenseBase<ThenDerived>::ConstantReturnType;
69 return Select<Derived, ThenDerived, ElseConstantType>(thenMatrix.derived(),
70 ElseConstantType(rows(), cols(), elseScalar), derived());
71}
72
77template <typename Derived>
78template <typename ElseDerived>
79inline EIGEN_DEVICE_FUNC CwiseTernaryOp<
80 internal::scalar_boolean_select_op<typename DenseBase<ElseDerived>::Scalar, typename DenseBase<ElseDerived>::Scalar,
82 typename DenseBase<ElseDerived>::ConstantReturnType, ElseDerived, Derived>
83DenseBase<Derived>::select(const typename DenseBase<ElseDerived>::Scalar& thenScalar,
84 const DenseBase<ElseDerived>& elseMatrix) const {
85 using ThenConstantType = typename DenseBase<ElseDerived>::ConstantReturnType;
86 return Select<Derived, ThenConstantType, ElseDerived>(ThenConstantType(rows(), cols(), thenScalar),
87 elseMatrix.derived(), derived());
88}
89
90} // end namespace Eigen
91
92#endif // EIGEN_SELECT_H
Generic expression where a coefficient-wise ternary operator is applied to two expressions.
Definition CwiseTernaryOp.h:86
Base class for all dense matrices, vectors, and arrays.
Definition DenseBase.h:44
internal::traits< Derived >::Scalar Scalar
Definition DenseBase.h:62
CwiseTernaryOp< internal::scalar_boolean_select_op< typename DenseBase< ThenMatrixType >::Scalar, typename DenseBase< ElseMatrixType >::Scalar, typename DenseBase< ConditionMatrixType >::Scalar >, ThenMatrixType, ElseMatrixType, ConditionMatrixType > Select
Expression of a coefficient wise version of the C++ ternary operator ?:
Definition Select.h:33
Namespace containing all symbols from the Eigen library.
Definition B01_Experimental.dox:1