jblas-project / jblas

Linear Algebra for Java
http://jblas.org
BSD 3-Clause "New" or "Revised" License
590 stars 149 forks source link

getRows with IntervalRange problems #29

Closed Neiko2002 closed 11 years ago

Neiko2002 commented 11 years ago

The method "public DoubleMatrix getRows(Range indices, DoubleMatrix result)" uses the indices.index() instead of the values. Resulting in problems when try to get some rows in the middle.

e.g.: DoubleMatrix m = new DoubleMatrix(new double[][]{{1,1,1},{2,2,2},{3,3,3},{4,4,4}}); DoubleMatrix m1 = m.getRows(new IntervalRange(0, 2)); DoubleMatrix m2 = m.getRows(new IntervalRange(2, m.getRows()));

m1 and m2 have the same values.

mikiobraun commented 11 years ago

Hi Nico,

thanks for writing. I'll check.

-M Am 03.06.2013 16:54 schrieb "Nico Hezel" notifications@github.com:

The method "public DoubleMatrix getRows(Range indices, DoubleMatrix result)" uses the indices.index() instead of the values. Resulting in problems when try to get some rows in the middle.

e.g.: DoubleMatrix m = new DoubleMatrix(new double[][]{{1,1,1},{2,2,2},{3,3,3},{4,4,4}}); DoubleMatrix m1 = m.getRows(new IntervalRange(0, 2)); DoubleMatrix m2 = m.getRows(new IntervalRange(2, m.getRows()));

m1 and m2 have the same values.

— Reply to this email directly or view it on GitHubhttps://github.com/mikiobraun/jblas/issues/29 .

mikiobraun commented 11 years ago

Yes, you're right. Corrected that. Also added a getColumns with Ranges. Was missing for some reason.

Thanks!

-M