v0.14.0
Loading...
Searching...
No Matches
Tensor1_times_Tensor1.hpp
Go to the documentation of this file.
1/* Multiplies two Tensor1's together yielding a T (int, double, etc.)
2 or a Tensor2. */
3
4/* A(i)*B(i) -> T */
5
6#pragma once
7
8namespace FTensor
9{
10 template <class A, class B, class T, class U, int Dim, char i,
11 int Current_Dim>
12 typename promote<T, U>::V
15 {
16 return a(Current_Dim - 1) * b(Current_Dim - 1)
18 }
19
20 template <class A, class B, class T, class U, int Dim, char i>
21 typename promote<T, U>::V
23 const Tensor1_Expr<B, U, Dim, i> &b, const Number<1> &)
24 {
25 return a(0) * b(0);
26 }
27
28 template <class A, class B, class T, class U, int Dim, char i>
31 {
32 return T1_times_T1(a, b, Number<Dim>());
33 }
34
35 /* A(i)*B(j) -> Tensor2 */
36
37 template <class A, class B, class T, class U, int Dim0, int Dim1, char i,
38 char j>
40 {
43
44 public:
47 : iterA(a), iterB(b)
48 {}
49 typename promote<T, U>::V operator()(const int N1, const int N2) const
50 {
51 return iterA(N1) * iterB(N2);
52 }
53 };
54
55 template <class A, class B, class T, class U, int Dim0, int Dim1, char i,
56 char j>
57 Tensor2_Expr<Tensor1_times_Tensor1<A, B, T, U, Dim0, Dim1, i, j>,
58 typename promote<T, U>::V, Dim0, Dim1, i, j>
61 {
64 j>(TensorExpr(a, b));
65 }
66}
static Number< 2 > N2
static Number< 1 > N1
constexpr double a
promote< T, U >::V operator()(const int N1, const int N2) const
Tensor1_Expr< B, U, Dim1, j > iterB
Tensor1_Expr< A, T, Dim0, i > iterA
Tensor1_times_Tensor1(const Tensor1_Expr< A, T, Dim0, i > &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
promote< T, U >::V operator*(const Ddg_Expr< A, T, Dim, Dim, i, j, k, l > &a, const Ddg_Expr< B, U, Dim, Dim, i, k, j, l > &b)
promote< T, U >::V T1_times_T1(const Tensor1_Expr< A, T, Dim, i > &a, const Tensor1_Expr< B, U, Dim, i > &b, const Number< Current_Dim > &)
constexpr AssemblyType A