Bill Allombert on Mon, 15 Jul 2024 23:11:42 +0200
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: vector of t_FRAC questions
|
- To: pari-users@pari.math.u-bordeaux.fr
- Subject: Re: vector of t_FRAC questions
- From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
- Date: Mon, 15 Jul 2024 23:11:37 +0200
- Arc-authentication-results: i=1; smail; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1721077899; c=relaxed/relaxed; bh=NL3wfHpP2m0/AnxXGrqT2RvJm7NzXv95DxKgCyFJbXA=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:Mail-Followup-To: References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; b=AEbwheOnz4PXvCvhWyS/rJVcezhaBr3ScWHWEreoPWS/v4KueRRd6guU02wmGWCD/06RyKC0SncSAmjnedVkp3tv54qjXySrnqXl9+g5VQoI9se5OxAq5Bkt0pwC9YbkwZjaekLb2RBgMplT35kK3GBPov2zopCX8doVTj0d0T6dO3bdr5Hs1+laHHGXDawQLenrhqJ9VqwynHmi3ODdBevASky/AqRQGkrMX4qgdRSv0Z6wTw745A6UI0UTr+4yvF2Kt6lEXQuTjz32480SV9L1wcuCKBjEvnhaDfDCn9ELd19HquLApNcSaiJ+AnAAdURWttsqO3tjX4kDFNK5QO4J1ju+uViHo7wIYb7fdjgqL4Zmoa07NyIrUHVWwKG3zENgVs/FhtYJHwOY5H1FhgrahiVj8ZgCl1rr9jznD+fcj2c8qFZl2k0fI1IBFYHwhEM0ulljDDaZaeATleIG5U2D7S7BX9/XUdWJTPNu3vsd4crVVVQO38lb0Cs+uAjgM6mQGa6kRIie7ZFYjRSiZ33aFdt1y2ahCkLMw5DPQhIxbLxRlZh4vLY32c1hP/sJQshRFR1/7OC9W0jfwd2qgXLD02Dur4Mu4hDg6YlhkFwDNK6OgYF9uUpXj++nSJ3fPbiLhcmOjmw5OlU75eHnQDcV6YgKXnajvBvsc8+o350=
- Arc-seal: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1721077899; cv=none; b=TbDmwEzKqzRN3UT+DRdkMzhnxBS/Oii8GvwFgyjTulLyTp4EUnDYO1/vmAqyOhh4spTpYvl2BSubf5KN9bkdDJWXCzL9G8wcY9yeRi20o3ywdlOLbBus6O6ds1S/zDYUyupA3/mtbe0kvnB1pSsuEOl21fnZyOi2BvULSfBfNoA2XuBpJy2qTiV+07lLbnfLwIXxrLXBPKskbpyLPsS5scottMxn+GV0yn1K8ph3i0dfjN3PVERmQg2PZRajkTzZFbbS5eaJcs0/TjgMas76Nlmf3BYcAi/G5jQYT6ztoKMTaHq6KGqr2mKYrK9zADYaiZtldCVqN1rhiOPrEnEquyBCC2WK47j22NkjOAhwv05obh5Q0ImwL8ONByinc+zhrDDQg97Q9gSyiHcX4jZo2iA2c/xy55+QLvhijSzUy3yPkVgGnLxs6O/Inni+swojnnYY75NelXUs8es+g3XD8+fSSQzNhGh8HEC3j20N8vQ5Dh4dkgqY98gCWdXNMlfacjnb8Kp22vtOOesQtwIww2gNwNEaUa64eOex/fkkGLwK1SVXtbhM0kFV1KqqNn7txMlmREynpkQREHJf3EclBJVjeaHfOdOC8i3FxdzjX7tUNrjH+xnFmaMQvpHkc4VNUw0tAaur3PwxVHIbRA/ayd41Aw3UtfEmJwkRXmZdtcg=
- Authentication-results: smail; dmarc=none header.from=math.u-bordeaux.fr
- Authentication-results: smail; arc=none
- Delivery-date: Mon, 15 Jul 2024 23:11:42 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=math.u-bordeaux.fr; s=2022; t=1721077899; bh=NL3wfHpP2m0/AnxXGrqT2RvJm7NzXv95DxKgCyFJbXA=; h=Date:From:To:Subject:References:In-Reply-To:From; b=u7Js69tKNb4gr0CxO7bg/ixpg0WbGsLaGAY3urLiKVF209QY/aolmR61ddlIHE813 /UlmKnN4SQR9yllPrRxOO+AZDS8zb6iuSQhlqKj6uE5v6MCpHGWm0sie1+6/Wyt0Xv hmczyAswu9J9lT4s9eKVsqO2Et3wmYF85KKnqxOzYI26DFs5rxEqHVvaVJPU8Fm7Gs QncsRvaxWyy35wIhH+ctvGIYxoQN3IGllz/J0keVK4qFDEix3jCpZ0x1L1N+ku81AA PmjwrAGw2vz3bDIpJao76TteTPwGJ2YyjEuoUnprkD/ngytdBy6HA9LIpxfSXHb6o1 MXOBBSB0iMBqOBuHL7G+uxBnzaOiVnD6qLEYc0StDuJm5x3rJeRudviATQDd77UJlm vG8Z+xRjugiimsxE2bUOFZjcwMSthqItYgMLc/lVtEYw0xsePNdgv0gy5N+6H+976A sGpjytN+WK3IjYiYlzeQR9J92jcyhq7McMljM1eVf2BGnqFArwcwODP3tR9/9FOZXL k2jkTheHQUL0LgpAWcxrqUzxnXEKa2HUKUaJNNITbrOJGufiA40fNr3nyV5X3ICEPT I5r7pHR+z4r9HObOqgpmNJF7TnnIbcZqvfFoNMWgr5/F0S8JDMx3HNDab2OWwjDpm7 gV2VcFKZVb9FnY+6ZpeATAEo=
- In-reply-to: <577cad62c54ee0c4600f5b401c933972@stamm-wilbrandt.de>
- Mail-followup-to: pari-users@pari.math.u-bordeaux.fr
- References: <577cad62c54ee0c4600f5b401c933972@stamm-wilbrandt.de>
On Mon, Jul 15, 2024 at 10:01:47PM +0200, hermann@stamm-wilbrandt.de wrote:
> I convert 3-dimensional vector or GMP mpq_t rational numbers from
> CGAL function get_build_direction() to GP this way:
>
> https://github.com/Hermann-SW/cgal4gp/blob/main/cgal4gp.cpp#L107-L123
>
> extern "C"
> GEN
> get_build_direction() {
> assert(_simplex != NULL);
> _Vector_3 _dir = _simplex->get_build_direction();
>
> return mkvec3(
> mkfrac(
> mpz2GEN(_dir[0].num.mpz()),
> mpz2GEN(_dir[0].den.mpz())),
> mkfrac(
> mpz2GEN(_dir[1].num.mpz()),
> mpz2GEN(_dir[1].den.mpz())),
> mkfrac(
> mpz2GEN(_dir[2].num.mpz()),
> mpz2GEN(_dir[2].den.mpz())));
> }
>
> That works nicely, but I get denominators of 1:
You are not supposed to use mkfrac with a denominator of 1,
since you already have a t_INT.
Instead you can use
GEN
mkfrac_or_int(GEN a, GEN b)
{
return equali1(b) ? a: mkfrac(a,b);
}
Cheers,
Bill