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
59adddae
Commit
59adddae
authored
Aug 14, 2020
by
niklas.baumgarten
Browse files
adapted covariance function to lambda as vector
parent
6312d7fa
Changes
1
Show whitespace changes
Inline
Side-by-side
mlmc/src/stochastics/CovarianceFunction.hpp
View file @
59adddae
...
@@ -9,15 +9,13 @@ class CovarianceFunction {
...
@@ -9,15 +9,13 @@ class CovarianceFunction {
public:
public:
double
sigma
=
1.0
;
double
sigma
=
1.0
;
int
norm_p
=
2
;
int
norm_p
=
2
;
double
lambda1
=
0.15
;
std
::
vector
<
double
>
lambda
;
double
lambda2
=
0.15
;
// Has no influence on 1D
double
smoothing
=
1.0
;
double
smoothing
=
1.0
;
CovarianceFunction
()
{
CovarianceFunction
()
{
config
.
get
(
"sigma"
,
sigma
);
config
.
get
(
"sigma"
,
sigma
);
config
.
get
(
"norm_p"
,
norm_p
);
config
.
get
(
"norm_p"
,
norm_p
);
config
.
get
(
"lambda1"
,
lambda1
);
config
.
get
(
"lambda"
,
lambda
);
config
.
get
(
"lambda2"
,
lambda2
);
config
.
get
(
"smoothing"
,
smoothing
);
config
.
get
(
"smoothing"
,
smoothing
);
}
}
...
@@ -29,7 +27,7 @@ public:
...
@@ -29,7 +27,7 @@ public:
class
CovarianceFunction1D
:
CovarianceFunction
{
class
CovarianceFunction1D
:
CovarianceFunction
{
public:
public:
double
covariance_fct
(
double
*
tau
)
override
{
double
covariance_fct
(
double
*
tau
)
override
{
tau
[
0
]
/=
lambda
1
;
tau
[
0
]
/=
lambda
[
0
]
;
return
pow
(
sigma
,
2
)
*
exp
(
-
pow
(
norm
(
tau
),
smoothing
));
return
pow
(
sigma
,
2
)
*
exp
(
-
pow
(
norm
(
tau
),
smoothing
));
}
}
...
@@ -41,8 +39,8 @@ public:
...
@@ -41,8 +39,8 @@ public:
class
CovarianceFunction2D
:
CovarianceFunction
{
class
CovarianceFunction2D
:
CovarianceFunction
{
public:
public:
double
covariance_fct
(
double
*
tau
)
override
{
double
covariance_fct
(
double
*
tau
)
override
{
tau
[
0
]
/=
lambda
1
;
tau
[
0
]
/=
lambda
[
0
]
;
tau
[
1
]
/=
lambda
2
;
tau
[
1
]
/=
lambda
[
1
]
;
return
pow
(
sigma
,
2
)
*
exp
(
-
pow
(
norm
(
tau
),
smoothing
));
return
pow
(
sigma
,
2
)
*
exp
(
-
pow
(
norm
(
tau
),
smoothing
));
}
}
...
...
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