Tools for Polynomial Coefficient Handling


Defines

#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 int *powers)
 Implementation of the check whether a coefficient exists.
static bool fors_polynomial_powers_next (const cpl_polynomial *p, int *powers)
 Step the powers of a polynomials coefficient to the next.
int fors_polynomial_count_coeff (const cpl_polynomial *p)
 Count the total number of non-zero coefficients.
int fors_polynomial_powers_find_first_coeff (const cpl_polynomial *p, int *powers)
 Find the first non-zero coefficient.
int fors_polynomial_powers_find_next_coeff (const cpl_polynomial *p, int *powers)
 Find the next non-zero coefficient.
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.
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.
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.
char * fors_polynomial_sprint_coeff (const cpl_polynomial *p, int *powers, const char *prefix)
 Print a coefficient's name into a newly allocated string.

Define 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 int *  powers 
) [static]

Implementation of the check whether a coefficient exists.

Parameters:
p Polynomial
powers Integer 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,
int *  powers 
) [static]

Step the powers of a polynomials coefficient to the next.

Parameters:
p Polynomial
powers Integer 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:
p Polynomial
Returns:
Number

Definition at line 150 of file fors_polynomial.c.

References cleanup, fors_polynomial_is_coeff_set(), and fors_polynomial_powers_next().

Referenced by build_equations_lhs_matrix_from_poly(), fors_photometry_define_polyf(), fors_photometry_define_polyp(), fors_photometry_poly_new_from_coefficients(), and fors_polynomial_create_variance_polynomial().

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

Find the first non-zero coefficient.

Parameters:
p Polynomial
powers Integer 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 cleanup, fors_polynomial_is_coeff_set(), and fors_polynomial_powers_find_next_coeff().

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

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

Find the next non-zero coefficient.

Parameters:
p Polynomial
powers Integer 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 cleanup, fors_polynomial_is_coeff_set(), and fors_polynomial_powers_next().

Referenced by build_equations_lhs_matrix_from_poly(), 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:
p Polynomial
coeffs Array containing coefficient values
n_coeffs Size of coeffs array
Returns:
Number

Definition at line 277 of file fors_polynomial.c.

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

Referenced by fors_photometry_poly_new_from_coefficients().

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_def Polynomial definition (please read below)
cov_coeff Covariance 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 cleanup, fors_polynomial_count_coeff(), fors_polynomial_powers_find_first_coeff(), and fors_polynomial_powers_find_next_coeff().

Referenced by fors_photometry_poly_new_from_coefficients().

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:
p Polynomial
name (Optional) name, can be NULL
level Message 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 cleanup, and fors_polynomial_is_coeff_set().

Referenced by fors_photometry(), fors_photometry_define_polyf(), and fors_photometry_define_polyp().

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

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

Parameters:
p Polynomial
powers Integer 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:

Definition at line 563 of file fors_polynomial.c.

Referenced by build_equations_lhs_matrix_from_poly().


Generated on Fri Mar 4 09:46:01 2011 for FORS Pipeline Reference Manual by  doxygen 1.4.7