UQTk: Uncertainty Quantification Toolkit 3.1.5
multiindex.cpp File Reference

Tools that deal with integer multiindices. More...

#include <math.h>
#include <assert.h>
#include "gen_defs.h"
#include "tools.h"
#include "arraytools.h"

Functions

int computeNPCTerms (int ndim, int norder)
 Computes the number of PC basis terms for Total-Order truncation with a given dimensionality and order.
 
int computeMultiIndex (int ndim, int norder, Array2D< int > &mi)
 Computes the multiindex set of a PC basis for Total-Order truncation with a given dimensionality and order Also, returns the number of terms.
 
int computeMultiIndexT (int ndim, int norder, int *mi)
 Computes the multiindex set of a PC basis for Total-Order truncation with a given dimensionality and order Also, returns the number of terms. Note that here, the multiindex array pointer stores indices in column-major format, i.e. mi[j*ndim+i] holds the j-th index for dimension i.
 
int computeMultiIndex (int ndim, int norder, Array2D< int > &mi, string ordtype)
 Computes the multiindex set of a PC basis for Total-Order truncation with a given dimensionality and order Also, returns the number of terms.
 
int computeMultiIndexTP (Array1D< int > &maxorders, Array2D< int > &mindex)
 Computes the multiindex set of a PC basis for Tensor-Product truncation with a given maximum order per dimensionality Also, returns the number of terms.
 
int computeNPCTermsHDMR (int ndim, Array1D< int > &maxorders)
 Computes the number of PC basis terms for HDMR truncation with a given dimensionality and maxorders array that contains maximal orders per interaction dimensionalities.
 
int computeMultiIndexHDMR (int ndim, Array1D< int > &maxorders, Array2D< int > &mindex)
 Computes the multiindex set of a PC basis for HDMR truncation with a given dimensionality and maxorders array that contains maximal orders per interaction dimensionalities.
 
void decodeMindex (Array1D< Array2D< int > > &sp_mindex, int ndim, Array2D< int > &mindex)
 Decode a multiindex set from a sparse format to a regular format.
 
bool is_admis (Array1D< int > &mindex_try, Array2D< int > &mindex)
 A boolean check to see if a new basis term is admissible or not.
 
void upOrder (Array2D< int > &mindex, Array2D< int > &new_mindex)
 Given a multiindex set it computes a new multiindex set where only 'admissible' bases are added.
 
void getOrders (Array2D< int > &mindex, Array1D< int > &orders)
 Given a multiindex set, it returns the orders of each basis term.
 
int get_invmindex (Array1D< int > mi)
 Given a single multiindex, this returns its relative position in the total-order multiindex set.
 
int get_invmindex_ord (Array1D< int > mi)
 Given a single multiindex, this returns its relative position in the total-order multiindex set among the bases of the same order.
 

Detailed Description

Tools that deal with integer multiindices.

Function Documentation

◆ computeMultiIndex() [1/2]

int computeMultiIndex ( int ndim,
int norder,
Array2D< int > & mi )

Computes the multiindex set of a PC basis for Total-Order truncation with a given dimensionality and order Also, returns the number of terms.

◆ computeMultiIndex() [2/2]

int computeMultiIndex ( int ndim,
int norder,
Array2D< int > & mi,
string ordtype )

Computes the multiindex set of a PC basis for Total-Order truncation with a given dimensionality and order Also, returns the number of terms.

◆ computeMultiIndexHDMR()

int computeMultiIndexHDMR ( int ndim,
Array1D< int > & maxorders,
Array2D< int > & mindex )

Computes the multiindex set of a PC basis for HDMR truncation with a given dimensionality and maxorders array that contains maximal orders per interaction dimensionalities.

◆ computeMultiIndexT()

int computeMultiIndexT ( int ndim,
int norder,
int * mi )

Computes the multiindex set of a PC basis for Total-Order truncation with a given dimensionality and order Also, returns the number of terms. Note that here, the multiindex array pointer stores indices in column-major format, i.e. mi[j*ndim+i] holds the j-th index for dimension i.

◆ computeMultiIndexTP()

int computeMultiIndexTP ( Array1D< int > & maxorders,
Array2D< int > & mindex )

Computes the multiindex set of a PC basis for Tensor-Product truncation with a given maximum order per dimensionality Also, returns the number of terms.

◆ computeNPCTerms()

int computeNPCTerms ( int ndim,
int norder )

Computes the number of PC basis terms for Total-Order truncation with a given dimensionality and order.

Note
The formula is (ndim+norder)!/(ndim!norder!)

◆ computeNPCTermsHDMR()

int computeNPCTermsHDMR ( int ndim,
Array1D< int > & maxorders )

Computes the number of PC basis terms for HDMR truncation with a given dimensionality and maxorders array that contains maximal orders per interaction dimensionalities.

◆ decodeMindex()

void decodeMindex ( Array1D< Array2D< int > > & sp_mindex,
int ndim,
Array2D< int > & mindex )

Decode a multiindex set from a sparse format to a regular format.

Note
For encoding and for more details on the format, see encodeMindex function of PCSet class
See also
PCSet.h

◆ get_invmindex()

int get_invmindex ( Array1D< int > mi)

Given a single multiindex, this returns its relative position in the total-order multiindex set.

◆ get_invmindex_ord()

int get_invmindex_ord ( Array1D< int > mi)

Given a single multiindex, this returns its relative position in the total-order multiindex set among the bases of the same order.

◆ getOrders()

void getOrders ( Array2D< int > & mindex,
Array1D< int > & orders )

Given a multiindex set, it returns the orders of each basis term.

Note
Essentially, this function performs sums of each rows

◆ is_admis()

bool is_admis ( Array1D< int > & mindex_try,
Array2D< int > & mindex )

A boolean check to see if a new basis term is admissible or not.

◆ upOrder()

void upOrder ( Array2D< int > & mindex,
Array2D< int > & new_mindex )

Given a multiindex set it computes a new multiindex set where only 'admissible' bases are added.

Note
A new basis is admissible, if by subtracting one order from any of the dimensions with non-zero order, one never leaves the set of old multiindices