Previous: , Up: Scalars & Intervals & Coefficients  

Coefficients (ap_coeff.h)

datatype: ap_coeff_discr_t
typedef enum ap_coeff_discr_t { AP_COEFF_SCALAR, AP_COEFF_INTERVAL }
ap_coeff_discr_t;

Discriminant indicating the underlying type of a coefficient.

datatype: ap_coeff_t
typedef struct ap_coeff_t {
  ap_coeff_discr_t discr;
  union {
    ap_scalar_t* scalar;
    ap_interval_t* interval;
  } val;
} ap_coeff_t;

A coefficient is either a scalar or an interval.


Next: , Previous: , Up: Coefficients  

Initializing coefficients

Function: void ap_coeff_alloc (ap_coeff_discr_t discr)

Allocate a coefficient, using discr to specify the type of coefficient (scalar or interval).

Function: void ap_coeff_free (ap_coeff_t* op)

Deallocate a coefficient.

Function: void ap_coeff_reinit (ap_coeff_t* op, ap_coeff_discr_t discr1, ap_scalar_discr_t discr2)

Changing the type of the coefficient and also the type of the underlting scalar(s).

Function: void ap_coeff_reduce (ap_coeff_t* op)

If the coefficient is an interval [a;a], convert it to a scalar. */

Function: void ap_coeff_init (ap_coeff_t* rop, ap_coeff_discr_t discr)
Function: void ap_coeff_init_set (ap_coeff_t* rop, ap_coeff_t* op)
Function: void ap_coeff_clear (ap_coeff_t* rop)

Initialize, initialize and assign, and clear a scalar \‘a la GMP (internal use).


Next: , Previous: , Up: Coefficients  

Assigning coefficients

Function: void ap_coeff_set (ap_coeff_t* rop, ap_coeff_t* op)

Set the value of rop from op.

Function: void ap_coeff_set_scalar (ap_coeff_t* rop, ap_scalar_t* op)
Function: void ap_coeff_set_scalar_mpq (ap_coeff_t* rop, mpq_t mpq)
Function: void ap_coeff_set_scalar_int (ap_coeff_t* rop, long int i)
Function: void ap_coeff_set_scalar_frac (ap_coeff_t* rop, long int i, unsigned long int j)
Function: void ap_coeff_set_scalar_double (ap_coeff_t* rop, double k)

Set the type of rop to scalar, and sets its value as the functions ap_scalar_set_XXX.

Function: void ap_coeff_set_interval (ap_coeff_t* rop, ap_interval_t* op)
Function: void ap_coeff_set_interval_scalar (ap_coeff_t* rop, ap_scalar_t* inf, ap_scalar_t* sup)
Function: void ap_coeff_set_interval_mpq (ap_coeff_t* rop, mpq_t inf, mpq_t sup)
Function: void ap_coeff_set_interval_int (ap_coeff_t* rop, int inf, int sup)
Function: void ap_coeff_set_interval_frac (ap_coeff_t* rop, int numinf, int deninf, int numsup, int densup)
Function: void ap_coeff_set_interval_double (ap_coeff_t* rop, double inf, double sup)

Set the type of rop to interval, and sets its value as the functions ap_interval_set_XXX.

Function: ap_coeff_t* ap_coeff_alloc_set (ap_coeff_t* op)
Function: ap_coeff_t* ap_coeff_alloc_set_scalar (ap_scalar_t* scalar)
Function: ap_coeff_t* ap_coeff_alloc_set_interval (ap_interval_t* interval)

Combined allocation and assignement.


Next: , Previous: , Up: Coefficients  

Comparing coefficients

Function: int ap_coeff_cmp (ap_coeff_t* op1, ap_coeff_t* op2)

Non-total comparison.

Function: bool ap_coeff_equal (ap_coeff_t* op1, ap_coeff_t* op2)

Equality test.

Function: bool ap_coeff_zero (ap_coeff_t* op)

Return true iff coeff is a zero scalar or an interval with zero bounds.


Previous: , Up: Coefficients  

Other operations on coefficients

Function: void ap_coeff_neg (ap_coeff_t* rop, ap_coeff_t* op)

Negation.

Function: void ap_coeff_swap (ap_coeff_t* op1, ap_coeff_t* op2)

Exchange the values of op1 and op2.

Function: int ap_coeff_hash (ap_coeff_t* op)

Return an hash code (for instance for OCaml interface).

Function: void ap_coeff_fprint (FILE* stream, ap_coeff_t* op)

Print op on the stream stream.


Previous: , Up: Coefficients