Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dumux-repositories
dumux
Commits
4f1d9dda
Commit
4f1d9dda
authored
Dec 27, 2017
by
Dennis Gläser
Browse files
[math] implement multiplymatrices() for field matrices
parent
c6f89f95
Changes
1
Hide whitespace changes
Inline
Side-by-side
dumux/common/math.hh
View file @
4f1d9dda
...
...
@@ -607,6 +607,29 @@ Dune::DynamicMatrix<Scalar> multiplyMatrices(const Dune::DynamicMatrix<Scalar> &
return
result
;
}
/*!
* \ingroup Common
* \brief Multiply two field matrices
*
* \param M1 The first field matrix
* \param M2 The second field matrix (to be multiplied to M1 from the right side)
*/
template
<
class
Scalar
,
int
rows1
,
int
cols1
,
int
cols2
>
Dune
::
FieldMatrix
<
Scalar
,
rows1
,
cols2
>
multiplyMatrices
(
const
Dune
::
FieldMatrix
<
Scalar
,
rows1
,
cols1
>
&
M1
,
const
Dune
::
FieldMatrix
<
Scalar
,
cols1
,
cols2
>
&
M2
)
{
using
size_type
=
typename
Dune
::
FieldMatrix
<
Scalar
,
rows1
,
cols2
>::
size_type
;
Dune
::
FieldMatrix
<
Scalar
,
rows1
,
cols2
>
result
(
0.0
);
for
(
size_type
i
=
0
;
i
<
rows1
;
i
++
)
for
(
size_type
j
=
0
;
j
<
cols2
;
j
++
)
for
(
size_type
k
=
0
;
k
<
cols1
;
k
++
)
result
[
i
][
j
]
+=
M1
[
i
][
k
]
*
M2
[
k
][
j
];
return
result
;
}
/*!
* \ingroup Common
* \brief Trace of dynamic matrix
...
...
Write
Preview
Supports
Markdown
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