Matrix manipulation


When solving Boggle, Sudoku or some n-by-n board game or when doing Image analysis or Parallel Computing – it is often useful to be able to represent one-dimensional data structures in 2-dimension and vice-versa.

Simple formulae exists for doing this conversion, as illustrated below:

Converting from Row by Col 2-dimensional (2-index) format to a 1-by-(Row*Col) matrix with only one index:

What we start out with
...what we end up with
...actually its more like this!

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s