Skip to content

Implement `cov()` and `cor()`

Ryan Curtin requested to merge rcurtin/bandicoot-code:cov-cor into unstable

This MR implements cov() and cor() and fixes a handful of other small things that were necessary:

  • strip_diagmat<> now handles transpose operations; I didn't think this was necessary, because trans(diagmat(x)) will just not include an op_htrans. But... diagmat(x).t() will.
  • SizeProxy and traits needed support for diagview<>s.
  • Fixed missing compute_n_rows() and compute_n_cols() in op_stddev.
  • Fixed order of types in threeway array operations.

The test strategy is primarily to compare with Armadillo, with a few test cases that have hard-coded results.

The implementation could be optimized with custom kernels, but I consider it slightly niche support so I am not going to kill myself over it too much right now.

Merge request reports