Skip to content

saddle-points: worst possible practice #787

@michalfita

Description

@michalfita

The saddle-points problem uses matrices, which are part of algebra. Any programmer doing algebra seriously knows that vector of vectors is the worst possible implementation of a matrix due to cache locality issues (doesn't apply to fixed array of fixed arrays).

Usage of vector of vectors (vec![vec![], vec![], vec![]];) teaches young adepts of programming bad practices. The correct ways to represent matrices are:

  1. Use algebraic crate that handles matrices correctly and optimally (that would give a hint how address algebraic problems in general)
  2. Use type holding one vector and dimensions and then implement access (that would give hint some other extensions to the type can be added, like column slice)
  3. Use linear vector and pass matrix dimensions' sizes as another argument (that would be the most C-like way, however still valid)

That's my second exercise on excercism.io, and I'm hugely disappointed.

I'm happy to provide a PR, but consensus is required which approach to choose.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions