[julia-users] Integer Division Native Code Emitted

2013-12-28 Thread Marcus Urban
I've noticed that the function div(a::Int, b::Int) results in a very large amount number of instructions, whereas rem(a::Int, b::Int) produces only a third as many. Is there an integer division function that emits code more like rem? Here are the results: # First rem() julia> g(a::Int, b::Int)

Re: [julia-users] Dynamically growing array?

2013-12-28 Thread Sheehan Olver
Thanks for the suggestions. It seems best to do the simplest first, and then optimize later if memory management is taking a significant cost. So I think I’ll stick with reshape! and Array{Array{Float64,1},1}. On 29 Dec 2013, at 7:36 am, Stefan Karpinski wrote: > If you make a mistake,

[julia-users] Re: Some problem with the interpreter

2013-12-28 Thread Alfred Tarski
I get something similar: julia> using PyPlot ERROR: invalid base 10 digit '.' in "0.5" in reload_path at loading.jl:146 in _require at loading.jl:59 in require at loading.jl:46 in reload_path at loading.jl:146 in _require at loading.jl:59 in require at loading.jl:43 while loading /home/ms/.julia/C

[julia-users] Re: Some problem with the interpreter

2013-12-28 Thread Ismael VC
I can also confirm this, using a VM from koding.com, and the Ubuntu nightly PPA, just updated: ismaelvc@vm-1:~$ uname -a Linux vm-1.ismaelvc.koding.kd.io 3.9.0-0-generic #4userns5 SMP Mon May 13 06:15:34 PDT 2013 x86_64 x86_64 x86_64 GNU/Linux ismaelvc@vm-1:~$ cat /etc/issue Ubuntu 13.04 \n \l

Re: [julia-users] Dynamically growing array?

2013-12-28 Thread Stefan Karpinski
If you make a mistake, segfault. On Sat, Dec 28, 2013 at 3:35 PM, Toivo Henningsson wrote: > So what happens if you use Tim's sneaky workaround and resize the 1d > array? I suppose that the pointer is no longer valid... > > > On Saturday, 28 December 2013 18:25:50 UTC+1, Stefan Karpinski wrote:

Re: [julia-users] Dynamically growing array?

2013-12-28 Thread Toivo Henningsson
So what happens if you use Tim's sneaky workaround and resize the 1d array? I suppose that the pointer is no longer valid... On Saturday, 28 December 2013 18:25:50 UTC+1, Stefan Karpinski wrote: > > The issue was bounds check elimination, which is already a problem for 1d > arrays. Currently it'

Re: [julia-users] Dynamically growing array?

2013-12-28 Thread Tim Holy
On Saturday, December 28, 2013 12:25:50 PM Stefan Karpinski wrote: > The issue was bounds check elimination, which is already a problem for 1d > arrays. Currently it's very hard to eliminate them because arrays can get > resized out from under you at any point. Thanks for the reminder. --Tim > >

Re: [julia-users] Re: Modules, Closures and Methods

