[mlpack] Question about Armadillo
Kirill Mishchenko
ki.mishchenko at gmail.com
Tue Jun 27 11:43:35 EDT 2017
The type of T is
arma::Glue<arma::Op<arma::Gen<arma::Col<double>, arma::gen_zeros>, arma::op_htrans>, arma::Op<arma::Gen<arma::Col<double>, arma::gen_zeros>, arma::op_htrans>, arma::glue_join_rows>
I guess there should be something wrong with the line
const T& ref = arma::join_rows(arma::zeros(2).t(), arma::zeros(2).t());
since this works fine
template<typename T>
void f(const T& arg)
{
arma::mat m = arg;
}
BOOST_AUTO_TEST_CASE(RefTest)
{
f(arma::join_rows(arma::zeros(2).t(), arma::zeros(2).t()));
}
Best regards,
Kirill Mishchenko
> On 27 Jun 2017, at 20:35, Ryan Curtin <ryan at ratml.org> wrote:
>
> On Tue, Jun 27, 2017 at 08:28:00PM +0500, Kirill Mishchenko wrote:
>>> I believe this is a result of strange inference by the compiler. You
>>> should double-check my explanation here, I'm not 100% sure that it is
>>> correct, but my gut feeling is that it is…
>>
>> It looks like there is some other reason. I got the same error when I tried the following
>>
>> template<typename T>
>> void g(const T&)
>> {
>> const T& ref = arma::join_rows(arma::zeros(2).t(), arma::zeros(2).t());
>> arma::mat m = ref;
>> }
>>
>> BOOST_AUTO_TEST_CASE(RefTest4)
>> {
>> g(arma::join_rows(arma::zeros(2).t(), arma::zeros(2).t()));
>> }
>
> I think this is the same thing, the compiler deduces a strange type for
> T. Also, sometimes Armadillo can give better output when compiled in
> debugging mode (so I guess reconfigure CMake with -DDEBUG=ON), that may
> provide a better output for diagnosis than just a segfault.
>
> I am curious, do you know what the deduced type for T is? That may shed
> additional light on the failure.
>
> --
> Ryan Curtin | "Wha' happened?"
> ryan at ratml.org <mailto:ryan at ratml.org> | - Mike LaFontaine
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://knife.lugatgt.org/pipermail/mlpack/attachments/20170627/54ba80e7/attachment.html>
More information about the mlpack
mailing list