[julia-users] @async tasks not yielding

2016-04-18 Thread 'Greg Plowman' via julia-users
I 'm somewhat confused about when @async tasks switch. My understanding was tasks would yield on a blocking operation such as IO. On 0.4.1, I started multiple workers on remote hosts asynchronously, and these started as I expected. Presumably the tasks launching the workers yielded when the

[julia-users] Re: Warning on operations mixing BigFloat and Float64

2016-04-18 Thread 'Greg Plowman' via julia-users
Perhaps you could overwrite the convert function to include a warning. (Maybe just temporarily until you discover all the conversions) As an example, this is a quick hack, modified from definition in mpfr.jl @eval begin function Base.convert(::Type{BigFloat}, x::Float64)

Re: [julia-users] X'Y and NullableArrays?

2016-04-18 Thread Matt Bauman
You can take some inspiration from DataArrays: https://github.com/JuliaStats/DataArrays.jl/blob/44192cf6261d6eed476018fb2770c5ca8dc4e9f2/src/operators.jl#L377-L445 There's a link there to a blog post about speeding up R's multiplication — I've not read it too carefully, but I think that may

Re: [julia-users] X'Y and NullableArrays?

2016-04-18 Thread paul . soederlind
Sorry, I was too quick there. Instead of >if X has a NaN in row t, then row t is deleted in both X and Y I wanted to say if X and/or Y has a NaN in row t, then row t is deleted in both X and Y /Paul S On Monday, 18 April 2016 23:35:11 UTC+2, paul.so...@gmail.com wrote: > > > In particular,

Re: [julia-users] X'Y and NullableArrays?

2016-04-18 Thread paul . soederlind
> In particular, if X and Y contain NaNs in different places... I meant that if X has a NaN in row t, then row t is deleted in both X and Y. Example: X = [1;NaN] Y = [10;11], then we redefine as Xb = [1] Yb = [10] and get Xb'Yb = [10] This is a fairly typical approach in eg. regression

Re: [julia-users] X'Y and NullableArrays?

2016-04-18 Thread Milan Bouchet-Valat
Le lundi 18 avril 2016 à 13:16 -0700, paul.soederl...@gmail.com a écrit : > Hi and thanks for the reply. > > However, I am not sure that I fully understand > >NullableArrays are not needed if you only have NaNs > > Maybe I have the wrong expectations about NullableArrays, but I hoped > that it

Re: [julia-users] X'Y and NullableArrays?

2016-04-18 Thread paul . soederlind
Hi and thanks for the reply. However, I am not sure that I fully understand >NullableArrays are not needed if you only have NaNs Maybe I have the wrong expectations about NullableArrays, but I hoped that it would provide a quick "excise": cut out all rows where there is a NaN in either X or Y

[julia-users] Re: methods ambiguity

2016-04-18 Thread Steven G. Johnson
On Monday, April 18, 2016 at 10:38:28 AM UTC-4, Didier Verna wrote: > > > Julia warns you when there's an ambiguity in method specificity, and > picks one "arbitrarily" (according to the manual). I guess arbitrarily > doesn't mean random. Is there a particular reason for not >

[julia-users] Re: 'do' notation in documentation?

2016-04-18 Thread Andreas Lobinger
Thank you for all answers. I remembered, that i saw something in the documentation, but i rather suspected it in Control Flow. Actually the foo(a,b,c) do x notation i also see as benefit. The foo(a,b,c) do without argument is leading to the 'wrong' assumptions, code would look clearer

Re: [julia-users] X'Y and NullableArrays?

2016-04-18 Thread Milan Bouchet-Valat
Le lundi 18 avril 2016 à 07:40 -0700, paul.soederl...@gmail.com a écrit : > Hi, > > I want to use NullableArrays to facilitate some multivariate > statistics (NaNs...).  > > If X is a NullableArray{T,K} and Y is a NullableArray{T,L}, can I do > X'Y? (My clumsy attempts say no, but I might have

Re: [julia-users] Re: optional arguments and specializations

2016-04-18 Thread Yichao Yu
On Mon, Apr 18, 2016 at 12:01 PM, Didier Verna wrote: > I wrote: > >> The manual seems wrong about this (0.4.5): >> >> f(a=1,b=2) = a+2b >> f(a::Int,b::Int) = a-2b >> f() # -> 5 >> f(1,2) # -> -3 >> >> The manual says that both calls give -3. So who's wrong, the language

