Skip to content
This repository has been archived by the owner on Jul 16, 2021. It is now read-only.

Replacing row iteration by chunks with iter_rows method #93

Closed
AtheMathmo opened this issue Jul 5, 2016 · 0 comments · Fixed by #107
Closed

Replacing row iteration by chunks with iter_rows method #93

AtheMathmo opened this issue Jul 5, 2016 · 0 comments · Fixed by #107
Labels

Comments

@AtheMathmo
Copy link
Owner

AtheMathmo commented Jul 5, 2016

In multiple places we use chunks iteration where we could use the new iter_rows and iter_rows_mut methods.

Known places where this exists:

  • gmm.rs in the update_params method (on new_means.mut_data()).
  • naive_bayes.rs in the update_params method (on targets.data()).
  • naive_bayes.rs in the get_classes method (on log_probs.data()).

In addition to the above there are likely a number of other areas where code can be tidied up using the iter_rows methods. One such example:

In svm.rs, the ker_mat method. Instead of using:

for i in 0..dim` {
    for j in 0..dim2 {
        ker_data.push(self.ker.kernel(&m1.data()[i * cols..(i + 1) * cols],
                                          &m2.data()[j * cols..(j + 1) * cols]));
    }
}

We can iterate over the rows in m1 and m2 and then push the data into ker_data.

There are likely many more examples. The above is a good start.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant