ParGeMSLR
Classes | Macros | Typedefs | Enumerations | Functions
utils.hpp File Reference

Basic ultility functions. More...

#include <stdio.h>
#include <cstdlib>
#include <utility>
#include <type_traits>
#include <ctype.h>
#include "complex.hpp"
#include <random>
#include <climits>
#include <cassert>

Go to the source code of this file.

Classes

class  pargemslr::PargemslrGlobalClass
 The data structure for parallel computing, including data structures for MPI and CUDA. More...
 
struct  pargemslr::PargemslrIsInteger< T >
 Tell if a value is integer. More...
 
struct  pargemslr::PargemslrIsInteger< const T >
 
struct  pargemslr::PargemslrIsInteger< volatile const T >
 
struct  pargemslr::PargemslrIsInteger< volatile T >
 
struct  pargemslr::PargemslrIsInteger< int >
 
struct  pargemslr::PargemslrIsInteger< long int >
 
struct  pargemslr::PargemslrIsDoublePrecision< T >
 Tell if a value is in double precision. More...
 
struct  pargemslr::PargemslrIsDoublePrecision< const T >
 
struct  pargemslr::PargemslrIsDoublePrecision< volatile const T >
 
struct  pargemslr::PargemslrIsDoublePrecision< volatile T >
 
struct  pargemslr::PargemslrIsDoublePrecision< double >
 
struct  pargemslr::PargemslrIsDoublePrecision< complexd >
 
struct  pargemslr::PargemslrIsParallel< T >
 Tell if a value is a parallel data structure. More...
 
struct  pargemslr::PargemslrIsParallel< const T >
 
struct  pargemslr::PargemslrIsParallel< volatile const T >
 
struct  pargemslr::CompareStruct< T >
 The struct of for sorting. More...
 
struct  pargemslr::CompareStructGreater< T >
 The operator > for CompareStruct. More...
 
struct  pargemslr::CompareStructLess< T >
 The operator < for CompareStruct. More...
 

Macros

#define PARGEMSLR_FIRM_CHKERR(ierr)   {{if(ierr){printf("Err value: %d on MPI rank %d\n",ierr, parallel_log::_grank);assert(!(ierr));};}}
 
#define PARGEMSLR_ERROR(message)   {printf("Error: %s on MPI rank %d\n", message, parallel_log::_grank);}
 
#define PARGEMSLR_CHKERR(ierr)   {;}
 
#define PARGEMSLR_PRINT_DEBUG(conda, condb, ...)   {;}
 
#define PARGEMSLR_WARNING(message)   {printf("Warning: %s on MPI rank %d\n", message, parallel_log::_grank);}
 
#define PARGEMSLR_PRINT(...)   fprintf(pargemslr::pargemslr_global::_out_file, __VA_ARGS__);
 
#define PARGEMSLR_SUCCESS   0
 
#define PARGEMSLR_RETURN_METIS_INSUFFICIENT_NDOM   1
 
#define PARGEMSLR_RETURN_METIS_NO_INTERIOR   2
 
#define PARGEMSLR_RETURN_METIS_PROBLEM_TOO_SMALL   3
 
#define PARGEMSLR_RETURN_PARILU_NO_INTERIOR   10
 
#define PARGEMSLR_ERROR_INVALED_OPTION   100
 
#define PARGEMSLR_ERROR_INVALED_PARAM   101
 
#define PARGEMSLR_ERROR_IO_ERROR   102
 
#define PARGEMSLR_ERROR_ILU_EMPTY_ROW   103
 
#define PARGEMSLR_ERROR_DOUBLE_INIT_FREE   104
 
#define PARGEMSLR_ERROR_COMPILER   105
 
#define PARGEMSLR_ERROR_FUNCTION_CALL_ERR   106
 
#define PARGEMSLR_ERROR_MEMORY_LOCATION   107
 
#define PARGEMSLR_CAST(type, val)   reinterpret_cast<type>((val))
 
#define PARGEMSLR_IO_SIZE   180
 
#define PARGEMSLR_IO_PRECOND_GLOBAL_PRECOND   0
 
#define PARGEMSLR_IO_PRECOND_LOCAL_REPCOND1   1
 
