// This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2014 Gael Guennebaud <gael.guennebaud@inria.fr> // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com> // Copyright (C) 2016 Eugene Brevdo <ebrevdo@gmail.com> // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
namespace internal { template <typename TernaryOp, typename Arg1, typename Arg2, typename Arg3> struct traits<CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3> > { // we must not inherit from traits<Arg1> since it has // the potential to cause problems with MSVC typedeftypename remove_all<Arg1>::type Ancestor; typedeftypename traits<Ancestor>::XprKind XprKind; enum {
RowsAtCompileTime = traits<Ancestor>::RowsAtCompileTime,
ColsAtCompileTime = traits<Ancestor>::ColsAtCompileTime,
MaxRowsAtCompileTime = traits<Ancestor>::MaxRowsAtCompileTime,
MaxColsAtCompileTime = traits<Ancestor>::MaxColsAtCompileTime
};
// even though we require Arg1, Arg2, and Arg3 to have the same scalar type // (see CwiseTernaryOp constructor), // we still want to handle the case when the result type is different. typedeftypename result_of<TernaryOp( consttypename Arg1::Scalar&, consttypename Arg2::Scalar&, consttypename Arg3::Scalar&)>::type Scalar;
/** \class CwiseTernaryOp * \ingroup Core_Module * * \brief Generic expression where a coefficient-wise ternary operator is * applied to two expressions * * \tparam TernaryOp template functor implementing the operator * \tparam Arg1Type the type of the first argument * \tparam Arg2Type the type of the second argument * \tparam Arg3Type the type of the third argument * * This class represents an expression where a coefficient-wise ternary * operator is applied to three expressions. * It is the return type of ternary operators, by which we mean only those * ternary operators where * all three arguments are Eigen expressions. * For example, the return type of betainc(matrix1, matrix2, matrix3) is a * CwiseTernaryOp. * * Most of the time, this is the only way that it is used, so you typically * don't have to name * CwiseTernaryOp types explicitly. * * \sa MatrixBase::ternaryExpr(const MatrixBase<Argument2> &, const * MatrixBase<Argument3> &, const CustomTernaryOp &) const, class CwiseBinaryOp, * class CwiseUnaryOp, class CwiseNullaryOp
*/ template <typename TernaryOp, typename Arg1Type, typename Arg2Type, typename Arg3Type> class CwiseTernaryOp : public CwiseTernaryOpImpl<
TernaryOp, Arg1Type, Arg2Type, Arg3Type, typename internal::traits<Arg1Type>::StorageKind>,
internal::no_assignment_operator
{ public: typedeftypename internal::remove_all<Arg1Type>::type Arg1; typedeftypename internal::remove_all<Arg2Type>::type Arg2; typedeftypename internal::remove_all<Arg3Type>::type Arg3;
// The index types should match
EIGEN_STATIC_ASSERT((internal::is_same< typename internal::traits<Arg1Type>::StorageKind, typename internal::traits<Arg2Type>::StorageKind>::value),
STORAGE_KIND_MUST_MATCH)
EIGEN_STATIC_ASSERT((internal::is_same< typename internal::traits<Arg1Type>::StorageKind, typename internal::traits<Arg3Type>::StorageKind>::value),
STORAGE_KIND_MUST_MATCH)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.