Grid
0.7.0
Lattice_transpose.h
Go to the documentation of this file.
1
/*************************************************************************************
2
3
Grid physics library, www.github.com/paboyle/Grid
4
5
Source file: ./lib/lattice/Lattice_transpose.h
6
7
Copyright (C) 2015
8
9
Author: Azusa Yamaguchi <ayamaguc@staffmail.ed.ac.uk>
10
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
11
12
This program is free software; you can redistribute it and/or modify
13
it under the terms of the GNU General Public License as published by
14
the Free Software Foundation; either version 2 of the License, or
15
(at your option) any later version.
16
17
This program is distributed in the hope that it will be useful,
18
but WITHOUT ANY WARRANTY; without even the implied warranty of
19
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
GNU General Public License for more details.
21
22
You should have received a copy of the GNU General Public License along
23
with this program; if not, write to the Free Software Foundation, Inc.,
24
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25
26
See the full license in the file "LICENSE" in the top level distribution directory
27
*************************************************************************************/
28
/* END LEGAL */
29
#ifndef GRID_LATTICE_TRANSPOSE_H
30
#define GRID_LATTICE_TRANSPOSE_H
31
33
// Transpose
35
36
NAMESPACE_BEGIN
(
Grid
);
37
39
// Transpose
41
/*
42
template<class vobj>
43
inline Lattice<vobj> transpose(const Lattice<vobj> &lhs){
44
Lattice<vobj> ret(lhs.Grid());
45
autoView( ret_v, ret, AcceleratorWrite);
46
autoView( lhs_v, lhs, AcceleratorRead);
47
accelerator_for(ss,lhs_v.size(),vobj::Nsimd(),{
48
coalescedWrite(ret_v[ss], transpose(lhs_v(ss)));
49
});
50
return ret;
51
};
52
*/
53
55
// Index level dependent transpose
57
template
<
int
Index,
class
vobj>
58
inline
auto
TransposeIndex
(
const
Lattice<vobj>
&lhs) ->
Lattice<decltype(transposeIndex<Index>
(vobj()))>
59
{
60
Lattice<decltype(transposeIndex<Index>
(vobj()))> ret(lhs.Grid());
61
autoView
( ret_v, ret,
AcceleratorWrite
);
62
autoView
( lhs_v, lhs,
AcceleratorRead
);
63
accelerator_for
(ss,lhs_v.size(),vobj::Nsimd(),{
64
coalescedWrite(ret_v[ss] , transposeIndex<Index>(lhs_v(ss)));
65
});
66
return
ret;
67
};
68
69
NAMESPACE_END
(
Grid
);
70
#endif
accelerator_for
#define accelerator_for(iterator, num, nsimd,...)
Definition
Accelerator.h:609
TransposeIndex
auto TransposeIndex(const Lattice< vobj > &lhs) -> Lattice< decltype(transposeIndex< Index >(vobj()))>
Definition
Lattice_transpose.h:58
autoView
#define autoView(l_v, l, mode)
Definition
Lattice_view.h:119
AcceleratorRead
@ AcceleratorRead
Definition
MemoryManager.h:66
AcceleratorWrite
@ AcceleratorWrite
Definition
MemoryManager.h:67
NAMESPACE_BEGIN
#define NAMESPACE_BEGIN(A)
Definition
Namespace.h:35
NAMESPACE_END
#define NAMESPACE_END(A)
Definition
Namespace.h:36
Lattice
Definition
Lattice_base.h:47
Grid
Definition
Deflation.h:31
Grid
lattice
Lattice_transpose.h
Generated by
1.16.1