#define PARGEMSLR_IO_PRECOND_LOCAL_REPCOND1_LEVEL   2
 
#define PARGEMSLR_IO_PRECOND_LOCAL_REPCOND2   3
 
#define PARGEMSLR_IO_PRECOND_LOCAL_REPCOND3   4
 
#define PARGEMSLR_IO_PRECOND_LOCAL_SMOOTHER1   5
 
#define PARGEMSLR_IO_SOLVER_OPTION   10
 
#define PARGEMSLR_IO_SOLVER_KDIM   11
 
#define PARGEMSLR_IO_SOLVER_MAXITS   12
 
#define PARGEMSLR_IO_SOLVER_TOL   13
 
#define PARGEMSLR_IO_SOLVER_ATOL   14
 
#define PARGEMSLR_IO_PREPOSS_NLEV_GLOBAL   20
 
#define PARGEMSLR_IO_PREPOSS_NLEV_LOCAL   21
 
#define PARGEMSLR_IO_PREPOSS_NCOMP_GLOBAL   22
 
#define PARGEMSLR_IO_PREPOSS_NCOMP_LOCAL   23
 
#define PARGEMSLR_IO_PREPOSS_PARTITION_GLOBAL   24
 
#define PARGEMSLR_IO_PREPOSS_PARTITION_LOCAL   25
 
#define PARGEMSLR_IO_PREPOSS_MINSEP   26
 
#define PARGEMSLR_IO_PREPOSS_KMIN_GLOBAL   27
 
#define PARGEMSLR_IO_PREPOSS_KMIN_LOCAL   28
 
#define PARGEMSLR_IO_PREPOSS_KFACTOR_GLOBAL   29
 
#define PARGEMSLR_IO_PREPOSS_KFACTOR_LOCAL   30
 
#define PARGEMSLR_IO_PREPOSS_VTXSEP_GLOBAL   31
 
#define PARGEMSLR_IO_PREPOSS_VTXSEP_LOCAL   32
 
#define PARGEMSLR_IO_PREPOSS_METIS_REFINE   33
 
#define PARGEMSLR_IO_PREPOSS_GLOBAL_PARTITION   34
 
#define PARGEMSLR_IO_ILU_DROPTOL_B_GLOBAL   40
 
#define PARGEMSLR_IO_ILU_DROPTOL_B_LOCAL   41
 
#define PARGEMSLR_IO_ILU_DROPTOL_EF_GLOBAL   42
 
#define PARGEMSLR_IO_ILU_DROPTOL_EF_LOCAL   43
 
#define PARGEMSLR_IO_ILU_DROPTOL_C_GLOBAL   44
 
#define PARGEMSLR_IO_ILU_DROPTOL_C_LOCAL   45
 
#define PARGEMSLR_IO_ILU_DROPTOL_S_GLOBAL   46
 
#define PARGEMSLR_IO_ILU_DROPTOL_S_LOCAL   47
 
#define PARGEMSLR_IO_ILU_ROWNNZ_B_GLOBAL   48
 
#define PARGEMSLR_IO_ILU_ROWNNZ_B_LOCAL   49
 
#define PARGEMSLR_IO_ILU_ROWNNZ_C_GLOBAL   50
 
#define PARGEMSLR_IO_ILU_ROWNNZ_C_LOCAL   51
 
#define PARGEMSLR_IO_ILU_LFIL_B_GLOBAL   52
 
#define PARGEMSLR_IO_ILU_LFIL_B_LOCAL   53
 
#define PARGEMSLR_IO_ILU_LFIL_C_GLOBAL   54
 
#define PARGEMSLR_IO_ILU_LFIL_C_LOCAL   55
 
#define PARGEMSLR_IO_ILU_ROWNNZ_S_GLOBAL   56
 
#define PARGEMSLR_IO_ILU_ROWNNZ_S_LOCAL   57
 
#define PARGEMSLR_IO_ILU_PERM_OPTION_GLOBAL   58
 
#define PARGEMSLR_IO_ILU_PERM_OPTION_LOCAL   59
 
#define PARGEMSLR_IO_ILU_OMP_OPTION_GLOBAL   60
 
