UQTk: Uncertainty Quantification Toolkit 3.1.5
pce_eval.cpp File Reference

Command-line utility for PC-related evaluations. More...

#include <unistd.h>
#include "PCSet.h"
#include "tools.h"
#include "arrayio.h"
#include "arraytools.h"

Macros

#define FCNTYPE   "PC"
 default function type
 
#define PCORD   1
 default PC order
 
#define PARAMFILE   "pccf.dat"
 default parameter file
 
#define AA   0.0
 default a parameter
 
#define BB   1.0
 default b parameter
 
#define CC   0.0
 default c parameter
 
#define DD   1.0
 default d parameter
 
#define STR1   "HG"
 default string parameter # 1
 
#define STR2   "mindex.dat"
 default string parameter # 2
 

Functions

void fEval_PC (Array2D< double > &xdata, Array1D< double > &ydata, int pcdim, int pcord, Array1D< double > &c_k, char *pcType, double alpha, double beta)
 Evaluates a PC given dimensionality, order, and coefficients array.
 
void gEval_PC (Array2D< double > &xdata, Array2D< double > &gdata, int pcdim, int pcord, Array1D< double > &c_k, char *pcType, double alpha, double beta)
 Evaluates the gradient of a PC given dimensionality, order, and coefficients array (only for LU PC)
 
void fEval_PCmi (Array2D< double > &xdata, Array1D< double > &ydata, Array1D< double > &c_k, char *pcType, char *miFile, double alpha, double beta)
 Evaluates a PC given multiindex file and coefficients array.
 
void fEval_PCmap (Array2D< double > &xdata, Array1D< double > &ydata, string pcIn, double a, double b, string pcOut, double c, double d)
 Maps given points according to PC maps, i.e. if x=PC1(\xi) and y=PC2(\xi), this function is y=PC2( PC1^{-1} (x) )
 
int usage ()
 Displays information about this program.
 
int main (int argc, char *argv[])
 

Detailed Description

Command-line utility for PC-related evaluations.

Author
K. Sargsyan 2012 -

Macro Definition Documentation

◆ AA

#define AA   0.0

default a parameter

◆ BB

#define BB   1.0

default b parameter

◆ CC

#define CC   0.0

default c parameter

◆ DD

#define DD   1.0

default d parameter

◆ FCNTYPE

#define FCNTYPE   "PC"

default function type

◆ PARAMFILE

#define PARAMFILE   "pccf.dat"

default parameter file

◆ PCORD

#define PCORD   1

default PC order

◆ STR1

#define STR1   "HG"

default string parameter # 1

◆ STR2

#define STR2   "mindex.dat"

default string parameter # 2

Function Documentation

◆ fEval_PC()

void fEval_PC ( Array2D< double > & xdata,
Array1D< double > & ydata,
int ndim,
int nord,
Array1D< double > & c_k,
char * pcType,
double alpha,
double beta )

Evaluates a PC given dimensionality, order, and coefficients array.

Parameters
[in]xdata: Input samples
[out]ydata: Output array
[in]ndim: PC dimesnionality
[in]nord: PC order
[in]c_k: Coefficient array
[in]pcType: PC type
[in]alpha: PC parameter #1
[in]beta: PC parameter #2

Get the number of input points and appropriately resize the output array

Sanity check of dimensionality

Declare the PC object

Get the number of terms

Evaluate the PC expansion

◆ fEval_PCmap()

void fEval_PCmap ( Array2D< double > & xdata,
Array1D< double > & ydata,
string pcIn,
double a,
double b,
string pcOut,
double c,
double d )

Maps given points according to PC maps, i.e. if x=PC1(\xi) and y=PC2(\xi), this function is y=PC2( PC1^{-1} (x) )

Parameters
[in]xdata: Input samples
[out]ydata: Output array
[in]pcIn: Input PC type (PC1)
[in]a: Input PC parameter #1
[in]b: Input PC parameter #2
[in]pcOut: Output PC type (PC2)
[in]c: Output PC parameter #1
[in]d: Output PC parameter #2

Get the number of input points and appropriately resize the output array

Ensure dimensionality = 1

Compute the PC map using function in pcmaps.cpp

◆ fEval_PCmi()

void fEval_PCmi ( Array2D< double > & xdata,
Array1D< double > & ydata,
Array1D< double > & c_k,
char * pcType,
char * miFile,
double alpha,
double beta )

Evaluates a PC given multiindex file and coefficients array.

Parameters
[in]xdata: Input samples
[out]ydata: Output array
[in]c_k: Coefficient array
[in]pcType: PC type
[in]nord: PC multiindex array
[in]alpha: PC parameter #1
[in]beta: PC parameter #2

Read the multiindex given the file

Get the number of input points and appropriately resize the output array

Sanity check of dimensionality

Declare the PC object

Get the number of terms

Evaluate the PC expansion

◆ gEval_PC()

void gEval_PC ( Array2D< double > & xdata,
Array2D< double > & gdata,
int ndim,
int nord,
Array1D< double > & c_k,
char * pcType,
double alpha,
double beta )

Evaluates the gradient of a PC given dimensionality, order, and coefficients array (only for LU PC)

Parameters
[in]xdata: Input samples
[out]gdata: Output gradient information stired in 2D array
[in]ndim: PC dimesnionality
[in]nord: PC order
[in]c_k: Coefficient array
[in]pcType: PC type
[in]alpha: PC parameter #1
[in]beta: PC parameter #2

Get the number of input points

Get the dimensionality

Resize the output array

Sanity check of dimensionality

Declare the PC object

Get the number of terms

Get the multi-indices for this PC representation

Evaluate the gradient of th PC expansion

◆ main()

int main ( int argc,
char * argv[] )

Main program: evaluates PC-related functions

Todo
Make the input arguments more transparent, i.e. what do they mean in different scenarios?

Set the default values

Read the user input

Print the input information on screen

Read the input data

Check which function is requested and compute it

Write the resulting array to a file

Gradient info, only available for LU PC

Write the resulting array to a file

Write the resulting 2D array to a file

◆ usage()

int usage ( )

Displays information about this program.