Exemplo n.º 1
0
static rule *make_rule75genzmalik(unsigned dim, unsigned fdim)
{
     rule75genzmalik *r;

     if (dim < 2) return NULL; /* this rule does not support 1d integrals */

     /* Because of the use of a bit-field in evalR_Rfs, we are limited
	to be < 32 dimensions (or however many bits are in unsigned).
	This is not a practical limitation...long before you reach
	32 dimensions, the Genz-Malik cubature becomes excruciatingly
	slow and is superseded by other methods (e.g. Monte-Carlo). */
     if (dim >= sizeof(unsigned) * 8) return NULL;

     r = (rule75genzmalik *) make_rule(sizeof(rule75genzmalik),
				       dim, fdim,
				       num0_0(dim) + 2 * numR0_0fs(dim)
				       + numRR0_0fs(dim) + numR_Rfs(dim),
				       rule75genzmalik_evalError,
				       destroy_rule75genzmalik);
     if (!r) return NULL;

     r->weight1 = (real(12824 - 9120 * to_int(dim) + 400 * isqr(to_int(dim)))
		   / real(19683));
     r->weight3 = real(1820 - 400 * to_int(dim)) / real(19683);
     r->weight5 = real(6859) / real(19683) / real(1U << dim);
     r->weightE1 = (real(729 - 950 * to_int(dim) + 50 * isqr(to_int(dim)))
		    / real(729));
     r->weightE3 = real(265 - 100 * to_int(dim)) / real(1458);

     r->p = (double *) malloc(sizeof(double) * dim * 3);
     if (!r->p) { destroy_rule((rule *) r); return NULL; }
     r->widthLambda = r->p + dim;
     r->widthLambda2 = r->p + 2 * dim;

     return (rule *) r;
}
Exemplo n.º 2
0
/* gimmick #2588: the XINE logo ;-) */
static void render_parallelogram (unsigned char *buf, int buf_width, int buf_height, unsigned int gray,
  int x, int y, int width, int height, int slant, int sc) {
  int i, o;
  int pitch = (3 * buf_width + 3) & ~3;
  if (height < 2) return;
  /* slant compensation */
  if (sc) {
    i = (width * slant + height / 2) / height;
    width = isqr (width * width + i * i);
  }
  /* 3 bytes per pixel */
  width *= 3;
  /* OK now render */
  height--;
  for (i = 0; i <= height; i++) {
    o = (buf_height - 1 - y - i) * pitch + 3 * (x + (slant * i + height / 2) / height);
    memset (buf + o, gray, width);
  }
}