UQTk: Uncertainty Quantification Toolkit 3.1.5
kle.h
Go to the documentation of this file.
1/* =====================================================================================
2
3 The UQ Toolkit (UQTk) version 3.1.5
4 Copyright (2024) NTESS
5 https://www.sandia.gov/UQToolkit/
6 https://github.com/sandialabs/UQTk
7
8 Copyright 2024 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
9 Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government
10 retains certain rights in this software.
11
12 This file is part of The UQ Toolkit (UQTk)
13
14 UQTk is open source software: you can redistribute it and/or modify
15 it under the terms of BSD 3-Clause License
16
17 UQTk is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 BSD 3 Clause License for more details.
21
22 You should have received a copy of the BSD 3 Clause License
23 along with UQTk. If not, see https://choosealicense.com/licenses/bsd-3-clause/.
24
25 Questions? Contact the UQTk Developers at https://github.com/sandialabs/UQTk/discussions
26 Sandia National Laboratories, Livermore, CA, USA
27===================================================================================== */
31
32
33#ifndef KLDECOMPUNI_H_SEEN
34#define KLDECOMPUNI_H_SEEN
35
36#include <iostream>
37#include "ftndefs.h"
38#include "Array1D.h"
39#include "Array2D.h"
40// #include "Array3D.h"
41
51
52 public:
53
64 KLDecompUni(const Array1D<double>& tSamples);
65
67
70
71 void Init() ;
72
75 void SetWeights(const Array1D<double>& weights) ;
76
79 void SetWeights(const double *weights, const int npts) ;
80
89 int decompose(const Array2D<double>& corr, const int& nKL);
90
99 int decompose(const double *corr, const int &nKL);
100
113 void KLproject(const Array2D<double>& realiz, Array2D<double>& xi);
114
116 const Array1D<double>& eigenvalues() const;
117 void eigenvalues(const int nEIG, double *eigs) const;
118
120 const Array2D<double>& KLmodes() const;
121
123 void KLmodes(const int npts, const int nKL, double *klModes ) const;
124
126 void meanRealiz(const Array2D<double>& realiz, Array1D<double>& mean_realiz);
127
138 void truncRealiz(const Array1D<double>& meanrea,const Array2D<double>& xi,const int& nKL, Array2D<double>& trunc_realiz);
139
140 private:
142 //KLDecompUni() {};
143
146
150
153
156
159
161 char jobz_ ;
165 char uplo_;
167 double vl_;
169 double vu_;
171 int il_;
173 int iu_;
175 double absTol_;
176
181
186
187};
188
189#endif /* KLDECOMPUNI_H_SEEN */
1D Array class for any type T
2D Array class for any type T
Stores data of any type T in a 1D array.
Definition Array1D.h:61
Stores data of any type T in a 2D array.
Definition Array2D.h:60
Computes the Karhunen-Loeve decomposition of a univariate stochastic process.
Definition kle.h:50
bool decomposed_
Flag to determine whether KL decomposition has taken place (and consequently that the interal data st...
Definition kle.h:149
int iu_
Upper index of range of eigenvalues requested.
Definition kle.h:173
void Init()
Definition kle.cpp:73
void SetWeights(const Array1D< double > &weights)
Set weights for computing the integral needed for Nystrom's method for solving the Fredholm integral ...
Definition kle.cpp:89
KLDecompUni(const KLDecompUni &)
Dummy default constructor, which should not be used as it is not well defined.
Definition kle.h:145
KLDecompUni()
Definition kle.cpp:65
char eigRange_
Option to set the type of range for eigenvalues.
Definition kle.h:163
Array1D< double > wh_
Array to hold square roots of weights.
Definition kle.h:158
int decompose(const Array2D< double > &corr, const int &nKL)
Perform KL decomposition into nKL modes and return actual number of modes that were obtained.
Definition kle.cpp:121
Array2D< double > whcwh_
Matrix to hold the upper triangular part of the matrix to get eigenvalues of.
Definition kle.h:152
Array1D< int > ifail_
Array to store indices of eigenvectors that failed to converge.
Definition kle.h:185
double vu_
Upper bound for range of eigenvalues.
Definition kle.h:169
double vl_
Lower bound for range of eigenvalues.
Definition kle.h:167
const Array2D< double > & KLmodes() const
Get associated KL modes.
Definition kle.cpp:264
~KLDecompUni()
Destructor.
Definition kle.h:69
char jobz_
Option to determine what to compute (eigenvalues and eigenvectors)
Definition kle.h:161
void truncRealiz(const Array1D< double > &meanrea, const Array2D< double > &xi, const int &nKL, Array2D< double > &trunc_realiz)
Returns the truncated KL sum.
Definition kle.cpp:321
void meanRealiz(const Array2D< double > &realiz, Array1D< double > &mean_realiz)
Calculate (in meanRealiz) the mean realizations.
Definition kle.cpp:300
void KLproject(const Array2D< double > &realiz, Array2D< double > &xi)
Project realizations to the KL modes and store them in xi ( )
Definition kle.cpp:204
double absTol_
Absolute tolerance for convergence.
Definition kle.h:175
const Array1D< double > & eigenvalues() const
Get eigenvalues in descending order.
Definition kle.cpp:232
int eig_info_
info on success of the eigenvector solutions
Definition kle.h:183
char uplo_
Option to indicate how matrix is stored.
Definition kle.h:165
Array1D< double > w_
Array to hold weights for Nystrom's method for Fredholm integral equation solution.
Definition kle.h:155
int il_
Lower index of range of eigenvalues requested.
Definition kle.h:171
Array1D< double > eig_values_
Array to store eigenvalues.
Definition kle.h:178
Array2D< double > KL_modes_
Matrix to store KL modes.
Definition kle.h:180