Skip to content

Conversation

@jadrian
Copy link

@jadrian jadrian commented Feb 18, 2016

Hi @esangel-

When using your MV.js for a course I'm teaching, I found a couple bugs in transpose() and mult() which seem to stem from an assumption that matrices must always be square. However, non-square matrices are useful, for example, for representing all the vertices of a shape.

The current implementation of transpose() creates a result whose number of rows is the same as the input's number of rows, and whose number of columns is also the same as the input's.

The current implementation of mult(), when called on two matrices, checks to see that their dimensions exactly match; that is, that if u is MxN, then v must also be MxN. Instead, the correct check is to verify that if u is MxN, then v must be NxP, and the result should be an MxP matrix.

My two patches fix these errors, but still assume that all rows are the same length in a matrix input, even though it's possible to create a list-of-lists with different lengths for the inner lists.

The changes should not disrupt the behavior of the existing code; all calls with square matrices work just the same as they did previously. Please check them over; I hope you find these to be useful contributions.

-Jadrian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant