FORS Pipeline Reference Manual  5.0.9
Macros | Functions
Tools for Polynomial Coefficient Handling

Macros

#define cleanup
 
#define cleanup
 
#define cleanup
 
#define cleanup
 
#define cleanup
 
#define cleanup
 
#define cleanup
 
#define cleanup
 
#define cleanup
 

Functions

static bool fors_polynomial_is_coeff_set (const cpl_polynomial *p, const cpl_size *powers)
 Implementation of the check whether a coefficient exists. More...
 
static bool fors_polynomial_powers_next (const cpl_polynomial *p, cpl_size *powers)
 Step the powers of a polynomials coefficient to the next. More...
 
int fors_polynomial_count_coeff (const cpl_polynomial *p)
 Count the total number of non-zero coefficients. More...
 
int fors_polynomial_powers_find_first_coeff (const cpl_polynomial *p, cpl_size *powers)
 Find the first non-zero coefficient. More...
 
int fors_polynomial_powers_find_next_coeff (const cpl_polynomial *p, cpl_size *powers)
 Find the next non-zero coefficient. More...
 
cpl_error_code fors_polynomial_set_existing_coeff (cpl_polynomial *p, const double *coeffs, int n_coeffs)
 Set the already existing coefficients in a polynomial to values taken from an array. More...
 
cpl_polynomial * fors_polynomial_create_variance_polynomial (const cpl_polynomial *p_def, const cpl_matrix *cov_coeff)
 Create a polynomial modelling the squared influence of the error of the coefficients of another polynomial. More...
 
cpl_error_code fors_polynomial_dump (const cpl_polynomial *p, const char *name, cpl_msg_severity level, const cpl_polynomial *p_def)
 Count the total number of non-zero coefficients. More...
 
char * fors_polynomial_sprint_coeff (const cpl_polynomial *p, cpl_size *powers, const char *prefix)
 Print a coefficient's name into a newly allocated string. More...
 

Detailed Description

Macro Definition Documentation

#define cleanup
Value:
do { \
if (pows != NULL) \
cpl_free(pows); \
pows = NULL; \
} while (0)

Definition at line 544 of file fors_polynomial.c.

#define cleanup
Value:
do { \
if (pows != NULL) \
cpl_free(pows); \
pows = NULL; \
} while (0)

Definition at line 544 of file fors_polynomial.c.

#define cleanup
Value:
do { \
if (powersA != NULL) { cpl_free(powersA); powersA = NULL;} \
if (powersB != NULL) { cpl_free(powersB); powersB = NULL;} \
if (powersE != NULL) { cpl_free(powersE); powersE = NULL;} \
cpl_polynomial_delete(ep); ep = NULL; \
} while (0)

Definition at line 544 of file fors_polynomial.c.

#define cleanup
Value:
do { \
if (pows != NULL) \
cpl_free(pows); \
pows = NULL; \
if (ndxstr != NULL) \
cpl_free(ndxstr); \
ndxstr = NULL; \
} while (0)

Definition at line 544 of file fors_polynomial.c.

#define cleanup
Value:
do { \
if (ndxstr != NULL) \
cpl_free(ndxstr); \
ndxstr = NULL; \
} while (0)

Definition at line 544 of file fors_polynomial.c.

Function Documentation

static bool fors_polynomial_is_coeff_set ( const cpl_polynomial *  p,
const cpl_size *  powers 
)
static

Implementation of the check whether a coefficient exists.

Parameters
pPolynomial
powersInteger array (of the same dimension) containing the powers
Returns
1 if it exists, 0 otherwise or in the case of error

Definition at line 74 of file fors_polynomial.c.

Referenced by fors_polynomial_count_coeff(), fors_polynomial_dump(), fors_polynomial_powers_find_first_coeff(), and fors_polynomial_powers_find_next_coeff().

static bool fors_polynomial_powers_next ( const cpl_polynomial *  p,
cpl_size *  powers 
)
static

Step the powers of a polynomials coefficient to the next.

Parameters
pPolynomial
powersInteger array of the same dimensionality as p
Returns
"true" if overflow or error, otherwise "false" if success

Definition at line 98 of file fors_polynomial.c.