#define PARGEMSLR_IO_ILU_OMP_OPTION_LOCAL   61
 
#define PARGEMSLR_IO_LR_ARNOLDI_OPTION1_GLOBAL   70
 
#define PARGEMSLR_IO_LR_ARNOLDI_OPTION2_GLOBAL   71
 
#define PARGEMSLR_IO_LR_ARNOLDI_OPTION1_LOCAL   72
 
#define PARGEMSLR_IO_LR_ARNOLDI_OPTION2_LOCAL   73
 
#define PARGEMSLR_IO_LR_RANK1_GLOBAL   74
 
#define PARGEMSLR_IO_LR_RANK2_GLOBAL   75
 
#define PARGEMSLR_IO_LR_RANK1_LOCAL   76
 
#define PARGEMSLR_IO_LR_RANK2_LOCAL   77
 
#define PARGEMSLR_IO_LR_RANK_FACTOR1_GLOBAL   78
 
#define PARGEMSLR_IO_LR_RANK_FACTOR2_GLOBAL   79
 
#define PARGEMSLR_IO_LR_RANK_FACTOR1_LOCAL   80
 
#define PARGEMSLR_IO_LR_RANK_FACTOR2_LOCAL   81
 
#define PARGEMSLR_IO_LR_ARNOLDI_FACTOR1_GLOBAL   82
 
#define PARGEMSLR_IO_LR_ARNOLDI_FACTOR2_GLOBAL   83
 
#define PARGEMSLR_IO_LR_ARNOLDI_FACTOR1_LOCAL   84
 
#define PARGEMSLR_IO_LR_ARNOLDI_FACTOR2_LOCAL   85
 
#define PARGEMSLR_IO_LR_TOL_EIG1_GLOBAL   86
 
#define PARGEMSLR_IO_LR_TOL_EIG2_GLOBAL   87
 
#define PARGEMSLR_IO_LR_TOL_EIG1_LOCAL   88
 
#define PARGEMSLR_IO_LR_TOL_EIG2_LOCAL   89
 
#define PARGEMSLR_IO_LR_MAXITS1_GLOBAL   90
 
#define PARGEMSLR_IO_LR_MAXITS2_GLOBAL   91
 
#define PARGEMSLR_IO_LR_MAXITS1_LOCAL   92
 
#define PARGEMSLR_IO_LR_MAXITS2_LOCAL   93
 
#define PARGEMSLR_IO_LR_TR_FACTOR   94
 
#define PARGEMSLR_IO_LR_TOL_ORTH   95
 
#define PARGEMSLR_IO_LR_TOL_REORTH   96
 
#define PARGEMSLR_IO_LR_RAND_INIT_GUESS   97
 
#define PARGEMSLR_IO_LR_RANK_C_NITER   98
 
#define PARGEMSLR_IO_LR_ARNOLDI_OPTIONA   99
 
#define PARGEMSLR_IO_LR_RANK_A   100
 
#define PARGEMSLR_IO_LR_RANK_FACTORA   101
 
#define PARGEMSLR_IO_LR_ARNOLDI_FACTORA   102
 
#define PARGEMSLR_IO_LR_TOL_EIGA   103
 
#define PARGEMSLR_IO_LR_MAXITSA   104
 
#define PARGEMSLR_IO_SCHUR_ENABLE   130
 
#define PARGEMSLR_IO_SCHUR_ITER_TOL   131
 
#define PARGEMSLR_IO_SCHUR_MAXITS   132
 
#define PARGEMSLR_IO_ADVANCED_DIAG_SHIFT   140
 
#define PARGEMSLR_IO_ADVANCED_GLOBAL_SOLVE   141
 
#define PARGEMSLR_IO_ADVANCED_USE_COMPLEX_SHIFT   142
 
#define PARGEMSLR_IO_ADVANCED_RESIDUAL_ITERS   143
 
#define PARGEMSLR_IO_ADVANCED_GRAM_SCHMIDT   144
 
#define PARGEMSLR_IO_ADVANCED_DIAG_SHIFT_MODIFIED   145
 
#define PARGEMSLR_IO_GENERAL_PRINT_LEVEL   150
 
