[mlpack-git] [mlpack] Adds inplace transpose method and some tests. (#408)

Ryan Curtin notifications at github.com
Mon Feb 23 13:18:45 EST 2015


> +
> +  mat Y = X;
> +
> +  BOOST_REQUIRE(arma::inplace_transpose(X) == false);
> +  BOOST_REQUIRE_EQUAL(X.n_rows, 4);
> +  BOOST_REQUIRE_EQUAL(X.n_cols, 2);
> +
> +  for (size_t i = 0; i < X.n_rows; ++i)
> +    for (size_t j = 0; j < X.n_cols; ++j)
> +      BOOST_REQUIRE_CLOSE(X.at(i, j), Y.at(j, i), 1e-5);
> +}
> +
> +/**
> + * Try to transpose using low-mem method.
> + */
> +BOOST_AUTO_TEST_CASE(InplaceTransposeLowMemTest)

Yeah, this test will probably usually cause a user's system to start swapping (which is a bad thing).  Can you think of a better way to perform this test without actually allocating such a huge matrix?  If not, the code contribution is sufficiently simple that I'll take it without tests.  After all, it depends on Armadillo, and we can assume that the Armadillo transposition code is sufficiently well-tested.

---
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/pull/408/files#r25187024
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20150223/aa9ab00d/attachment.html>


More information about the mlpack-git mailing list