Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
amdis
amdis-core
Commits
35d37669
Commit
35d37669
authored
Sep 03, 2019
by
Praetorius, Simon
Browse files
Added outer product for FieldVector
parent
b374ce9e
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/amdis/common/FieldMatVec.hpp
View file @
35d37669
...
...
@@ -367,6 +367,9 @@ namespace Dune
template
<
class
T
,
class
S
,
int
N
,
int
M
,
int
K
>
auto
outer
(
FieldMatrix
<
T
,
N
,
K
>
const
&
vec1
,
FieldMatrix
<
S
,
M
,
K
>
const
&
vec2
);
template
<
class
T
,
class
S
,
int
N
,
int
M
>
auto
outer
(
FieldVector
<
T
,
N
>
const
&
vec1
,
FieldVector
<
S
,
M
>
const
&
vec2
);
// ----------------------------------------------------------------------------
template
<
class
T
>
...
...
src/amdis/common/FieldMatVec.inc.hpp
View file @
35d37669
...
...
@@ -422,6 +422,18 @@ auto outer(FieldMatrix<T,N,K> const& vec1, FieldMatrix<S,M,K> const& vec2)
return
mat
;
}
/// Outer product (vec1 * vec2^T)
template
<
class
T
,
class
S
,
int
N
,
int
M
>
auto
outer
(
FieldVector
<
T
,
N
>
const
&
vec1
,
FieldVector
<
S
,
M
>
const
&
vec2
)
{
using
result_type
=
FieldMatrix
<
TYPEOF
(
std
::
declval
<
T
>
()
*
std
::
declval
<
S
>
()
),
N
,
M
>
;
result_type
mat
;
for
(
int
i
=
0
;
i
<
N
;
++
i
)
for
(
int
j
=
0
;
j
<
M
;
++
j
)
mat
[
i
][
j
]
=
vec1
[
i
]
*
vec2
[
j
];
return
mat
;
}
// ----------------------------------------------------------------------------
template
<
class
T
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment