mikiobraun/jblas — Issue #12: get(Range rs, Range cs)
Author: cheshirekow
Created: 2012-01-06 16:53:14+00:00
State: open

First, thanks for sharing this code. Second, a bug report:

I think this is essentially the same as issue #10. There appears to be a bug in FloatMatrix.get(Range rs, Range cs) (FloatMatrix.class:642) which currently looks like this:

````java
public FloatMatrix get(Range rs, Range cs) {
rs.init(0, rows);
cs.init(0, columns);
FloatMatrix result = new FloatMatrix(rs.length(), cs.length());

for (; rs.hasMore(); rs.next()) {
for (; cs.hasMore(); cs.next()) {
result.put(rs.index(), cs.index(), get(rs.value(), cs.value()));
}
}
return result;
}
````

The problem is that only first row is actually "got". I think this is because cs needs to be reset for each row. For instance:

````java
public FloatMatrix get(Range rs, Range cs) {
rs.init(0, rows);
cs.init(0, columns);
FloatMatrix result = new FloatMatrix(rs.length(), cs.length());

for (; rs.hasMore(); rs.next()) {
for (; cs.hasMore(); cs.next()) {
cs.init(0,columns) //<--------------- NOTE CHANGE -----
result.put(rs.index(), cs.index(), get(rs.value(), cs.value()));
}
}

return result;
}
````

I didn't bother to check if the same is present in DoubleMatrix