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
ff6568bd
Commit
ff6568bd
authored
2 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
also use for SpecializationTest
parent
7d035ec0
No related branches found
No related tags found
1 merge request
!1185
MultiQTest: detailed report for worst case only
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Tests/Unit/Numeric/FormFactorSpecializationTest.cpp
+5
-24
5 additions, 24 deletions
Tests/Unit/Numeric/FormFactorSpecializationTest.cpp
with
5 additions
and
24 deletions
Tests/Unit/Numeric/FormFactorSpecializationTest.cpp
+
5
−
24
View file @
ff6568bd
...
@@ -9,33 +9,14 @@
...
@@ -9,33 +9,14 @@
class
FFSpecializationTest
:
public
testing
::
Test
{
class
FFSpecializationTest
:
public
testing
::
Test
{
protected:
protected:
void
run_test
(
IFormFactor
*
p
0
,
IFormFactor
*
p
1
,
double
eps
,
double
qmag1
,
double
qmag2
)
void
run_test
(
IFormFactor
*
ff
0
,
IFormFactor
*
ff
1
,
double
eps
,
double
qmag1
,
double
qmag2
)
{
{
int
failures
=
formfactorTest
::
run_test2_for_many_q
(
int
failures
=
formfactorTest
::
run_test3_for_many_q
(
[
&
](
C3
q
,
bool
report
)
->
double
{
return
test_ff_eq
(
q
,
p0
,
p1
,
eps
,
report
);
},
qmag1
,
[
&
](
C3
q
)
->
complex_t
{
return
ff0
->
formfactor
(
q
);
},
qmag2
,
eps
);
[
&
](
C3
q
)
->
complex_t
{
return
ff1
->
formfactor
(
q
);
},
qmag1
,
qmag2
,
eps
);
EXPECT_EQ
(
failures
,
0
);
EXPECT_EQ
(
failures
,
0
);
}
}
private
:
double
test_ff_eq
(
C3
q
,
IFormFactor
*
p0
,
IFormFactor
*
p1
,
double
eps
,
bool
report
)
{
const
complex_t
f0
=
p0
->
formfactor
(
q
);
const
complex_t
f1
=
p1
->
formfactor
(
q
);
const
double
avge
=
(
std
::
abs
(
f0
)
+
std
::
abs
(
f1
))
/
2
;
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 at q = "
<<
q
<<
":
\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
;
}
};
};
const
double
eps_polyh
=
6e-12
;
// Linux 3e-12, relaxed for Win
const
double
eps_polyh
=
6e-12
;
// Linux 3e-12, relaxed for Win
...
...
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