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.anal...@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