[julia-users] Re: optional arguments and specializations

2016-04-18 Thread Didier Verna
I wrote: > The manual seems wrong about this (0.4.5): > > f(a=1,b=2) = a+2b > f(a::Int,b::Int) = a-2b > f() # -> 5 > f(1,2) # -> -3 > > The manual says that both calls give -3. So who's wrong, the language or > the manual ? So it seems that optional arguments /values/ are tied to the

Re: [julia-users] optional arguments and specializations

2016-04-18 Thread Yichao Yu
On Mon, Apr 18, 2016 at 11:47 AM, Didier Verna wrote: > > The manual seems wrong about this (0.4.5): > > f(a=1,b=2) = a+2b > f(a::Int,b::Int) = a-2b > f() # -> 5 > f(1,2) # -> -3 > > The manual says that both calls give -3. So who's wrong, the language or > the manual ?

Re: [julia-users] Square matrices as a parametric type ?

2016-04-18 Thread Didier Verna
Tim Holy wrote: > Since it's open-source you can check on your own :-). But the short > answer is: Yes, but I'm asking here for performance reasons ;-) Thanks. -- ELS'16 registration open! http://www.european-lisp-symposium.org Lisp, Jazz, Aïkido:

[julia-users] Re: Warning on operations mixing BigFloat and Float64

2016-04-18 Thread Paweł Biernat
I know about the promotion, but this is precisely what I want to avoid. It might happen that there are hard-coded Float64 constants somewhere in the code and I would like to locate them and replace with higher precision ones. I could probably just do a direct search in the source code to

[julia-users] optional arguments and specializations

2016-04-18 Thread Didier Verna
The manual seems wrong about this (0.4.5): f(a=1,b=2) = a+2b f(a::Int,b::Int) = a-2b f() # -> 5 f(1,2) # -> -3 The manual says that both calls give -3. So who's wrong, the language or the manual ? -- ELS'16 registration open! http://www.european-lisp-symposium.org Lisp, Jazz, Aïkido:

Re: [julia-users] Square matrices as a parametric type ?

2016-04-18 Thread Tim Holy
Since it's open-source you can check on your own :-). But the short answer is: - The only support this needs is the Julia language itself. There is no need to have it in Base (i.e., no disadvantage to having it in a package), nor does it use any features of julia that aren't there for other

Re: [julia-users] Square matrices as a parametric type ?

2016-04-18 Thread Matt Bauman
On Monday, April 18, 2016 at 11:03:53 AM UTC-4, Didier Verna wrote: > > What I'm actually interested in is how deep in the language > this needs to be grounded, since I guess this is not based on the > AbstractArray interface. Does it need to access the language's > internals ? How's

[julia-users] Re: Warning on operations mixing BigFloat and Float64

2016-04-18 Thread Tomas Lycken
Adding a BigFloat and a Float64 should automatically promote both to BigFloats, avoiding precision loss for you. julia> BigFloat(2.9) + 0.3 3.199900079927783735911361873149871826171875 Do you have a case where this doesn’t happen? // T On Monday, April

Re: [julia-users] Square matrices as a parametric type ?

2016-04-18 Thread Kristoffer Carlsson
FixedSizeArrays are stack allocated and FlexibleArrays are just a wrapper around normal arrays. On Monday, April 18, 2016 at 5:03:53 PM UTC+2, Didier Verna wrote: > > Tim Holy wrote: > > > https://github.com/SimonDanisch/FixedSizeArrays.jl and > >

Re: [julia-users] 'do' notation in documentation?

2016-04-18 Thread Tomas Lycken
If you'd like to share that document, it would be a valuable resource for others as well when trying to help out. It's not unlikely that at least a subset of the things in your list are things that are present (and perhaps even quite extensively so) in the documentation, but explained in a way

Re: [julia-users] Square matrices as a parametric type ?

2016-04-18 Thread Didier Verna
Tim Holy wrote: > https://github.com/SimonDanisch/FixedSizeArrays.jl and > https://github.com/eschnett/FlexibleArrays.jl Thanks. What I'm actually interested in is how deep in the language this needs to be grounded, since I guess this is not based on the AbstractArray

