This works for me on 0.3.4 on mac:
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "help()" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.3.4 (2014-12-26 10:42 UTC)
_/ |\__'_|_|_|\__'_| | Official http://julialang.org/ release
|__/ | x86_64-apple-darwin13.4.0
julia> a = rand(10);
julia> Collections.heapify!(a)
10-element Array{Float64,1}:
0.0610402
0.318859
0.1811
0.494483
0.412013
0.643721
0.65164
0.536059
0.867843
0.97967
-viral
On Saturday, January 3, 2015 5:44:55 PM UTC+5:30, Rodolfo Santana wrote:
>
> Hi Tim,
>
> Thanks for the reply! Yes, I realize this is what 'heapify!' does.
>
> I first do x= rand(10). Then, I try Collections.heapify!(x) and I get the
> error:
>
> ERROR: heapify! not defined
>
> Maybe someone can post a screenshot of how to use this function in Julia?
> I couldn't find an example on the web using this function.
>
> Thanks,
>
> -Rodolfo
>
> On Saturday, January 3, 2015 5:40:22 AM UTC-6, Tim Holy wrote:
>>
>> Also post any error messages, etc.
>>
>> You realize that `heapify!` returns an array, just with elements in a
>> different
>> order? The smallest element will be first.
>>
>> --Tim
>>
>> On Saturday, January 03, 2015 03:12:39 AM Rodolfo Santana wrote:
>> > Here it is:
>> >
>> > Julia Version 0.3.4
>> >
>> > Commit 3392026* (2014-12-26 10:42 UTC)
>> >
>> > Platform Info:
>> >
>> > System: Darwin (x86_64-apple-darwin13.4.0)
>> >
>> > CPU: Intel(R) Core(TM) i7 CPU M 620 @ 2.67GHz
>> >
>> > WORD_SIZE: 64
>> >
>> > BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Nehalem)
>> >
>> > LAPACK: libopenblas
>> >
>> > LIBM: libopenlibm
>> >
>> > LLVM: libLLVM-3.3
>> >
>> > On Saturday, January 3, 2015 5:06:42 AM UTC-6, [email protected] wrote:
>> > > Strange, works for me, maybe post the whole versioninfo() output that
>> the
>> > > experts can look at.
>> > >
>> > > Cheers
>> > > Lex
>> > >
>> > > On Saturday, January 3, 2015 8:58:21 PM UTC+10, Rodolfo Santana
>> wrote:
>> > >> Hi Lex,
>> > >>
>> > >> I am using Version 0.3.4
>> > >>
>> > >> On Saturday, January 3, 2015 4:55:06 AM UTC-6, [email protected]
>> wrote:
>> > >>> Whats your versioninfo()
>> > >>>
>> > >>> On Saturday, January 3, 2015 8:53:30 PM UTC+10, Rodolfo Santana
>> wrote:
>> > >>>> Thanks for the reply! I have tried that, but I get:
>> > >>>>
>> > >>>> ERROR: heapify! not defined
>> > >>>>
>> > >>>> On Saturday, January 3, 2015 4:48:27 AM UTC-6, Ivar Nesje wrote:
>> > >>>>> *Collections.heapify!(x)*
>> > >>>>>
>> > >>>>> kl. 11:22:24 UTC+1 lørdag 3. januar 2015 skrev Rodolfo Santana
>> > >>>>>
>> > >>>>> følgende:
>> > >>>>>> Let's say I have an array x=rand(10) . How do I use the heapify!
>> > >>>>>> function to heapify x?
>> > >>>>>>
>> > >>>>>> Thanks!
>> > >>>>>> -Rodolfo
>>
>>