Example #1
0
KernelEstimator::KernelEstimator(double precision) {

    mValues = double_array(50);
    mWeights = double_array(50);
    mNumValues = 0;
    mSumOfWeights = 0;
    mAllWeightsOne = true;
    mPrecision = precision;
    // precision cannot be zero
    if (mPrecision < Utils::SMALL) {
        mPrecision = Utils::SMALL;
    }
    //    mStandardDev = 1e10 * mPrecision; // Set the standard deviation initially very wide
    mStandardDev = mPrecision / (2 * 3);
}
Example #2
0
void populate_pool(struct bitmap_file original,
		struct pixel current,
		struct pixel **pool,
		size_t *size,
		unsigned long *used)
{

	struct pixel *tmp = NULL;

	for (int i = 0; i < original.ih->heigth; i++) {
		for (int j = 0; j < original.ih->width; j++) {
			if (*used == *size - 1) {
				void **ptr = (void **) pool;
				double_array(ptr, sizeof(struct pixel), size);
				pool = (struct pixel **) ptr;
			}

			tmp = original.pixels + i * original.ih->width + j;

			if (tmp->red == current.red
					&& tmp->green == current.green
					&& tmp->blue == current.blue) {

				if (i == original.ih->heigth - 1)
					(*pool)[*used] = *(tmp - original.ih->width);
				else
					(*pool)[*used] = *(tmp + original.ih->width);

				(*used)++;
			}
		}
	}
}
Example #3
0
int main(void){
#if DO_COMPARE_ARRAY_POINT
    int x[SIZE],y[SIZE];
    int i;
    int j = 0;
    for(i = 0 ; i < SIZE ; i++)
        x[i] = i;
    for(i = SIZE-1 ; i >= 0 ; i--)
        y[i] = j++;
    int numSize = SIZE;
    compare_array_point(x,y,numSize);//the answer is that point is faster than array
#endif
#if DO_DISASEMBLE_SWITCH
    disasemble_switch();
#endif
#if DO_DOUBLE_ARRAY
    double_array();
#endif
    return 0;
}