In browser environment, when I used multiply, it got stuck on NDIter in an infinite loop.
- The cause is that
NDArray arity isn't checked by the multiply function and it assumes it will work with two matrices. If one tries to multiple a matrix ([[...],[...],[...]]) with a vector [..], the c2 value is undefined.
- This causes a subsequently constructed result matrix to have
0 size, i.e. undefined length.
- Which isn't checked either when
NDIter is constructed, resulting in an infinite loop because index > undefined is true (because undefined is cast to 0).
Solution
- Check if vector is provided as second argument and turn it into a matrix.
- Handle vectors from NDIter?