The Math Forum

Search All of the Math Forum:

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

Math Forum » Discussions » sci.math.* » sci.math

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
William Elliot

Posts: 2,637
Registered: 1/8/12
Re: matrices as vectors
Posted: Feb 20, 2013 3:31 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On Tue, 19 Feb 2013, 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.

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.