SUNphi  1.0
Transpose.hpp
Go to the documentation of this file.
1 #ifndef _TRANSPOSE_HPP
2 #define _TRANSPOSE_HPP
3 
4 /// \file Transpose.hpp
5 ///
6 /// \brief Defines a class which take the transposed of a SmET
7 
8 #include <tens/TensClass.hpp>
9 #include <smet/Reference.hpp>
10 #include <smet/NnarySmET.hpp>
11 
12 namespace SUNphi
13 {
14  // Base type to qualify as \c Transposer
15  DEFINE_BASE_TYPE(Transposer);
16 
17  /// Class to take the transposed of a \c SmET
18  template <typename..._Refs> // Type to be transposed
19  class Transposer :
20  public BaseTransposer, // Inherit from \c BaseTransposer to detect in expression
21  public NnarySmET<Transposer<_Refs...>>, // Inherit from \c NnarySmET
22  public ConstrainAreSmETs<_Refs...> // Constrain all \c Refs to be \c SmET
23  {
24 
25  public:
26 
28 
30 
31  /// Returns the size of a component
32  ///
33  /// The result is the size of the twinned component
34  template <typename TC>
35  int compSize() const
36  {
37  return get<0>(refs).template compSize<TwinCompOf<TC>>();
38  }
39 
40  // Attributes
43 
44  /// TensorKind of the bound expression
45  PROVIDE_TK(typename TkOf<Ref<0>>::Twinned);
46 
48 
50 
52 
54 
56  };
57 
58  // Check that a test \c Transposer is a \c NnarySmET
59  STATIC_ASSERT_IS_NNARY_SMET(Transposer<Tens<TensKind<TensComp<double,1>>,double>>);
60 
61  // Build Transposer from \c transpose
62  SIMPLE_NNARY_SMET_BUILDER(transpose,Transposer);
63 
64  // Simplifies transpose(transpose)
65  CANCEL_DUPLICATED_NNARY_SMET_CALL(transpose,Transposer);
66 
67  // Move \c Transposer to the lhs
68  SMET_GOES_ON_LHS(transpose,Transposer);
69 }
70 
71 #endif
#define AS_ASSIGNABLE_AS_REF(ID)
Get the same assignability of a given ref.
Definition: NnarySmET.hpp:197
Transposer(SMETS &&...smets)
Definition: Transpose.hpp:55
#define PROVIDE_TK(...)
Provides the Tk member.
Definition: BaseSmET.hpp:94
#define NO_EXTRA_MERGE_DELIMS
Add an empty ExtraDelims.
Definition: NnarySmET.hpp:319
int compSize() const
Definition: Transpose.hpp:35
#define CANCEL_DUPLICATED_NNARY_SMET_CALL(CALLER,NNARY_SMET)
Definition: NnarySmET.hpp:451
#define IDENTITY_REPRESENTATIVE_FUNCTION
Provide an identity representative function.
Definition: NnarySmET.hpp:29
#define REPRESENTATIVE_FUNCTION_WINS_ALL
Provides Fund, eval and mergedComps according to representativeFunction.
Definition: NnarySmET.hpp:432
#define FORWARD_IS_ALIASING_TO_REFS
Definition: NnarySmET.hpp:420
#define PROVIDE_NNARY_SMET_SIMPLE_CREATOR(NNARY_SMET)
Defines a simple creator taking n references.
Definition: NnarySmET.hpp:383
#define STATIC_ASSERT_IS_NNARY_SMET(...)
Defines the check for a Nnary SmET.
Definition: NnarySmET.hpp:394
#define SMET_GOES_ON_LHS(LHS_FUN,SMET)
Definition: BaseSmET.hpp:299
#define NOT_STORING
Set the SmET to not-storing.
Definition: BaseSmET.hpp:86
#define PROVIDE_SMET_ASSIGNEMENT_OPERATOR(UNARY_SMET)
Defines the assignement operator, calling assign.
Definition: Assign.hpp:35
#define SIMPLE_NNARY_SMET_BUILDER(BUILDER,NNARY_SMET)
Definition: NnarySmET.hpp:406
#define PROVIDE_NNARY_SMET_REFS_AND_CHECK_ARE_N(N)
Definition: NnarySmET.hpp:126
decltype(auto) evalThroughRepresentativeFunctionPassingCompsByName(Ts &&...ts)
Definition: NnarySmET.hpp:101
#define DEFINE_BASE_TYPE(TYPE,...)
Definition: TypeTraits.hpp:526