2013-12-28 Thread andrew cooke
yes, thanks, that was it. unfortunately the talk/paper i remember was for scala, not julia :o( but abstract types with fields addresses the problem, i think (it was one of th ethings i looked for and couldn't find) andrew On Saturday, 28 December 2013 11:51:13 UTC-3, Isaiah wrote: > > Sounds

Re: [julia-users] Dynamically growing array?

2013-12-28 Thread Stefan Karpinski
The issue was bounds check elimination, which is already a problem for 1d arrays. Currently it's very hard to eliminate them because arrays can get resized out from under you at any point. > On Dec 28, 2013, at 10:08 AM, Tim Holy wrote: > > Holding columns in separate entries is a great way. H

Re: [julia-users] Re: Modules, Closures and Methods

2013-12-28 Thread Ivar Nesje
See: https://github.com/JuliaLang/julia/issues/4935, to find discussion about adding fields in a abstract declaration where all types/imutables that inherit from it have those fields as extra fields. Ivar kl. 16:15:59 UTC+1 lørdag 28. desember 2013 skrev Tim Holy følgende: > > I struggled with

[julia-users] Re: How to load installed packages?

2013-12-28 Thread Ivar Nesje
First you have to install the package (once) by typing > Pkg.add("Clustering") Then you have the files for the Clustering Package on your computer and to load them into your session you have to do either using Clustering or import Clustering If you use import you will have to prefix all calls

[julia-users] How to load installed packages?

2013-12-28 Thread takabailando
Hi Julia user, I am a newbie to Julia and asking you a very very simple question: how to actually load installed packages? I am trying to run a clustering algorithm with the means function available in the Clustering package. But when I type "kmeans", it returned "kmeans not defined". I am gues

Re: [julia-users] Re: Modules, Closures and Methods

2013-12-28 Thread Tim Holy
I struggled with this in the design of Images. Then I adopted the view that all metadata would be stored in a Dict. The sun came out, the birds started singing, and random passers-by offered me free beer. Life was good. Of course, images are a bit of a special case, because you can basically gu

Re: [julia-users] Dynamically growing array?

2013-12-28 Thread Tim Holy
Holding columns in separate entries is a great way. However, if you need to do linear algebra on the matrix at intermediate stages during its growth, then you'll have a lot of needless copying occurring while you convert the column- storage into a matrix. In such circumstances, there's a sneaky

Re: [julia-users] Re: Modules, Closures and Methods

2013-12-28 Thread Isaiah Norton
Sounds like this: http://en.wikipedia.org/wiki/Expression_problem On Sat, Dec 28, 2013 at 9:39 AM, andrew cooke wrote: > > there's a classic problem in computer science on extending apis with both > functions and state, and i remember a julia talk or paper saying that > multiple dispatch solved

Re: [julia-users] Re: Modules, Closures and Methods

2013-12-28 Thread andrew cooke
yes! that would fix it! thanks! On Saturday, 28 December 2013 11:34:58 UTC-3, John Myles White wrote: > > Haven’t had time to read through this in depth, but is your concern that > abstract types can’t contain fields? That is likely to get fixed at some > point in the future. > > — John > >

[julia-users] Re: Modules, Closures and Methods

2013-12-28 Thread andrew cooke
there's a classic problem in computer science on extending apis with both functions and state, and i remember a julia talk or paper saying that multiple dispatch solved this nicely. so i think reading that might help, but i can't remember what it's called (it the ... problem and i think there

Re: [julia-users] Re: Modules, Closures and Methods

2013-12-28 Thread John Myles White
Haven’t had time to read through this in depth, but is your concern that abstract types can’t contain fields? That is likely to get fixed at some point in the future. — John On Dec 28, 2013, at 9:31 AM, andrew cooke wrote: > thanks. i've done almost exactly the same thing with the "Nothing"

[julia-users] Re: Modules, Closures and Methods

2013-12-28 Thread andrew cooke
thanks. i've done almost exactly the same thing with the "Nothing" type at https://github.com/andrewcooke/BlockCipherSelfStudy.jl/blob/master/src/GA.jl i don't think my problem is specific to GA. the problem is how to add extra state to an api. in traditional OO you can use inheritance to cre

[julia-users] Re: Dynamically growing array?

2013-12-28 Thread Ivar Nesje
Which way is BEST depends on the size of the array and if performance or maintainability/simplicity is most important. If performance is important you have to do testing on your specific use case to see which solution does the right trade of. I think the most readable way is to collect the colu

Re: [julia-users] How to handle flags / options?

2013-12-28 Thread Tobias Knopp
I would strongly favor giving enums an own namespace. In C one often repeats the enum name in the enum value in order to solve potential name clashs. Further it would be really cool to have enums in Base. I want to wrap a C API where C enums are used to get/set values inside of objects and in t