Charles Greathouse on Wed, 07 Sep 2016 19:26:11 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: No more vector gcd and lcm?


Oh, it's just the two-argument vector version? OK, that's fine with me -- all I use is the one-vector or two-scalar versions.

Charles Greathouse
Case Western Reserve University

On Wed, Sep 7, 2016 at 4:52 AM, Pascal Molin <molin@math.univ-paris-diderot.fr> wrote:
I also use a lot gcd and lcm on vectors and matrices, but those have not been removed when the vector is the only argument.

I had never noticed the behaviour with the Cartesian product and it is not obvious it is what we want, so in my opinion
dropping it is reasonable.

Pascal

2016-09-06 23:03 GMT+02:00 Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>:
On Tue, Sep 06, 2016 at 04:31:46PM -0400, Charles Greathouse wrote:
> Recently changes were committed to the git version to drop support for gcd
> and lcm on vectors (and columns and matrices). This has been a useful
> feature, is there a reason for dropping it?
>
> There are a thousand sequences in the OEIS which use lcm or gcd and it's
> not entirely clear which use the version that was removed. (Probably not
> that many, but still, breaking changes are bad.)

Could you give an example ?

> Of course fold can be used to replace these constructs, but this can be
> very much slower in the case of lcm. vector(10^6,i,random(10^6)+1) is 300x
> slower with fold than with the original version. (In fairness, I don't know
> of any applications of huge LCMs of big numbers.)

The one which has been removed is not the one that can be done using
fold(). Instead it is the one that can be done using apply + a function
that compute the external Cartesian product of two vectors.

? gcd([1,2],[3,4,5])
%2 = [[1,1],[1,2],[1,1]]

Cheers,
Bill.