UQTk: Uncertainty Quantification Toolkit 3.1.5
mrv.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#ifndef MRV_H_SEEN
33#define MRV_H_SEEN
34
35#include "Array1D.h"
36#include "Array2D.h"
37#include "PCSet.h"
38
39#include <iostream>
40#include <string.h>
41#include <stdio.h>
42#include <sstream>
43
44using namespace std; // needed for python string conversion
45
47
48class Mrv {
49public:
50
52 Mrv(int ndim,string pdfType, Array1D<int> rndInd, int order,string pctype);
54 ~Mrv() {}
55
56
58 int Parametrize();
59
62 void getBounds(Array1D<double>& lower, Array1D<double>& upper);
63
65 int getPDim(){ return this->pDim_;}
66
72 Array2D<double> mcParam(Array2D<double>& multiPCcf, int nsam);
78 Array2D<double> propMC(Array2D<double> (*forwardFcn)(Array2D<double>&, Array2D<double>&, Array2D<double>&, void*), Array2D<double>& fixindnom,void* funcinfo,Array2D<double>& multiPCcf, Array2D<double>& x,int nsam);
80 void computeMoments(Array2D<double>& funcCf, Array1D<double>& fcnMean,Array1D<double>& fcnStd,bool covFlag, Array2D<double>& fcnCov);
81
83 void getPCTermId(Array1D<int>& pctermid){pctermid=pctermId_; return;}
84
85private:
92
94 string pdfType_;
96 string pcType_;
98 int pDim_;
100 int rDim_;
102 int nDim_;
106 int nPC_;
109
110
111
112};
113
114/*******************************************************************/
115/*******************************************************************/
116/*******************************************************************/
117
118
119#endif /* MRV_H_SEEN */
1D Array class for any type T
2D Array class for any type T
Header file for the Multivariate PC class.
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
multivariate RV parameterized by PC expansions
Definition mrv.h:48
int getPDim()
Get dimensionailty of parameterization.
Definition mrv.h:65
void getBounds(Array1D< double > &lower, Array1D< double > &upper)
Get bounds on parameters.
Definition mrv.cpp:130
~Mrv()
Destructor.
Definition mrv.h:54
Array2D< double > getMultiPCcf(Array1D< double > &rvParams)
Given parameters of representation, fold them in a 2d-array of PC coefficients for convenience.
Definition mrv.cpp:164
Array2D< double > evalMultiPC(Array2D< double > &xiSam, Array2D< double > &multiPCcf)
Evaluate at multivariate PC at given germ samples for given coefficient matrix.
Definition mrv.cpp:176
PCSet * pcModel_
Pointer to the corresponding PC object.
Definition mrv.h:108
Mrv(int ndim, string pdfType, Array1D< int > rndInd, int order, string pctype)
Constructor with dimensionality, pdftype, randomized parameter indices, order, and pctype.
Definition mrv.cpp:45
int order_
Order of function PC representation.
Definition mrv.h:104
int nDim_
Number of physical parameters lambda.
Definition mrv.h:102
Array1D< int > rndInd_
Randomized parameters indices.
Definition mrv.h:87
void getPCTermId(Array1D< int > &pctermid)
Get PC term ID.
Definition mrv.h:83
Array2D< double > propNISP(Array2D< double >(*forwardFcn)(Array2D< double > &, Array2D< double > &, Array2D< double > &, void *), Array2D< double > &fixindnom, void *funcinfo, Array2D< double > &multiPCcf, Array2D< double > &x)
Propagate the multivariate RV with given coefficeints through a given function at given values x.
Definition mrv.cpp:217
Array1D< int > paramId_
For a given parameterization, id the corresponding physical parameter lambda.
Definition mrv.h:89
Array1D< int > pctermId_
For a given parameterization, id the PC term/order for the corresponding parameter representation.
Definition mrv.h:91
int nPC_
Number of PC parameters for each independent component.
Definition mrv.h:106
Array2D< double > quadParam(Array2D< double > &multiPCcf)
Quadrature-sample all parameters given coefficient matrix.
Definition mrv.cpp:205
Array2D< double > mcParam(Array2D< double > &multiPCcf, int nsam)
Random-sample all parameters given coefficient matrix.
Definition mrv.cpp:195
void computeMoments(Array2D< double > &funcCf, Array1D< double > &fcnMean, Array1D< double > &fcnStd, bool covFlag, Array2D< double > &fcnCov)
Compute moments given coefficent matrix.
Definition mrv.cpp:251
int rDim_
Number of randomized parameters.
Definition mrv.h:100
int Parametrize()
Parameterization bookkeeping (i.e. alpha corresponds to certain parameter lambda and certain PC term)
Definition mrv.cpp:69
Array2D< double > propMC(Array2D< double >(*forwardFcn)(Array2D< double > &, Array2D< double > &, Array2D< double > &, void *), Array2D< double > &fixindnom, void *funcinfo, Array2D< double > &multiPCcf, Array2D< double > &x, int nsam)
Sample values of a given function given input coefficeint matrix.
Definition mrv.cpp:239
string pcType_
PC type (see pce library for options)
Definition mrv.h:96
int pDim_
Number of parameters in alpha parameterization.
Definition mrv.h:98
string pdfType_
PDF type ('pct', 'pci' or 'full')
Definition mrv.h:94
Defines and initializes PC basis function set and provides functions to manipulate PC expansions defi...
Definition PCSet.h:73