Bill Allombert on Sat, 24 Oct 2015 14:16:49 +0200

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Faster digits and fromdigits in base 2^k, and FlxqM_mul_Kronecker

On Sat, Oct 10, 2015 at 09:29:53AM +0200, Peter Bruin wrote:
> +\fun{GEN}{fromdigits_2k}{GEN x, long k} converse of \tet{binary_2k};
> +given a \typ{VEC} $x$ of length $l$ and a positive \kbd{long} $k$,
> +where each $x[i]$ is a \typ{INT} with $0\leq x[i] < 2^k$, return the
> +integer $\sum_{i = 1}^l x[i] 2^{k(l-i)}$, as a \typ{INT}.
> +
> +\fun{GEN}{fromdigits_2k_zv}{GEN x, long k} as \tet{fromdigits_2k}, but
> +with $x$ being a \typ{VECSMALL} and each $x[i]$ being a \kbd{long}
> +with $0\leq x[i] < 2^k$; here $k$ may be any positive \kbd{long}.
> +
>  \subsec{Integer valuation}
>  For integers $x$ and $p$, such that $x\neq 0$ and $|p| > 1$, we define
>  $v_p(x)$ to be the largest integer exponent $e$ such that $p^e$ divides $x$.

Hello Peter,

In the documentation of fromdigits_2k_zv:

as I understand, x[i] is treated as a ulong, and not as a long.
The meaning of "here $k$ may be any positive \kbd{long}." should be clarified
to be more explicit when k is equal or larger than BITS_IN_LONG

But more importantly, the fromdigits_2k_zv should be called zv_fromdigits_2k, because
the input is a zv and not the output.

And in fact, more accurately, it should be nv_fromdigits_2k because the entries
are treated as unsigned.
(the original functions binary_2k_zv and  binary_zv have the same problem)