Referenced by fors_polynomial_count_coeff(), and fors_polynomial_powers_find_next_coeff().

int fors_polynomial_count_coeff ( const cpl_polynomial *  p)

Count the total number of non-zero coefficients.

Parameters
pPolynomial
Returns
Number

Definition at line 150 of file fors_polynomial.c.

References fors_polynomial_is_coeff_set(), and fors_polynomial_powers_next().

Referenced by fors_polynomial_create_variance_polynomial().

int fors_polynomial_powers_find_first_coeff ( const cpl_polynomial *  p,
cpl_size *  powers 
)

Find the first non-zero coefficient.

Parameters
pPolynomial
powersInteger array (of the same dimension) containing the powers
Returns
"true" if overflow or error, otherwise "false"

Definition at line 192 of file fors_polynomial.c.

References fors_polynomial_is_coeff_set(), and fors_polynomial_powers_find_next_coeff().

Referenced by fors_polynomial_create_variance_polynomial(), and fors_polynomial_set_existing_coeff().

int fors_polynomial_powers_find_next_coeff ( const cpl_polynomial *  p,
cpl_size *  powers 
)

Find the next non-zero coefficient.

Parameters
pPolynomial
powersInteger array (of the same dimension) containing the powers
Returns
"true" if overflow or error, otherwise "false"

Definition at line 232 of file fors_polynomial.c.

References fors_polynomial_is_coeff_set(), and fors_polynomial_powers_next().

Referenced by fors_polynomial_create_variance_polynomial(), fors_polynomial_powers_find_first_coeff(), and fors_polynomial_set_existing_coeff().

cpl_error_code fors_polynomial_set_existing_coeff ( cpl_polynomial *  p,
const double *  coeffs,
int  n_coeffs 
)

Set the already existing coefficients in a polynomial to values taken from an array.

Parameters
pPolynomial
coeffsArray containing coefficient values
n_coeffsSize of coeffs array
Returns
Number

Definition at line 277 of file fors_polynomial.c.

References fors_polynomial_powers_find_first_coeff(), and fors_polynomial_powers_find_next_coeff().

cpl_polynomial* fors_polynomial_create_variance_polynomial ( const cpl_polynomial *  p_def,
const cpl_matrix *  cov_coeff 
)

Create a polynomial modelling the squared influence of the error of the coefficients of another polynomial.

Parameters
p_defPolynomial definition (please read below)
cov_coeffCovariance matrix of the coefficients
Returns
The error polynomial, NULL in the case of error
Input Parameter Details:
  • p_def is a polynomial which is used as a definition of which coefficients are set, therefore:
  • the coefficients in p_def must be either zero (treated as non-existing) or significantly different from zero (currently checked against DBL_EPSILON),
  • cov_coeff must be square, and have as many columns as p_def has coefficients,
  • the entries of cov_coeff must refer to the coefficients of p_dev in the order of their occurrence, with the first dimension of p_dev as the fastest index.

Definition at line 356 of file fors_polynomial.c.

References fors_polynomial_count_coeff(), fors_polynomial_powers_find_first_coeff(), and fors_polynomial_powers_find_next_coeff().

cpl_error_code fors_polynomial_dump ( const cpl_polynomial *  p,
const char *  name,
cpl_msg_severity  level,
const cpl_polynomial *  p_def 
)

Count the total number of non-zero coefficients.

Parameters
pPolynomial
name(Optional) name, can be NULL
levelMessage level
p_def(Optional) polynomial definition, used to determine non-zero coefficients
Returns
CPL error code

Definition at line 465 of file fors_polynomial.c.

References fors_polynomial_is_coeff_set().

char* fors_polynomial_sprint_coeff ( const cpl_polynomial *  p,
cpl_size *  powers,
const char *  prefix 
)

Print a coefficient's name into a newly allocated string.

Parameters
pPolynomial
powersInteger array (of the same dimension) containing the powers
name(Optional) name prefix, can be NULL
Returns
Allocated string, NULL in the case of error

A coefficient is printed into a newly allocated string like following:

  • if prefix is NULL or empty, then in the format "%d,%d,%d,...,%d",
  • otherwise in the format "%s_%d,%d,...,%d", prefix, etc.

Definition at line 563 of file fors_polynomial.c.