Re: #matr~ vs ##matr (and: arity, questenian and !!)

Bill Allombert <[email protected]>
Newsgroups gmane.comp.mathematics.pari.devel
Message-ID <ZWicda04lAd8omx+@seventeen>
On Mon, Nov 27, 2023 at 02:12:46PM +0100, Bill Allombert wrote:
> On Sun, Nov 26, 2023 at 07:48:32PM -0800, Ilya Zakharevich wrote:
> > On Fri, Feb 05, 2021 at 05:54:48AM -0800, Ilya Zakharevich wrote:
> > > On Fri, Feb 05, 2021 at 05:46:43AM -0800, Ilya Zakharevich wrote:
> > > >   Is not it desirable to implement ##matr as an (optimized) synonym for #matr~?
> > > > 
> > > > If the answer to the second question is positive, then one can maybe
> > > > improve things by returning a special value (such as -1) for scalars…
> > > 
> > > Well, to get things yet simpler, one can make ###x to return 0 for
> > > scalars, 1 for vectors/lists and 2 for matrices.
> > 
> > Taking all these things together, I think that in the best of the
> > worlds one would have these:
> > 
> >   #mattr~   optimized in the compiler to (an equivalent to) (matsize(mattr))[1]
> 
> This one will not break backward compatibility while being easy to do.
> 
> See the new branch bill-translength.
> 
> ? M=matrix(200,201,i,j,random(2^200));
> ? for(i=1,1000,#M~)
>   ***   last result computed in 0 ms.
> instead of
>   ***   last result: cpu time 485 ms, real time 486 ms.

I pushed my branch to master. Thanks for your suggestion.
Cheers,
Bill.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.