Triumvirate C++ API 0.5.0
Three-point clustering measurements in large-scale structure analyses.
Loading...
Searching...
No Matches
trv::array Namespace Reference

Enumerations

enum  ExtrapOption {
  NONE = 0 , ZERO = 1 , PAD = 2 , LIN = 3 ,
  LOGLIN = 4
}
 Extrapolation scheme. More...
 

Functions

template<typename T >
bool check_isclose (const std::vector< T > &arr, const T val, T atol=1.e-8, T rtol=1.e-5)
 Check if all elements of a 1-d array are close to a given value.
 
int check_1d_array (std::vector< double > &a, bool check_lin, bool check_loglin, bool check_sign)
 Check the linearity or log-linearity of a 1-d array.
 
void extrap_lin (std::vector< double > &a, int N_ext, std::vector< double > &a_ext)
 Extrapolate a 1-d array linearly.
 
void extrap_loglin (std::vector< double > &a, int N_ext, std::vector< double > &a_ext)
 Extrapolate a 1-d array exponentially (i.e. log-linearly).
 
void extrap_pad (std::vector< double > &a, int N_ext, double c_lower, double c_upper, std::vector< double > &a_ext)
 Extrapolate a 1-d array by constant padding.
 
void extrap2d_lin (std::vector< std::vector< double > > &a, int N_row_ext, int N_col_ext, std::vector< std::vector< double > > &a_ext)
 Extrapolate a 2-d array bi-linearly.
 
void extrap2d_loglin (std::vector< std::vector< double > > &a, int N_row_ext, int N_col_ext, std::vector< std::vector< double > > &a_ext)
 Extrapolate a 2-d array bi-exponentially (i.e. log-bilinearly).
 
void extrap2d_pad (std::vector< std::vector< double > > &a, int N_row_ext, int N_col_ext, double c_row_lower, double c_row_upper, double c_col_lower, double c_col_upper, std::vector< std::vector< double > > &a_ext)
 Extrapolate a 2-d array by constant padding.
 
std::vector< int > get_sorted_indices (std::vector< int > sorting_vector)
 Get the sorted indices.
 

Enumeration Type Documentation

◆ ExtrapOption

Extrapolation scheme.

Enumerator
NONE 

0: none

ZERO 

1: zero

PAD 

2: pad

LIN 

3: linear

LOGLIN 

4: log-linear

Definition at line 83 of file arrayops.hpp.

Function Documentation

◆ check_isclose()

template<typename T >
bool trv::array::check_isclose ( const std::vector< T > & arr,
const T val,
T atol = 1.e-8,
T rtol = 1.e-5 )

Check if all elements of a 1-d array are close to a given value.

Template Parameters
TA typename.
Parameters
arr1-d array as a vector.
valValue to check against.
atolAbsolute tolerance (default is 1.e-8).
rtolRelative tolerance (default is 1.e-5).
Returns
true if all elements are close to val, false otherwise.

Definition at line 103 of file arrayops.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_1d_array()

int trv::array::check_1d_array ( std::vector< double > & a,
bool check_lin,
bool check_loglin,
bool check_sign )

Check the linearity or log-linearity of a 1-d array.

Parameters
a1-d array as a vector.
check_linIf true, check linearity.
check_loglinIf true, check log-linearity. This also checks for any sign change or zeros.
check_signIf true, check for any sign change or zeros.
Returns
0 if no check fails, 1 if linearity check fails, 2 if log-linearity check fails, or 3 if sign check fails.

Definition at line 58 of file arrayops.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ extrap_lin()

void trv::array::extrap_lin ( std::vector< double > & a,
int N_ext,
std::vector< double > & a_ext )

Extrapolate a 1-d array linearly.

Parameters
[in]a1-d array as a vector.
[in]N_extNumber of extra elements on either side.
[out]a_extExtrapolated 1-d array.

Definition at line 92 of file arrayops.cpp.

+ Here is the caller graph for this function:

◆ extrap_loglin()

void trv::array::extrap_loglin ( std::vector< double > & a,
int N_ext,
std::vector< double > & a_ext )

Extrapolate a 1-d array exponentially (i.e. log-linearly).

Parameters
[in]a1-d array as a vector.
[in]N_extNumber of extra elements on either side.
[out]a_extExtrapolated 1-d array.

Definition at line 121 of file arrayops.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ extrap_pad()

void trv::array::extrap_pad ( std::vector< double > & a,
int N_ext,
double c_lower,
double c_upper,
std::vector< double > & a_ext )

Extrapolate a 1-d array by constant padding.

Parameters
[in]a1-d array as a vector.
[in]N_extNumber of extra elements on either side.
[in]c_lowerLower-end padding constant.
[in]c_upperUpper-end padding constant.
[out]a_extExtrapolated 1-d array.

Definition at line 180 of file arrayops.cpp.

+ Here is the caller graph for this function:

◆ extrap2d_lin()

void trv::array::extrap2d_lin ( std::vector< std::vector< double > > & a,
int N_row_ext,
int N_col_ext,
std::vector< std::vector< double > > & a_ext )

Extrapolate a 2-d array bi-linearly.

Parameters
[in]a2-d array.
[in]N_row_extNumber of extra elements on either side of each row.
[in]N_col_extNumber of extra elements on either side of each column.
[out]a_extExtrapolated 2-d array.

Definition at line 203 of file arrayops.cpp.

◆ extrap2d_loglin()

void trv::array::extrap2d_loglin ( std::vector< std::vector< double > > & a,
int N_row_ext,
int N_col_ext,
std::vector< std::vector< double > > & a_ext )

Extrapolate a 2-d array bi-exponentially (i.e. log-bilinearly).

Parameters
[in]a2-d array.
[in]N_row_extNumber of extra elements on either side of each row.
[in]N_col_extNumber of extra elements on either side of each column.
[out]a_extExtrapolated 2-d array.

Definition at line 214 of file arrayops.cpp.

◆ extrap2d_pad()

void trv::array::extrap2d_pad ( std::vector< std::vector< double > > & a,
int N_row_ext,
int N_col_ext,
double c_row_lower,
double c_row_upper,
double c_col_lower,
double c_col_upper,
std::vector< std::vector< double > > & a_ext )

Extrapolate a 2-d array by constant padding.

Parameters
[in]a2-d array.
[in]N_row_extNumber of extra elements on either side of each row.
[in]N_col_extNumber of extra elements on either side of each column.
[in]c_row_lowerLower-end padding constant for each row.
[in]c_row_upperUpper-end padding constant for each row.
[in]c_col_lowerLower-end padding constant for each column.
[in]c_col_upperUpper-end padding constant for each column.
[out]a_extExtrapolated 2-d array.

Definition at line 225 of file arrayops.cpp.

◆ get_sorted_indices()

std::vector< int > trv::array::get_sorted_indices ( std::vector< int > sorting_vector)

Get the sorted indices.

Parameters
sorting_vectorSorting vector.
Returns
Sorted indices.

Definition at line 243 of file arrayops.cpp.