Removed ack signal.
[frac.git] / cf.h
blob0b4e5f6d2a48d1320bfa19bd11c0246ed87eb5b9
1 // Requires gmp.h
2 //
3 // Opaque interface to continued fractions object.
5 #ifndef __CF_H__
6 #define __CF_H__
8 struct cf_s;
9 typedef struct cf_s *cf_t;
11 cf_t cf_new(void *(*func)(cf_t), void *data);
12 void cf_free(cf_t cf);
14 void cf_get(mpz_t z, cf_t cf);
15 void cf_put(cf_t cf, mpz_t z);
17 void cf_signal(cf_t cf);
18 int cf_wait(cf_t cf);
20 void *cf_data(cf_t cf);
22 // cf_converge.c:
23 // Compute convergents of a simple continued fraction x.
24 // Outputs p then q on channel, where p/q is the last convergent computed.
25 cf_t cf_new_convergent(cf_t x);
27 // Compute convergents of (a x + b)/(c x + d)
28 // where x is a regular continued fraction.
29 cf_t cf_new_convergent_mobius(cf_t x, mpz_t a, mpz_t b, mpz_t c, mpz_t d);
31 // Compute convergents of (a x + b)/(c x + d)
32 // where x is a nonregular continued fraction.
33 cf_t cf_new_convergent_nonregular(cf_t x, mpz_t a, mpz_t b, mpz_t c, mpz_t d);
35 cf_t cf_new_nonregular_to_cf(cf_t x, mpz_t a, mpz_t b, mpz_t c, mpz_t d);
37 #endif // __CF_H__