UQTk: Uncertainty Quantification Toolkit 3.1.5
pcmaps.cpp File Reference

Suite of functions to help map one kind of a PC variable to another. More...

#include "Array1D.h"
#include "Array2D.h"
#include "gen_defs.h"
#include "error_handlers.h"
#include "probability.h"
#include "arrayio.h"
#include "pcmaps.h"
#include "combin.h"
#include <assert.h>
#include <math.h>
#include <float.h>

Macros

#define EPS   1e-16
 
#define MXEPS   1e+100
 

Functions

double PCtoPC (double x, const std::string pcIn, double in1, double in2, const std::string pcOut, double out1, double out2)
 Implements a map y=f(x), where f is a function mapping one PC domain (pcIn with parameters in1,in2) to another (pcOut with parameters out1,out2)
 
void PCtoPC (Array2D< double > &xx, const std::string pcIn, double in1, double in2, Array2D< double > &yy, const std::string pcOut, double out1, double out2)
 Implements PCtoPC() map entrywise from array xx to yy.
 
double rtbis_mod (double func(double, const std::string, double, double, const std::string, double, double), const double x1, const double x2, const double xacc, double x, const std::string pcIn, double in1, double in2, const std::string pcOut, double out1, double out2)
 Bisection method for root-finding, modified to invert PCtoPC maps.
 
void linint (Array2D< double > &xydata, const double x, double &y, int col)
 Auxiliary linear interpolation function.
 
void linint (Array2D< double > &xydata, const double x, double &y)
 Auxiliary linear interpolation function.
 

Detailed Description

Suite of functions to help map one kind of a PC variable to another.

Macro Definition Documentation

◆ EPS

#define EPS   1e-16

◆ MXEPS

#define MXEPS   1e+100

Function Documentation

◆ linint() [1/2]

void linint ( Array2D< double > & xydata,
const double x,
double & y )

Auxiliary linear interpolation function.

Note
Currently not used, as there is an overloaded linint() function that is more general

◆ linint() [2/2]

void linint ( Array2D< double > & xydata,
const double x,
double & y,
int col )

Auxiliary linear interpolation function.

◆ PCtoPC() [1/2]

void PCtoPC ( Array2D< double > & xx,
const std::string pcIn,
double in1,
double in2,
Array2D< double > & yy,
const std::string pcOut,
double out1,
double out2 )

Implements PCtoPC() map entrywise from array xx to yy.

◆ PCtoPC() [2/2]

double PCtoPC ( double x,
const std::string pcIn,
double in1,
double in2,
const std::string pcOut,
double out1,
double out2 )

Implements a map y=f(x), where f is a function mapping one PC domain (pcIn with parameters in1,in2) to another (pcOut with parameters out1,out2)

Note
Besides standard PC types, it also incorporates a) 'TG' : truncated-gaussian variable, b) 'RB' : Roe-Baker PDF from Roe, G. H., & Baker, M. B. (2007). Why is climate sensitivity so unpredictable?. Science, 318(5850), 629-632. c) 'pdf': Given arbitrary cumulative distribution function values in cdf.dat it maps corresponding r.v. to PC variables as well
Parameters
[in]x: Input scalar x
[in]pcIn: PC type for input x (options are LU, HG, LG, JB, SW, TG, RB, pdf)
[in]in1: Parameter #1 for input PC (if relevant, i.e. for LG, JB, SW, TG, RB)
[in]in2: Parameter #2 for input PC (if relevant, i.e. for JB, SW, RB)
[in]pcOut: PC type for output y (options are LU, HG, LG, JB, SW, TG, RB, pdf)
[in]out1: Parameter #1 for output PC (if relevant, i.e. for LG, JB, SW, TG, RB)
[in]out2: Parameter #2 for output PC (if relevant, i.e. for JB, SW, RB)
Returns
y : Output scalar y
Note
The user is free to choose any value of x that is in the PC domain defined by pcIn
The map f() is a map frpm pcIn germ to a pcOut germ
For example, y=PCtoPC(x,'HG',0,0,'LU',0,0) maps $(-\infty,\infty)$ to $[-1,1]$ as a map from standard normal r.v. to uniform r.v.

◆ rtbis_mod()

double rtbis_mod ( double funcdouble, const std::string, double, double, const std::string, double, double,
const double x1,
const double x2,
const double xacc,
double x,
const std::string pcIn,
double in1,
double in2,
const std::string pcOut,
double out1,
double out2 )

Bisection method for root-finding, modified to invert PCtoPC maps.