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
429a3dc0
Commit
429a3dc0
authored
May 12, 2021
by
niklas.baumgarten
Browse files
formatting
parent
01fbad9e
Changes
1
Hide whitespace changes
Inline
Side-by-side
mlmc/src/estimators/datastructure/EmpiricMeasureLevelMaps.hpp
View file @
429a3dc0
...
...
@@ -12,106 +12,106 @@ struct Exponents;
struct
MonteCarloMap
:
public
LevelMap
<
MonteCarlo
>
{
int
maxLevel
=
10
;
int
maxLevel
=
10
;
MonteCarloMap
()
{
config
.
get
(
"maxLevel"
,
maxLevel
);
};
MonteCarloMap
()
{
config
.
get
(
"maxLevel"
,
maxLevel
);
};
MonteCarloMap
(
std
::
initializer_list
<
std
::
pair
<
int
,
MonteCarlo
>>
mcMap
)
:
LevelMap
<
MonteCarlo
>
(
mcMap
)
{
config
.
get
(
"maxLevel"
,
maxLevel
);
};
MonteCarloMap
(
std
::
initializer_list
<
std
::
pair
<
int
,
MonteCarlo
>>
mcMap
)
:
LevelMap
<
MonteCarlo
>
(
mcMap
)
{
config
.
get
(
"maxLevel"
,
maxLevel
);
};
void
UpdateSampleCounter
(
double
epsilon
);
void
UpdateSampleCounter
(
double
epsilon
);
void
AppendLevel
(
double
epsilon
,
Exponents
exponents
,
int
newLevel
);
void
AppendLevel
(
double
epsilon
,
Exponents
exponents
,
int
newLevel
);
};
struct
SampleCounterMap
:
public
LevelMap
<
SampleCounter
>
{
SampleCounterMap
()
{};
SampleCounterMap
()
{};
SampleCounterMap
(
std
::
initializer_list
<
std
::
pair
<
int
,
SampleCounter
>>
ctrs
)
:
LevelMap
<
SampleCounter
>
(
ctrs
)
{};
SampleCounterMap
(
std
::
initializer_list
<
std
::
pair
<
int
,
SampleCounter
>>
ctrs
)
:
LevelMap
<
SampleCounter
>
(
ctrs
)
{};
void
Update
(
const
MonteCarloMap
&
mcMap
);
void
Update
(
const
MonteCarloMap
&
mcMap
);
bool
NoSamplesLeft
();
bool
NoSamplesLeft
();
};
struct
MeanMap
:
public
LevelMap
<
Mean
>
{
double
Q
=
0.0
;
double
Cost
=
0.0
;
double
Q
=
0.0
;
double
Cost
=
0.0
;
MeanMap
()
{};
MeanMap
()
{};
MeanMap
(
std
::
initializer_list
<
std
::
pair
<
int
,
Mean
>>
avgs
)
:
LevelMap
<
Mean
>
(
avgs
)
{};
MeanMap
(
std
::
initializer_list
<
std
::
pair
<
int
,
Mean
>>
avgs
)
:
LevelMap
<
Mean
>
(
avgs
)
{};
MeanMap
(
const
MonteCarloMap
&
mcMap
)
{
Update
(
mcMap
);
};
MeanMap
(
const
MonteCarloMap
&
mcMap
)
{
Update
(
mcMap
);
};
void
Update
(
const
MonteCarloMap
&
mcMap
);
void
Update
(
const
MonteCarloMap
&
mcMap
);
};
struct
SVarMap
:
public
LevelMap
<
SVar
>
{
SVarMap
()
{};
SVarMap
()
{};
SVarMap
(
std
::
initializer_list
<
std
::
pair
<
int
,
SVar
>>
vars
)
:
LevelMap
<
SVar
>
(
vars
)
{};
SVarMap
(
std
::
initializer_list
<
std
::
pair
<
int
,
SVar
>>
vars
)
:
LevelMap
<
SVar
>
(
vars
)
{};
SVarMap
(
const
MonteCarloMap
&
mcMap
)
{
Update
(
mcMap
);
};
SVarMap
(
const
MonteCarloMap
&
mcMap
)
{
Update
(
mcMap
);
};
void
Update
(
const
MonteCarloMap
&
mcMap
);
void
Update
(
const
MonteCarloMap
&
mcMap
);
};
struct
KurtosisMap
:
LevelMap
<
Kurtosis
>
{
KurtosisMap
()
{};
KurtosisMap
()
{};
KurtosisMap
(
std
::
initializer_list
<
std
::
pair
<
int
,
Kurtosis
>>
kurtosis
)
:
LevelMap
<
Kurtosis
>
(
kurtosis
)
{};
KurtosisMap
(
std
::
initializer_list
<
std
::
pair
<
int
,
Kurtosis
>>
kurtosis
)
:
LevelMap
<
Kurtosis
>
(
kurtosis
)
{};
KurtosisMap
(
const
MonteCarloMap
&
mcMap
)
{
Update
(
mcMap
);
};
KurtosisMap
(
const
MonteCarloMap
&
mcMap
)
{
Update
(
mcMap
);
};
void
Update
(
const
MonteCarloMap
&
mcMap
);
void
Update
(
const
MonteCarloMap
&
mcMap
);
};
struct
MultiLevelMonteCarloData
{
SampleCounterMap
ctrs
;
MeanMap
avgs
;
SVarMap
vars
;
KurtosisMap
kurtosis
;
MultiLevelMonteCarloData
()
{};
MultiLevelMonteCarloData
(
const
MonteCarloMap
&
mcMap
)
{
ExtractDataFrom
(
mcMap
);
}
MultiLevelMonteCarloData
(
const
SampleCounterMap
&
ctrs
,
const
MeanMap
&
avgs
,
const
SVarMap
&
vars
,
const
KurtosisMap
&
kurtosis
)
:
ctrs
(
ctrs
),
avgs
(
avgs
),
vars
(
vars
),
kurtosis
(
kurtosis
)
{};
void
ExtractDataFrom
(
const
MonteCarloMap
&
mcMap
);
friend
Logging
&
operator
<<
(
Logging
&
s
,
const
MultiLevelMonteCarloData
&
data
)
{
return
s
<<
"E(Qf-Qc)="
<<
data
.
avgs
.
GetYVector
()
<<
endl
<<
"E(Qf)="
<<
data
.
avgs
.
GetQVector
()
<<
endl
<<
"V(Qf-Qc)="
<<
data
.
vars
.
GetYVector
()
<<
endl
<<
"V(Qf)="
<<
data
.
vars
.
GetQVector
()
<<
endl
<<
"kurtosis="
<<
data
.
kurtosis
.
GetYVector
()
<<
endl
<<
"E(cost)="
<<
data
.
avgs
.
GetCostVector
()
<<
endl
<<
"Used Levels="
<<
data
.
avgs
.
GetLevelVector
()
<<
endl
<<
"Used Samples"
<<
data
.
ctrs
.
GetMVector
()
<<
endl
;
}
SampleCounterMap
ctrs
;
MeanMap
avgs
;
SVarMap
vars
;
KurtosisMap
kurtosis
;
MultiLevelMonteCarloData
()
{};
MultiLevelMonteCarloData
(
const
MonteCarloMap
&
mcMap
)
{
ExtractDataFrom
(
mcMap
);
}
MultiLevelMonteCarloData
(
const
SampleCounterMap
&
ctrs
,
const
MeanMap
&
avgs
,
const
SVarMap
&
vars
,
const
KurtosisMap
&
kurtosis
)
:
ctrs
(
ctrs
),
avgs
(
avgs
),
vars
(
vars
),
kurtosis
(
kurtosis
)
{};
void
ExtractDataFrom
(
const
MonteCarloMap
&
mcMap
);
friend
Logging
&
operator
<<
(
Logging
&
s
,
const
MultiLevelMonteCarloData
&
data
)
{
return
s
<<
"E(Qf-Qc)="
<<
data
.
avgs
.
GetYVector
()
<<
endl
<<
"E(Qf)="
<<
data
.
avgs
.
GetQVector
()
<<
endl
<<
"V(Qf-Qc)="
<<
data
.
vars
.
GetYVector
()
<<
endl
<<
"V(Qf)="
<<
data
.
vars
.
GetQVector
()
<<
endl
<<
"kurtosis="
<<
data
.
kurtosis
.
GetYVector
()
<<
endl
<<
"E(cost)="
<<
data
.
avgs
.
GetCostVector
()
<<
endl
<<
"Used Levels="
<<
data
.
avgs
.
GetLevelVector
()
<<
endl
<<
"Used Samples"
<<
data
.
ctrs
.
GetMVector
()
<<
endl
;
}
};
#endif //EMPIRICMEASURELEVELMAPS_HPP
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