#include <stdio.h>
#include "pslib.h"

#define ORDER 3
#define BAD 1

int main(int argc, char **argv)
{
    psPolynomial1D *poly = psPolynomial1DAlloc(ORDER, PS_POLYNOMIAL_ORD);

    for (int i = 0; i < poly->n; i++) {
	poly->coeff[i] = (float)i;
	if (i == BAD) {
	    poly->mask[i] = 1;	// Don't use this coefficient!
	} else {
	    poly->mask[i] = 0;
	}
    }

    fprintf(stderr,"Value using mask: %f\n", psPolynomial1DEval(0.5, poly));

    // A different method of doing the same thing
    poly->coeff[BAD] = 0.0;		// Set coefficient to zero instead of masking
    poly->mask[BAD] = 0;		// Use this coefficient

    fprintf(stderr,"Value using coefficient zeroing: %f\n", psPolynomial1DEval(0.5, poly));

    psFree(poly);

    exit(EXIT_SUCCESS);
}
