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

Replacing row iteration by chunks with iter_rows method #93

@AtheMathmo

Description

@AtheMathmo

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions