Make as-vec work consistently on all matrix sizes
Opened this issue · 0 comments
mikera commented
Currently the as-vec
function behaves inconsistently:
- When given a normal mxn matrix, it converts to a vector of vectors, as expected
- When given a nx1 or 1xn matrix, it produces a flattened (1D) vector
The Clatrix behaviour is similar to that displayed by R, but this is widely regarded as a design flaw, see e.g.: http://radfordneal.wordpress.com/2008/08/20/design-flaws-in-r-2-%E2%80%94-dropped-dimensions/
This auto-flattening behaviour causes problems when writing any code that is designed to deal with arbitrary sized matrix, as it requires significant amounts of special-case code to be written.
I propose that this should be fixed in the next major release of Clatrix, and the behaviour (1) adopted throughout. It may be a breaking change for some users.