Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

put Ranges #10

Closed
mondi opened this issue Jan 27, 2011 · 2 comments
Closed

put Ranges #10

mondi opened this issue Jan 27, 2011 · 2 comments
Labels
accepted This sounds like something to look into. in progress

Comments

@mondi
Copy link

mondi commented Jan 27, 2011

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
Copy link
Member

Hello mondi,

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

-M

@mikiobraun
Copy link
Member

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

-M

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted This sounds like something to look into. in progress
Projects
None yet
Development

No branches or pull requests

2 participants