Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Did I misunderstand something? that "3x3" matrix isn't a 2 dimensional matrix. It's a 9 item array.


They're the same thing in a way. Most dense n-dimensional matrices are stored as a simple 1d array with some metadata about how to interpret it.


We learned to do that in my second CS class at university. It is a common way to represent a matrix. instead of keeping track of just `i`, you will also have a row index and use the modulus operator on the iterator tracking (i) to get the column index.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: