Hacker News new | ask | show | jobs
by mbauman 1657 days ago
I'd love to figure out where the disconnect is — and how we can make the manual more clear. It's a pretty simple rule: the number of semicolons specifies the dimension in which you "move". I've seen two disconnects, but yours might be different

* Julia's arrays are column major but when you use spaces to write them, you do so in row major fashion. This new syntax enables a column major input: `[1 2; 3 4]` is equivalent to `[1; 3;; 2; 4]`.

* When you're using spaces, it might feel "funny" to jump from one semicolon (which concatenates the rows in the first dimension) to three semicolons (which concatenates the matrices in the third dimension) in an expression like `[1 2; 3 4;;; 5 6; 7 8]`, but the key is that spaces first build rows and then the semicolons concatenate them along a particular dimension.

Anyhow, if you can expand on what's causing trouble, it'd be great to figure out how to improve the description in the manual.

2 comments

It's really hard to say in what way I don't understand something that I'm not sure I even understand.

I think one approach is to maybe fully explain the column major approach, and then introduce the row major approach, and lastly how those two interact.

> [1 2; 3 4]` is equivalent to `[1; 3;; 2; 4]`.

is a hard to understand example.

Is the space equal to ;;? e.g., is [1 2; 3 4] the same as [1;;2;3;;4]?

The ;; is similar to the space, in that it separates elements in the second dimension. But they are not quite equivalent, because you cannot write [1;;2;3;;4]. With semicolons you have to start with the innermost dimension and work outwards. The space notation is there so that you can write the array in row-order, since that is very common.
There has got to be a way to sprinkle emojis into the documentation: https://github.com/under-Peter/OMEinsum.jl#learn-by-examples