jblas-project / jblas

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

put Ranges #10

Closed mondi closed 11 years ago

mondi commented 13 years ago

Hello mikkiobraun

Your API is a great work. thank you. By making some data imports with the put function and ranges I found some bug. If I understood the function put(Range rs, Range cs, DoubleMatrix x) correctly they should in the first loop something like „cs.reset();“ otherwise only the first row would be inserted.

/* Put a matrix into specified indices. / public DoubleMatrix put(Range rs, Range cs, DoubleMatrix x) { rs.init(0, rows); cs.init(0, columns);

    x.checkRows(rs.length());
    x.checkColumns(cs.length());

    for (; rs.hasMore(); rs.next()) {
        for (; cs.hasMore(); cs.next()) {
            put(rs.value(), cs.value(), x.get(rs.index(), cs.index()));
        }
        cs.reset();
    }

    return this;
}
mikiobraun commented 13 years ago

Hello mondi,

oh yes, you're totally right... . I'll try to put in a fix for this soon... .

-M

mikiobraun commented 13 years ago

Actually, cs.init(0, columns); does what cs.reset() is supposed to do so that quick fix should work.

-M