chromium/third_party/eigen3/src/Eigen/src/Core/Reshaped.h

// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2008-2017 Gael Guennebaud <[email protected]>
// Copyright (C) 2014 yoco <[email protected]>
//
// 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/.

#ifndef EIGEN_RESHAPED_H
#define EIGEN_RESHAPED_H

// IWYU pragma: private
#include "./InternalHeaderCheck.h"

namespace Eigen {

/** \class Reshaped
 * \ingroup Core_Module
 *
 * \brief Expression of a fixed-size or dynamic-size reshape
 *
 * \tparam XprType the type of the expression in which we are taking a reshape
 * \tparam Rows the number of rows of the reshape we are taking at compile time (optional)
 * \tparam Cols the number of columns of the reshape we are taking at compile time (optional)
 * \tparam Order can be ColMajor or RowMajor, default is ColMajor.
 *
 * This class represents an expression of either a fixed-size or dynamic-size reshape.
 * It is the return type of DenseBase::reshaped(NRowsType,NColsType) and
 * most of the time this is the only way it is used.
 *
 * If you want to directly manipulate reshaped expressions,
 * for instance if you want to write a function returning such an expression,
 * it is advised to use the \em auto keyword for such use cases.
 *
 * Here is an example illustrating the dynamic case:
 * \include class_Reshaped.cpp
 * Output: \verbinclude class_Reshaped.out
 *
 * Here is an example illustrating the fixed-size case:
 * \include class_FixedReshaped.cpp
 * Output: \verbinclude class_FixedReshaped.out
 *
 * \sa DenseBase::reshaped(NRowsType,NColsType)
 */

namespace internal {

traits<Reshaped<XprType, Rows, Cols, Order>>;

template <typename XprType, int Rows, int Cols, int Order, bool HasDirectAccess>
class ReshapedImpl_dense;

}  // end namespace internal

template <typename XprType, int Rows, int Cols, int Order, typename StorageKind>
class ReshapedImpl;

template <typename XprType, int Rows, int Cols, int Order>
class Reshaped : public ReshapedImpl<XprType, Rows, Cols, Order, typename internal::traits<XprType>::StorageKind> {};

// The generic default implementation for dense reshape simply forward to the internal::ReshapedImpl_dense
// that must be specialized for direct and non-direct access...
ReshapedImpl<XprType, Rows, Cols, Order, Dense>;

namespace internal {

/** \internal Internal implementation of dense Reshaped in the general case. */
ReshapedImpl_dense<XprType, Rows, Cols, Order, false>;

/** \internal Internal implementation of dense Reshaped in the direct access case. */
ReshapedImpl_dense<XprType, Rows, Cols, Order, true>;

// Evaluators
template <typename ArgType, int Rows, int Cols, int Order, bool HasDirectAccess>
struct reshaped_evaluator;

evaluator<Reshaped<ArgType, Rows, Cols, Order>>;

reshaped_evaluator<ArgType, Rows, Cols, Order, false>;

reshaped_evaluator<ArgType, Rows, Cols, Order, true>;

}  // end namespace internal

}  // end namespace Eigen

#endif  // EIGEN_RESHAPED_H