Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Mpp
MLUQ
Commits
20a69789
Commit
20a69789
authored
May 12, 2021
by
niklas.baumgarten
Browse files
renaming
parent
268f5ef8
Changes
2
Hide whitespace changes
Inline
Side-by-side
mlmc/src/estimators/datastructure/EmpiricMeasureLevelMaps.cpp
View file @
20a69789
...
...
@@ -6,14 +6,14 @@ void EstimatorMap::UpdateSampleCounter(double epsilon) {
int
optimalM
;
double
factor
=
0.0
;
for
(
auto
&
[
level
,
mc
]
:
_levelMap
)
factor
+=
sqrt
(
mc
.
aggregate
.
sVar
.
Y
*
mc
.
aggregate
.
mean
.
C
);
for
(
auto
&
[
level
,
estimator
]
:
_levelMap
)
factor
+=
sqrt
(
estimator
.
aggregate
.
sVar
.
Y
*
estimator
.
aggregate
.
mean
.
C
);
for
(
auto
&
[
level
,
mc
]
:
_levelMap
)
{
for
(
auto
&
[
level
,
estimator
]
:
_levelMap
)
{
optimalM
=
(
int
)
(
ceil
(
2
*
pow
(
epsilon
,
-
2
)
*
factor
*
sqrt
(
mc
.
aggregate
.
sVar
.
Y
/
mc
.
aggregate
.
mean
.
C
)));
sqrt
(
estimator
.
aggregate
.
sVar
.
Y
/
estimator
.
aggregate
.
mean
.
C
)));
if
(
optimalM
==
1
)
optimalM
++
;
// Hack
mc
.
aggregate
.
UpdateSampleCounter
(
optimalM
-
mc
.
aggregate
.
ctr
.
M
);
estimator
.
aggregate
.
UpdateSampleCounter
(
optimalM
-
estimator
.
aggregate
.
ctr
.
M
);
}
}
...
...
@@ -36,9 +36,9 @@ void EstimatorMap::AppendLevel(double epsilon, Exponents exponents, int newLevel
}
}
void
SampleCounterMap
::
Update
(
const
EstimatorMap
&
mc
Map
)
{
for
(
auto
&
[
level
,
mc
]
:
mc
Map
)
_levelMap
[
level
]
=
SampleCounter
(
mc
.
aggregate
.
ctr
);
void
SampleCounterMap
::
Update
(
const
EstimatorMap
&
estimator
Map
)
{
for
(
auto
&
[
level
,
estimator
]
:
estimator
Map
)
_levelMap
[
level
]
=
SampleCounter
(
estimator
.
aggregate
.
ctr
);
}
bool
SampleCounterMap
::
NoSamplesLeft
()
{
...
...
@@ -51,20 +51,20 @@ bool SampleCounterMap::NoSamplesLeft() {
return
noSamplesLeft
;
}
void
MeanMap
::
Update
(
const
EstimatorMap
&
mc
Map
)
{
for
(
auto
&&
[
level
,
mc
]
:
mc
Map
)
{
_levelMap
[
level
]
=
mc
.
aggregate
.
mean
;
Q
+=
mc
.
aggregate
.
mean
.
Y
;
Cost
+=
mc
.
aggregate
.
mean
.
C
;
// Todo at the right place?
void
MeanMap
::
Update
(
const
EstimatorMap
&
estimator
Map
)
{
for
(
auto
&&
[
level
,
estimator
]
:
estimator
Map
)
{
_levelMap
[
level
]
=
estimator
.
aggregate
.
mean
;
Q
+=
estimator
.
aggregate
.
mean
.
Y
;
Cost
+=
estimator
.
aggregate
.
mean
.
C
;
// Todo at the right place?
}
}
void
SVarMap
::
Update
(
const
EstimatorMap
&
mc
Map
)
{
for
(
auto
&
[
level
,
mc
]
:
mc
Map
)
_levelMap
[
level
]
=
mc
.
aggregate
.
sVar
;
void
SVarMap
::
Update
(
const
EstimatorMap
&
estimator
Map
)
{
for
(
auto
&
[
level
,
estimator
]
:
estimator
Map
)
_levelMap
[
level
]
=
estimator
.
aggregate
.
sVar
;
}
void
KurtosisMap
::
Update
(
const
EstimatorMap
&
mc
Map
)
{
for
(
auto
&
[
level
,
mc
]
:
mc
Map
)
_levelMap
[
level
]
=
mc
.
aggregate
.
kurtosis
;
void
KurtosisMap
::
Update
(
const
EstimatorMap
&
estimator
Map
)
{
for
(
auto
&
[
level
,
estimator
]
:
estimator
Map
)
_levelMap
[
level
]
=
estimator
.
aggregate
.
kurtosis
;
}
mlmc/src/estimators/datastructure/EmpiricMeasureLevelMaps.hpp
View file @
20a69789
...
...
@@ -35,7 +35,7 @@ struct SampleCounterMap : public LevelMap<SampleCounter> {
SampleCounterMap
(
std
::
initializer_list
<
std
::
pair
<
int
,
SampleCounter
>>
ctrs
)
:
LevelMap
<
SampleCounter
>
(
ctrs
)
{};
void
Update
(
const
EstimatorMap
&
mc
Map
);
void
Update
(
const
EstimatorMap
&
estimator
Map
);
bool
NoSamplesLeft
();
};
...
...
@@ -53,7 +53,7 @@ struct MeanMap : public LevelMap<Mean> {
Update
(
mcMap
);
};
void
Update
(
const
EstimatorMap
&
mc
Map
);
void
Update
(
const
EstimatorMap
&
estimator
Map
);
};
struct
SVarMap
:
public
LevelMap
<
SVar
>
{
...
...
@@ -67,7 +67,7 @@ struct SVarMap : public LevelMap<SVar> {
Update
(
mcMap
);
};
void
Update
(
const
EstimatorMap
&
mc
Map
);
void
Update
(
const
EstimatorMap
&
estimator
Map
);
};
struct
KurtosisMap
:
LevelMap
<
Kurtosis
>
{
...
...
@@ -81,7 +81,7 @@ struct KurtosisMap : LevelMap<Kurtosis> {
Update
(
mcMap
);
};
void
Update
(
const
EstimatorMap
&
mc
Map
);
void
Update
(
const
EstimatorMap
&
estimator
Map
);
};
struct
MultilevelData
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment