Open argriffing opened 8 years ago
Added arb_sqr and acb_sqr as well as documentation in commit:
https://github.com/rickyefarr/arb/commit/73011a5386120dd3fa20215bff4df4c757f06b3e
Should other types have a squaring method?
Maybe. There are already squaring methods for matrices. With polynomials, I guess there should also be sqrlow, and for arb_t/acb_t, addsqr, subsqr.
I'll add these when I get the chance, but I do have a question. Are there any particular reason why we wouldn't use the preprocessor to define these functions? For example, instead of using an inlined function, use
Are there any reasons why this would not be preferable?
I haven't done any tests in awhile, but the last time I did mpfr was faster when squaring. Perhaps the algorithm that is used by mpfr should be implemented?
Does anyone know the algorithm used? I'll try to implement it.
Any updates on this? Is this worth pursuing further?
About the preprocessor: the problem is that it doesn't create a linkable function.
Squaring uses mpn_mul and mpfr_mul depending on the precision, so it should be close to optimal. However, there's still some overhead than necessary in arb_mul, which I plan to remove some time...
This could just be a small wrapper around
arb_mul(b, a, a, prec)
for now.