Exemplo n.º 1
0
Arquivo: hilbert.c Projeto: blynn/pbc
// Computes z = h(tau)
// (called h() by Blake et al, f() by Cohen.)
static void compute_h(mpc_t z, mpc_t tau) {
  mpc_t z0, z1, q;
  mpc_init(q);
  mpc_init(z0);
  mpc_init(z1);
  compute_q(q, tau);
  mpc_mul(z0, q, q);
  compute_Delta(z0, z0);
  compute_Delta(z1, q);
  mpc_div(z, z0, z1);
  mpc_clear(q);
  mpc_clear(z0);
  mpc_clear(z1);
}
Exemplo n.º 2
0
		{ 1.78534, 0.46763 }, { 1.78534, -0.46763 } },
		{ { 0.8643, 1.45389 }, { 0.8643, -1.45389 },
		{ 1.61433, 0.83134 }, { 1.61433, -0.83134 }, { 1.87504, 0 } }
	};
	__declspec(align(16)) complex4c poles[VYV_MAX_K];
	double q;
	__declspec(align(16)) double filter[VYV_MAX_K + 1];
	__declspec(align(16)) double A[VYV_MAX_K * VYV_MAX_K], inv_A[VYV_MAX_K * VYV_MAX_K];
	int i, j, matrix_size;

	assert(c && sigma > 0 && VYV_VALID_K(K) && tol > 0);

	/* Make a crude initial estimate of q. */
	q = sigma / 2;
	/* Compute an accurate value of q using Newton's method. */
	q = compute_q(poles0[K - VYV_MIN_K], K, sigma, q);

	for (i = 0; i < K; ++i)
		poles[i] = c_real_pow(poles0[K - VYV_MIN_K][i], 1 / q);

	/* Compute the filter coefficients b_0, a_1, ..., a_K. */
	expand_pole_product(filter, poles, K);

	/* Compute matrix for handling the right boundary. */
	for (i = 0, matrix_size = K * K; i < matrix_size; ++i)
		A[i] = 0.0;

	for (i = 0; i < K; ++i)
		for (A[i + K * i] = 1.0, j = 1; j <= K; ++j)
			A[i + K * extension(K, i + j)] += filter[j];