[julia-users] X'Y and NullableArrays?

2016-04-18 Thread paul . soederlind
Hi, I want to use NullableArrays to facilitate some multivariate statistics (NaNs...). If X is a NullableArray{T,K} and Y is a NullableArray{T,L}, can I do X'Y? (My clumsy attempts say no, but I might have missed something.) Thanks for the help /Paul S

[julia-users] methods ambiguity

2016-04-18 Thread Didier Verna
Julia warns you when there's an ambiguity in method specificity, and picks one "arbitrarily" (according to the manual). I guess arbitrarily doesn't mean random. Is there a particular reason for not standardizing a tie-breaker (possibly the one currently in use) ? -- ELS'16 registration

[julia-users] Re: Unload dynamic library after ccall

2016-04-18 Thread Hans-Peter
It works well with a symbol, sorry for the noise. Code: @assert length(filter(x->contains(x, "hello"), Libdl.dllist())) == 0 hellohdl = Libdl.dlopen("/Users/chappi/_curr/c_und_julia/hello") hellosym = Libdl.dlsym(hellohdl, :my_main) @assert length(filter(x->contains(x, "hello"), Libdl.dllist()))

Re: [julia-users] Square matrices as a parametric type ?

2016-04-18 Thread Tim Holy
https://github.com/SimonDanisch/FixedSizeArrays.jl and https://github.com/eschnett/FlexibleArrays.jl --Tim On Monday, April 18, 2016 03:55:21 PM Didier Verna wrote: > Hello, > > is there a way to define such a beast? I would like for instance to > express something like this:

[julia-users] Warning on operations mixing BigFloat and Float64

2016-04-18 Thread Paweł Biernat
Hi, I want to make sure I am not loosing any precision in my code by accidentally mixing BigFloat and Float64 (e.g. adding two numbers of different precision). I was thinking about replacing the definitions of `+`, `-`, etc. for BigFloat but if you do that for all two argument functions this

[julia-users] Re: Decreasing rate of return on number of blas threads

2016-04-18 Thread Thomas Covert
was curious about this question myself. here is my versioninfo() for a recent iMac with an i7: Julia Version 0.4.5 Commit 2ac304d* (2016-03-18 00:58 UTC) Platform Info: System: Darwin (x86_64-apple-darwin14.5.0) CPU: Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz WORD_SIZE: 64 BLAS:

[julia-users] Square matrices as a parametric type ?

2016-04-18 Thread Didier Verna
Hello, is there a way to define such a beast? I would like for instance to express something like this: SquareMatrix{Int32,3} and get instances that would be similar to 3x3 Array{Int32,2}. Right now, it seems to me that the available array abstractions only let you express the rank as part of

Re: [julia-users] Promotion of Array{Array{T,2},1}

2016-04-18 Thread Tim Holy
If performance matters, currently you're going to have to specify the element type---not for the sake of your `MyType` object, but simply for the efficient access to elements of c and d. This will change once https://github.com/JuliaLang/julia/pull/15921 merges. On julia 0.4, you could write

[julia-users] Re: ExcelReaders: specific range

2016-04-18 Thread Fernando Banez-Chicharro
OK. Thanks! El lunes, 18 de abril de 2016, 6:52:48 (UTC-4), Scott T escribió: > > I don't think this possible at the moment, especially because one needs to > first read the sheet in order to know what the range is called. You might > want to open an issue at

[julia-users] Re: ExcelReaders: specific range

2016-04-18 Thread Scott T
I don't think this possible at the moment, especially because one needs to first read the sheet in order to know what the range is called. You might want to open an issue at https://github.com/davidanthoff/ExcelReaders.jl and suggest it. On Monday, 18 April 2016 05:51:23 UTC+1, Fernando

[julia-users] Re: an error with DataFrames on Ubuntu 16.04 64bits

2016-04-18 Thread K leo
The PPA version. On Monday, April 18, 2016 at 9:51:44 AM UTC+5:30, Tony Kelman wrote: > > Where is your Julia build from?

[julia-users] Re: Simple function allocating too much memory (Gini coefficient)

