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
03dfa400
Commit
03dfa400
authored
2 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
even simpler handling of delta distribution
parent
116fcf61
No related branches found
No related tags found
1 merge request
!1299
decisive simplification of scan resolution evaluation
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Param/Distrib/RangedDistributions.cpp
+6
-11
6 additions, 11 deletions
Param/Distrib/RangedDistributions.cpp
with
6 additions
and
11 deletions
Param/Distrib/RangedDistributions.cpp
+
6
−
11
View file @
03dfa400
...
...
@@ -13,6 +13,7 @@
// ************************************************************************************************
#include
"Param/Distrib/RangedDistributions.h"
#include
"Base/Util/Assert.h"
#include
"Param/Distrib/Distributions.h"
#include
"Param/Distrib/ParameterSample.h"
#include
<cmath>
...
...
@@ -64,22 +65,16 @@ IRangedDistribution::~IRangedDistribution() = default;
std
::
vector
<
ParameterSample
>
IRangedDistribution
::
generateSamples
(
double
mean
,
double
stddev
)
const
{
auto
generator
=
distribution
(
mean
,
stddev
);
if
(
!
generator
->
isDelta
())
return
generator
->
equidistantSamples
(
m_n_samples
,
m_sigma_factor
,
m_limits
);
if
(
stddev
==
0
)
// it's a delta distribution
return
{{
mean
,
1.0
}};
ASSERT
(
stddev
>
0
);
// handling the case of delta distributions
auto
samples
=
generator
->
equidistantSamples
(
1
,
m_sigma_factor
,
m_limits
);
ParameterSample
&
sample
=
samples
[
0
];
// there is only one element in the vector
sample
.
weight
=
1.0
;
return
std
::
vector
<
ParameterSample
>
(
1
,
sample
);
auto
generator
=
distribution
(
mean
,
stddev
);
return
generator
->
equidistantSamples
(
m_n_samples
,
m_sigma_factor
,
m_limits
);
}
IDistribution1D
*
IRangedDistribution
::
distribution
(
double
mean
,
double
stddev
)
const
{
if
(
stddev
<
0.0
)
throw
std
::
runtime_error
(
"Error in IRangedDistribution::distribution: standard deviation is less than zero"
);
return
distribution_impl
(
mean
,
stddev
);
}
...
...
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