Rename critical points functions

This commit is contained in:
Lucas 2020-03-09 00:32:30 +00:00
parent 2c79b15008
commit 4fd684d288
3 changed files with 14 additions and 14 deletions

View File

@ -23,7 +23,7 @@ static size_t idx = 0;
static long double complex criticals[MAX_CRITICALS];
int
behaves_critical(long double complex (*df)(long double complex),
criticals_test(long double complex (*df)(long double complex),
long double complex (*ddf)(long double complex), long double complex z,
long double complex *crit, long niters, long double bailout,
long double epsilon)
@ -41,7 +41,7 @@ behaves_critical(long double complex (*df)(long double complex),
}
void
add_critical_point(long double complex z)
criticals_add(long double complex z)
{
size_t i;
@ -55,13 +55,13 @@ add_critical_point(long double complex z)
}
size_t
ncriticals(void)
criticals_size(void)
{
return idx;
}
long double complex
get_critical(size_t i)
criticals_get(size_t i)
{
if (i >= idx)
errx(1, "get_critical: index %zu out of range", i);

View File

@ -13,9 +13,9 @@
#include <complex.h>
#include <stddef.h>
int behaves_critical(long double complex (*)(long double complex),
int criticals_test(long double complex (*)(long double complex),
long double complex (*)(long double complex), long double complex,
long double complex *, long, long double, long double);
void add_critical_point(long double complex);
size_t ncriticals(void);
long double complex get_critical(size_t);
void criticals_add(long double complex);
size_t criticals_size(void);
long double complex criticals_get(size_t);

12
julia.c
View File

@ -46,10 +46,10 @@ print_critical_points(void)
long double complex z;
size_t i, n;
n = ncriticals();
n = criticals_size();
fprintf(stderr, "Critical points:\n");
for (i = 0; i < n; i++) {
z = get_critical(i);
z = criticals_get(i);
fprintf(stderr, "%4zu. (%.20Lf, %.20Lf)\n", i, creall(z),
cimagl(z));
}
@ -61,9 +61,9 @@ tends_to_critical(long double complex z, long double *t)
long double d;
size_t i, n;
n = ncriticals();
n = criticals_size();
for (i = 0; i < n; i++) {
d = cabsl(z - get_critical(i));
d = cabsl(z - criticals_get(i));
if (d < epsilon) {
*t = d;
return 1;
@ -218,9 +218,9 @@ julia_main(int argc, char *argv[])
for (j = 0; j < width; j++) {
zx = cen_x + (j / (long double)width - 0.5L) * sec_w;
z = zx + I * zy;
if (behaves_critical(df, ddf, z, &crit, newton_iters,
if (criticals_test(df, ddf, z, &crit, newton_iters,
bailout, epsilon))
add_critical_point(crit);
criticals_add(crit);
}
}