multiplication of logical with float tables

16 views
Skip to first unread message

Daniel Oberhoff

unread,
Nov 28, 2014, 8:06:58 AM11/28/14
to nt2...@googlegroups.com
Hi,

I am trying to port some machine learning code from grumpy to nt2. So far so good, but I stumble over trying to do something like this:

compare_less_equal(feat_mean, tt0) * feat_mean

i.e. I want all elements wich are smaller than tt0 zeroed. But doing this gives a long error message, starting with:

error: no type named 'type' in 'boost::dispatch::meta::call<boost::simd::tag::multiplies_ (boost::simd::logical<double> &, double), void>'


any ideas?

Joel FALCOU

unread,
Nov 28, 2014, 8:42:40 AM11/28/14
to nt2...@googlegroups.com
Hi and thanks for your interest in NT2.

NT2 computation are strictly typed, like in MATLAB so this kind of
product won't work.

What you can do is actually express what you want to do : zeroing
element lesser than tt0 :

feat_mean = if_else( feat_mean <= tt0, 0., feat_mean);

This can later be optimized by usign the shortcut if_zero_else

feat_mean = if_zero_else( feat_mean <= tt0, feat_mean);


Daniel Oberhoff

unread,
Nov 28, 2014, 8:57:08 AM11/28/14
to nt2...@googlegroups.com
aaah, thanks :). that works. I will probably soon have more questions, but for now, that keeps me going.
Reply all
Reply to author
Forward
0 new messages