sebiniemann / ArmadilloJava

Pure Java-based linear algebra library
armadillojava.org
8 stars 8 forks source link

incorrect handling of submatrices #62

Closed conradsnicta closed 10 years ago

conradsnicta commented 10 years ago

The syntax conversion table (CONVERSION.md) has a possible bug, and may affect the underlying Java code. In the submatrix views section, there is:

Matlab = A(ai:bi, aj:bj) Armadillo = A.submat(ai, bi, aj, bj)

The above conversion is not correct. The syntax for Armadillo C++ submatrices is as follows:

X.submat( first_row, first_col, last_row, last_col )

X( span(first_row, last_row), span(first_col, last_col) ) X.submat( span(first_row, last_row), span(first_col, last_col) )

Note that in the first form (ie. without span), first_col is the second argument, while in the forms with span, first_col is in a different position.

The exact details for C++ Armadillo submatrices are here: http://arma.sourceforge.net/docs.html#submat

sebiniemann commented 10 years ago

Thanks for the notice, this is actually an unintentional deviation from the Armadillo C++ API.

It will be fixed in the upcoming release (together with the support of the Armadillo C++ API v4.000.0), which may be ready in the next days.

However, it is already fixed since a few days (82c420a462dd82877add153a95a32cc31bfee992), but this branch is not yet stable.