[julia-users] Re: Large memory allocation and GC time in fractal renderer

2015-02-21 Thread Viral Shah
The memory usage balloons once the expression becomes bigger: julia> g(a0,a1,a2,a3,a4,x) = for i=1:10^6; f = a0 + a1*x +a2*x^2 + a3*x^3; end g (generic function with 3 methods) julia> @time g(1.0,1.0,1.0,1.0,1.0,1+im) elapsed time: 0.011524283 seconds (104 bytes allocated) As soon as I introduc

[julia-users] ftp

2015-02-21 Thread Jason Eckstein
Does anyone know if I can download a file through an ftp site with Julia? This is an exmaple of the link I want to read ftp://ftp.nasdaqtrader.com/SymbolDirectory/otclist.txt

[julia-users] Re: Tensor-product function for multidimensional arrays (>2 dims)

2015-02-21 Thread Spencer Lyon
Bump on this thread. I need this functionality again... On Friday, December 6, 2013 at 11:04:44 AM UTC-5, Spencer Lyon wrote: > > I am working with tensors with more than 2 dimensions. I would like to > find a Julia equivalent to the numpy function tensordot. The docstring > for the function exp

[julia-users] Re: Large memory allocation and GC time in fractal renderer

2015-02-21 Thread Viral Shah
Memory profiling (see http://docs.julialang.org/en/latest/manual/profile/#memory-allocation-analysis), suggests this line is the culprit: f = a0 + a1*x + a2*x^2 + a3*x^3 + a4*x^4 -viral On Sunday, February 22, 2015 at 7:14:22 AM UTC+5:30, DumpsterDoofus wrote: > > I wrote a simple script for

[julia-users] Re: Function that takes an abstract type and calls function depending on the concrete type passed.

2015-02-21 Thread Josh Langsfeld
If your initial knn function has logic that depends on the concrete type of tree being input, it's a sign you should refactor that logic into separate methods which are dispatched on by the concrete type. The simplest case of this would be to just pass that argument during setup to every _knn f

[julia-users] Convert a string with commas into a float

2015-02-21 Thread AVF
What is the best way to convert a string such as "123,456" into a float 123456.0? I could not find a method that would splice out a character from the middle of a string to feed the result to `float()`. Thanks.

Re: [julia-users] Possible bug? Dict fails to properly index custom type.

2015-02-21 Thread Jameson Nash
Python doesn't actually forbid them, it just sometimes makes you sometimes write a bit of extra code to use them. however, i'm pretty sure you can already find a discussion of this in the google-groups archive for this mailing list. On Sat Feb 21 2015 at 9:12:20 PM Dawid Crivelli wrote: > Moreov

Re: [julia-users] Possible bug? Dict fails to properly index custom type.

2015-02-21 Thread Dawid Crivelli
> > Moreover, if you put a mutable object into a dict and then change one of > its fields and its hash depended on that field value, then it will be > "lost" in the sense that if you check for that *same object* being in the > dict, it will appear not to be, since it no longer ends up in the sa

[julia-users] Large memory allocation and GC time in fractal renderer

2015-02-21 Thread DumpsterDoofus
I wrote a simple script for a Schroder fractal (a distant cousin of Newton fractals) of a fourth-order polynomial: function SchroderFourth(a0::Float64, a1::Float64, a2::Float64, a3::Float64, a4::Float64, c::Complex{Float64}) x = c x2 = c M = 100 R = 10.0^-6 a = 0.1 for j in 1:M x2 = x f = a0 + a1

[julia-users] Re: Trying to access a pointee extracted with pointer_to_array() kills julia instantaniously

2015-02-21 Thread J Luis
> Make sure GMT.GMT_RESOURCE is declared as an immutable type if you want > Array{GMT.GMT_RESOURCE} to correspond to the memory layout of an array of C > structs. > Ghrrr, but the problem is that I need to mutate it afterwards.

Re: [julia-users] Re: Trying to access a pointee extracted with pointer_to_array() kills julia instantaniously

2015-02-21 Thread J Luis
Thanks, I understand that but are there any options? related issue https://groups.google.com/forum/?fromgroups=#!topic/julia-users/i8DO3pBAHPU sábado, 21 de Fevereiro de 2015 às 21:20:47 UTC, Stefan Karpinski escreveu: > > Jameson's point is that [LL] give you a pointer to the memory of a Julia

Re: [julia-users] How do you simultaneously launch processes using @spawnat?

2015-02-21 Thread DumpsterDoofus
Nice, that works (assuming `addprocs(4)` is used instead). Alternately, if the first line is placed last, they all launch simultaneously. My guess as to the reason why this occurs is because process 1 is responsible for sending tasks to the worker processes (2,3,4), and if it is given a job in

Re: [julia-users] How do you simultaneously launch processes using @spawnat?

2015-02-21 Thread Jameson Nash
Don't launch the first computation on your REPL process (1), and launch them on 2,3,4,5 instead. On Sat Feb 21 2015 at 6:59:22 PM DumpsterDoofus wrote: > I have a 4-core machine. I launch Julia at the REPL, and then run > `addprocs(3)`. I then copy-paste the following into the REPL: > > s1 = @sp

[julia-users] How do you simultaneously launch processes using @spawnat?

2015-02-21 Thread DumpsterDoofus
I have a 4-core machine. I launch Julia at the REPL, and then run `addprocs(3)`. I then copy-paste the following into the REPL: s1 = @spawnat 1 expensiveComputation1 s2 = @spawnat 2 expensiveComputation2 s3 = @spawnat 3 expensiveComputation3 s4 = @spawnat 4 expensiveComputation4 where `expensive

[julia-users] Re: Matlab keyboard command in Julia?

2015-02-21 Thread Scott T
Hi Vinay, You should look at Debug.jl , which lets you insert breakpoints into your code. Cheers, Scott On Saturday, 21 February 2015 16:39:37 UTC, vinay wrote: > > > > Hi, > > Just a newbie question: Does Julia have something equivalent to Matlab's > keybo

[julia-users] Re: int({"5","4"}) works float({"5.5","4.4"}) doesn't

2015-02-21 Thread Sean Marshallsay
map(parsefloat, ["5.5", "4.4"]) is probably the best way unless your array is very large. int(), float() and curly brackets will all be depracated in v0.4. On Friday, 20 February 2015 22:51:05 UTC, Stepa Solntsev wrote: > > What seems to be the issue here? >

Re: [julia-users] Re: Trying to access a pointee extracted with pointer_to_array() kills julia instantaniously

2015-02-21 Thread Stefan Karpinski
Jameson's point is that [LL] give you a pointer to the memory of a Julia array object which is then immediately not referred to by anything, meaning it can be garbage collected. Thus, you get a pointer which is immediately invalid. It will be ok to access until the next GC, but that can happen at a

Re: [julia-users] Re: Trying to access a pointee extracted with pointer_to_array() kills julia instantaniously

2015-02-21 Thread Jameson Nash
it doesn't matter what LL is. `pointer( [ anything ] )` will occasionally cause segfaults or data corruption, because `[ anything ]` is more complicated than just a variable name On Sat Feb 21 2015 at 2:51:46 PM J Luis wrote: > LL is a linked list returned by C (thanks for your other pointer abo

Re: [julia-users] Re: Trying to access a pointee extracted with pointer_to_array() kills julia instantaniously

2015-02-21 Thread J Luis
LL is a linked list returned by C (thanks for your other pointer about linked lists) LL = GMT_Create_Options(API, 0, r); sábado, 21 de Fevereiro de 2015 às 19:11:37 UTC, Jameson escreveu: > > Note that in your code `pointer([LL])` will occasionally cause a > segfault. The argument to `pointer`

Re: [julia-users] Re: Trying to access a pointee extracted with pointer_to_array() kills julia instantaniously

2015-02-21 Thread Jameson Nash
Note that in your code `pointer([LL])` will occasionally cause a segfault. The argument to `pointer` must be simply a variable name, not an expression. (i'm working a PR to eliminate the need for `pointer`, since I believe that it is hard to use correctly: https://github.com/JuliaLang/julia/blob/jn

[julia-users] Re: Trying to access a pointee extracted with pointer_to_array() kills julia instantaniously

2015-02-21 Thread J Luis
Thanks. That was exactly it. sábado, 21 de Fevereiro de 2015 às 18:20:05 UTC, Steven G. Johnson escreveu: > > Make sure GMT.GMT_RESOURCE is declared as an immutable type if you want > Array{GMT.GMT_RESOURCE} to correspond to the memory layout of an array of C > structs. >

[julia-users] Re: Trying to access a pointee extracted with pointer_to_array() kills julia instantaniously

2015-02-21 Thread Steven G. Johnson
Make sure GMT.GMT_RESOURCE is declared as an immutable type if you want Array{GMT.GMT_RESOURCE} to correspond to the memory layout of an array of C structs.

[julia-users] Trying to access a pointee extracted with pointer_to_array() kills julia instantaniously

2015-02-21 Thread J Luis
Ok, I have this more strange case (julia 0.4) In the following X is a pointer to an array of structures (From the C side) X = GMT_Encode_Options(API, "blockmean", '$', pointer([LL]), n_items); julia> X Ptr{GMT.GMT_RESOURCE} @0x18df0740 Now, in this case I know there are 2 of those struc

Re: [julia-users] Re: int({"5","4"}) works float({"5.5","4.4"}) doesn't

2015-02-21 Thread Stefan
How do I convert to such an array? On Fri, Feb 20, 2015 at 5:42 PM, Seth wrote: > If you want an array, use brackets: > > float(["5.5","4.4"]) > > On Friday, February 20, 2015 at 2:51:05 PM UTC-8, Stepa Solntsev wrote: >> >> What seems to be the issue here? >> >

Re: [julia-users] isa should be user friendlier

2015-02-21 Thread Stefan Karpinski
The isa function does the same thing in Julia as in Matlab; the difference is that in Matlab there isn't a real Float32 type since there are no true scalar value – there is only what would be called Array{Float32} in Julia. On Sat, Feb 21, 2015 at 12:32 PM, J Luis wrote: > I was obviously not su

[julia-users] Function that takes an abstract type and calls function depending on the concrete type passed.

2015-02-21 Thread Kristoffer Carlsson
Hello, I am getting some coupling between my types and I don't really know how to solve it in a good way. As shown below in the code I have a module with 3 files, one with an abstract type and two that are concrete types of the abstract one. In the file with the abstract type I have a function

Re: [julia-users] isa should be user friendlier

2015-02-21 Thread J Luis
I was obviously not suggesting to change the Julia type system. However, considering that it uses the same name as a Matlab function and that the manual says "Determine whether x is of the given type." it is no surprise that one would expect it to give the desired answer. "Is the type of my va

Re: [julia-users] Why does my Julia code run so slow?

2015-02-21 Thread Viral Shah
It is also worth trying out one of the 0.4-dev nightlies and compare the performance. The code does avoid creating temporaries to a large extent, but it may be worth checking if the new GC helps. -viral > On 21-Feb-2015, at 10:09 pm, michael.cr...@gmail.com wrote: > > What's the type of c.ou

[julia-users] Re: Why does my Julia code run so slow?

2015-02-21 Thread michael . creel
What's the type of c.outputs? In train_one it seems to be Int64, in prdict! it seems to be Float64. On Thursday, February 19, 2015 at 3:51:20 PM UTC+1, Zhixuan Yang wrote: > > Hello everyone, > > Recently I'm working on my first Julia project, a word embedding training > program similar to Goog

[julia-users] Matlab keyboard command in Julia?

2015-02-21 Thread vinay
Hi, Just a newbie question: Does Julia have something equivalent to Matlab's keyboard command for inspecting the current stack which is very useful for debugging. Did some googling but could not find the answer to this. Vinay

Re: [julia-users] cannot resize array with shared data

2015-02-21 Thread andrew cooke
hi, thanks for replying, but i didn't understand much of what you said. i think you're saying that my code (the CRC library) is calling array_try_unshare or jl_array_grow_end? i don't see either of those in my code at https://github.com/andrewcooke/CRC.jl/blob/master/src/CRC.jl what i do see

Re: [julia-users] isa should be user friendlier

2015-02-21 Thread Stefan Karpinski
This question has been pretty thoroughly addressed. To recap for the sake of clarity, there is no reason why the isa function *can't* see the type inside of an array – it would be easy to implement this. However, that is *not what the isa function does*. The isa function answers a single clear, wel

Re: [julia-users] isa should be user friendlier

2015-02-21 Thread Isaiah Norton
It is precisely a question of the type system. If arrays did not have unique types then there would be no point to having multiple dispatch or a type system at all. On Sat, Feb 21, 2015 at 11:43 AM, J Luis wrote: > > > sábado, 21 de Fevereiro de 2015 às 15:36:17 UTC, Tim Holy escreveu: >> >> Jus

Re: [julia-users] isa should be user friendlier

2015-02-21 Thread J Luis
sábado, 21 de Fevereiro de 2015 às 15:36:17 UTC, Tim Holy escreveu: > > Just as a reminder, the question was: why does julia distinguish a > 1-element > array from a scalar, and can we change it so it doesn't? Hi, let me just clarify that the above might be a consequence but it was not the o

[julia-users] Re: symbolic computation in Julia (again)

2015-02-21 Thread lapeyre . math122a
Regarding python and SymPy: I meant to say implementing Mma-like expressions via a hierarchy of *classes*, not types > > >

[julia-users] Re: api - web scraping

2015-02-21 Thread Seth
You'll probably have to code something up yourself using the various packages at http://github.com/JuliaWeb. On Saturday, February 21, 2015 at 3:49:10 AM UTC-8, pip7...@gmail.com wrote: > > Any web scraping library or modules for the Julia language. > If so, any links - examples. > Regards >

Re: [julia-users] Possible bug? Dict fails to properly index custom type.

2015-02-21 Thread Stefan Karpinski
It's not really for efficiency, but rather for correctness – two instances of a mutable type that happen to have the same field values are still not the same object since it's quite easy to write code that distinguishes them by mutating one but not the other. Moreover, if you put a mutable object i

[julia-users] symbolic computation in Julia (again)

2015-02-21 Thread lapeyre . math122a
Hi, Here is more on the experiment in symbolic computation. Some results and timing are given in the README. https://github.com/jlapeyre/SJulia The focus is still on a Mathematica-like language, although I think it's possible and desirable to write routines with an interface so that they can

Re: [julia-users] Generate an HSV image from an `M` by `N` by 3 array

2015-02-21 Thread Tim Holy
Ah, gotcha. It would be great to have you improve the docs of Color.jl! I guess I always naturally think about Image.jl's docs first. If you're just manipulating arrays of ColorValues, you don't need Images, but your imwrite command does come from there. --Tim On Saturday, February 21, 2015 07

[julia-users] Re: Problem iterating through GLMs in Monte Carlo experiments

2015-02-21 Thread Steve Kay
Many thanks Simon and Taylor - your advice works a treat. Steve On Saturday, February 21, 2015 at 11:37:27 AM UTC, Steve Kay wrote: > > I'm trying to program a simple Monte Carlo experiment that after > generating sample data within each MC rep then runs a GLM within it, > accumulating the coe

Re: [julia-users] Generate an HSV image from an `M` by `N` by 3 array

2015-02-21 Thread DumpsterDoofus
Thanks, that would do it for me. As far as the docs go, I was mainly looking at the page https://github.com/JuliaLang/Color.jl, where there is only one example of the use of `convert`, namely `convert(RGB, HSL(270, 0.5, 0.5))`. Is there another doc page?

[julia-users] Re: Problem iterating through GLMs in Monte Carlo experiments

2015-02-21 Thread Taylor Maxwell
You do not need DataFrames to run a GLM. If you construct your now Float64 design matrix (X) and have you dependent variable y you can fit a GLM with such a logistic regression with the following command: fit(GeneralizedLinearModel,X,y,Binomial()) to fit an LM model you can: fit(LinearModel,

[julia-users] Re: Problem iterating through GLMs in Monte Carlo experiments

2015-02-21 Thread Simon Kornblith
You can just call glm(X, y, Normal(), LogLink()) directly with a design matrix X and response vector y, e.g.: julia> glm(randn(100, 3), rand(100), Normal(), LogLink()) GLM.GeneralizedLinearModel: Coefficients: Estimate Std.Error z value Pr(>|z|) x1 0.0179427 0.0574712 0.312202 0.7549

Re: [julia-users] Generate an HSV image from an `M` by `N` by 3 array

2015-02-21 Thread Tim Holy
convert(Array{RGB{Float64}}, A) (To me this seems to be explained in the docs; if not, please submit improvements.) --Tim On Saturday, February 21, 2015 07:03:45 AM DumpsterDoofus wrote: > I tried using `convert` elementwise over a `reinterpret`ed array: > > A = ones(Float64, 3, 1000, 1000); >

Re: [julia-users] isa should be user friendlier

2015-02-21 Thread Tim Holy
Just as a reminder, the question was: why does julia distinguish a 1-element array from a scalar, and can we change it so it doesn't? I explained (1) why it works the way it does and (2) why changing it would discard some of julia's other advantages. I wasn't saying "Matlab is wrong," I was sayi

Re: [julia-users] Re: Why does my Julia code run so slow?

2015-02-21 Thread Zhixuan Yang
I passed "--check-bounds=no" to julia when launching the REPL to avoid writing @inbounds explicitly. Simply adding @simd before for loops doesn't seem to be helping, it slightly slows down the code. @nexprs is exactly what I need to avoid redundant code when unrolling loops. I will use this t

Re: [julia-users] Generate an HSV image from an `M` by `N` by 3 array

2015-02-21 Thread DumpsterDoofus
I tried using `convert` elementwise over a `reinterpret`ed array: A = ones(Float64, 3, 1000, 1000); B = reinterpret(HSV{Float64}, A); C = [convert(RGB, B[i,j]) for i in 1:1000, j in 1:1000]; imwrite(C, "image.PNG") However, this doesn't work, because the array comprehension doesn't appear to be

Re: [julia-users] Generate an HSV image from an `M` by `N` by 3 array

2015-02-21 Thread Tim Holy
Try the `convert` function. --Tim On Friday, February 20, 2015 02:19:03 PM DumpsterDoofus wrote: > How would you go about the conversion of the Array{HSV{Float64}} to > Array{RGB{Float64}}? > > On Friday, February 20, 2015 at 4:57:45 PM UTC-5, Tim Holy wrote: > > Hmm, seems like you need to conv

Re: [julia-users] Re: Why does my Julia code run so slow?

2015-02-21 Thread Tim Holy
Just to check, in writing out your own version of gemv! you're using @inbounds @simd, right? The @nexprs macro (documented in the Base.Cartesian section of the manual) lets you unroll loops manually. Also, see the (currently alpha) KernelTools.jl repository for some ideas about improving cache

Re: [julia-users] isa should be user friendlier

2015-02-21 Thread Andreas Lobinger
Hello colleague, i guess we cannot reach a conclusion, but 1. i couldn't see the difference between scalars and matrices of 1x1 in your example. And btw: mysum simply does not make sense; in any case i'd expect a sum operator within the language (which is pretty efficient in Matla

[julia-users] Re: getting into a clean state (Errors on Gtk and Winston)

2015-02-21 Thread Andreas Lobinger
Hello colleagues, thanks for the hints per email. I somehow reached stability by * back to julia 0.3.6 * Gtk v0.7.10 * Winston at master but replacing ctx = Gtk.getgc(c) in line 16 of src/gtk.jl Wishing a happy day, Andreas

Re: [julia-users] Re: Why does my Julia code run so slow?

2015-02-21 Thread Mauro
> After all, the C code was optimized intensively in the cache level and > all loops were unrolled. Julia is good at unrolling loops using marcos. > Maybe I should try to use more computers. Currently my code is paralleled > by using pmap(). I hope the communication overhead will not be a new >

[julia-users] Problem iterating through GLMs in Monte Carlo experiments

2015-02-21 Thread Steve Kay
I'm trying to program a simple Monte Carlo experiment that after generating sample data within each MC rep then runs a GLM within it, accumulating the coefficients from each rep in a matrix. As the GLM command needs a dataframe I convert all my matrix held simulated data into this form and then

[julia-users] api - web scraping

2015-02-21 Thread pip7kids
Any web scraping library or modules for the Julia language. If so, any links - examples. Regards

Re: [julia-users] Possible bug? Dict fails to properly index custom type.

2015-02-21 Thread Milan Bouchet-Valat
Le vendredi 20 février 2015 à 18:40 -0800, Tom Colvin a écrit : > I get a "key not found" error even though the key is clearly in there. > Here's a stripped down version of the code that produces the error: > > # Define my custom type > type Test > act::Array{Int64} > obs::Array{Int64} > end >

Re: [julia-users] Re: Equivalent of MATLAB struct with subfields and constant values

2015-02-21 Thread Milan Bouchet-Valat
Le vendredi 20 février 2015 à 22:26 -0800, Viral Shah a écrit : > You could explore DataArrays. > https://github.com/JuliaStats/DataArrays.jl I guess you mean DataFrames? Indeed, the column names would provide the equivalent of your variables/subfields. flows.out wouldn't be possible, but you can

Re: [julia-users] Why does my Julia code run so slow?

2015-02-21 Thread Viral Shah
This does look like a nice benchmark. I would love to see what it takes to narrow down the gap further. Playing around with it now. Perhaps the threads branch is also worth a shot. -viral > On 21-Feb-2015, at 1:23 pm, Zhixuan Yang wrote: > > After recompiled an native arch version of Julia

[julia-users] Re: Why does my Julia code run so slow?

2015-02-21 Thread Luke Stagner
You may want to try using a profiler. I recently used the ProfileView.jl package to great success. On Friday, February 20, 2015 at 11:53:56 PM UTC-8, Zhixuan Yang wrote: > > After recompiled an native arch version of Julia and OpenBLAS, it's about > 8

Re: [julia-users] Optional Arguments

2015-02-21 Thread Tamas Papp
Hi, Can you clarify what you want to achieve with this? I don't understand the problem (what are the doubts?). BTW, arguments after the ; are *keyword* arguments in Julia, *optional* arguments are a different kettle of fish. See http://docs.julialang.org/en/release-0.3/manual/functions/#optional-