Karim Belabas on Mon, 15 Jul 2024 23:19:31 +0200
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: vector of t_FRAC questions
|
- To: hermann@stamm-wilbrandt.de
- Subject: Re: vector of t_FRAC questions
- From: Karim Belabas <Karim.Belabas@math.u-bordeaux.fr>
- Date: Mon, 15 Jul 2024 23:19:02 +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=1721078344; c=relaxed/relaxed; bh=IkiNR8McpNRHCi5IQUT7+Pe815Bo71oWYNflBiO+jH0=; h=DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: Mail-Followup-To:References:MIME-Version:Content-Type: Content-Disposition:Content-Transfer-Encoding:In-Reply-To; b=PqB7fsoKmFx+G7kcEIt06snS0wpTZaVMG27y+08OerVXOaPibVaUFZT+O62C9VlArxByxQtUYvpaUoSVHnBRv9CWFNfdrAMDaewoGtqtlH20uULlMVXw3PzA13fYC3dBAc7nguiB+vzz41p54lxJHgVK/mGdDF2nq0Q/csz7DSi5DcfVDZ6CrFbpnb7Vz/vQ1flLmCDRYMEvn+fwOeIi3bILmjUu7k91S0OuzUS+EfEFzC4T5pUwnyEKWJYtz3qpEymsUHbEksz9ambGgVQipvlyU3xp9GPFEoOM4QgyIA0klGo7qwZbeN0xg/coEdUUnSglTloFxwtXjqICGe3/J1KN8pjwpoq2qy6IDwDzLhPi3ys35nACDVIA3zgZYwMpGwoqgDEQ3HtPOC5kgLBsW0xWWVYr1cWSHnlyNUJJTXfrUCisRZnDIrNfFwuIK8M5h+fNPVMlGn4YxvB6cmImLRD/55LE2S5BQmmyTFk71udLp89pxyLhFyRmNbpzlydLnXwRb+vHh92Ky6jbhwzz6TgZk26qzmeXsagkqLccqaN72l6/trahN51Hexhe5PzJASxqGKO6z5xlc7iGBVPnR2snkeXNOP2bVKIqTYfkeDL4Exq6sVuprIaSThJ8hEBWRjwXySfBgvEvriZh2xvFOQ7hFxsQFZ0GLSQEb9Z4rCw=
- Arc-seal: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1721078344; cv=none; b=DWBHGT50Hb23yRAdE8ov9Y6jWB8J9GDuore36sj3J07llpGRO1E/Be9DY3rqWkpE7cUnb7rD3kTQTqHnX4qGaBJQcmAh/OCslmKMg/4E5yaWxQ5EB7VmCWBRupR+OueAynxW05/BKFsCtM3B2gbyB/SQeGJUe2vUhZ+OCESwlNg3cbSXLSY0lJoDoPRIBPN3Hk225gP33qxKr1+bIOvWe2t0Crjzj5mDhtXhZEXosLbgHqBAFdcJu2tO8bEKcDi+NLZa4MEV4lCjbJxQX4hvhDAQ6pGtgjT4XdcagQdO1oeyhVL2Zs9Yseudt7Gawt9R1VeoqP3VkbYU2Z4R5eE8Ch97KWKRT1+DWI/hb8GrJQwxYdx3An/eHQBmP1zGTPDz6Tzw+8Zpm/lAjlRihv7SbnGmAHPnzSal01KpnVJaniua8YHSQlURJiOUrSSTU7PHSSqon5AuB+XszufJnWtG3vkQnspJZz13FRwP5GaVri4ikOI9pAXnQd23LgDuhNgzroWzucwXX9+fDSaAiRoUhfBTjGPWzcWw/mZ6L6LMGUU9xKKLlcBRP71nWHOh9nJqQYhcbw+p30keQ9mSJX5bGe7dUEZTJn2TlNGE7j0zIzbGqMKK5kSIMO/sDUPAg1v+CwBZbYeS4lJsaAWe+C0HeBQVwXixu24s0FWVrO3Liso=
- Authentication-results: smail; dmarc=none header.from=math.u-bordeaux.fr
- Authentication-results: smail; arc=none
- Cc: pari-users@pari.math.u-bordeaux.fr
- Delivery-date: Mon, 15 Jul 2024 23:19:31 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=math.u-bordeaux.fr; s=2022; t=1721078344; bh=IkiNR8McpNRHCi5IQUT7+Pe815Bo71oWYNflBiO+jH0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ernhlRPWXdzgBJyr+qdUlkA/jlIgLivTGPM3ERK2WHf/sxWqcncGYgCvceqtYJynC c/Oo4HD9HqAGHcObU58WgLgr4gaZzYM4h6mWzfqqzP9m1b5ugvvUfXTfBHMD7uKBLq vJDyQAouS9jc7KStJzhjzbjcREhN6t/o+pYCvFQ8EOlzt7TLj4vzTTrhxOvPD6AMfB EkEwIhfEjMZ7AiXLFIR2h//Vkcrx3dsyE2l+e7cXTg2dRPTqOpVfmrqM6lhys2QMnk ddaIi1PeJsobpGaOU2sis+w1V8lzUIN+XC/oqp4/SKH/sYlyE3USb/95A5GUE44/6j YaxtNdsi4frDDdA28N259eHDzCa7FQ9UI6DuPjTPmjgGJEo+3GEKVi/JHivE8qn2Cb 8tX2Md5XxGj0ksYKlXEh8eGnDryrBDNitJYTNVr3UPmkw/lEzbeJWAQ/M5cEGnMXRf MrpPFpZGvUjVNhjjWkoagbpUREx2wGu0T2XnY2nUFVfHwdbrYVss1TLo2E4ckRS75e cq8k4YQt05EkyscHx0/u2u9KPedNlrcjkN6H9XTH3cW38NmnIQGHoMQZuMnFuEhPlP UZKR8CzpBF99+PeRqyxFueXG9dc3CeHEHvyihIS6yZkTQRfq8lyWxsviPS/xRHePJB sKbUL75EQsXDUcBDPvUt+3vE=
- In-reply-to: <14d30d43346d471d9424665db7e205ec@stamm-wilbrandt.de>
- Mail-followup-to: hermann@stamm-wilbrandt.de, pari-users@pari.math.u-bordeaux.fr
- References: <577cad62c54ee0c4600f5b401c933972@stamm-wilbrandt.de> <CAMLkfFTo+2RrUaaaoHDNKgfXTLMirBoUg5SFx6FqWq0g9wgCDQ@mail.gmail.com> <14d30d43346d471d9424665db7e205ec@stamm-wilbrandt.de>
* hermann@stamm-wilbrandt.de [2024-07-15 23:00]:
> On 2024-07-15 22:35, Loïc Grenié wrote:
> > > D) how to convert d to [10, 112, -5] in GP simpler?
> >
> > d/2*2, and maybe d*2/2, would probably have the expected
> > effect. d*1 not...
> >
> Thanks, that helps:
>
> ? d
> [81920/1, 917504/1, -40960/1]
> ? d*2/2
> [81920, 917504, -40960]
> ?
>
>
> Despite doc ...
Nope. You're creating invalid GP objects from libpari, doc no longer applies.
There's a big fat warning at the beginning of chapter 5 in User's manual:
We shall now study specialized functions, more efficient than the library
wrappers, but sloppier on argument checking and damage control; besides
speed, their main advantage is to give finer control about the inner
workings of generic routines, offering more options to the programmer.
Important advice. Generic routines eventually call lower level functions.
Optimize your algorithms first, not overhead and conversion costs
between PARI routines. For generic operations, use generic routines
first; do not waste time looking for the most specialized one available
unless you identify a genuine bottleneck, or you need some special
behavior the generic routine does not offer. The PARI source code is
part of the documentation; look for inspiration there.
mkfrac() is a low-level constructors, both very fast and quite unsafe:
user is responsible to check that all preconditions are met. If you want
sanity tests, just use the high level gdiv(x,y) instead of mkfrac(x,y)
Cheers,
K.B.
--
Pr. Karim Belabas, U. Bordeaux, Vice-président en charge du Numérique
Institut de Mathématiques de Bordeaux UMR 5251 - (+33) 05 40 00 29 77
http://www.math.u-bordeaux.fr/~kbelabas/