v0.14.0
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 
8 namespace 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 }
FTensor
JSON compatible output.
Definition: Christof_constructor.hpp:6
FTensor::Tensor1_times_Tensor1::iterB
Tensor1_Expr< B, U, Dim1, j > iterB
Definition: Tensor1_times_Tensor1.hpp:42
FTensor::operator*
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)
Definition: Ddg_times_Ddg.hpp:79
FTensor::Tensor2_Expr
Definition: Tensor2_Expr.hpp:26
FTensor::T1_times_T1
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 > &)
Definition: Tensor1_times_Tensor1.hpp:13
A
constexpr AssemblyType A
Definition: operators_tests.cpp:30
FTensor::Number
Definition: Number.hpp:11
FTensor::Tensor1_Expr
Definition: Tensor1_Expr.hpp:27
a
constexpr double a
Definition: approx_sphere.cpp:30
FTensor::Tensor1_times_Tensor1::operator()
promote< T, U >::V operator()(const int N1, const int N2) const
Definition: Tensor1_times_Tensor1.hpp:49
FTensor::Tensor1_times_Tensor1
Definition: Tensor1_times_Tensor1.hpp:39
FTensor::promote::V
T1 V
Definition: promote.hpp:17
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FTensor::Tensor1_times_Tensor1::iterA
Tensor1_Expr< A, T, Dim0, i > iterA
Definition: Tensor1_times_Tensor1.hpp:41
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
EshelbianPlasticity::U
@ U
Definition: EshelbianContact.cpp:197
FTensor::Tensor1_times_Tensor1::Tensor1_times_Tensor1
Tensor1_times_Tensor1(const Tensor1_Expr< A, T, Dim0, i > &a, const Tensor1_Expr< B, U, Dim1, j > &b)
Definition: Tensor1_times_Tensor1.hpp:45