[julia-users] Re: Why construction of Dict via generator is not type-stable?

2016-11-15 Thread Pablo Zubieta
FWIW this is should work fine on master and the solution is likely to be backported to the next 0.5.x version (https://github.com/JuliaLang/julia/pull/19245). On Sunday, November 13, 2016 at 10:16:20 AM UTC-6, bogumil@gmail.com wrote: > > Consider the following two functions: > > function f

Re: [julia-users] Re: How does promote_op work?

2016-09-23 Thread Pablo Zubieta
. But I could have also overriden promote_op > and not had to deal with empty arrays as a special case. > > > On 24 Sep. 2016, at 8:15 am, Pablo Zubieta > wrote: > > Sheehan, are you planning on doing a lot of operations with empty arrays? > On 0.5 with your example &

[julia-users] Re: How does promote_op work?

2016-09-23 Thread Pablo Zubieta
seem to get > errors (@inferred tests fail) if I remove my promote_op specialization. > Perhaps my problems are all a consequence of > https://github.com/JuliaLang/julia/issues/18465 and they will go away > soon...? > > On Friday, September 23, 2016 at 5:54:03 AM UTC-7, Pablo Zub

[julia-users] Re: How does promote_op work?

2016-09-23 Thread Pablo Zubieta
t; *+ (generic function with 164 methods)* > > > *julia> **Array(Foo{Float64},0)+Array(Foo{Float64},0)* > > *0-element Array{Any,1}* > > > > > > On Friday, September 23, 2016 at 10:54:03 PM UTC+10, Pablo Zubieta wrote: >> >> In julia 0.5 the followi

[julia-users] Re: How does promote_op work?

2016-09-23 Thread Pablo Zubieta
In julia 0.5 the following should work without needing doing anything to promote_op import Base.+ immutable Foo end +(a::Foo, b::Foo) =1.0 Array{Foo}(0) + Array{Foo}(0)) promote_op is supposed to be an internal method that you wouldn't need to override. If it is not working i because the operat

[julia-users] Re: Return type of broadcast

2016-09-17 Thread Pablo Zubieta
There is a bit of a conflict between elementwise operations and broadcast (both rely on promote_op). There has been issues on the past where people wanted things like 1 .+ Number[1, 2, 3] == Number[2, 3, 4] to work. The current behaviour is consistent with this, which is, if you start with a n

[julia-users] Re: Any Julia pkgs using Polymer web components?

2016-09-07 Thread Pablo Zubieta
Escher.jl uses Polymer web components. I don't think it exposes them directly, but shouldn't be to hard looking at the code to see how it incorporates them into its functionality. On Wednesday, September 7, 2016 at 3:47:08 AM UTC+2, Jeffrey Sarnoff wrote: > > If you know of work with Julia and P

[julia-users] Re: Adding tuples

2016-08-10 Thread Pablo Zubieta
And just to throw out another option, you might also consider ((a[i] + b[i] for i = 1:N)...) Pablo.

[julia-users] Re: Adding tuples

2016-08-10 Thread Pablo Zubieta
Does something like this seems good enough? Base.:+{N}(a::NTuple{N}, b::NTuple{N}) = ntuple(i -> a[i] + b[i], N) there is also map(+, a, b) where `a`, and `b` are the tuples you want to sum elementwise. There is a chance that eventually one will be able to also use broadcast or elementwise ad

Re: [julia-users] Changed broadcast semantics in 0.5?

2016-08-04 Thread Pablo Zubieta
gt;> >> Cheers, >>Kevin >> >> On Mon, Aug 1, 2016 at 8:28 AM, Oliver Schulz >> wrote: >> >>> Thanks, Pablo. Uh, do you think that PR will make it into 0.5? >>> >>> >>> On Monday, August 1, 2016 at 3:41:23 PM UTC+2,

Re: [julia-users] Changed broadcast semantics in 0.5?

2016-08-01 Thread Pablo Zubieta
This should work if https://github.com/JuliaLang/julia/pull/17389 gets merged. On Monday, August 1, 2016 at 3:06:36 PM UTC+2, Oliver Schulz wrote: > > > Not before the bug is fixed and this is also orthogonal to loop fusion. > > Sure, I get that. But that means then that bug is fixed, things lik

[julia-users] Re: Help with `promote_op` in v0.5

2016-07-29 Thread Pablo Zubieta
This is due to issue https://github.com/JuliaLang/julia/issues/17314, and should get fixed if https://github.com/JuliaLang/julia/pull/17389 gets merged. On Friday, July 29, 2016 at 5:00:14 PM UTC+2, j verzani wrote: > > The test for the Polynomials package are now failing in v0.5. Before > > ```

[julia-users] Re: Extending functions in Base (or another module)

