Tenncor
shaped_arr.hpp
Go to the documentation of this file.
1 
9 #include "teq/shape.hpp"
10 
11 #include "eteq/generated/pyapi.hpp"
12 
13 #ifndef ETEQ_SHAPED_ARR_HPP
14 #define ETEQ_SHAPED_ARR_HPP
15 
16 namespace eteq
17 {
18 
20 template <typename T>
21 struct ShapedArr final
22 {
23  ShapedArr (void) = default;
24 
25  ShapedArr (teq::Shape shape, T data = 0) :
26  data_(shape.n_elems(), data), shape_(shape) {}
27 
29  std::vector<T> data_;
30 
33 };
34 
35 }
36 
37 #endif // ETEQ_SHAPED_ARR_HPP
Shaped array wraps around a vector and shape.
Definition: shaped_arr.hpp:21
std::vector< T > data_
Vector of size equal to shape_.n_elems()
Definition: shaped_arr.hpp:29
Definition: constant.hpp:17
Definition: shape.hpp:62
ShapedArr(teq::Shape shape, T data=0)
Definition: shaped_arr.hpp:25
ShapedArr(void)=default
teq::Shape shape_
Tensor shape of data_.
Definition: shaped_arr.hpp:32