/*************************************************************************** * Copyright (c) Johan Mabille, Sylvain Corlay and Wolf Vollprecht * * Copyright (c) QuantStack * * * * Distributed under the terms of the BSD 3-Clause License. * * * * The full license is in the file LICENSE, distributed with this software. * ****************************************************************************/ #ifndef XTENSOR_FORWARD_HPP #define XTENSOR_FORWARD_HPP // This file contains forward declarations and // alias types to solve the problem of circular // includes. It should not contain anything else // and should not bring additional dependencies to // the files that include it. So: // - do NOT define classes of metafunctions here // - do NOT include other headers // // If you need to do so, something is probably // going wrong (either your change, or xtensor // needs to be refactored). #include #include #include #include "xlayout.hpp" #include "xtensor_config.hpp" namespace xt { struct xtensor_expression_tag; struct xoptional_expression_tag; template struct xcontainer_inner_types; template class xcontainer; template class uvector; template class svector; template < class EC, layout_type L = XTENSOR_DEFAULT_LAYOUT, class SC = XTENSOR_DEFAULT_SHAPE_CONTAINER(typename EC::value_type, typename EC::allocator_type, std::allocator), class Tag = xtensor_expression_tag> class xarray_container; /** * @typedef xarray * Alias template on xarray_container with default parameters for data container * type and shape / strides container type. This allows to write * * @code{.cpp} * xt::xarray a = {{1., 2.}, {3., 4.}}; * @endcode * * instead of the heavier syntax * * @code{.cpp} * xt::xarray_container, std::vector> a = ... * @endcode * * @tparam T The value type of the elements. * @tparam L The layout_type of the xarray_container (default: XTENSOR_DEFAULT_LAYOUT). * @tparam A The allocator of the container holding the elements. * @tparam SA The allocator of the containers holding the shape and the strides. */ template < class T, layout_type L = XTENSOR_DEFAULT_LAYOUT, class A = XTENSOR_DEFAULT_ALLOCATOR(T), class SA = std::allocator::size_type>> using xarray = xarray_container; template < class EC, layout_type L = XTENSOR_DEFAULT_LAYOUT, class SC = XTENSOR_DEFAULT_SHAPE_CONTAINER(typename EC::value_type, std::allocator, std::allocator), class Tag = xtensor_expression_tag> class xarray_adaptor; /** * @typedef xarray_optional * Alias template on xarray_container for handling missing values * * @tparam T The value type of the elements. * @tparam L The layout_type of the container (default: XTENSOR_DEFAULT_LAYOUT). * @tparam A The allocator of the container holding the elements. * @tparam BA The allocator of the container holding the missing flags. * @tparam SA The allocator of the containers holding the shape and the strides. */ template < class T, layout_type L = XTENSOR_DEFAULT_LAYOUT, class A = XTENSOR_DEFAULT_ALLOCATOR(T), class BC = xtl::xdynamic_bitset, class SA = std::allocator::size_type>> using xarray_optional = xarray_container< xtl::xoptional_vector, L, XTENSOR_DEFAULT_SHAPE_CONTAINER(T, A, SA), xoptional_expression_tag>; template class xtensor_container; /** * @typedef xtensor * Alias template on xtensor_container with default parameters for data container * type. This allows to write * * @code{.cpp} * xt::xtensor a = {{1., 2.}, {3., 4.}}; * @endcode * * instead of the heavier syntax * * @code{.cpp} * xt::xtensor_container, 2> a = ... * @endcode * * @tparam T The value type of the elements. * @tparam N The dimension of the tensor. * @tparam L The layout_type of the tensor (default: XTENSOR_DEFAULT_LAYOUT). * @tparam A The allocator of the containers holding the elements. */ template using xtensor = xtensor_container; template class xtensor_adaptor; template class xtensor_view; template class fixed_shape; /** * @typedef xshape * Alias template for ``fixed_shape`` allows for a shorter template shape definition in ``xtensor_fixed``. */ template using xshape = fixed_shape; template class xfixed_container; template class xfixed_adaptor; /** * @typedef xtensor_fixed * Alias template on xfixed_container with default parameters for layout * type. This allows to write * * @code{.cpp} * xt::xtensor_fixed> a = {{1., 2.}, {3., 4.}}; * @endcode * * instead of the syntax * * @code{.cpp} * xt::xfixed_container, xt::layout_type::row_major> a = ... * @endcode * * @tparam T The value type of the elements. * @tparam FSH A xshape template shape. * @tparam L The layout_type of the tensor (default: XTENSOR_DEFAULT_LAYOUT). * @tparam Sharable Whether the tensor can be used in a shared expression. */ template using xtensor_fixed = xfixed_container; /** * @typedef xtensor_optional * Alias template on xtensor_container for handling missing values * * @tparam T The value type of the elements. * @tparam N The dimension of the tensor. * @tparam L The layout_type of the container (default: XTENSOR_DEFAULT_LAYOUT). * @tparam A The allocator of the containers holding the elements. * @tparam BA The allocator of the container holding the missing flags. */ template < class T, std::size_t N, layout_type L = XTENSOR_DEFAULT_LAYOUT, class A = XTENSOR_DEFAULT_ALLOCATOR(T), class BC = xtl::xdynamic_bitset> using xtensor_optional = xtensor_container, N, L, xoptional_expression_tag>; template class xview; template class xfunction; } #endif