Reading about the removal of eye has put me into a deep emotional state

I will give you a fair warning here that this topic is going to have a serious intention for which I felt the urge to express it using some sarcasm. If you react badly to sarcasm, do not continue. If this is deemed inappropriate, please move or remove this topic.

Let me give some background. Not few mathematicians (me included) and many engineers use Matlab for research as well as within teaching activities at universities. I have come to see the fact that Matlab is a large commercial product as its strongest and its weakest point.

There is little doubt that Julia is a good alternative to other languages in particular in numerics, and I would wish for an open source language close to mathematics with a good feeling for intuition (this excluding numpy) to become even more widely used.

Now, I have more than enough times heard the borderline defensive argument not to avoid, or God behold, to criticize, anything about which you feel badly in an open source programming project, but to contribute yourself instead of being just so selfish and lazy.

I can understand where this comes from, but there is then at least this weird feeling when virtually everything you work on is open source research and teaching - and therein, many things are not necessarily given much credit to either.

When learning the basics of Julia, I quite early typed in eye to see if it just works as in Matlab. As that turned out to be wrong, I assumed that there would probably just be some similar command. After all, there could not possibly be a complicated expression to generate the multiplicatively neutral element of matrix multiplication in a version with which I could do exactly the same as I can do with the additively neutral element zeros.

Following the documentation of multi-arrays, next to your zeros and ones, this unholy statement may then appear in your code: Matrix{T}(LinearAlgebra.I, m, n). Naturally, the first thing I did was to practice some Julia by writing my own function eye to hopefully work analogously to zeros.

What I did not expect was to later read that eye actually once existed in Julia.

At that point, I also learned from DiscourseLink and GitHub that it was taken away to particularly teach all these pesky Matlab users a lesson - to finally think about what madness had driven them all the time. Well, or at least to shame them a bit by importing MatlabCompat.

It was agreed on that there could not possibly be many sensible uses of an explicit or semi-explicit identity matrix. And anyway, that Diagonal(ones(n)) is not much longer found only agreement.

I could not keep myself from looking up if - consequently - someone had the audacity to ask for the removal of ones and zeros in a language where one can literally use :duck: as variable name (which I personally find awesome and of which I am aware that it is not at all comparable on a technical level).

And indeed, someone did.

But wait? 28 thumps up that (I quote) fill(oneunit(T), sz) looks like a non-trivial loss in readability compared to ones(T, sz)?

Let me here make a small comment on the visual, figurative and semantic ingenuity of the word eye.
Firstly, for anyone a bit nervous with the single letter I, eye just sounds exactly the same. Moreover, the identity matrix even looks like a slightly rotated, slightly weird eye. And then, at last, the letter y itself provides another hint at a diagonal.

Anyway - someone (and I much approve of the time and effort) even investigated how often the command ones could actually be replaced by something faster. This is at least in agreement with the same argumentation regarding eye in particular when it comes to the function kron.

In short, explicitly constructing the naturally sparse identity matrix eye(n,n) is expected to provide a slower implementation than working with something implicit when calling kron (ignoring that explicitly using the Kronecker product is itself something that one should put into question anytime it is used).

And indeed, the visually disturbing line K = kron(Diagonal(ones(n)),A) + kron(B,Diagonal(ones(m))) will improve the runtime of your algorithm compared to K = kron(eye(n,n),A) + kron(B,eye(m,m)) by at least 0.01% given that the line thereafter inevitably calls (C * K) \ X.

I have to admit that I find the more recently implemented I(n) quite nice. It is impossible to easily overwrite it, and it is calmer than eye(n,n) (which makes much more sense than Matlab’s eye(n)), though it still does not provide me with the hyperdiagonal tensor eye(n,n,n) for which I reserve my right to sometimes desire it explicitly when used as starting value for an algorithm.

The honest take away message is here that I just could not help (and I am afraid others will too) but feel uninvited and discouraged to possibly submit a serious request over at GitHub. This is not really about eye. I just felt that some discussion on GitHub are kind of aggressive, and while I do not intend to blame anyone for this, it is just something that I wanted to put into an as different perspective as possible through this topic.

4 Likes

If I were to guess, the discussions on GitHub might tend to be slightly less inviting compared to here because often it is just between people who have become quite familiar with each other (core devs & common contributers) and feel comfortable expressing their opinions concisely.

Anyways, compared to Matlab, I much prefer I (no arguments). I happened to be using it a lot recently and it was awesome not having to even worry about dimensions! That was always what I hated most about linear algebra.

4 Likes

Also, there’s I(n) for identity matrices with a specific size.

(Saw now it’s mentioned in the OP).

4 Likes