Is very fast, big thx!!
Paul

W dniu czwartek, 4 grudnia 2014 19:04:03 UTC+1 użytkownik tshort napisał:
>
> You could look to see if the PooledDataArray in the DataArrays package 
> will do what you are after or at least give you ideas.
> On Dec 4, 2014 12:35 PM, "paul analyst" <paul.a...@mail.com <javascript:>> 
> wrote:
>
>> I have :
>> Julia> J
>> 1
>> 5
>> 10000000
>> 2
>> 10000000
>> 1
>>
>>
>> i need recode to lowest values as posible
>> Julia> J
>> 1
>> 3
>> 4
>> 2
>> 4
>> 1
>>
>> Paul
>>
>>
>>
>>
>>
>> W dniu czwartek, 4 grudnia 2014 17:37:15 UTC+1 użytkownik Stefan 
>> Karpinski napisał:
>>>
>>> What are you trying to do? Reduce each value in J mod 1000?
>>>
>>> On Thu, Dec 4, 2014 at 10:44 AM, paul analyst <paul.a...@mail.com> 
>>> wrote:
>>>
>>>> I have a long vector J, which has little value. Unfortunately, these 
>>>> values 
>>>> are very different (small and large) J = [1 3 7 2 12548745 2 
>>>> 125485458544363456345 125485458544363456345 ... 3 12,548,545,854].
>>>> The following is a very slow like:
>>>> julia> J
>>>> 1846623-element Array{Int64,1}:
>>>>         930070
>>>>        1475172
>>>>    21474836496435345
>>>>    21474836496435345    
>>>> 4296445417
>>>>        641
>>>>        130
>>>>        130
>>>>        143
>>>> ...
>>>>     4296444827
>>>>        143
>>>>        148
>>>>        144
>>>>        145
>>>>
>>>> J1=zeros(J)
>>>> suJ=sort(unique(J))
>>>> l=length(suJ)
>>>>
>>>> for i =1:l
>>>> temp=findin(J,[suJ[i]])
>>>> J1[temp]=i;if mod(i,1000).==0 println(i) end;
>>>> end;
>>>>
>>>> How fast reduce the Vector range of values (Recode for smaler numbers)?
>>>> Paul
>>>>
>>>
>>> 

Reply via email to