2016-06-28 Thread Pablo Zubieta
You might also want to express your perspective on why a function such as invoke is needed here https://github.com/JuliaLang/julia/pull/13123. On Tuesday, June 28, 2016 at 5:26:16 PM UTC+2, Bill Hart wrote: > > We have hit an issue that we can't seem to find a workaround for. Our only > working

[julia-users] Re: Memory corruption when using BigFloats

2016-06-07 Thread Pablo Zubieta
pen but my adviser wants > this code private until published, so I am sticking with it (again, > everything works except not sufficiently high precision bigs, so it's not > necessary for the paper at all). > > On Tuesday, June 7, 2016 at 9:58:23 AM UTC-7, Pablo Zubieta wrote: >>

[julia-users] Re: Memory corruption when using BigFloats

2016-06-07 Thread Pablo Zubieta
t of the code I'll show exactly how bigfloats (and only bigfloats) fail > here, and cause a segfault. I wish I can be more open but my adviser wants > this code private until published, so I am sticking with it (again, > everything works except not sufficiently high precision bigs,

[julia-users] Re: Memory corruption when using BigFloats

2016-06-07 Thread Pablo Zubieta
Do you happen to have a minimal reproducible example? On Tuesday, June 7, 2016 at 6:23:05 PM UTC+2, Scott Jones wrote: > > I've been trying to help @ChrisRackaukus (of DifferentialEquations.jl > fame!) out with a nasty bug he's been running into. > He is using `BigFloat`s, and keeps getting numbe

[julia-users] Re: How to produce the ≉ symbol?

2016-06-03 Thread Pablo Zubieta
Use `\napprox`

Re: [julia-users] [Plots.jl] Sequential color of consecutive data series

2016-03-03 Thread Pablo Zubieta
Thank you, this works fine for me. I understand the motivation of generating the palette based on the background color and I don't expect this to be implemented. No worries.

[julia-users] [Plots.jl] Sequential color of consecutive data series

2016-03-03 Thread Pablo Zubieta
Hi I was making a plot using Plots.jl and the gadfly backend to draw different series of data on the same plot and I found that if I declare the colour for just a specific data series the default palette advances to the next colour even though the next available colour in the palette has not be

[julia-users] Re: let unpack

2016-02-11 Thread Pablo Zubieta
let; (a,b,c) = (1, 2, 3); a end (note the semicolon) works. But I think it should work as Mauro stated.

[julia-users] Re: Euler Maruyama for neural networks, slower than python

2016-01-21 Thread Pablo Zubieta
I guess that you can also throw a couple of @inbounds before the for loops in Mauro's solution to improve things a bit more.

[julia-users] Re: Euler Maruyama for neural networks, slower than python

2016-01-21 Thread Pablo Zubieta
I just stumble upon this comment on this GitHub issue . It seems that the current situation in Julia won't let you match the numpy code yet (until that issue is solved). But

[julia-users] Re: Euler Maruyama for neural networks, slower than python

2016-01-21 Thread Pablo Zubieta
I am seeing the opposite on my machine (the Julia version being 4 times faster than the one in Python). It might be a problem with the BLAS library that is being used. What is your platform and Julia version?

Re: [julia-users] Re: Sort function

2016-01-20 Thread Pablo Zubieta
I don't know why it was removed, but if you need that to work you can define function Base.isless(A::AbstractVector, B::AbstractVector) a, b = length(A), length(B) a == 0 && return b > 0 for i in 1:min(a,b) A[i] != B[i] && return A[i] < B[i] end return a < b end and th

Re: [julia-users] Chars with ending double quotes

2016-01-15 Thread Pablo Zubieta
I thought so. I filed and issue here: https://github.com/JuliaLang/julia/issues/14683

[julia-users] Chars with ending double quotes

2016-01-15 Thread Pablo Zubieta
Is there a particular reason for the following to be valid Chars? '\""' '\"""' # or any number of "s '\a"' '\Ψ"""' More generally the pattern '\[Any valid code point][Any number of "]' seems to be a valid Char.

Re: [julia-users] Re: A Julia code slower than Matlab, can it be faster?

2015-12-15 Thread Pablo Zubieta
Stefan said that your code is well type (type stable). Have you tried Yichao's suggestions? Here is the function ground() taking them into account: function ground() R = 320. Ks = 2^11 - 1 x = linspace(-R, R, Ks+1) dx = 2R/Ks dt = 0.1 pm = 2π/2dx px = circshift( linsp

[julia-users] Re: `<` and `isless` for GradientNumber (ForwardDiff.jl)

2015-12-10 Thread Pablo Zubieta
It doesn't work with the master branch of ForwardDiff.jl neither. So I filled a bug report: https://github.com/JuliaDiff/ForwardDiff.jl/issues/76

[julia-users] Re: `<` and `isless` for GradientNumber (ForwardDiff.jl)

2015-12-10 Thread Pablo Zubieta
ug there. Sorry for the noise. Cheers, Pablo Zubieta

[julia-users] Re: `<` and `isless` for GradientNumber (ForwardDiff.jl)

2015-12-10 Thread Pablo Zubieta
Sorry for the noise. Cheers, Pablo Zubieta

[julia-users] Re: `<` and `isless` for GradientNumber (ForwardDiff.jl)

2015-12-10 Thread Pablo Zubieta
I'm using julia 0.4.1. Here's an example using ForwardDiff foo(l, x) = ifelse( abs(x) < l, sin(x), cos(x) ) bar(l, x) = ifelse( isless(abs(x),l), sin(x), cos(x) ) derivative(x->foo(2,x), 1.) # ERROR: < not defined for ForwardDiff. GradientNumber{1,Float64,Tuple{Float64}} derivative(x->bar(2,x),

[julia-users] `<` and `isless` for GradientNumber (ForwardDiff.jl)

2015-12-10 Thread Pablo Zubieta
adienNumber? Thanks, Pablo Zubieta

Re: [julia-users] Re: unknown option root

2015-10-12 Thread Pablo Zubieta
If you are running Ubuntu you should run sudo apt-get install xscreensaver-data-extra instead.

[julia-users] Re: Is there a way to replace f(object, args...) with object.f(args...)?

2015-10-07 Thread Pablo Zubieta
As others mentioned, it is better to use multiple dispatch as the Julia language was developed with it as one of its central features. You could easily change the name of the function to make it look natural (in the english grammar sense). E.g. you can define feed(Man, food) or feed(Man, with=f

[julia-users] Re: Easy way to find only unary methods of an operator?

2015-06-01 Thread Pablo Zubieta
Maybe methods(\, (Any,)) But I don't think there is any unary form of \. Greetings, Pablo

[julia-users] Re: problem with bigfloat precision

2015-05-14 Thread Pablo Zubieta
Nevermind I saw your PR.

[julia-users] Re: problem with bigfloat precision

2015-05-14 Thread Pablo Zubieta
I would think it is even more robust a definition like mylog(b, x) = (promote(b, x); log(x) ./ log(b)) in case someone wants to write mylog(2.1, 2). Stefan, should this be the definition in Base?

[julia-users] Re: Performance difference between running in REPL and calling a script?

2015-03-27 Thread Pablo Zubieta
Hi Michael As Stefan just pointed out, in Julia one should in general take advantage of the Multiple Dispatch paradigm and write functions that dispatch on the types instead of having functions belonging to the type (as you would have in Python). Let me give you a simple example by rewriting y

[julia-users] Re: Print(char(0x08))

2015-03-06 Thread Pablo Zubieta
It works for me in the julia 0.3.6 REPL (on linux), but it does not seem to work on IJulia.

[julia-users] Re: Constructing matrices

2015-02-23 Thread Pablo Zubieta
Yeah, I have never thought of that, but it seems kind of confusing. You can do julia> hvcat(1, 1, 2, 3) 3x1 Array{Int64,2}: 1 2 3 julia> hvcat(1, 1, 2, 3)'' == hvcat(1, 1, 2, 3) true Greetings.

Re: [julia-users] Numerical precision of simple mathematical operations

2015-02-12 Thread Pablo Zubieta
In your case you may want to try with arbitrary precision floats (BigFloat) So just define x = BigFloat[1, 0.045126, 6.9315] w1 = w2 = w3 = BigFloat[1 1 1] w4 = BigFloat[1 -10 -10] and call your function as compute(f1[1], f2[1], f3[1], d[1], BigFloat(0), BigFloat(153))

Re: [julia-users] Levi-Civita symbol/tensor

2015-02-11 Thread Pablo Zubieta
Done! https://github.com/JuliaLang/julia/issues/10172

Re: [julia-users] Levi-Civita symbol/tensor

2015-02-11 Thread Pablo Zubieta
Hi again, There were some bugs in my implementations. I updated the gist with the corrected versions and added a simpler looking function (but of O(n²) running time). I did some tests and found (with my slow processor)

Re: [julia-users] Levi-Civita symbol/tensor

2015-02-10 Thread Pablo Zubieta
The first loop in the previous post might as well be for i = 1:n-1 Sorry, for the quantity of posts.

Re: [julia-users] Levi-Civita symbol/tensor

2015-02-10 Thread Pablo Zubieta
Also, a brute-force (but simple-looking) approach that is O(n²) might be function levicivita{T<:Integer}(p::AbstractVector{T}) n = lenght(p) ɛ = 1 for i = 1:n for j = i+1:n ɛ *= sign(p[j] - p[i]) ɛ == 0 && return 0 end end return ɛ end

Re: [julia-users] Levi-Civita symbol/tensor

2015-02-10 Thread Pablo Zubieta
Hi all! I believe that sign{T<:Integer}(perm::AbstractVector{T}) is already defined and returns something like [sign(n) for n in perm] So, I think it would be better to call it by other name, or with a different signature. By looking at the code at the code used in Permutations, I came up wi

[julia-users] Re: JuliaBox

2014-11-10 Thread Pablo Zubieta
Hi Shashi, I would like a code too. Thanks in advance, Pablo

[julia-users] Re: Benchmarks for Julia 0.3x ???

2014-10-28 Thread Pablo Zubieta
I bee trying to help with this. And already fixed the java and R issues (I think). I've been thinking on how to fix the other, but I would like some feedback first. To fix the C and Fortran issue (which basically consists on avoid constant-foldi

[julia-users] Re: Benchmarks for Julia 0.3x ???

2014-10-23 Thread Pablo Zubieta
I've been asking myself the same as Uwe. Is there any place where we can find this information? Greetings, Pablo

[julia-users] Re: immutable types with array fields

2014-09-13 Thread Pablo Zubieta
I see. Yeah, I wasn't sure if there was already some work done on fixed-size arrays. But it is great to know there are plans of working on it. Thanks, for the answer.

[julia-users] immutable types with array fields

2014-09-13 Thread Pablo Zubieta
Hi everyone I was wondering (since it seems that we are allowed to use array fields inside immutable types) if there are problems or any loose on the benefits of using immutable types if I do one of the following: 1. Have an array field that is going to maintain its size but not the val

[julia-users] Re: ANN: PGF/TikZ packages

2014-08-23 Thread Pablo Zubieta
@Kaj Wiik Sorry! There is a typo, it should be: a = Plots.Linear(rand(20), rand(20)) Pablo

[julia-users] Re: ANN: PGF/TikZ packages

2014-08-23 Thread Pablo Zubieta
@Kaj Wiik I believe you need to use: a = Plot.Linear(rand(20), rand(20)) Checkout here: http://nbviewer.ipython.org/github/sisl/PGFPlots.jl/blob/master/doc/PGFPlots.ipynb Cheers, Pablo

[julia-users] Re: Error using Pkg.add

2014-08-10 Thread Pablo Zubieta
Done! Here is the link to the issue https://github.com/JuliaLang/julia/issues/7946 .

[julia-users] Re: Error using Pkg.add

2014-08-10 Thread Pablo Zubieta
I can't see an sse3 flag in /proc/cpuinfo. Here it is anyway. processor: 0 vendor_id: AuthenticAMD cpu family: 17 model: 3 model name: AMD Turion(tm) X2 Dual-Core Mobile RM-70 stepping: 1 microcode: 0x232 cpu MHz: 500.000 cache size: 512 KB physical

[julia-users] Re: Error using Pkg.add

2014-08-10 Thread Pablo Zubieta
I forgot to mention, I am not running a VM.

[julia-users] Re: Error using Pkg.add

2014-08-10 Thread Pablo Zubieta
I renamed the file, but it does not sort out the problem.

[julia-users] Re: Error using Pkg.add

2014-08-10 Thread Pablo Zubieta
Is it safe to remove the sys.so file?

[julia-users] Re: Error using Pkg.add

2014-08-10 Thread Pablo Zubieta
My processor is an AMD Turion X2. I was using the 0.3.0-rc1 version without a problem.

[julia-users] Error using Pkg.add

2014-08-10 Thread Pablo Zubieta
I am currently using Ubuntu 14.04 and the Julia Nightlies PPA. Recently, I updated to the 0.3.0-rc2 versions and I get the following error when trying to add a package: signal (4): Illegal instruction _mapreduce at ./reduce.jl:168 prune_versions at ./pkg/query.jl:141 prune_dependencies at ./pkg/

[julia-users] Re: Strange LLVM error

2014-08-01 Thread Pablo Zubieta
I don't thinks that leads to an infinite loop. Instead it creates a 12-dimensional matrix with 3^12 (531441) elements. If you use rand(ones(Int, 12)...); I guess it won't take nothing to calculate the matrix. The problem is printing or showing it.

Re: [julia-users] Re: essay on the history of programming languages

2014-07-16 Thread Pablo Zubieta
Ismael, although ASCIIString is a subtype of String, Array{ASCIIString,1} is not a subtype of Array{String,1}. As far as I understand Julia has been designed this way for practical reasons. You can read about it in the manual's section: Types. You might want to rewrite your function as functio

[julia-users] Re: Manual deallocation

2014-07-08 Thread Pablo Zubieta
Thanks for the answers. I agree that a manual chapter would be helpful.

[julia-users] Manual deallocation

2014-07-07 Thread Pablo Zubieta
Let's say I have some large matrices I need to do some calculations and I use them in order to get some results that I will use in a second part of a computation where I not longer need the initial matrices. Suppose also that I preallocate those matrices. Would it be ok to bind the names of tho