#define PARGEMSLR_IO_POLY_ORDER   160
 
#define PARGEMSLR_IO_PARALLEL_NPROCX   170
 
#define PARGEMSLR_IO_PARALLEL_NPROCY   171
 
#define PARGEMSLR_IO_PARALLEL_NPROCZ   172
 
#define PARGEMSLR_IO_PARALLEL_NDOMX   173
 
#define PARGEMSLR_IO_PARALLEL_NDOMY   174
 
#define PARGEMSLR_IO_PARALLEL_NDOMZ   175
 

Typedefs

typedef class pargemslr::PargemslrGlobalClass pargemslr::pargemslr_global
 The data structure for parallel computing, including data structures for MPI and CUDA. More...
 
typedef CompareStruct< int > pargemslr::compareord_int
 
typedef CompareStruct< long int > pargemslr::compareord_long
 
typedef CompareStruct< float > pargemslr::compareord_float
 
typedef CompareStruct< double > pargemslr::compareord_double
 

Enumerations

enum  pargemslr::PrecisionEnum {
  kUnknownPrecision = -1, kInt, kLongInt, kHalfReal,
  kHalfComplex, kSingleReal, kSingleComplex, kDoubleReal,
  kDoubleComplex
}
 The precision enum. More...
 

Functions

double * pargemslr::PargemslrSetDefaultParameterArray (double *params)
 Set the default parameter array. More...
 
template<typename T >
pargemslr::PargemslrMax (T a, T b)
 Get the larger one out of two numbers. More...
 
template<typename T >
pargemslr::PargemslrMin (T a, T b)
 Get the smaller one out of two numbers. More...
 
template<typename T >
std::enable_if<!PargemslrIsComplex< T >::value, T >::type pargemslr::PargemslrAbs (const T &a)
 Get the absolute value of a numbers. More...
 
float pargemslr::PargemslrAbs (const complexs &a)
 Get the absolute value of a numbers. More...
 
double pargemslr::PargemslrAbs (const complexd &a)
 Get the absolute value of a numbers. More...
 
template<typename T >
std::enable_if<!PargemslrIsComplex< T >::value, T >::type pargemslr::PargemslrReal (const T &a)
 Get the real part of a numbers. More...
 
float pargemslr::PargemslrReal (const complexs &a)
 Get the real part of a numbers. More...
 
double pargemslr::PargemslrReal (const complexd &a)
 Get the real part of a numbers. More...
 
template<typename T >
std::enable_if<!PargemslrIsComplex< T >::value, T >::type pargemslr::PargemslrConj (const T &a)
 Get the conjugate of a numbers, for real value we do nothing. More...
 
template<typename T >
std::enable_if< PargemslrIsComplex< T >::value, T >::type pargemslr::PargemslrConj (const T &a)
 Get the conjugate of a numbers, for real value we do nothing. More...
 
template<typename T >
std::enable_if< PargemslrIsInteger< T >::value, int >::type pargemslr::PargemslrValueRandHost (T &a)
 Generate random integer number at host memory. More...
 
template<typename T >
std::enable_if< PargemslrIsReal< T >::value, int >::type pargemslr::PargemslrValueRandHost (T &a)
 Generate random float number between [0, 1] at host memory. More...
 
template<typename T >
std::enable_if< PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrValueRandHost (T &a)
 Generate random single complex number, real and imag part both between [0, 1] at host memory. More...
 
int pargemslr::PargemslrPrintSpace (int width)
 Print spaces using cout. More...
 
int pargemslr::PargemslrPrintDashLine (int width)
 Print a dash line using cout. More...
 
template<typename T >
std::enable_if< PargemslrIsInteger< T >::value, int >::type pargemslr::PargemslrPrintValueHost (T val, int width)
 Print a integer value, fixed width. More...
 
template<typename T >
std::enable_if< PargemslrIsReal< T >::value, int >::type pargemslr::PargemslrPrintValueHost (T val, int width)
 Print a real value, fixed width. More...
 
template<typename T >
std::enable_if< PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrPrintValueHost (T val, int width)
 Print a complex value, fixed width. More...
 
