Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


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

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: 1,481
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, 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.



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

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.