3 ms·
I hate these 2x2 (or nxn) matrix examples. You never know what is considered column and what is row.
by mbeex 7y ago
I hate these 2x2 (or nxn) matrix examples. You never know what is considered column and what is row.
- tomrod 7y agoRows, then columns. Lowest index level is column. Follows Pandas, more or less.
- throwawaymath 7y agoJulia takes after Matlab, where matrices are defined by enumerating each row followed by a semicolon. Personally I prefer Mathematica's syntax, but the Julia/Matlab syntax is still way better than Numpy syntax (though to be fair most of that is due to the lack of native matrix support in Python). If it helps at all, this is exactly what you'll see when you create a matrix in Julia: julia> mat = [1 2; 3 4] 2×2 Array{Int64,2}: 1 2 3 4
- dnautics 7y agoFYI you can also do this julia> mat = [1 2 3 4]
- throwawaymath 7y agoOh that's neat. Thanks, I wasn't aware of that.
- FridgeSeal 7y agoI definitely have this problem with Numpy: it just sort of vomits the whole matrix at you and never really makes it clear which one’s which. I haven’t had the problem with Julia though: it will actually format the output and the API’s make it clear when you’re dealing with rows or columns, and which one.