void pargemslr::PargemslrReadFirstWord (char *pin, char **pout)
 Read the first word from a input string, convert to upper case. More...
 
int pargemslr::PargemslrReadInputArg (const char *argname, int amount, float *val, int argc, char **argv)
 Read input data. If we want to find "xxx", the user input should be "-xxx". More...
 
int pargemslr::PargemslrReadInputArg (const char *argname, int amount, double *val, int argc, char **argv)
 Read input data. If we want to find "xxx", the user input should be "-xxx". More...
 
int pargemslr::PargemslrReadInputArg (const char *argname, int amount, complexs *val, int argc, char **argv)
 Read input data. If we want to find "xxx", the user input should be "-xxx". More...
 
int pargemslr::PargemslrReadInputArg (const char *argname, int amount, complexd *val, int argc, char **argv)
 Read input data. If we want to find "xxx", the user input should be "-xxx". More...
 
int pargemslr::PargemslrReadInputArg (const char *argname, int amount, int *val, int argc, char **argv)
 Read input data. If we want to find "xxx", the user input should be "-xxx". More...
 
int pargemslr::PargemslrReadInputArg (const char *argname, char *val, int argc, char **argv)
 Read input data. If we want to find "xxx", the user input should be "-xxx". More...
 
int pargemslr::PargemslrReadInputArg (const char *argname, bool *val, int argc, char **argv)
 Read input data. If we want to find "xxx", the user input should be "-xxx". More...
 
int pargemslr::PargemslrReadInputArg (const char *argname, int argc, char **argv)
 Check if we have an argument. If we want to find "xxx", the user input should be "-xxx". More...
 
template<typename T >
std::enable_if<!(PargemslrIsComplex< T >::value), int >::type pargemslr::PargemslrPlotData (T *ydata, int length, int numx, int numy)
 Plot the data to the terminal output. More...
 
template<typename T >
std::enable_if< PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrPlotData (T *ydata, int length, int numx, int numy)
 Plot the data to the terminal output. More...
 
int pargemslr::PargemslrSetOutputFile (const char *filename)
 Set output file of PARGEMSLR_PTINT. More...
 

Typedef Documentation

◆ pargemslr_global

The data structure for parallel computing, including data structures for MPI and CUDA.
All CUDA information are shared, local MPI information can be different.

Enumeration Type Documentation

◆ PrecisionEnum

The precision enum.

Function Documentation

◆ PargemslrAbs() [1/3]

double pargemslr::PargemslrAbs ( const complexd a)

Get the absolute value of a numbers.

Parameters
[in]aThe value.
Returns
Return the absolute value.

◆ PargemslrAbs() [2/3]

float pargemslr::PargemslrAbs ( const complexs a)

Get the absolute value of a numbers.

Parameters
[in]aThe value.
Returns
Return the absolute value.

◆ PargemslrAbs() [3/3]

template<typename T >
std::enable_if<!PargemslrIsComplex< T >::value, T >::type pargemslr::PargemslrAbs ( const T &  a)

Get the absolute value of a numbers.

Parameters
[in]aThe value.
Returns
Return the absolute value.

◆ PargemslrConj() [1/2]

template<typename T >
std::enable_if<!PargemslrIsComplex< T >::value, T >::type pargemslr::PargemslrConj ( const T &  a)

Get the conjugate of a numbers, for real value we do nothing.

Parameters
[in]aThe value.
Returns
Return the conjugate.

◆ PargemslrConj() [2/2]

template<typename T >
std::enable_if< PargemslrIsComplex< T >::value, T >::type pargemslr::PargemslrConj ( const T &  a)

Get the conjugate of a numbers, for real value we do nothing.

Parameters
[in]aThe value.
Returns
Return the conjugate.

◆ PargemslrMax()

template<typename T >
T pargemslr::PargemslrMax ( a,
b 
)

Get the larger one out of two numbers.

Parameters
[in]aFirst value.
[in]bSecond value.
Returns
Return the larger value.

◆ PargemslrMin()

template<typename T >
T pargemslr::PargemslrMin ( a,
b 
)

Get the smaller one out of two numbers.

Parameters
[in]aFirst value.
[in]bSecond value.
Returns
Return the smaller value.

