Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container 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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
0d3c29ae
Commit
0d3c29ae
authored
2 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
SymmetryTest: report worst case only
parent
56dc21f7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1185
MultiQTest: detailed report for worst case only
Pipeline
#82876
failed
2 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Tests/Unit/Numeric/FormFactorSpecializationTest.cpp
+7
-8
7 additions, 8 deletions
Tests/Unit/Numeric/FormFactorSpecializationTest.cpp
Tests/Unit/Numeric/FormFactorSymmetryTest.cpp
+21
-21
21 additions, 21 deletions
Tests/Unit/Numeric/FormFactorSymmetryTest.cpp
with
28 additions
and
29 deletions
Tests/Unit/Numeric/FormFactorSpecializationTest.cpp
+
7
−
8
View file @
0d3c29ae
...
...
@@ -12,9 +12,8 @@ protected:
void
run_test
(
IFormFactor
*
p0
,
IFormFactor
*
p1
,
double
eps
,
double
qmag1
,
double
qmag2
)
{
int
failures
=
formfactorTest
::
run_test2_for_many_q
(
[
&
](
C3
q
,
bool
report
)
->
double
{
return
test_ff_eq
(
q
,
p0
,
p1
,
eps
,
report
);
},
qmag1
,
qmag2
,
eps
);
[
&
](
C3
q
,
bool
report
)
->
double
{
return
test_ff_eq
(
q
,
p0
,
p1
,
eps
,
report
);
},
qmag1
,
qmag2
,
eps
);
EXPECT_EQ
(
failures
,
0
);
}
...
...
@@ -28,12 +27,12 @@ private:
const
double
result
=
abserr
/
avge
*
std
::
min
(
1.
,
eps
*
avge
/
1e-16
);
if
(
report
)
{
std
::
cout
<<
"Deviation at q = "
<<
q
<<
":
\n
"
;
std
::
cout
<<
" Re(f0) = "
<<
std
::
setprecision
(
16
)
<<
real
(
f0
)
<<
", Im(f0) = "
<<
imag
(
f0
)
<<
"
\n
"
;
std
::
cout
<<
" Re(f0) = "
<<
std
::
setprecision
(
16
)
<<
real
(
f0
)
<<
", Im(f0) = "
<<
imag
(
f0
)
<<
"
\n
"
;
std
::
cout
<<
" Re(f1) = "
<<
real
(
f1
)
<<
", Im(f1) = "
<<
imag
(
f1
)
<<
"
\n
"
;
std
::
cout
<<
" abs dev = "
<<
std
::
setprecision
(
8
)
<<
abserr
<<
", rel dev = "
<<
abserr
/
avge
<<
",
score = "
<<
result
<<
",
limit = "
<<
eps
<<
"
\n
"
;
std
::
cout
<<
" abs dev = "
<<
std
::
setprecision
(
8
)
<<
abserr
<<
", rel dev = "
<<
abserr
/
avge
<<
", score = "
<<
result
<<
", limit = "
<<
eps
<<
"
\n
"
;
}
return
result
;
}
...
...
This diff is collapsed.
Click to expand it.
Tests/Unit/Numeric/FormFactorSymmetryTest.cpp
+
21
−
21
View file @
0d3c29ae
...
...
@@ -8,15 +8,17 @@
class
FFSymmetryTest
:
public
testing
::
Test
{
protected:
void
run_test
(
IFormFactor
*
ff
,
std
::
function
<
C3
(
const
C3
&
)
>
trafo
,
double
eps
,
double
qmag1
,
double
qmag2
)
void
run_test
(
IFormFactor
*
ff
,
std
::
function
<
C3
(
const
C3
&
)
>
trafo
,
double
eps
,
double
qmag1
,
double
qmag2
)
{
formfactorTest
::
run_test_for_many_q
([
&
](
C3
q
)
{
test_qq_eq
(
ff
,
q
,
trafo
(
q
),
eps
);
},
qmag1
,
qmag2
);
int
failures
=
formfactorTest
::
run_test2_for_many_q
(
[
&
](
C3
q
,
bool
report
)
->
double
{
return
test_qq_eq
(
ff
,
q
,
trafo
(
q
),
eps
,
report
);
},
qmag1
,
qmag2
,
eps
);
EXPECT_EQ
(
failures
,
0
);
}
private
:
void
test_qq_eq
(
IFormFactor
*
ff
,
C3
q
,
C3
p
,
double
eps
)
double
test_qq_eq
(
IFormFactor
*
ff
,
C3
q
,
C3
p
,
double
eps
,
bool
report
)
{
complex_t
f0
=
ff
->
formfactor
(
q
);
#ifdef ALGORITHM_DIAGNOSTIC
...
...
@@ -24,21 +26,19 @@ private:
#endif
const
complex_t
f1
=
ff
->
formfactor
(
p
);
const
double
avge
=
(
std
::
abs
(
f0
)
+
std
::
abs
(
f1
))
/
2
;
const
double
precision
=
std
::
max
(
1e-16
,
eps
*
avge
);
EXPECT_NEAR
(
real
(
f0
),
real
(
f1
),
precision
)
<<
"q="
<<
q
<<
", p="
<<
p
#ifdef ALGORITHM_DIAGNOSTIC
<<
"
\n
msg(q): "
<<
msg0
<<
"
\n
"
<<
"
\n
msg(p): "
<<
polyhedralDiagnosis
.
message
()
<<
"
\n
"
#endif
;
EXPECT_NEAR
(
imag
(
f0
),
imag
(
f1
),
precision
)
<<
"q="
<<
q
<<
", p="
<<
p
#ifdef ALGORITHM_DIAGNOSTIC
<<
"
\n
msg(q): "
<<
msg0
<<
"
\n
"
<<
"
\n
msg(p): "
<<
polyhedralDiagnosis
.
message
()
<<
"
\n
"
#endif
;
const
double
abserr
=
std
::
max
(
fabs
(
real
(
f0
)
-
real
(
f1
)),
fabs
(
imag
(
f0
)
-
imag
(
f1
)));
const
double
result
=
abserr
/
avge
*
std
::
min
(
1.
,
eps
*
avge
/
1e-16
);
if
(
report
)
{
std
::
cout
<<
"Deviation of q0 = "
<<
q
<<
"
\n
"
;
std
::
cout
<<
" and q1 = "
<<
p
<<
":
\n
"
;
std
::
cout
<<
" Re(f0) = "
<<
std
::
setprecision
(
16
)
<<
real
(
f0
)
<<
", Im(f0) = "
<<
imag
(
f0
)
<<
"
\n
"
;
std
::
cout
<<
" Re(f1) = "
<<
real
(
f1
)
<<
", Im(f1) = "
<<
imag
(
f1
)
<<
"
\n
"
;
std
::
cout
<<
" abs dev = "
<<
std
::
setprecision
(
8
)
<<
abserr
<<
", rel dev = "
<<
abserr
/
avge
<<
", score = "
<<
result
<<
", limit = "
<<
eps
<<
"
\n
"
;
}
return
result
;
}
};
...
...
@@ -99,7 +99,7 @@ TEST_F(FFSymmetryTest, TruncatedSphere)
{
TruncatedSphere
ff
(
.79
,
.34
,
0
);
run_test
(
&
ff
,
[](
const
C3
&
q
)
->
C3
{
return
q
.
rotatedZ
(
M_PI
/
3.13698
);
},
1
e-1
2
,
1e-99
,
2e2
);
&
ff
,
[](
const
C3
&
q
)
->
C3
{
return
q
.
rotatedZ
(
M_PI
/
3.13698
);
},
2
e-1
3
,
1e-99
,
2e2
);
}
TEST_F
(
FFSymmetryTest
,
Spheroid
)
...
...
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