Tatooine
rank.h
Go to the documentation of this file.
1#ifndef TATOOINE_RANK_H
2#define TATOOINE_RANK_H
3//==============================================================================
4#include <tatooine/concepts.h>
6//==============================================================================
7namespace tatooine {
8//==============================================================================
9template <arithmetic_or_complex Scalar>
10constexpr auto rank() {
11 return 0;
12}
13template <arithmetic_or_complex Scalar>
14constexpr auto rank(Scalar&&) {
15 return 0;
16}
17// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
18template <static_tensor Tensor>
19constexpr auto rank() {
20 return std::decay_t<Tensor>::rank();
21}
22// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
23template <static_tensor Tensor>
24constexpr auto rank(Tensor &&) { return std::decay_t<Tensor>::rank(); }
25// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
26template <dynamic_tensor Tensor>
27constexpr auto rank(Tensor && t) { return t.rank(); }
28//==============================================================================
29} // namespace tatooine
30//==============================================================================
31#endif
Definition: algorithm.h:6
tensor< real_number, Dimensions... > Tensor
Definition: tensor.h:184
constexpr auto rank()
Definition: rank.h:10