◆ PargemslrPlotData() [1/2]

template<typename T >
std::enable_if<!(PargemslrIsComplex< T >::value), int >::type pargemslr::PargemslrPlotData ( T *  ydata,
int  length,
int  numx,
int  numy 
)

Plot the data to the terminal output.

Parameters
[in]dataThe data.
[in]lengthlength of the data.
[in]numxthe number of grids on x.
[in]numxthe number of grids on y.
Returns
Return error message.

◆ PargemslrPlotData() [2/2]

template<typename T >
std::enable_if< PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrPlotData ( T *  ydata,
int  length,
int  numx,
int  numy 
)

Plot the data to the terminal output.

Parameters
[in]argnameThe target argument.
[in]argcFrom the main function.
[in]argvFrom the main function.
Returns
Return error message.

◆ PargemslrPrintDashLine()

int pargemslr::PargemslrPrintDashLine ( int  width)

Print a dash line using cout.

Parameters
[in]widthThe width of the line.
Returns
Return error message.

◆ PargemslrPrintSpace()

int pargemslr::PargemslrPrintSpace ( int  width)

Print spaces using cout.

Parameters
[in]widthThe width of the space.
Returns
Return error message.

◆ PargemslrPrintValueHost() [1/3]

template<typename T >
std::enable_if< PargemslrIsInteger< T >::value, int >::type pargemslr::PargemslrPrintValueHost ( val,
int  width 
)

Print a integer value, fixed width.

Parameters
[in]valThe value.
[in]widthThe width of the value.
Returns
Return error message.

◆ PargemslrPrintValueHost() [2/3]

template<typename T >
std::enable_if< PargemslrIsReal< T >::value, int >::type pargemslr::PargemslrPrintValueHost ( val,
int  width 
)

Print a real value, fixed width.

Parameters
[in]valThe value.
[in]widthThe width of the value.
Returns
Return error message.

◆ PargemslrPrintValueHost() [3/3]

template<typename T >
std::enable_if< PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrPrintValueHost ( val,
int  width 
)

Print a complex value, fixed width.

Parameters
[in]valThe value.
[in]widthThe width of the value.
Returns
Return error message.

◆ PargemslrReadFirstWord()

void pargemslr::PargemslrReadFirstWord ( char *  pin,
char **  pout 
)

Read the first word from a input string, convert to upper case.

Parameters
[in]pinThe input char*.
[out]poutThe output char**.

◆ PargemslrReadInputArg() [1/8]

int pargemslr::PargemslrReadInputArg ( const char *  argname,
bool *  val,
int  argc,
char **  argv 
)

Read input data. If we want to find "xxx", the user input should be "-xxx".

Parameters
[in]argnameThe target argument.
[in]valThe output value.
[in]argcFrom the main function.
[in]argvFrom the main function.
Returns
Return 1 when find the data, 0 otherwise.

◆ PargemslrReadInputArg() [2/8]

int pargemslr::PargemslrReadInputArg ( const char *  argname,
char *  val,
int  argc,
char **  argv 
)

Read input data. If we want to find "xxx", the user input should be "-xxx".

Parameters
[in]argnameThe target argument.
[in]valThe output value.
[in]argcFrom the main function.
[in]argvFrom the main function.
Returns
Return 1 when find the data, 0 otherwise.

◆ PargemslrReadInputArg() [3/8]

int pargemslr::PargemslrReadInputArg ( const char *  argname,
int  amount,
complexd val,
int  argc,
char **  argv 
)

Read input data. If we want to find "xxx", the user input should be "-xxx".

Parameters
[in]argnameThe target argument.
[in]amountnumber of data we load after "-xxx".
[in]valThe output value.
[in]argcFrom the main function.
[in]argvFrom the main function.
Returns
Return 1 when find the data, 0 otherwise.

◆ PargemslrReadInputArg() [4/8]

int pargemslr::PargemslrReadInputArg ( const char *  argname,
int  amount,
complexs val,
int  argc,
char **  argv 
)

Read input data. If we want to find "xxx", the user input should be "-xxx".

