v0.14.0
Loading...
Searching...
No Matches
Tensor2_and_Tensor1.hpp
Go to the documentation of this file.
1/* Multiply a Tensor1 and a Tensor2 together but don't contract, yielding a
2 Tensor2. */
3
4/* A(i,j) & B(i) -> Tensor2 */
5
6#pragma once
7
8namespace FTensor
9{
10 // Base Template
11 template <class A, class B, class T, class U, int Dim0_0, int Dim1_0,
12 int Dim0_1, char i0, char j0, char i1>
14 {};
15
16 /* A(i,j) & B(i) -> Tensor2 */
17
18 template <class A, class B, class T, class U, int Dim0, int Dim1, char i,
19 char j>
20 class Tensor2_and_Tensor1<A, B, T, U, Dim0, Dim1, Dim0, i, j, i>
21 {
24
25 public:
26 typename promote<T, U>::V operator()(const int N1, const int N2) const
27 {
28 return iterA(N1, N2) * iterB(N1);
29 }
30
35 };
36
37 /* A(i,j) & B(j) -> Tensor2 */
38
39 template <class A, class B, class T, class U, int Dim0, int Dim1, char i,
40 char j>
41 class Tensor2_and_Tensor1<A, B, T, U, Dim0, Dim1, Dim1, i, j, j>
42 {
45
46 public:
47 typename promote<T, U>::V operator()(const int N1, const int N2) const
48 {
49 return iterA(N1, N2) * iterB(N2);
50 }
51
56 };
57
58 /* A(i,j) & B(i/j) -> Tensor2 */
59
60 template <class A, class B, class T, class U, int Dim0_0, int Dim1_0,
61 int Dim0_1, char i0, char j0, char i1>
64 {
65 using TensorExpr
67 static_assert(
68 !std::is_empty<TensorExpr>::value,
69 "Indexes or Dimensions are not compatible with the & operator");
71 i0, j0>(TensorExpr(a, b));
72 }
73
74 /* B(i/j) & A(i,j) -> Tensor2 */
75
76 // TODO=> We are not respecting operation order, in the really odd case
77 // someone uses this operation with non
78 // TODO=> commutable T or U. Any ideas on how should we handel this.
79
80 template <class A, class B, class T, class U, int Dim0_0, int Dim1_0,
81 int Dim0_1, char i0, char j0, char i1>
90}
static Number< 2 > N2
static Number< 1 > N1
constexpr double a
Tensor2_and_Tensor1(const Tensor2_Expr< A, T, Dim0, Dim1, i, j > &a, const Tensor1_Expr< B, U, Dim0, i > &b)
promote< T, U >::V operator()(const int N1, const int N2) const
promote< T, U >::V operator()(const int N1, const int N2) const
Tensor2_and_Tensor1(const Tensor2_Expr< A, T, Dim0, Dim1, i, j > &a, const Tensor1_Expr< B, U, Dim1, j > &b)
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'j', 3 > j
const double T
Tensors class implemented by Walter Landry.
Definition FTensor.hpp:51
Ddg_Expr< Ddg_and_Tensor2_symmetric< A, B, T, U, Dim01_0, Dim23_0, Dim_1, i0, j0, k0, l0, i1, j1 >, typename promote< T, U >::V, Dim01_0, Dim23_0, i0, j0, k0, l0 > operator&(const Ddg_Expr< A, T, Dim01_0, Dim23_0, i0, j0, k0, l0 > &a, const Tensor2_symmetric_Expr< B, U, Dim_1, i1, j1 > &b)
constexpr AssemblyType A