Why `eye` has been deprecated?

It seems you attributed that quote to the wrong person. I do quite a bit of coding in Matlab, and as a result there have been quite a few occasions where I’ve been annoyed with the quirks of that language. Every time Julia has moved away from Matlab syntax, I’ve found it made the language better. (I wish that they’d gotten rid of the hard-coded f' = adjoint(f) as well.)

3 Likes

Yikes! What would you suggest instead?

1 Like

Why should we fully adopt MATLAB idioms? Isn’t it because we think it is not perfect and then we have the Julia language?

eye is not explicit, you won’t notice which type you are using. I will vote for IMatrix if we need something for identity matrix rather than eye. If we have

eye(3)

You cannot tell whether this is a Array, or SparseMatrixCSC, or CuArray etc. explicit is better than implicit.

MATLAB is not Julia, Python is not Julia, although Julia make use part of their idioms. I don’t think it is good to use UniformScaling either though. But this should be another story.

1 Like

Why hard-coded f' = adjoint(f) is annoying? Is there any example for this?

33 posts were split to a new topic: On adjoints and custom postfix and infix operators

I don’t think there is anything wrong with being a janitor, and I have in fact often heard that title used in a respectful way about people who do a lot of important, low-profile work.

While I agree with much of your post, I didn’t see any devaluation of “janitorial tasks” in @stillyslalom’s post.

2 Likes

In finance and econometrics, there’s often a fair number of I_n (eye(n)) floating around in the papers/texts. Since I like my programs to stick closely to the “theory,” this carries over to my attempts to code.

In the run up to 0.7, I spent some time purging eye from all my code for my lecture notes (and using I instead). In line with Stefan’s forecast, I had 95% luck. I believe that the only remaining case that I still have is a couple of kron(X,I) where X is a square matrix. However, I suspect it qualifies as an anti pattern.

5 Likes

This is temporarily worse than it will be in the future. With the deprecation removed in 1.0-dev, we can now have a pull-request to allow range(0, pi, length=50).

Moderator’s note: I’ve split this thread as best I could.

9 Likes

Ok so maybe rather than just my specific suggestions of contributing to the Wikibook and working on a MatlabToJulia.jl (or modernizing MatlabCompat.jl) is anyone interested in forming some sort of MATLAB/Julia users SIG which can do these sorts of things (including others’ probably better ideas than mine) in a coordinated way? This could just be a sub-forum here on Discourse (and, if people insist, a Slack channel, but ugh, Slack :slight_smile: ).

I think individually we probably are very busy and have little time but collectively we can do a lot to turn some of the kinds of discussion we have on threads like these into some concrete solutions that build on the (1.0) core language.

5 Likes

Count on me! 99,99% of the engineers at INPE (National Institute for Space Research) use MATLAB and an easy update path is required :slight_smile:

I think MatlabCompat is fine. But we need to make it come back to life.

6 Likes

I’m sorry, my tone was a bit sharp. Most of the small handful of contributions I’ve made to the language and ecosystem have been docs-related, I’ve worked as an actual janitor, and I really do appreciate well-written documentation. I’m just looking forward to the ecosystem documentation/blogs/examples catching up to the language (and ready to help once 1.0 and major peripheral packages are stable).

Re: Matlab, I don’t think we need to copy the syntax, per se, but I’d like a Batteries.jl or KitchenSink.jl package that just reexports other packages to provide functionality on par with what’s built into Matlab. (FFTW, SpecialFunctions, Plots, LinearAlgebra, Images, DataFrames, Interpolations, Roots, Random, LsqFit, QuadGK, DifferentialEquations, ???)

3 Likes

Frankly I feel that Matlab developers have made a number of questionable choices over the years, and very rarely they made the effort to correct them. Consistency and obviousness is a great advantage of Julia!

7 Likes

@StefanKarpinski could we get perhaps a subcategory of Development?

https://github.com/ChrisRackauckas/Cuddle.jl ? :troll:

2 Likes

I’m not Stefan, but I’m also a moderator here — why don’t you start with a new thread and if there’s sufficient interest/traffic we can expand it out to a subcategory. Really, though, I think this would be best coordinated around a specific repository (like MatlabCompat) and discussion within issues there.

4 Likes

On a related note, could someone post a one-liner that creates a dense Float64 identity matrix in both 0.6 and 0.7 with no deprecation warnings? Here is what I using now:

   eye1 = zeros(n,n)
   for i = 1 : n
        eye1[i,i] = 1.0
   end

With Compat you can use

Matrix{Float64}(I, n, n)

on both versions.

5 Likes

I didn’t say that being a janitor was bad, or something that is offensive to be compared to. I said that the comparison wasn’t fair, and the following text was supposed to explain why…

A janitor does important work, but it is routine work: cleaning, moving stuff around, and maybe doing some small repairs - but nothing that requires specialized, skilled (licensed) work. What I’m saying is that proper documentation and testing is not routine work. If you’ve ever had to document or test a program you did not write yourself you’ll know what I mean. It requires lots of knowledge and ability to read and understand code to do this well.

Anyway, since I don’t think there were any ill intentions I don’t think we should continue this sub-thread beyond this message. I think we’re all on the same page :slight_smile:

2 Likes

Count me too. MatlabCompat has the right name but I would prefer a package without the dependencies it has.

Maybe you want to make MatlabCombat a metapackage, which reexports. This way the package which implements eye and similar won’t have any dependencies.