Matrix.lua -

: Allows you to pass any anonymous function, such as function(val) return math.max(0, val) end (ReLU activation).

: It fits the library's design of returning a new matrix rather than modifying the original, maintaining "immutability". davidm/lua-matrix - GitHub matrix.lua

: By integrating this into the core library, you can ensure it handles table indexing in a way that minimizes overhead, which is a common bottleneck for large matrices (e.g., 250x250 or larger). : Allows you to pass any anonymous function,