Bill Allombert on Wed, 02 Jul 2025 23:29:00 +0200
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: choosing k elements from a "set", and concat of vecsmall
|
- To: pari-users@pari.math.u-bordeaux.fr
- Subject: Re: choosing k elements from a "set", and concat of vecsmall
- From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
- Date: Wed, 2 Jul 2025 23:28:55 +0200
- Delivery-date: Wed, 02 Jul 2025 23:29:00 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=math.u-bordeaux.fr; s=2022; t=1751491737; bh=sA2MI7MEvY4KxS96PKyHOg0RTmMf6uEVzg65Dsd9fE8=; h=Date:From:To:Subject:References:In-Reply-To:From; b=aQfLqpH4lKZzYlAe8c4B3AzRlpQl+dk6j5bQgNQC22xbYErc/GFAE3rWNQ8kkO6pF 28Mar7dDMhW8pRJqHkmvFeFQoXF6nanB3a2VlMSk9qYSOuLW9Mh1GuKl/u4DzFEix7 HESrdw8nOulmrWc9JT7Orenjgz9BII0H1tRqh2LHMi5YRRZ9CveVPuSX+efDdstfLX 4zpWQDRrvXV1F2YV2BibfY3YZ++JIaXrL1DRorWc5ZyRq4Y1xxDWdJTgBp8/KK+DzF 2gq2bWo7Lsbdet5dm8UThQuxS1yHqanPchWYPcCIFpAN49omxDfKqgDv0klVfMbSfD eh+A8GzwddwOWNvra2O3v6EVlhyupUfakKFKijVZ8cZTfAst9jBTfn+kGbC4qv7xA/ b5Wu4ptXSE/B7jn109hqSi/Zw0vd2ip3Jh1Li9Wj5j5mhd0l1gxUJdPLbOjPgBoucy +O77iu6b+2UjIyRWs2RGkvTFJ7omHM1O5axa4ma6Gjv7fhFFHtefPR/RWYdTCQnSlK ZcvL3HyHotmJGa6vtfbMqD1BRJhjQmrNumLCrqBPqwlSgrv+C7A1NRLzlJlvuGRkcl z0hANgYYPZqSnTbVq4fwN29yko7h6stqp/ROlVrdZ9/3OaUZkfJrDRrffaKv79V/rQ 8y40aF4dh/U1AS47ppnzF28k=
- In-reply-to: <CAFoRp-NPLVNXBgr9pCGpLaQo9JGAxZ7H==iXzyXORVp1egwzCw@mail.gmail.com>
- Mail-followup-to: pari-users@pari.math.u-bordeaux.fr
- References: <CAFoRp-NPLVNXBgr9pCGpLaQo9JGAxZ7H==iXzyXORVp1egwzCw@mail.gmail.com>
On Wed, Jul 02, 2025 at 03:32:20PM -0500, Hans L wrote:
> I often have a need to loop over all "n choose k" elements from a set. The
> closest builtin functionality I have found for this is to use forsubset,
> and then build a vector from that with vector as follows:
>
> forsubset([#S,k], s0,
> my(s = vector(k, i, S[s0[i]]));
> ...
> );
You can do s = vecextract(S,s0); instead.
> Another somewhat related thing I noticed recently which feels like an
> oversight is when that concat is presented with a t_VEC and t_VECSMALL, it
> just inserts the t_VECSMALL as a single element.
> ? concat([1,2,3],Vecsmall([4,5,6]))
> %12 = [1, 2, 3, Vecsmall([4, 5, 6])]
But this would change the semantic of concat.
Cheers,
Bill.