Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: matrices as vectors
Replies: 4   Last Post: Feb 22, 2013 12:43 PM

 Messages: [ Previous | Next ]
 William Elliot Posts: 2,637 Registered: 1/8/12
Re: matrices as vectors
Posted: Feb 20, 2013 3:31 AM

On Tue, 19 Feb 2013, leonard14279@gmail.com wrote:

> Had the idea to represent a 2d-matrix as a 1d-vector.
> Have an existing program to perform matrix operations, where a matrix is
> represented as an array of arrays.
> Seems like the code would be more straightforward if a matrix were
> represented as a 1d-vector.
> Need a function to map [ row, col ] indices to an index [ n ], and
> vice-versa.

Does that mean anything?
Are you wanting to map n by m matrices to 1 by n matrices?
That can't be done without loosing lots of information.

> Then the rest should be straightforward.
> So we have two functions ...
>
> ij-to-n( row, col ) {
> n = row * numrows + col;
> }
>
> n-to-ij( n ) {
> row = ( n - col ) / numrows;
> col = n - ( row * numrows );
> }

Those aren't well defined functions, they're snippits of some alian code.

> Then the rest of the code can be refactored to use the 1d-vector
> representation of a 2d-matrix.

I don't know what you're talking about. Do you?
You can represent a n by m matrice by a colume of m n-dimensional vectors.

> The question is, are there already existing formulas for matrix
> operations, where the matrix is represented as a 1d-vector?

Depends upon what you mean.

Date Subject Author
2/20/13 William Elliot
2/20/13 Michael Stemper
2/21/13 J.B. Wood
2/22/13 Kaba