Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Core Modules
dune-common
Commits
ebb8e965
Commit
ebb8e965
authored
5 years ago
by
Lukas Renelt
Browse files
Options
Downloads
Patches
Plain Diff
resolve signature difference with lapack-binding
parent
91d8d961
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!776
compute Eigenvalues and -vectors in 1-3d without LAPACK
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dune/common/fmatrixev.hh
+4
-4
4 additions, 4 deletions
dune/common/fmatrixev.hh
dune/common/test/eigenvaluestest.cc
+8
-9
8 additions, 9 deletions
dune/common/test/eigenvaluestest.cc
with
12 additions
and
13 deletions
dune/common/fmatrixev.hh
+
4
−
4
View file @
ebb8e965
...
...
@@ -60,7 +60,7 @@ namespace Dune {
template
<
typename
K
>
static
void
eigenValuesVectors
(
const
FieldMatrix
<
K
,
1
,
1
>&
matrix
,
FieldVector
<
K
,
1
>&
eigenValues
,
Field
Vector
<
FieldVector
<
K
,
1
>
,
1
>&
eigenVectors
)
Field
Matrix
<
K
,
1
,
1
>&
eigenVectors
)
{
eigenValues
[
0
]
=
matrix
[
0
][
0
];
eigenVectors
[
0
]
=
{
1.0
};
...
...
@@ -105,7 +105,7 @@ namespace Dune {
template
<
typename
K
>
static
void
eigenValuesVectors
(
const
FieldMatrix
<
K
,
2
,
2
>&
matrix
,
FieldVector
<
K
,
2
>&
eigenValues
,
Field
Vector
<
FieldVector
<
K
,
2
>
,
2
>&
eigenVectors
)
Field
Matrix
<
K
,
2
,
2
>&
eigenVectors
)
{
using
Vector
=
FieldVector
<
K
,
2
>
;
using
Matrix
=
FieldMatrix
<
K
,
2
,
2
>
;
...
...
@@ -358,7 +358,7 @@ namespace Dune {
template
<
typename
K
>
static
void
eigenValuesVectors
(
const
FieldMatrix
<
K
,
3
,
3
>&
matrix
,
FieldVector
<
K
,
3
>&
eigenValues
,
Field
Vector
<
FieldVector
<
K
,
3
>
,
3
>&
eigenVectors
)
Field
Matrix
<
K
,
3
,
3
>&
eigenVectors
)
{
using
Vector
=
FieldVector
<
K
,
3
>
;
using
Matrix
=
FieldMatrix
<
K
,
3
,
3
>
;
...
...
@@ -379,7 +379,7 @@ namespace Dune {
[evec[0], evec[1], evec[2]] is right handed and
orthonormal. */
Field
Vector
<
Vector
,
3
>
evec
(
Vector
(
0.0
)
)
;
Field
Matrix
<
K
,
3
,
3
>
evec
(
0.0
);
FieldVector
<
K
,
3
>
eval
(
eigenValues
);
if
(
r
>=
0
)
{
Impl
::
eig0
(
scaledMatrix
,
eval
[
2
],
evec
[
2
]);
...
...
This diff is collapsed.
Click to expand it.
dune/common/test/eigenvaluestest.cc
+
8
−
9
View file @
ebb8e965
...
...
@@ -101,7 +101,7 @@ void testSymmetricFieldMatrix()
testMatrix
[
j
][
k
]
=
testMatrix
[
k
][
j
]
=
((
int
)(
M_PI
*
j
*
k
*
i
))
%
100
-
1
;
FieldVector
<
field_type
,
dim
>
eigenValues
;
Field
Vector
<
FieldVector
<
field_type
,
dim
>
,
dim
>
eigenVectors
;
Field
Matrix
<
field_type
,
dim
,
dim
>
eigenVectors
;
FMatrixHelp
::
eigenValuesVectors
(
testMatrix
,
eigenValues
,
eigenVectors
);
// Make sure the compute numbers really are the eigenvalues
...
...
@@ -139,9 +139,9 @@ void testSymmetricFieldMatrix()
}
template
<
typename
field_type
,
int
dim
>
void
compareEigenvectorSets
(
Field
Vector
<
FieldVector
<
field_type
,
dim
>
,
dim
>
evec
,
void
compareEigenvectorSets
(
Field
Matrix
<
field_type
,
dim
,
dim
>
evec
,
FieldVector
<
field_type
,
dim
>
refEval
,
Field
Vector
<
FieldVector
<
field_type
,
dim
>
,
dim
>
refEvec
)
Field
Matrix
<
field_type
,
dim
,
dim
>
refEvec
)
{
field_type
th
=
dim
*
std
::
sqrt
(
std
::
numeric_limits
<
field_type
>::
epsilon
());
...
...
@@ -176,8 +176,8 @@ void compareEigenvectorSets(FieldVector<FieldVector<field_type,dim>,dim> evec,
template
<
typename
field_type
,
int
dim
>
void
checkMatrixWithReference
(
FieldMatrix
<
field_type
,
dim
,
dim
>
matrix
,
Field
Vector
<
FieldVector
<
field_type
,
dim
>
,
dim
>
refEvec
,
FieldVector
<
field_type
,
dim
>
refEval
)
Field
Matrix
<
field_type
,
dim
,
dim
>
refEvec
,
FieldVector
<
field_type
,
dim
>
refEval
)
{
//normalize reference
for
(
auto
&
ev
:
refEvec
)
...
...
@@ -185,7 +185,7 @@ void checkMatrixWithReference(FieldMatrix<field_type, dim, dim> matrix,
field_type
th
=
dim
*
std
::
sqrt
(
std
::
numeric_limits
<
field_type
>::
epsilon
());
Field
Vector
<
FieldVector
<
field_type
,
dim
>
,
dim
>
eigenvectors
;
Field
Matrix
<
field_type
,
dim
,
dim
>
eigenvectors
;
FieldVector
<
field_type
,
dim
>
eigenvalues
;
FMatrixHelp
::
eigenValuesVectors
(
matrix
,
eigenvalues
,
eigenvectors
);
...
...
@@ -205,7 +205,7 @@ void checkMatrixWithLAPACK(FieldMatrix<field_type, dim, dim> matrix)
{
field_type
th
=
dim
*
std
::
sqrt
(
std
::
numeric_limits
<
field_type
>::
epsilon
());
Field
Vector
<
FieldVector
<
field_type
,
dim
>
,
dim
>
eigenvectors
,
refEvec
;
Field
Matrix
<
field_type
,
dim
,
dim
>
eigenvectors
,
refEvec
;
FieldVector
<
field_type
,
dim
>
eigenvalues
,
refEval
;
FMatrixHelp
::
eigenValuesVectors
(
matrix
,
eigenvalues
,
eigenvectors
);
...
...
@@ -253,7 +253,6 @@ void checkMultiplicity()
{
1
,
5
,
5
});
//repeat tests with LAPACK (if found)
/*
#if HAVE_LAPACK
checkMatrixWithLAPACK
<
double
,
2
>
({{
1
,
0
},
{
0
,
1
}});
checkMatrixWithLAPACK
<
double
,
2
>
({{
0
,
1
},
{
1
,
0
}});
...
...
@@ -261,7 +260,7 @@ void checkMultiplicity()
checkMatrixWithLAPACK
<
double
,
3
>
({{
0
,
1
,
0
},
{
1
,
0
,
0
},
{
0
,
0
,
5
}});
checkMatrixWithLAPACK
<
double
,
3
>
({{
3
,
-
2
,
0
},
{
-
2
,
3
,
0
},
{
0
,
0
,
5
}});
#endif
*/
}
int
main
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment