vkostyukov / la4j

Linear Algebra for Java
http://la4j.org
Apache License 2.0
373 stars 109 forks source link

Validation error in Matrix.insert #255

Closed twheys closed 9 years ago

twheys commented 9 years ago

Line 747 of org.la4j.Matrix incorrectly compares the number of rows and columns to be inserted with columns and rows:

if (destRow + rows > this.columns || destColumn + columns > this.rows) {
    fail("Out of bounds: Cannot add " + rows + " rows and " + columns + " cols at "
        + destRow + ", " + destColumn + " in a " + this.rows + "x" + this.columns + " matrix.");
}

Should be

if (destRow + rows > this.rows || destColumn + columns > this.columns) {
    fail("Out of bounds: Cannot add " + rows + " rows and " + columns + " cols at "
        + destRow + ", " + destColumn + " in a " + this.rows + "x" + this.columns + " matrix.");
}
vkostyukov commented 9 years ago

Do you mind to create a PR?

twheys commented 9 years ago

sure

vkostyukov commented 9 years ago

Cool! Thanks!

sylvia43 commented 9 years ago

That was my bad :P

I wrote that, didn't test it enough. Copy paste error :disappointed: