Skip to content

Make as-vec work consistently on all matrix sizes #29

@mikera

Description

@mikera

Currently the as-vec function behaves inconsistently:

  1. When given a normal mxn matrix, it converts to a vector of vectors, as expected
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions