!cxPCiPlsXnajakSrqd:matrix.org

Array languages

547 Members
General discussion about APL-like array languages. See #array:matrix.org for other rooms22 Servers

Load older messages


SenderMessageTime
31 Mar 2023
@ngn:matrix.orgngn"row" and "column" are relative to the default orientation in which a matrix is written00:02:49
@ngn:matrix.orgngnso it may be better to describe the order as "lexicographic order of index tuples"00:03:11
@ngn:matrix.orgngnthe convention for matrices happens to be "first axis down, second axis right"00:05:12
@ngn:matrix.orgngncontrary to the convention in geometry where the point (x,y) lies x units right and y units up00:05:35
@ngn:matrix.orgngn * contrary to the convention in geometry where the point (x,y) lies x units right and y units up from the origin00:05:42
@_discord_209725348768776192:t2bot.ioMoonchild well there is a question of what lexicographic order is used by ravel—axes are ordered from 'beginning' to 'end' rather than the other way around, which would give column-major raveling of matrices 00:07:34
@_discord_718551566336000090:t2bot.iojatta Matrix * vector multiplication would be done row-wise m[1,1] * v[1] + m[1,2] * v[2] instead of column-wise (m[1,1] * v[1], m[2,1] * v[1]) ? 00:13:18
@ngn:matrix.orgngn
In reply to @_discord_209725348768776192:t2bot.io
well there is a question of what lexicographic order is used by ravel—axes are ordered from 'beginning' to 'end' rather than the other way around, which would give column-major raveling of matrices
beginning to end (i.e. first, last) of course
00:16:28
@ngn:matrix.orgngn
In reply to @_discord_209725348768776192:t2bot.io
well there is a question of what lexicographic order is used by ravel—axes are ordered from 'beginning' to 'end' rather than the other way around, which would give column-major raveling of matrices
* beginning to end (i.e. first, second) of course
00:16:43
@mlochbaum:matrix.orgMarshall I tried to untangle some of the various orderings on this wiki page. I use "index order" instead of "ravel order" in BQN, a lot like ngn's suggestion. 00:17:54
@ngn:matrix.orgngnim sorry for accidentally contributing to dyalog's wiki00:18:25
@_discord_209725348768776192:t2bot.ioMoonchild lol 00:19:38
@ngn:matrix.orgngn
In reply to @_discord_718551566336000090:t2bot.io
Matrix * vector multiplication would be done row-wise m[1,1] * v[1] + m[1,2] * v[2] instead of column-wise (m[1,1] * v[1], m[2,1] * v[1]) ?
matrix multiplication is generalized to "inner product" in apl. it works on any-dimensional arrays. better think of it as merging the last axis of alpha (the left argument) and the first axis of omega (the right argument) instead of row- or column-wise.
00:21:31
@ngn:matrix.orgngnafaik, the other apl-likes do it the same way, and it makes sense00:22:45
@ngn:matrix.orgngn * im sorry for accidentally contributing to agreeing with dyalog's wiki 00:27:32
@_discord_718551566336000090:t2bot.iojatta I guess the reason this order is nice is that it lets you express a[i,j] as a[i][j] equally efficiently. Under column-major storage a[i] is too slow. 00:43:51
@_discord_718551566336000090:t2bot.iojatta (idk if there's a way to describe column-major storage in apl vocabulary) 00:46:19
@_discord_209725348768776192:t2bot.ioMoonchild no 00:46:23
@_discord_209725348768776192:t2bot.ioMoonchild you can lay out arrays however you want 00:46:25
@_discord_718551566336000090:t2bot.iojatta but you can't make an efficient apl if a[i] requires hopping all over the place 00:47:43
@ngn:matrix.orgngnas long as you store vectors in consecutive memory cells, no00:48:30
@_discord_209725348768776192:t2bot.ioMoonchild the non-strawman case involves i being a large array of indices, which must hop all over the place anyway 00:48:50
@ngn:matrix.orgngn for matrices one of the two will inevitably have to be hopping: a[i;] or a[;j] 00:49:00
@_discord_209725348768776192:t2bot.ioMoonchild regardless—yeah, that 00:49:19
@_discord_209725348768776192:t2bot.ioMoonchild (and see also stuff like morton order, which makes both hop around, but somewhat less than they might otherwise) 00:49:43
@_discord_624974820840308737:t2bot.ioColTim#5847 I thought this was the C/Fortran split about how multi-dimensional arrays were laid out in memory 01:05:21
@_discord_718551566336000090:t2bot.iojatta It is 01:07:20
@_discord_718551566336000090:t2bot.iojatta https://en.wikipedia.org/wiki/Row-_and_column-major_order 01:07:32
@_discord_624974820840308737:t2bot.ioColTim#5847 I wonder if it is as relevant now. I thought the way cells are accessed in e.g. matrix multiplies is in blocks or chunks 01:13:39
@_discord_624974820840308737:t2bot.ioColTim#5847 so you're not traversing the entire row or column 01:14:11

There are no newer messages yet.


Back to Room ListRoom Version: 6