Note that the broadcasting works for sparse matrices only on recent builds.

On Monday, September 21, 2015 at 6:28:46 AM UTC-7, Matt Bauman wrote:
>
> The bitwise operations (&, |) broadcast over arrays and work just fine for 
> this.  Watch out for their precedence, though: you need to wrap them in 
> parentheses if you want to combine them with the result of comparisons `(A 
> == 1) | (A == 2)`.
>
> On Monday, September 21, 2015 at 8:41:29 AM UTC-4, Daniel Carrera wrote:
>>
>> It looks like I can get the right effect using component-wise 
>> multiplication:
>>
>> julia> ![true, true, false] .* [false, true, true]
>> 3-element Array{Bool,1}:
>>  false
>>  false
>>   true
>>
>>
>> Is this the correct solution or is this an ugly hack?
>>
>> Cheers,
>> Daniel.
>>
>>
>>
>> On 21 September 2015 at 14:35, Daniel Carrera <dcar...@gmail.com> wrote:
>>
>>> Hello,
>>>
>>> I have two boolean arrays and I am trying to obtain the boolean array 
>>> resulting from a component-wise `AND`:
>>>
>>> julia> [true, true, false] .&& [false, true, true]
>>> ERROR: syntax: invalid identifier name "&&"
>>>
>>> julia> [true, true, false] .& [false, true, true]
>>> ERROR: type Array has no field &
>>>
>>>
>>> Can anyone figure out what I'm doing wrong? I was hoping that `.&` and 
>>> `.&&` would apply the operation on a per-component basis. Help?
>>>
>>> Cheers,
>>> Daniel.
>>>
>>
>>

Reply via email to