.. _program_listing_file_src_navtk_tensors.hpp: Program Listing for File tensors.hpp ==================================== |exhale_lsh| :ref:`Return to documentation for file ` (``src/navtk/tensors.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #pragma once #include #include #include #ifndef NAVTK_SCALAR # define NAVTK_SCALAR double #endif namespace navtk { typedef NAVTK_SCALAR Scalar; } // namespace navtk #ifdef NAVTK_PYTHON_TENSOR # include namespace navtk { template using Tensor = xt::pytensor; // xtensor-python doesn't have a `_fixed` equivalent template using MatrixN = xt::pytensor; template using VectorN = xt::pytensor; } // namespace navtk #else # include # include namespace navtk { template using Tensor = xt::xtensor; template using MatrixN = xt::xtensor_fixed >; template using VectorN = xt::xtensor_fixed >; } // namespace navtk #endif #include namespace navtk { typedef Tensor<2> Matrix; template using MatrixT = Tensor<2, T>; typedef Tensor<1> Vector; typedef MatrixN<3, 3> Matrix3; typedef VectorN<3> Vector3; typedef VectorN<4> Vector4; template using VectorT = Tensor<1, T>; using namespace xt::placeholders; // required for `_` to work using Size = Matrix::size_type; } // namespace navtk