Karim Belabas on Tue, 06 Feb 2024 17:56:30 +0100
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: vec* functions on lists
|
- To: pari-users@pari.math.u-bordeaux.fr
- Subject: Re: vec* functions on lists
- From: Karim Belabas <Karim.Belabas@math.u-bordeaux.fr>
- Date: Tue, 6 Feb 2024 17:56:14 +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=1707238576; c=relaxed/relaxed; bh=xSJr9GYM0ahjosi1TYywG52prJcqwQmWEK71TcUmnbA=; 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=C+MK1zZBoS/RARrCNMMdGqZ0gXfwa3C5HnELyq4YQtxNrwO1tVWsb+kRlQGrfs2bot8Nkfkg7aEVxQFqRDVh9uGUauKRP+2bvi/XTJjFudNogMeoTQhjPduJ44ThD0DcWfRkX5GMd4KcYqyJqlUtG+CNm5FSY7QZ4hEjrrCSP7YbISGokZnW/Rcr9Bgevk4zMI+YFmJFL1KyP87Euh4ptKTsEfZ7EcZTewmnom/CT4UtXZYEHSx+xbYMVl8CTVlZCr5QMfC3UVcerKgp6BSO8HlJ1FHqgh++cHQLJL4hpMX7lSVO+CGwzjnsYz6ydKFJ77Jz8iAb3oNvpeJwYDoFmnbYLjDFh9f7wmoMWIdh2igL46+A1oOX90MqTHx6R8cs+R7TFi05nL3T4RI6eWjEhzRB0+cHc65R4N1H2BL+sFJdKt8lhvqjVX+KIYGpSDvEKbcxXXcD1gr+ur5OG4LYkLG9XmeEN9HasMSMTnLATsL6unzoty165Kvp9VmLwaj6CWXaVhgkTxuRfCxecJ1dWHBafKS0mSZ4QwCMkd4Mov+QeTBtdNu2pQw7jZmdhv+bIak0geFkQOtlYgNoCMjxCVeu30/zCROoVUWKG7BQ8UykFKwKH9koaL05WeeadVcpFC980TgLKJJlSWVhk+FNYTBZMYZedvK22yubRMJ7cEM=
- Arc-seal: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1707238576; cv=none; b=xnI40Qb8rBpVLyr4OdNNfYjfCXULyl5lWB2bk9wSvTnz6YwGf173/UBqUACXf4f5MsGIdlQFr94f3t1V1vzwVh0/QZHsH9jlKhLqvMjoxuMKTrlvK7/AMh0JbiawhFiAzW1HA4zmwucXmgfjiIFoUu+OaaDxglTtPItYi0529+iwp8E4l2k24A0k/g99wammDzF0o0gex+ZV/xoBvY9pc+1zjZrLu7gaPiNd2G7T/6dw28RnqyeZAdwlCOcGBKp+TBs/BnZLL3bWxFXCKeGnVdPwCaKZBP53RL02JKMHjx+SKqPMHXQZHjhobRL8/Q3sxD7Ut95zOE3RRnumrSMEPBOrPyrEMpK/2Jiw6Nlph33050PeLywNY9picoeVr5VfymyJamQeIRCFjjdzdBMXQwA8yC13sylpTRM/XwFrmjagAvVQpreOHwjq+88SBbjCDlw06zPsjhIloSTLU1ZUCbtXzwRghXygVEqzJ32vF9QSlVTxhn5Iw15Rap8uWiEKe4ihFXmFrTlqwBNnTy9wdwwzgRBvRwVWROjHf22nd0JAQ+1RWNg5X1q/bcS2c3xlxdCkjkagMhT8Hzx8YcQgwThgyf80cWOjAcTvVaTsfQJDsPHIRq2pVjJsigX2PR2qhj+aJfrWHHo6jEoXWPR7Hv+5Ed+utwrYlzt0AWxKhaI=
- Authentication-results: smail; dmarc=none header.from=math.u-bordeaux.fr
- Authentication-results: smail; arc=none
- Delivery-date: Tue, 06 Feb 2024 17:56:30 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=math.u-bordeaux.fr; s=2022; t=1707238576; bh=xSJr9GYM0ahjosi1TYywG52prJcqwQmWEK71TcUmnbA=; h=Date:From:To:Subject:References:In-Reply-To:From; b=i0WsaIjyYDl2d5sVzTJZtSC2izbZ2RNoyB/32u1kuzAm+X9YOMj1MEXC49CzgTUvO CEK+jBYr1qgAlLsz+668otevhJ8hPrkiUV5Tm+81UfM5Hj8BGWPcRUHlRrvMLlkw2s sL7nQi1F6I1U/cs5+Cn8uz3uJRBHWRhYAIuqUaSwkyhWRAhOTHOcXMSWcqb16CRzvx anyxpzNTcPKG/e1sEyHQcaX1N1jQ5OAxaysKxNRzKzoH6Fu+6bVy41VvO2EKLdq0Pq 5w8LLWeibv8JrEsfgjaPRXH0IVa7w39h1vABi2+a7Yz77w+9smar6o8iJKofBGGkXc sovVUYsxBnQPPRoN6P9PKfNqNedbYW/OaONCEyyH/4Aq1ZFslnrMb4Mk0ecS/8Nzfp FtkYeeDVdRoK1ANTRhpHYdWD6kEg/GErlIYCG7Ij0f850p2ubROFAL6XuN4VET90Jl xiiKj9tRD2mG4xS7fWmNzcgdzfMft7te6aCcX3mkq7wSVuyNO5Y0MQTBfCb/OADVlh 2CPFA2TvbAPcvLtJN+gEdjuGD76WwBpp+BtJHGTDeEjnXUzkSiXN+tVXljhtYAqNfk mGTsiAnWzWDA686IZSONU4cYlHAeOUAAdAsN1tyl1Y7qIgW9a/Yi0uycIVVYEu99Z7 mPtDGQb1JSFPmZ6csNDJ2/4o=
- In-reply-to: <ZcJUn6I1fKoMCbeE@seventeen>
- Mail-followup-to: pari-users@pari.math.u-bordeaux.fr
- References: <CAJkPp5N9gxDvYBU5boNOj1Y0QHy5_DjUG0Pbwm-gb40mTLQhAQ@mail.gmail.com> <ZcJUn6I1fKoMCbeE@seventeen>
* Bill Allombert [2024-02-06 16:47]:
> On Mon, Jan 08, 2024 at 06:04:27AM -0500, Max Alekseyev wrote:
> > In PARI/GP version 2.16.1 I see
> >
> > ? vecmin(List([1,2,3]))
> > %1 = List([1, 2, 3])
> >
> > ? vecprod(List([1,2,3]))
> > *** at top-level: vecprod(List([1,2,3]))
> > *** ^----------------------
> > *** vecprod: incorrect type in vecprod (t_LIST).
> > *** Break loop: type 'break' to go back to GP prompt
> >
> > Can vector functions be extended to support List arguments (as if they were
> > vectors)?
>
> As a rule, I convert lists to vectors as soon as I have finished to fill them.
> I always do
> fun(...) = my(L=List());....;Vec(L);
1) I did extend vecmin() and vecmax() for lists: the previous behavior (return
a full copy of the list) was both surprising and useless.
2) Status for other vec* commands:
- concat, vecsearch, vecsort, vecmin, vecmax: support t_LISTs
- vecextract: Error. Since we already allow List[a..b] and List[^i],
vecextract could be extended to return a sublist; on the other hand
the code is already complicated and this would risk introduce bugs for
a limited usecase.
- vecprod / vecsum: Error. No particular argument to support or not
support it. It's a very generic and simple code, easy to test. We
might as well support t_LISTs.
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/