Parameters
[in]argnameThe target argument.
[in]amountnumber of data we load after "-xxx".
[in]valThe output value.
[in]argcFrom the main function.
[in]argvFrom the main function.
Returns
Return 1 when find the data, 0 otherwise.

◆ PargemslrReadInputArg() [5/8]

int pargemslr::PargemslrReadInputArg ( const char *  argname,
int  amount,
double *  val,
int  argc,
char **  argv 
)

Read input data. If we want to find "xxx", the user input should be "-xxx".

Parameters
[in]argnameThe target argument.
[in]amountnumber of data we load after "-xxx".
[in]valThe output value.
[in]argcFrom the main function.
[in]argvFrom the main function.
Returns
Return 1 when find the data, 0 otherwise.

◆ PargemslrReadInputArg() [6/8]

int pargemslr::PargemslrReadInputArg ( const char *  argname,
int  amount,
float *  val,
int  argc,
char **  argv 
)

Read input data. If we want to find "xxx", the user input should be "-xxx".

Parameters
[in]argnameThe target argument.
[in]amountnumber of data we load after "-xxx".
[in]valThe output value.
[in]argcFrom the main function.
[in]argvFrom the main function.
Returns
Return 1 when find the data, 0 otherwise.

◆ PargemslrReadInputArg() [7/8]

int pargemslr::PargemslrReadInputArg ( const char *  argname,
int  amount,
int *  val,
int  argc,
char **  argv 
)

Read input data. If we want to find "xxx", the user input should be "-xxx".

Parameters
[in]argnameThe target argument.
[in]amountnumber of data we load after "-xxx".
[in]valThe output value.
[in]argcFrom the main function.
[in]argvFrom the main function.
Returns
Return 1 when find the data, 0 otherwise.

◆ PargemslrReadInputArg() [8/8]

int pargemslr::PargemslrReadInputArg ( const char *  argname,
int  argc,
char **  argv 
)

Check if we have an argument. If we want to find "xxx", the user input should be "-xxx".

Parameters
[in]argnameThe target argument.
[in]argcFrom the main function.
[in]argvFrom the main function.
Returns
Return 1 when find the data, 0 otherwise.

◆ PargemslrReal() [1/3]

double pargemslr::PargemslrReal ( const complexd a)

Get the real part of a numbers.

Parameters
[in]aThe value.
Returns
Return the real part value.

◆ PargemslrReal() [2/3]

float pargemslr::PargemslrReal ( const complexs a)

Get the real part of a numbers.

Parameters
[in]aThe value.
Returns
Return the real part value.

◆ PargemslrReal() [3/3]

template<typename T >
std::enable_if<!PargemslrIsComplex< T >::value, T >::type pargemslr::PargemslrReal ( const T &  a)

Get the real part value of a numbers.

Parameters
[in]aThe value.
Returns
Return the real part value.

◆ PargemslrSetDefaultParameterArray()

double * pargemslr::PargemslrSetDefaultParameterArray ( double *  params)

Set the default parameter array.

Parameters
[in]paramsThe parameter array, memroy should be allocated.
Returns
Return this array.

◆ PargemslrSetOutputFile()

int pargemslr::PargemslrSetOutputFile ( const char *  filename)

Set output file of PARGEMSLR_PTINT.

Parameters
[in]filenameThe pointer of the file.
Returns
Return error message.

◆ PargemslrValueRandHost() [1/3]

template<typename T >
std::enable_if< PargemslrIsInteger< T >::value, int >::type pargemslr::PargemslrValueRandHost ( T &  a)

Generate random integer number at host memory.

Parameters
[out]aThe random value.
Returns
Return error message.

◆ PargemslrValueRandHost() [2/3]

template<typename T >
std::enable_if< PargemslrIsReal< T >::value, int >::type pargemslr::PargemslrValueRandHost ( T &  a)

Generate random float number between [0, 1] at host memory.

Parameters
[out]aThe random value.
Returns
Return error message.

◆ PargemslrValueRandHost() [3/3]

template<typename T >
std::enable_if< PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrValueRandHost ( T &  a)

Generate random single complex number, real and imag part both between [0, 1] at host memory.

Parameters
[out]aThe random value.
Returns
Return error message.