[julia-users] Conditional works like on the selected columns of the matrix

2014-04-19 Thread paul analyst
I have a logical vector t 
julia> t 
1x4 BitArray{2}:
 true  false  false  false

and matrix v
julia> v 
4x4 Array {Float64, 2}: 
  -0.0018187 -0.18174 0.982684 0.0360478 
  -0.018408 0.98314 0.1819 -0.00297265 
  -0.995394 -0.0167994 -0.00839779 0.0940118 
   0.0940681 0.0111097 -0.0342677 0.994914 

How quickly multiplied by -1 only the columns where vactor t = true  ?
Paul


Re: [julia-users] Conditional works like on the selected columns of the matrix

2014-04-19 Thread Stefan Karpinski
scale!(v, 1 .- 2t)


On Sat, Apr 19, 2014 at 5:11 AM, paul analyst  wrote:

> I have a logical vector t
> julia> t
> 1x4 BitArray{2}:
>  true  false  false  false
>
> and matrix v
> julia> v
> 4x4 Array {Float64, 2}:
>   -0.0018187 -0.18174 0.982684 0.0360478
>   -0.018408 0.98314 0.1819 -0.00297265
>   -0.995394 -0.0167994 -0.00839779 0.0940118
>0.0940681 0.0111097 -0.0342677 0.994914
>
> How quickly multiplied by -1 only the columns where vactor t = true  ?
> Paul
>


Re: [julia-users] Conditional works like on the selected columns of the matrix

2014-04-19 Thread paul analyst
Big thx, 
what is "-2" before t ?
Paul

W dniu sobota, 19 kwietnia 2014 14:47:40 UTC+2 użytkownik Stefan Karpinski 
napisał:
>
> scale!(v, 1 .- 2t)
>
>
> On Sat, Apr 19, 2014 at 5:11 AM, paul analyst 
> > wrote:
>
>> I have a logical vector t 
>> julia> t 
>> 1x4 BitArray{2}:
>>  true  false  false  false
>>
>> and matrix v
>> julia> v 
>> 4x4 Array {Float64, 2}: 
>>   -0.0018187 -0.18174 0.982684 0.0360478 
>>   -0.018408 0.98314 0.1819 -0.00297265 
>>   -0.995394 -0.0167994 -0.00839779 0.0940118 
>>0.0940681 0.0111097 -0.0342677 0.994914 
>>
>> How quickly multiplied by -1 only the columns where vactor t = true  ?
>> Paul
>>
>
>

Re: [julia-users] Conditional works like on the selected columns of the matrix

2014-04-19 Thread Stefan Karpinski
Broadcasting subtraction of 2 times t from 1.


On Sat, Apr 19, 2014 at 3:42 PM, paul analyst  wrote:

> Big thx,
> what is "-2" before t ?
> Paul
>
> W dniu sobota, 19 kwietnia 2014 14:47:40 UTC+2 użytkownik Stefan Karpinski
> napisał:
>>
>> scale!(v, 1 .- 2t)
>>
>>
>> On Sat, Apr 19, 2014 at 5:11 AM, paul analyst  wrote:
>>
>>> I have a logical vector t
>>> julia> t
>>> 1x4 BitArray{2}:
>>>  true  false  false  false
>>>
>>> and matrix v
>>> julia> v
>>> 4x4 Array {Float64, 2}:
>>>   -0.0018187 -0.18174 0.982684 0.0360478
>>>   -0.018408 0.98314 0.1819 -0.00297265
>>>   -0.995394 -0.0167994 -0.00839779 0.0940118
>>>0.0940681 0.0111097 -0.0342677 0.994914
>>>
>>> How quickly multiplied by -1 only the columns where vactor t = true  ?
>>> Paul
>>>
>>
>>