2016-04-18 Thread bernhard
Thank you Simon. I figured out how to fix my issue. I do not know what the underlying reason is though (but that is less important to me right now) If I preallocate the vector srt, my timing and allocation problems are resolved, see the three versions below: thank you all. Executing

[julia-users] Re: Simple function allocating too much memory (Gini coefficient)

2016-04-18 Thread Simon Danisch
In Julia this: function xxx22xx1B(e99y::Array,ww=ones(22)) return 22.2 end turns into this: xxx22xx1B(e99y::Array) = xxx22xx1B(e99y, ones(22)) function xxx22xx1B(e99y::Array,ww) return 22.2 end So you get 2 functions ;) Am Montag, 18. April 2016 09:38:19 UTC+2 schrieb bernhard: > > Hi

[julia-users] Re: Simple function allocating too much memory (Gini coefficient)

2016-04-18 Thread bernhard
Thanks. *I noticed that Julia tells me that two functions are defined.* *Why would that happen?* consider this piece of code: julia> function xxx22xx1B(e99y::Array,ww=ones(22)) return 22.2 end xxx22xx1B (generic function with 2 methods) Minimal version: not sure how easy that

[julia-users] Re: Simple function allocating too much memory (Gini coefficient)

2016-04-18 Thread bernhard
I checked again. If I load my package first, the function allocates about 6MB. I do not know why. If anyone could give me a hint that would be great! I do not want to publish my package (sorry for that). It is quite large and somewhat proprietary. It could be a scoping issue, but I do not know

[julia-users] Re: Simple function allocating too much memory (Gini coefficient)

2016-04-18 Thread Patrick Kofod Mogensen
Okay. If you could try to create a minimal module that still shows this behavior, then maybe someone can help. Is the package available online? On Monday, April 18, 2016 at 11:11:26 AM UTC+2, bernhard wrote: > > You are right. > Thanks. > > The issue is related to a package of mine. > If I first

[julia-users] Re: Simple function allocating too much memory (Gini coefficient)

2016-04-18 Thread bernhard
You are right. Thanks. The issue is related to a package of mine. If I first load my package and then define this function (with a unique name even), it will allocate 6MB of ram for n=30k. I think it is related to the fact that I overloaded some functions (length and others). Well I extended

[julia-users] Unload dynamic library after ccall

2016-04-18 Thread Hans-Peter
I'm playing around with calling c code. After changes in my code and thus in the shared library I need to restart Julia in order to make the new code available in Julia/ccall. Question: is it possible to unload (and reload) a library? (It works using dlopen/dlclose without a ccall. But as soon

[julia-users] Promotion of Array{Array{T,2},1}

2016-04-18 Thread Patrick Kofod Mogensen
Say I have something like type MyType{T} a::T b::Vector{T} c::Vector{Vector{T}} d::Vector{Matrix{T}} end MyType(3, [3, 3], Vector{Int64}[[3,3], [4,4]], Matrix{Int64}[[3 1],[1 3]]) MyType(3, [3, 3], Vector[[3,3], [4,4]], Matrix[[3 1],[1 3]]) The first call to the MyType

[julia-users] Re: Simple function allocating too much memory (Gini coefficient)

2016-04-18 Thread Patrick Kofod Mogensen
What do you mean by slow and a lot of memory here? julia> using Benchmarks julia> @benchmark gini(ab,cd,ef) Benchmark Results Time per evaluation: 3.68 ms [3.54 ms, 3.82 ms] Proportion of time in GC: 0.12% [0.00%, 0.84%] Memory allocated:

[julia-users] Simple function allocating too much memory (Gini coefficient)

2016-04-18 Thread bernhard
Hi all I have written the function below. For some reason it is quite slow and allocates a lot of memory. I realize that the sorting (which creates srt) needs memory to store the sort order. However the second loop also seems to allocate a lot of memory and I do not know why. Arrlen and i are

Re: [julia-users] bounds error / inexacterror

2016-04-18 Thread Michele Zaffalon
It looks like your `ratio` is a scalar number and you are trying to get the k-th element of it. On Sun, Apr 17, 2016 at 3:32 PM, Yichao Yu wrote: > On Sun, Apr 17, 2016 at 9:14 AM, Emeline Lépine > wrote: > > Hi, > > > > According the index line 37