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
b3b21f87
Commit
b3b21f87
authored
5 years ago
by
Christian Engwer
Committed by
Lukas Renelt
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[test] test multiplicity of 3x3 EV calculation
parent
cd4c780f
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!776
compute Eigenvalues and -vectors in 1-3d without LAPACK
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/common/test/eigenvaluestest.cc
+43
-0
43 additions, 0 deletions
dune/common/test/eigenvaluestest.cc
with
43 additions
and
0 deletions
dune/common/test/eigenvaluestest.cc
+
43
−
0
View file @
b3b21f87
...
...
@@ -10,6 +10,7 @@
#include
<dune/common/fmatrixev.hh>
#include
<algorithm>
#include
<limits>
#include
<complex>
using
namespace
Dune
;
...
...
@@ -119,6 +120,42 @@ void testSymmetricFieldMatrix()
}
}
template
<
typename
field_type
,
int
dim
>
void
checkMultiplicityImpl
(
FieldMatrix
<
field_type
,
dim
,
dim
>
A
,
FieldVector
<
field_type
,
dim
>
refev
)
{
field_type
th
=
dim
*
std
::
sqrt
(
std
::
numeric_limits
<
field_type
>::
epsilon
());
FieldVector
<
field_type
,
dim
>
eigenValues
;
// calculate via specialized function
FMatrixHelp
::
eigenValues
(
A
,
eigenValues
);
if
((
eigenValues
-
refev
).
two_norm
()
>
th
)
DUNE_THROW
(
MathError
,
"Eigenvalues ["
<<
eigenValues
<<
"] computed by FMatrixHelp::eigenValues do not matchthe reference solution ["
<<
refev
<<
"]"
);
// calculate eigenValues via LAPACK
FieldMatrix
<
field_type
,
dim
,
dim
>
dummy
;
FMatrixHelp
::
eigenValuesVectorsLapack
(
A
,
eigenValues
,
dummy
,
'n'
);
if
((
eigenValues
-
refev
).
two_norm
()
>
th
)
DUNE_THROW
(
MathError
,
"Eigenvalues ["
<<
eigenValues
<<
"] computed by FMatrixHelp::eigenValuesVectorsLapack do not matchthe reference solution ["
<<
refev
<<
"]"
);
}
template
<
typename
field_type
>
void
checkMultiplicity3D
()
{
checkMultiplicityImpl
<
double
,
3
>
({{
1
,
0
,
0
},
{
0
,
1
,
0
},
{
0
,
0
,
1
}},
{
1
,
1
,
1
});
checkMultiplicityImpl
<
double
,
3
>
({{
0
,
1
,
0
},
{
1
,
0
,
0
},
{
0
,
0
,
5
}},
{
-
1
,
1
,
5
});
checkMultiplicityImpl
<
double
,
3
>
({{
3
,
-
2
,
0
},
{
-
2
,
3
,
0
},
{
0
,
0
,
5
}},
{
1
,
5
,
5
});
}
int
main
()
{
#if HAVE_LAPACK
...
...
@@ -129,6 +166,12 @@ int main()
testSymmetricFieldMatrix
<
double
,
2
>
();
testSymmetricFieldMatrix
<
double
,
3
>
();
#if HAVE_LAPACK
testSymmetricFieldMatrix
<
double
,
4
>
();
testSymmetricFieldMatrix
<
double
,
200
>
();
#endif // HAVE_LAPACK
checkMultiplicity3D
<
double
>
();
return
0
;
}
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