55
66#pragma once
77
8+ #include " Shared_Vector.h"
89#include " Global_Func-2.h"
910#include < memory>
1011#include < vector>
1617
1718namespace RI
1819{
19-
20+
2021template <typename T>
2122class Tensor
2223{
2324public:
24- std::vector<std:: size_t > shape;
25+ Shape_Vector shape;
2526 std::shared_ptr<std::valarray<T>> data=nullptr ;
2627
27- explicit inline Tensor (const std::vector<std:: size_t > &shape_in);
28- explicit inline Tensor (const std::vector<std:: size_t > &shape_in, std::shared_ptr<std::valarray<T>> data_in);
28+ explicit inline Tensor (const Shape_Vector &shape_in);
29+ explicit inline Tensor (const Shape_Vector &shape_in, std::shared_ptr<std::valarray<T>> data_in);
2930
3031 Tensor ()=default ;
3132 Tensor (const Tensor<T> &t_in)=default ;
@@ -34,7 +35,7 @@ class Tensor
3435 Tensor<T> &operator =(Tensor<T> &&t_in)=default ;
3536
3637 inline std::size_t get_shape_all () const ;
37- inline Tensor reshape (const std::vector<std:: size_t > &shape_in) const ;
38+ inline Tensor reshape (const Shape_Vector &shape_in) const ;
3839
3940 Tensor copy () const ;
4041
@@ -56,7 +57,7 @@ class Tensor
5657 // Tensor & operator += (const Tensor &);
5758 Tensor operator -() const ;
5859
59- template <class Archive > void serialize ( Archive & ar ){ ar (shape); ar ( data); } // for cereal
60+ template <class Archive > void serialize ( Archive & ar ){ ar (shape, data); } // for cereal
6061};
6162
6263
@@ -97,7 +98,6 @@ template<typename T, std::size_t N0, std::size_t N1, std::size_t N2>
9798extern std::array<std::array<std::array<T,N2>,N1>,N0> to_array (const Tensor<T> &t);
9899template <typename T, std::size_t N0, std::size_t N1, std::size_t N2, std::size_t N3>
99100extern std::array<std::array<std::array<std::array<T,N3>,N2>,N1>,N0> to_array (const Tensor<T> &t);
100-
101101}
102102
103103#include " Blas_Interface-Tensor.h"
0 commit comments