Loïc Grenié on Thu, 22 Oct 2015 09:38:24 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Using forvec as fordiv |
On Wed, Oct 21, 2015 at 04:41:47PM -0400, Charles Greathouse wrote:
> Given a vectors u and v with #v == #u, what's the easiest way to extract
> the elements of v for which the corresponding element of u is nonzero? (All
> elements from u will be 0 or 1.)
I suggest you look up vecextract.
? vecextract([1,2,3,4,5],fromdigits([1,0,1,0,1],2))
%1 = [1,3,5]