Bill Allombert on Wed, 24 Jan 2024 11:40:35 +0100
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Missing functionality in forvec()
|
- To: pari-dev@pari.math.u-bordeaux.fr
- Subject: Re: Missing functionality in forvec()
- From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
- Date: Wed, 24 Jan 2024 11:40:30 +0100
- Arc-authentication-results: i=1; smail; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1706092832; c=relaxed/relaxed; bh=hp+ngxzECIQjE5lLU4swtWThXpHJnOQKj9bc1SGcFyM=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:Mail-Followup-To: References:MIME-Version:Content-Type:Content-Disposition: Content-Transfer-Encoding:In-Reply-To; b=zD9NuRU8wFFW+SFRn5Fo0sxVHV42UtT5JQ9UCi3xjRmemQcBw/lrIP6I5Kcg+pA534n95NuHjb7o/MCexSIJK4IX5V8VZgG5bekwHi3uFSFTQaLQX+D42SfHCH5j6YoG+XnPWGNGWMKUFNBIc1BP358JQPxSHdVcNm4i06H/Y20zlkggYRrndSmybE7SK5qtKMNsUgzGypHP9lhBpUL6HR8JSZUJfR08t3K7+rRB/oEARDWw/EZ13/qhaHq/23xbzfNz4RBHcoteIM+OTM01b7XIXrItMSIhfpvSQ6d8CSiHExWZ8+xeOmiAMgmcCzvhi6jKloaf7lOTw2epKYj75WCr7CX4B7SuI4cVtHn19vqtfvo8AxriU6gfv2QwcEGyC25hKUE8tTh4cb8DxbFFyf781bSLkBQUdCRR/1vr5mhbTybHxNYxqFUzyC9LytLCg6UtltCPF2vLKt/TTeoFboF0LkL1ecP6gmzSAaV+ft42EcubGUERbGB0LwiF5K5liezqwJGV2z71uT8/YtS49IjEGDSOOVvuZ9b7sZfH4Wk0x2wEiMl4FnCzcoOnRYxXScnUAAa+4AyTeU8R0wo8rKtrxOrfrCbUDEyuTtokIlOmMcWz/M8idga0Ig5s0/p2ouM8AV/wpJjFr6sPYAOpGKqgCjj6V/CKdMkv4/2PAHs=
- Arc-seal: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1706092832; cv=none; b=0Tm4W6zZYnNutbX+0u65Qg8eXKOgiL64I99CsqA9cLdel9IJFbJUSJzZleZLy69aUWSHcSpjjMZ7YONCtQEZRd45dCD9V8w3tken8SSqEMfCL984PwQw5e0LWROz7JB8WLSKTQFLOUbpwEslmHCN3WnJ3sof82XPbqUtt5vXMEsgghHfET0p/zWjxysPgvA8HgARIBZqDSmtscaJEVH/ARd30WmxOVtPwUMUuiZzqwgM1cl1vOBGZm55ITRfCN7LQbpKJadSkMW0YYr7lGOA00ebuXlPcWnEdkgjZHtBIRBaU7eRnMej7SCh60Vi70xUR2Ho+n5SLdm1c8LW963GsN9d45e92hGgSBYVSfvWBvleTTTDwYm2g3NEuE381wGkPlpwlMEGT4/GTAWm94b9YPjjI3do373YbtD4yK8+VWy9SrMhcC1BhYd9nxNEyq18spX2cYQ3DB6JvGKO2TPV5wlTTcWEf2X6mtMmvwjCsuDkkU5V+r5QpO06mh7COCt9DO3Wzk+2DZh+CUA7QL4u9Hd9IpySe0ski1AEHgDTQaepJvkkkWc5N8iR9SWlZJ7qxEBeqefGKWMNgX35U/87MMTxnBJPpOMszH+NN3DvwKA1U4kpGs9NkaEzl59ltZnhKhgI1gk70FA/AQGtn1mooJ/3a0rsiywqP2gJLja3e9k=
- Authentication-results: smail; arc=none
- Delivery-date: Wed, 24 Jan 2024 11:40:35 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=math.u-bordeaux.fr; s=2022; t=1706092832; bh=hp+ngxzECIQjE5lLU4swtWThXpHJnOQKj9bc1SGcFyM=; h=Date:From:To:Subject:References:In-Reply-To:From; b=BAaUcXd8WaBywHoRKxa0wGsrrVXHjGnO0wGhEBLkQV+kVVQ/JL6aOUi7CQXOOTjgM KOYxlugJEHtSVlI8b4FbAJNNZykRJBQ7JObB+1APGkrWEZ2+sWn9/6YWU9709Ku8vm kGqMwFEs+Xnnxcd3iKJ7UPXKHAwjq0rIqgWJ7ueGbUBUpYeAordTjTR/KreR8yU0Uz sJbyIvl8cEsgqNySkJsBKDy7DXtprU+zj1dNi8AMajwd1DHLmvks56yNoM34Fb02x5 32YwDl2DlHrU+1xqfJJ2C0vNSyrkHeSHpGiIj+PFZt40Uo8haVUFv6/Idkt9c5ln8e FYaO0Degzcd+AvqV74VwFMEx4zWiYKm+p+6AjnUC93ogLBMIVBhVwFftPuTcmxRc3D a8l56YkWjgPM7jRs9Ptb9SKN1sKw0Rl3pC0h6r/jhsNYy+wtZtEF9x0M6T0epmb3Aj rnBxaBQkGhJ15o34v8fkyW8twT+wF9GMmySY3KOETnd/2SwmkjbChHNN6wbP8IArAJ lz/t4sPVCewZ/9baY1uAeP6kpBrLh5ju/LiaFI4x//BFWG0/hMLziromHfOwLZGkH0 LwzDToBSF4fOn5yewYSM6iEWRmrXLj/S/bd8HTX0/b/o9GpVmwp69lCNJX7A8j49T6 74rFkx9pGbtBZL1ocTDoQWQ4=
- In-reply-to: <ZbDWIMllQJMIVS/A@login.math.berkeley.edu>
- Mail-followup-to: pari-dev@pari.math.u-bordeaux.fr
- References: <ZbDWIMllQJMIVS/A@login.math.berkeley.edu>
On Wed, Jan 24, 2024 at 01:19:28AM -0800, Ilya Zakharevich wrote:
> I want to use forwec() in a complicated algorithms needing a lot of
> cached data. The caches should be recalculated on backtracking.
I agree, forvec is nice for interactive use, but it does not lend itself
to efficient code, because you have to recompute evrything from scratch
for each entries.
I used cache and backtracking to extrem length in my thesis.
(e.g. the libpari function testpermutation)
> Here I consider forvec() as if it is traversing-in-order an “ordered rooted tree”.
>
> While forvec() takes a lot of workload under the cover, with forvec()
> it is a PITA to detect backtracking. On the other hand, I can see
> that with an extra argument taking an (optional) variable reference
> 'v, and reporting the details of backtracking in v, the life would be
> much easier!
>
> The docs could go like this (I would need only one of these 3 flavors
> of reporting; two others are added in anticipation of usability in
> other situations):
>
> Let n be the number of tail counters which wrapped around after the
> preceding iteration, and m be the number which will wrap around on
> the next iteration. If 'v was a small/v/vector at start, put n and
> m into the first two components; otherwise report n or -m,
> preferring the non-0 value. (For what follows, note that with
> flag=2 both n and m may be non-0 even if the trailing ranges are not
> of length 1.) If 'v was 0 at start, prefer the largest of n and m,
> otherwise prefer positive or negative depending on the sign of 'v at
> start.
Could you give an example of usage ?
Maybe print all the numbers of the form x^2+2*x^2+3*x^2+...+n*x^2 ?
I was considering suggesting the number of way to write a number as a sum of k
squares using the naive algorithm, but this require the ability to cut branches.
I am concerned the interface would be too complex to be of use.
Cheers,
Bill.