v0.14.0
src
ftensor
src
FTensor
Tensor2
Tensor2_minus_Tensor2.hpp
Go to the documentation of this file.
1
/* Subtracts a Tensor2 from a Tensor2, yielding a Tensor2. */
2
3
#pragma once
4
5
namespace
FTensor
6
{
7
/* Base template */
8
template
<
class
A
,
class
B,
class
T,
class
U
,
int
Dim0_0,
int
Dim1_0,
9
int
Dim0_1,
int
Dim1_1,
char
i0,
char
j0,
char
i1,
char
j1>
10
class
Tensor2_minus_Tensor2
11
{};
12
13
/* A(i,j)-B(i,j) */
14
15
template
<
class
A
,
class
B,
class
T,
class
U
,
int
Dim0,
int
Dim1,
char
i
,
16
char
j
>
17
class
Tensor2_minus_Tensor2
<
A
, B, T,
U
, Dim0, Dim1, Dim0, Dim1,
i
,
j
,
i
,
j
>
18
{
19
const
Tensor2_Expr<A, T, Dim0, Dim1, i, j>
iterA
;
20
const
Tensor2_Expr<B, U, Dim0, Dim1, i, j>
iterB
;
21
22
public
:
23
typename
promote<T, U>::V
operator()
(
const
int
N1,
const
int
N2)
const
24
{
25
return
iterA(N1, N2) - iterB(N1, N2);
26
}
27
28
Tensor2_minus_Tensor2
(
const
Tensor2_Expr<A, T, Dim0, Dim1, i, j>
&
a
,
29
const
Tensor2_Expr<B, U, Dim0, Dim1, i, j>
&b)
30
: iterA(
a
), iterB(b)
31
{}
32
};
33
34
/* A(i,j)-B(j,i) */
35
36
template
<
class
A
,
class
B,
class
T,
class
U
,
int
Dim0,
int
Dim1,
char
i
,
37
char
j
>
38
class
Tensor2_minus_Tensor2
<
A
, B, T,
U
, Dim0, Dim1, Dim1, Dim0,
i
,
j
,
j
,
i
>
39
{
40
const
Tensor2_Expr<A, T, Dim0, Dim1, i, j>
iterA
;
41
const
Tensor2_Expr<B, U, Dim1, Dim0, j, i>
iterB
;
42
43
public
:
44
typename
promote<T, U>::V
operator()
(
const
int
N1,
const
int
N2)
const
45
{
46
return
iterA(N1, N2) - iterB(N2, N1);
47
}
48
49
Tensor2_minus_Tensor2
(
const
Tensor2_Expr<A, T, Dim0, Dim1, i, j>
&
a
,
50
const
Tensor2_Expr<B, U, Dim1, Dim0, j, i>
&b)
51
: iterA(
a
), iterB(b)
52
{}
53
};
54
55
template
<
class
A
,
class
B,
class
T,
class
U
,
int
Dim0_0,
int
Dim1_0,
56
int
Dim0_1,
int
Dim1_1,
char
i0,
char
j0,
char
i1,
char
j1>
57
Tensor2_Expr<Tensor2_minus_Tensor2<
A
, B, T,
U
, Dim0_0, Dim1_0, Dim0_1,
58
Dim1_1, i0, j0, i1, j1>,
59
typename
promote<T, U>::V
, Dim0_0, Dim1_0, i0, j0>
60
operator-
(
const
Tensor2_Expr<A, T, Dim0_0, Dim1_0, i0, j0>
&
a
,
61
const
Tensor2_Expr<B, U, Dim0_1, Dim1_1, i1, j1>
&b)
62
{
63
using
TensorExpr =
Tensor2_minus_Tensor2
<
A
, B, T,
U
, Dim0_0, Dim1_0,
64
Dim0_1, Dim1_1, i0, j0, i1, j1>;
65
static_assert(
66
!std::is_empty<TensorExpr>::value,
67
"Indexes or Dimensions are not compatible with the - operator"
);
68
return
Tensor2_Expr<TensorExpr, typename promote<T, U>::V
, Dim0_0, Dim1_0,
69
i0, j0>(TensorExpr(
a
, b));
70
}
71
}
FTensor::Tensor2_minus_Tensor2< A, B, T, U, Dim0, Dim1, Dim1, Dim0, i, j, j, i >::iterB
const Tensor2_Expr< B, U, Dim1, Dim0, j, i > iterB
Definition:
Tensor2_minus_Tensor2.hpp:41
FTensor
JSON compatible output.
Definition:
Christof_constructor.hpp:6
FTensor::Tensor2_Expr
Definition:
Tensor2_Expr.hpp:26
A
constexpr AssemblyType A
Definition:
operators_tests.cpp:30
FTensor::Tensor2_minus_Tensor2< A, B, T, U, Dim0, Dim1, Dim0, Dim1, i, j, i, j >::iterB
const Tensor2_Expr< B, U, Dim0, Dim1, i, j > iterB
Definition:
Tensor2_minus_Tensor2.hpp:20
a
constexpr double a
Definition:
approx_sphere.cpp:30
FTensor::promote::V
T1 V
Definition:
promote.hpp:17
FTensor::Tensor2_minus_Tensor2< A, B, T, U, Dim0, Dim1, Dim0, Dim1, i, j, i, j >::iterA
const Tensor2_Expr< A, T, Dim0, Dim1, i, j > iterA
Definition:
Tensor2_minus_Tensor2.hpp:19
FTensor::Tensor2_minus_Tensor2< A, B, T, U, Dim0, Dim1, Dim1, Dim0, i, j, j, i >::operator()
promote< T, U >::V operator()(const int N1, const int N2) const
Definition:
Tensor2_minus_Tensor2.hpp:44
i
FTensor::Index< 'i', SPACE_DIM > i
Definition:
hcurl_divergence_operator_2d.cpp:27
FTensor::Tensor2_minus_Tensor2< A, B, T, U, Dim0, Dim1, Dim0, Dim1, i, j, i, j >::Tensor2_minus_Tensor2
Tensor2_minus_Tensor2(const Tensor2_Expr< A, T, Dim0, Dim1, i, j > &a, const Tensor2_Expr< B, U, Dim0, Dim1, i, j > &b)
Definition:
Tensor2_minus_Tensor2.hpp:28
FTensor::operator-
Ddg_Expr< Ddg_minus_Ddg< A, B, T, U, Dim01, Dim23, i, j, k, l >, typename promote< T, U >::V, Dim01, Dim23, i, j, k, l > operator-(const Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > &a, const Ddg_Expr< B, U, Dim01, Dim23, i, j, k, l > &b)
Definition:
Ddg_minus_Ddg.hpp:33
j
FTensor::Index< 'j', 3 > j
Definition:
matrix_function.cpp:19
FTensor::Tensor2_minus_Tensor2< A, B, T, U, Dim0, Dim1, Dim1, Dim0, i, j, j, i >::iterA
const Tensor2_Expr< A, T, Dim0, Dim1, i, j > iterA
Definition:
Tensor2_minus_Tensor2.hpp:40
FTensor::Tensor2_minus_Tensor2
Definition:
Tensor2_minus_Tensor2.hpp:10
FTensor::Tensor2_minus_Tensor2< A, B, T, U, Dim0, Dim1, Dim0, Dim1, i, j, i, j >::operator()
promote< T, U >::V operator()(const int N1, const int N2) const
Definition:
Tensor2_minus_Tensor2.hpp:23
FTensor::Tensor2_minus_Tensor2< A, B, T, U, Dim0, Dim1, Dim1, Dim0, i, j, j, i >::Tensor2_minus_Tensor2
Tensor2_minus_Tensor2(const Tensor2_Expr< A, T, Dim0, Dim1, i, j > &a, const Tensor2_Expr< B, U, Dim1, Dim0, j, i > &b)
Definition:
Tensor2_minus_Tensor2.hpp:49
EshelbianPlasticity::U
@ U
Definition:
EshelbianContact.cpp:197
Generated by
Doxygen
1.8.17 and hosted at