On Wed, 11 Aug 2021, Sven Schreiber wrote:
 Hi,
 working with flatten() and msplitby(), I'm noticing the following:
 - By default, flatten() works horizontally, but msplitby() vertically
 (rows). Ok it's too late to change any defaults, but actually msplitby()
 currently doesn't do horizontally at all. (Yes, I know I can transpose
 and re-transpose, but that's exactly what I call a "quirk".) Maybe an
 optional arg could be added there as well, like flatten() has?
 - For some easy operations, msplitby() is quite complicated. For
 example, if I have 2000 rows and want to turn that into 1000 matrices
 with 2 rows each, then AFAIK I have to define the assignment vector as
 follows: seq(1,1000)' ** ones(2). (Please correct me if there's a simple
 way I'm missing.) Instead I think for such even splits it should be as
 straightforward as writing: msplitby(m, 2). Maybe such a scalar argument
 could be allowed in non-ambiguous cases? 
Please formulate this as a feature for msplitby(). Right now that 
function offers very general control over splitting but as you say 
it's not convenient for certain simple cases, and it probably should 
offer choice of dimension. A revised but backward-compatible 
signature might be:
matrices msplitby (matrix M, <vector-or-scalar> by, bool alt)
where @alt would switch to column-wise splitting and scalar @by 
would give the chunk size, provided the relevant dimension is 
divisible by @by.
BTW splitting a matrix by columns will be much faster then by rows; 
for splitting a big matrix by rows it might even pay to transpose, 
split by columns, and re-transpose, though that would have to be 
tested.
Allin