Description
Regarding the greatest common divisor (GCD) and least common multiple (LCM), as binary operators, it seems that two incompatible meanings exist:
- The meaning used in Euclid's geometrical text (Elements), based on commensurability
- An issue with this meaning, for Julian purposes, is that it's not defined when all arguments are zero.
- As used, for example, here:
- A, more modern, abstract algebraic meaning
- An issue with this meaning, for Julian purposes, is that the values are trivial for any field, such as the rational numbers, for example. Rational numbers are supported for Julia's
gcd
andlcm
for a long time, and changes here would be breaking and quite disruptive. - As used, for example, here:
- As used in the standard library of Fricas
- An issue with this meaning, for Julian purposes, is that the values are trivial for any field, such as the rational numbers, for example. Rational numbers are supported for Julia's
@cyanescent and @barucden point out in #55379 and #56113 that:
lcm
is currently broken for arrays of nonintegral numbers- the breakage stems from a faulty, non-identity,
init
argument to reduce (thelcm
for array arguments is implemented in terms ofreduce
and the binarylcm
)
@cyanescent further points out in the linked PR that perhaps a valid value for init
doesn't exist. It seems to me that @cyanescent is correct and the attempt at supporting empty collections is misguided, because it corresponds to the second meaning above, while Julia otherwise uses the first meaning above.
The init
arguments should be removed, I guess, while breaking support for empty arrays, as per @barucden's suggestion in the linked issue. I'll try to guide @cyanescent in forming their PR to fix this (mostly just tests are necessary). Also I guess a PkgEval will be necessary.
Activity