uncomplicate / neanderthal

Fast Clojure Matrix Library
http://neanderthal.uncomplicate.org
Eclipse Public License 1.0
1.06k stars 56 forks source link

Why is mrows the number of rows and ncols the number of cols, shouldn't it be nrows? #89

Closed vascoferreira25 closed 4 years ago

vascoferreira25 commented 4 years ago

Hi, I've been fiddling with neanderthal for fun and I came across the mrows function in core that returns the number of rows of a matrix. There is a function called ncols that returns the number of columns.

Wouldn't it be better, for better consistency, to call this function nrows?

blueberry commented 4 years ago

It's because matrix dimensions are usually m x n, so m-rows and n-cols help users distinguish better between these two. It is easy (or at least easier) to mix up nrows and ncols, or to forget to edit your code properly if you switch the orientation. In other words, just a useful mnemonic device.

Of course, nothing stops you from (def nrows mrows) in your code if you prefer that.