| 100 | typename Layout_ |
| 101 | > |
| 102 | class TensorRefPlanarComplex { |
| 103 | public: |
| 104 | /// Data type of individual access |
| 105 | using Element = Element_; |
| 106 | |
| 107 | /// Complex element type |
| 108 | using ComplexElement = complex<Element>; |
| 109 | |
| 110 | /// Mapping function from logical coordinate to linear memory |
| 111 | using Layout = Layout_; |
| 112 | |
| 113 | static_assert(sizeof_bits<Element>::value >= 8, |
| 114 | "Planar complex not suitable for subbyte elements at this time"); |
| 115 | |
| 116 | /// Reference type to an element |
| 117 | using Reference = PlanarComplexReference<Element>; |
| 118 | |
| 119 | /// Logical rank of tensor index space |
| 120 | static int const kRank = Layout::kRank; |
| 121 | |
| 122 | /// Index type |
| 123 | using Index = typename Layout::Index; |
| 124 | |
| 125 | /// Long index used for pointer offsets |
| 126 | using LongIndex = typename Layout::LongIndex; |
| 127 | |
| 128 | /// Coordinate in logical tensor space |
| 129 | using TensorCoord = typename Layout::TensorCoord; |
| 130 | |
| 131 | /// Layout's stride vector |
| 132 | using Stride = typename Layout::Stride; |
| 133 | |
| 134 | /// TensorRef to constant data |
| 135 | using ConstTensorRef = TensorRefPlanarComplex< |
| 136 | typename platform::remove_const<Element>::type const, |
| 137 | Layout>; |
| 138 | |
| 139 | /// TensorRef to non-constant data |
| 140 | using NonConstTensorRef = TensorRefPlanarComplex< |
| 141 | typename platform::remove_const<Element>::type, |
| 142 | Layout>; |
| 143 | |
| 144 | /// Require at least rank=1. Mathematically, a rank=0 tensor would be considered to be a |
| 145 | /// scalar, but degenerate cases such as these are difficult to accommodate without |
| 146 | /// extensive C++ metaprogramming or support for zero-length arrays. |
| 147 | static_assert(kRank > 0, "Cannot define a zero-rank TensorRef"); |
| 148 | |
| 149 | private: |
| 150 | |
| 151 | /// Pointer |
| 152 | Element* ptr_; |
| 153 | |
| 154 | /// Layout object maps logical coordinates to linear offsets |
| 155 | Layout layout_; |
| 156 | |
| 157 | /// Offset to imaginary part |
| 158 | LongIndex imaginary_stride_; |
| 159 | |