Matrices

Jan 23, 2009 at 8:05pm
For a math project I want to create a class to deal with matrices (two-dimensional arrays). I want to write my own class, I want it to be fast, and I don't need the matrix to be dynamical (in fact, the size is determined by the constructor and after that it will be impossible to resize it).

I wondered, would it be faster if I use a simple one-dimensional array for the matrix (i.e.: for a 4x4 Matrix I would use an array of size 16) ?
Jan 23, 2009 at 8:26pm
That wouldn't make any difference. In fact, there is no difference between two-dimensional arrays and one-dimensional arrys from the computers point of view: two-dimensional arrays are just a tool to make things easier for programmers.
Jan 23, 2009 at 8:34pm
there will be only problem with memory, because in two dimensional array you have length 16, but in one dimensional array you need extra memory for count of columns or rows.
Jan 23, 2009 at 8:47pm
oh no, I already have a variable for the size of the matrix and they are always square matrices, so the only issue is speed.
Jan 23, 2009 at 8:50pm
For the speed it doesnt matter at all.
Topic archived. No new replies allowed.