Skip to content

Commit 0d09c26

Browse files
authored
Merge pull request openturns#481 from regislebrun/improve_kriging
Improved initialization in KrigingAlgorithm constructors
2 parents 48eeb52 + 5123ead commit 0d09c26

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

lib/src/Uncertainty/Algorithm/MetaModel/Kriging/KrigingAlgorithm.cxx

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,13 @@ KrigingAlgorithm::KrigingAlgorithm(const Sample & inputSample,
6767
, outputSample_(outputSample)
6868
, normalize_(normalize)
6969
, covarianceModel_()
70-
, glmAlgo_()
70+
, glmAlgo_(inputSample, outputSample, covarianceModel, basis, normalize, true)
7171
, gamma_(0)
7272
, rho_(0)
7373
, result_()
7474
, covarianceCholeskyFactor_()
7575
, covarianceCholeskyFactorHMatrix_()
7676
{
77-
// Here we must force the GLMAlgo to keep the Cholesky factor as it is mandatory
78-
// for the interpolation part
79-
glmAlgo_ = GeneralLinearModelAlgorithm(inputSample, outputSample, covarianceModel, basis, normalize, true);
8077
// Force the GLM algo to use the exact same linear algebra as the Kriging algorithm
8178
if (ResourceMap::Get("KrigingAlgorithm-LinearAlgebra") == "HMAT") glmAlgo_.setMethod(1);
8279
else glmAlgo_.setMethod(0);
@@ -94,16 +91,13 @@ KrigingAlgorithm::KrigingAlgorithm(const Sample & inputSample,
9491
, outputSample_(outputSample)
9592
, normalize_(normalize)
9693
, covarianceModel_(covarianceModel)
97-
, glmAlgo_()
94+
, glmAlgo_(inputSample, outputSample, covarianceModel, basisCollection, normalize, true)
9895
, gamma_(0)
9996
, rho_(0)
10097
, result_()
10198
, covarianceCholeskyFactor_()
10299
, covarianceCholeskyFactorHMatrix_()
103100
{
104-
// Here we must force the GLMAlgo to keep the Cholesky factor as it is mandatory
105-
// for the interpolation part
106-
glmAlgo_ = GeneralLinearModelAlgorithm(inputSample, outputSample, covarianceModel, basisCollection, normalize, true);
107101
// Force the GLM algo to use the exact same linear algebra as the Kriging algorithm
108102
if (ResourceMap::Get("KrigingAlgorithm-LinearAlgebra") == "HMAT") glmAlgo_.setMethod(1);
109103
else glmAlgo_.setMethod(0);
@@ -120,15 +114,13 @@ KrigingAlgorithm::KrigingAlgorithm(const Sample & inputSample,
120114
, outputSample_(outputSample)
121115
, normalize_(true)
122116
, covarianceModel_(covarianceModel)
117+
, glmAlgo_(inputSample, inputTransformation, outputSample, covarianceModel, basis, true)
123118
, gamma_(0)
124119
, rho_(0)
125120
, result_()
126121
, covarianceCholeskyFactor_()
127122
, covarianceCholeskyFactorHMatrix_()
128123
{
129-
// Here we must force the GLMAlgo to keep the Cholesky factor as it is mandatory
130-
// for the interpolation part
131-
glmAlgo_ = GeneralLinearModelAlgorithm(inputSample, inputTransformation, outputSample, covarianceModel, basis, true);
132124
// Force the GLM algo to use the exact same linear algebra as the Kriging algorithm
133125
if (ResourceMap::Get("KrigingAlgorithm-LinearAlgebra") == "HMAT") glmAlgo_.setMethod(1);
134126
else glmAlgo_.setMethod(0);
@@ -145,16 +137,13 @@ KrigingAlgorithm::KrigingAlgorithm(const Sample & inputSample,
145137
, outputSample_(outputSample)
146138
, normalize_(true)
147139
, covarianceModel_(covarianceModel)
148-
, glmAlgo_()
140+
, glmAlgo_(inputSample, inputTransformation, outputSample, covarianceModel, basisCollection, true)
149141
, gamma_(0)
150142
, rho_(0)
151143
, result_()
152144
, covarianceCholeskyFactor_()
153145
, covarianceCholeskyFactorHMatrix_()
154146
{
155-
// Here we must force the GLMAlgo to keep the Cholesky factor as it is mandatory
156-
// for the interpolation part
157-
glmAlgo_ = GeneralLinearModelAlgorithm(inputSample, inputTransformation, outputSample, covarianceModel, basisCollection, true);
158147
// Force the GLM algo to use the exact same linear algebra as the Kriging algorithm
159148
if (ResourceMap::Get("KrigingAlgorithm-LinearAlgebra") == "HMAT") glmAlgo_.setMethod(1);
160149
else glmAlgo_.setMethod(0);

0 commit comments

Comments
 (0)