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!
Published by


I apply my degree in computing with my experience in building networked software to create products that people will love. More about me here

Leave a Comment

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

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

Google photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s