1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 07:55:35 +00:00

Merge branch 'feature/distil' of github.com:mmphys/Grid into feature/distil

This commit is contained in:
ferben 2019-02-15 14:32:26 +00:00
commit e51744260f

View File

@ -508,6 +508,25 @@ bool DebugFelixTensorTest( void )
std::vector<Complex> Memory(Nmom * Nt * N_1 * N_2 * N_3 * 2);
using BaryonTensorMap = Eigen::TensorMap<BaryonTensorSet>;
BaryonTensorMap BField4 (&Memory[0], Nmom,4,Nt,N_1,N_2,N_3);
using TestScalar = std::complex<float>;
//typedef Eigen::TensorFixedSize<TestScalar, Eigen::Sizes<9,4,2>, Eigen::StorageOptions::RowMajor> TestTensorFixed;
using T3 = Eigen::Tensor<TestScalar, 3, Eigen::StorageOptions::RowMajor>;
using T2 = Eigen::Tensor<TestScalar, 2, Eigen::StorageOptions::RowMajor>;
T3 a(4,3,2);
for_all( a, [&](TestScalar &c, float n, const std::size_t * pDims ){
c = std::complex<float>{n,-n};
} );
std::cout << "a initialised to:\n" << a << std::endl;
Eigen::array<int, 3> offsets = {0,0,0};
Eigen::array<int, 3> extents = {1,3,2};
T2 b(3,2);
auto c = a.slice( offsets, extents).reshape(extents);
std::cout << "c is:\n" << c << std::endl;
b = a.chip(0,0);
std::cout << "b is:\n" << b << std::endl;
//b = c;
return true;
}