9#ifndef GMATTENSOR_CONFIG_H
10#define GMATTENSOR_CONFIG_H
15#ifdef GMATTENSOR_USE_XTENSOR_PYTHON
16#include <xtensor-python/pytensor.hpp>
18#include <xtensor/xtensor.hpp>
27#define UNUSED(p) ((void)(p))
29#define GMATTENSOR_ASSERT_IMPL(expr, file, line) \
31 throw std::runtime_error( \
32 std::string(file) + ':' + std::to_string(line) + \
33 ": assertion failed (" #expr ") \n\t"); \
56#ifdef GMATTENSOR_ENABLE_ASSERT
57#define GMATTENSOR_ASSERT(expr) GMATTENSOR_ASSERT_IMPL(expr, __FILE__, __LINE__)
59#define GMATTENSOR_ASSERT(expr)
72#ifdef GMATTENSOR_USE_XTENSOR_PYTHON
77template <
typename T,
size_t N>
78using tensor = xt::pytensor<T, N>;
85template <
typename T,
size_t N>
106template <
size_t RANK,
class T>
113template <
size_t RANK,
class EC,
size_t N, xt::layout_type L,
class Tag>
114struct allocate<RANK, xt::xtensor<EC, N, L, Tag>> {
115 using type =
typename xt::xtensor<EC, RANK, L, Tag>;
118#ifdef XTENSOR_FIXED_HPP
119template <
size_t RANK,
class EC,
class S, xt::layout_type L>
120struct allocate<RANK, xt::xtensor_fixed<EC, S, L>> {
121 using type =
typename xt::xtensor<EC, RANK, L>;
125#ifdef XTENSOR_FIXED_HPP
126template <
size_t RANK,
class EC,
class S, xt::layout_type L,
bool SH,
class Tag>
127struct allocate<RANK, xt::xfixed_container<EC, S, L, SH, Tag>> {
128 using type =
typename xt::xtensor<EC, RANK, L, Tag>;
133template <
size_t RANK,
class EC,
size_t N, xt::layout_type L>
134struct allocate<RANK, xt::pytensor<EC, N, L>> {
135 using type =
typename xt::pytensor<EC, RANK, L>;
xt::xtensor< T, N > tensor
Fixed (static) rank array.
Tensor products / operations.
Helper to allocate 'output' which is of the same type of some 'input', but of a different rank.