Re: [julia-users] Standard wrapper for global variable optimization hack?

2016-06-13 Thread Eric Forgy
Creating a global instance of a special type seems reasonable to me. I also use global Dict's for this kind of thing. Instead of inc_global, I might define Base.(:+)(w::wrapper,s) = w.x + s so you can just do `w += 1` :) If you find a better way, I would love to see it. PS: Minor point,

[julia-users] Re: (How?) Has parallel execution changed in 0.5?

2016-06-13 Thread Amit Murthy
The following did not hang on master on my system Pkg.add("Optim") using Optim # precompile Optim addprocs(4) @everywhere using Optim # Load on all workers followed by the function definition On Tuesday, 14 June 2016 04:35:55 UTC+5:30, Nils Gudat wrote: > > I feel like I've posted on

Re: [julia-users] Standard wrapper for global variable optimization hack?

2016-06-13 Thread Arch Robison
Indeed the one-element vector case was what inspired my wrapper. I created the wrapper to avoid the run-time bounds check on the vector, though I suppose I could sprinkle @inbounds to eliminate it. On Mon, Jun 13, 2016 at 6:40 PM, Eric Forgy wrote: > Not sure if this is

[julia-users] Standard wrapper for global variable optimization hack?

2016-06-13 Thread Eric Forgy
Not sure if this is the best way (curious about 'Ref'), but you could also make x a 1-element vector: const x = [0] x[1] += 1

[julia-users] (How?) Has parallel execution changed in 0.5?

2016-06-13 Thread Nils Gudat
I feel like I've posted on here with the same title when we went from 0.3 to 0.4, but I'm finding myself in a similar situation. When running my code on 0.5, it simply stops at a function definition - there's no error, the program just doesn't move on. The function definition is this:

[julia-users] Re: How to install 0.4.5 on Ubuntu?

2016-06-13 Thread cdm
T. Kelman's advice is apt here ... unpacking the generic Linux binaries has worked well on Ubuntu systems for me over the past months. the current release, 0.4.5, for 64-bit environments can be had here:

[julia-users] Re: Standard wrapper for global variable optimization hack?

2016-06-13 Thread Kristoffer Carlsson
Modifying construction values is technically "undefined behaviour" (hence the warning) and is only provided as a convenience when working interactively.

[julia-users] Re: Standard wrapper for global variable optimization hack?

2016-06-13 Thread 'Greg Plowman' via julia-users
I have a feeling this is a stupid question, but here it is anyway: Why do you need a wrapper? Why not just declare the object const directly? const x = 0.0 function inc_global() x += 1 end

[julia-users] Re: How to install 0.4.5 on Ubuntu?

2016-06-13 Thread Nils Gudat
Sorry to come back to this, but I've now tried the instructions given above (which are also on the julialang website as I've now seen), but I keep getting v0.5.0-2975-ubuntu14.04.1. When I do sudo apt-get install julia=0.4.5 as before, I'm being told that version 0.4.5 is not found. What could

[julia-users] Standard wrapper for global variable optimization hack?

2016-06-13 Thread Kristoffer Carlsson
Ref?

[julia-users] Standard wrapper for global variable optimization hack?

2016-06-13 Thread Arch Robison
I'm revising the notes for my JuliaCon workshop, and wondering if there is a standard way/convention for the following hack to reduce the overhead of accessing a global variable. The hack is to replace a global variable, if known to always be bound to objects of the same type, with a const

[julia-users] Re: A naive question regarding the definition of a type with arguments of varying types

2016-06-13 Thread Kristoffer Carlsson
Perhaps: type RealorComplex{T1 <: Number, T2<:Real} v::Vector{T1} w::Vector{Complex{T2}} function RealorComplex(v, w) @assert T1 <: AbstractFloat || T1 <: Complex new(v, w) end end RealorComplex{T1,T2}(v::Vector{T1}, w::Vector{Complex{T2}}) = RealorComplex{T1, T2}(v, w)

[julia-users] how can I create an incidence matrix

2016-06-13 Thread Gerson Jr.
Hi I would like to create an incidence matrix. I have a file with 3 columns, like: id x y A 22 2 B 4 21 C 21 360 D 26 2 E 22 58 F 2 347 And I want a matrix like (without col and row names): 2 4 21 22 26 58 347 360 A 1 0 0 1 0 0 0 0 B 0 1 1 0 0 0 0 0 C 0 0 1 0 0

[julia-users] A naive question regarding the definition of a type with arguments of varying types

2016-06-13 Thread Kuan Xu
I'm trying to define a type which has two fields, the first of which can be either real or complex and the second is always complex. type RealorComplex{T<:Number} v::Vector{T} w::Vector{Complex{T}} end r = RealorComplex([1.0, 2.0], [1.0+1.0im, 2.0]) t = RealorComplex([1.0+1.0im,

Re: [julia-users] ControKTH

2016-06-13 Thread Toivo Henningsson
There is also https://github.com/JuliaControl/ControlSystems.jl which is MIT licensed.

Re: [julia-users] Re: Packages Distances problem with Distances.Jaccard : very slow

2016-06-13 Thread Kristoffer Carlsson
Please try https://github.com/JuliaStats/Distances.jl/pull/44 On Monday, June 13, 2016 at 8:14:01 PM UTC+2, Mauro wrote: > > > function myjaccard2(a::Array{Float64,1}, b::Array{Float64,1}) > > num = 0. > > den = 0. > > for I in 1:length(a) > > @inbounds ai = a[I] > >

[julia-users] Re: Pivoting when inverting a sparse matrix

2016-06-13 Thread Kristoffer Carlsson
Pardiso also has academic license. On Monday, June 13, 2016 at 8:09:48 PM UTC+2, Patrick Belliveau wrote: > > Julia doesn't seem to have a built in sparse direct solver specifically > for symmetric indefinite matrices. However, as Tony alluded to, there are > Julia packages that interface with

[julia-users] Re: Packages Distances problem with Distances.Jaccard : very slow

2016-06-13 Thread Kristoffer Carlsson
Please try https://github.com/JuliaStats/Distances.jl/pull/44 Using: function testDistances5(a::Array{Float64,1}, b::Array{Float64,1}) @time for i in 1:5000 myjaccard5(a,b) end d = Jaccard() @time for i in 1:5000 evaluate(d, a,b) end end I get: julia>

Re: [julia-users] Re: Packages Distances problem with Distances.Jaccard : very slow

2016-06-13 Thread Mauro
> function myjaccard2(a::Array{Float64,1}, b::Array{Float64,1}) > num = 0. > den = 0. > for I in 1:length(a) > @inbounds ai = a[I] > @inbounds bi = b[I] > num = num + min(ai,bi) > den = den + max(ai,bi) > end > 1. - num/den > end > > > > function

[julia-users] Re: Pivoting when inverting a sparse matrix

2016-06-13 Thread Patrick Belliveau
Julia doesn't seem to have a built in sparse direct solver specifically for symmetric indefinite matrices. However, as Tony alluded to, there are Julia packages that interface with the mumps and pardiso libraries, which do pivoting for symmetric indefinite matrices while taking advantage of

[julia-users] Re: Packages Distances problem with Distances.Jaccard : very slow

2016-06-13 Thread jean-pierre both
It makes perfect sense to use Jaccard distances for float values Cf for example http://www.ncbi.nlm.nih.gov/pubmed/16794951 Nevertheless the problem is just an implementation, the time spent should be comparable with the one with Euclidean. The problem I mention is that the nice implementation

Re: [julia-users] Question in using JuMP

2016-06-13 Thread JC
Thank you very much! On Monday, June 13, 2016 at 1:17:27 PM UTC-4, Mauro wrote: > > Better repost this to julia-opt list. Mauro > > On Mon, 2016-06-13 at 04:27, JC wrote: > > I have been trying to use JuMP for an optimization problem and ran into > > many issues. > > > >

[julia-users] Interact.jl + ipywidgets 5.x.x

2016-06-13 Thread Josef Heinen
Did anyone manage to get Interact.jl working with an up-to-date version of ipywidgets? I had to setup a special environment containing ipywidgets v4.1.1 and notebook v4.2.0 to use Interact.jl in Jupyter with a Julia 0.4.5 kernel by overwriting the PYTHONPATH before starting jupyter notebook:

Re: [julia-users] Question in using JuMP

2016-06-13 Thread Mauro
Better repost this to julia-opt list. Mauro On Mon, 2016-06-13 at 04:27, JC wrote: > I have been trying to use JuMP for an optimization problem and ran into > many issues. > > 1. I made my own function called myf and try to register that so that I can > read it into my

[julia-users] ANN: Updated "lite" branch of Julia

2016-06-13 Thread Scott Jones
Since people have been looking at paring down the size of Julia recently, I went back and made sure my "lite" branch ( https://github.com/ScottPJones/julia/tree/spj/lite) of Julia was sync'ed with master, as that as had quite a lot of changes recently. Here is some information comparing the

[julia-users] how to learn about function arguments

2016-06-13 Thread ggggg
Hello, I've been thinking about writing a Julia package thats similar to lmfit , which provides a nice api for developing and exploring fitting models. I'll show you one of the key parts of the api, you create a Model from a function, and the model

Re: [julia-users] Abstract version of rng=1:end ?

2016-06-13 Thread Dan
A reason such 'extended' ranges might be good, is the ability to dispatch on them for efficiency. For example, `deleteat!(vec,5:end)` could be implemented faster than just any `deleteat!` of any range. This would be applicable to other such structures with edge effects. Indeed, we can learn

[julia-users] Re: Why does adding type assertion to field slow down this example?

2016-06-13 Thread Jason Merrill
On Thursday, June 9, 2016 at 6:36:35 PM UTC-4, Arch Robison wrote > > Yes, I know if I declare x with a concrete type such as Int, the code will > do blazingly fast. But I was poking around to see if declaring it with an > abstract type narrower than Any would help. > I think the other piece

Re: [julia-users] ControKTH

2016-06-13 Thread Linus Härenstam-Nielsen
I have to admit I did not take any licencing issues into consideration before uploading the code. I've deleted the repository for now but I will post here again if I end up re-uploading. On Monday, June 13, 2016 at 4:34:01 PM UTC+2, Stefan Karpinski wrote: > > There is no LICENSE file in that

Re: [julia-users] Plotting lots of data

2016-06-13 Thread Tom Breloff
If you check out the dev branch of Plots, you can do 'plot(y, t=:scattergl)' and it should use the WebGL method in Plotly. Try it out if you want... (and report back if you find anything interesting) On Mon, Jun 13, 2016 at 9:11 AM, Jonathan Malmaud wrote: > Does the

Re: [julia-users] Abstract version of rng=1:end ?

2016-06-13 Thread Yichao Yu
On Mon, Jun 13, 2016 at 10:47 AM, Matthew Pearce wrote: > Hello > > I find myself frequently wishing to define functions that accept a range > argument to operate on like: > > function foo{T}(M::Array{T,1}, rng::UnitRange) > return sum(M[rng].^2) > end > > It would be

[julia-users] Abstract version of rng=1:end ?

2016-06-13 Thread Matthew Pearce
Hello I find myself frequently wishing to define functions that accept a range argument to operate on like: function foo{T}(M::Array{T,1}, rng::UnitRange) return sum(M[rng].^2) end It would be nice to be able to pass in `rng = 1:end`, but this isn't legal. So I need a signature like,

Re: [julia-users] ControKTH

2016-06-13 Thread Stefan Karpinski
There is no LICENSE file in that directory, so using this code is legally iffy. Linus says he "copied part of MatLab's algorithm", which makes legality sound even more questionable. Linus, can you address the license issues here and in the repository? What license was the original code under? What

[julia-users] Question in using JuMP

2016-06-13 Thread JC
I have been trying to use JuMP for an optimization problem and ran into many issues. 1. I made my own function called myf and try to register that so that I can read it into my objective function but am getting error message saying "Unrecognized function :myf used in nonlinear expression". 2.

Re: [julia-users] Plotting lots of data

2016-06-13 Thread Jonathan Malmaud
Does the Plots.jl wrapper over PlotlyJS support the OpenGL-based scatter plotting? On Monday, June 13, 2016 at 8:08:42 AM UTC-4, Tom Breloff wrote: > > I recommend testing your stuff with Plots... The overhead should be > constant among backends, so you can use the same code to benchmark

[julia-users] making Juliadoc available to sphinx/python

2016-06-13 Thread Tamas Papp
Hi, Could someone please explain what the recommended approach is for making sure that the juliadoc module is available when I want to compile documentation for _packages_ for offline reading (eg "make singehtml")? I tried export PYTHONPATH="~/src/julia/deps/build/julia-env/src/juliadoc/"

Re: [julia-users] Plotting lots of data

2016-06-13 Thread Tom Breloff
I recommend testing your stuff with Plots... The overhead should be constant among backends, so you can use the same code to benchmark PyPlot, GR and Plotly/PlotlyJS. See the "backends" page of the Plots docs for more info. I recommend checking out master as there's been some good

[julia-users] Re: Packages Distances problem with Distances.Jaccard : very slow

2016-06-13 Thread Kristoffer Carlsson
It seems weird to me that you guys want to call Jaccard distance with float arrays. AFAIK Jaccard distance measures the distance between two distinct samples from a pair of sets so basically between two Vector{Bool}, see:

[julia-users] Re: Packages Distances problem with Distances.Jaccard : very slow

2016-06-13 Thread Simon Danisch
It also seems unnecessary to restrict it to Float64 and Array: function myjaccard2{T}(A::AbstractArray{T,1}, B::AbstractArray{T, 1}) num = zero(T) den = zero(T) for (a,b) in zip(A,B) num += min(a,b) den += max(a,b) end return 1.0 - num/den end Maybe also

Re: [julia-users] Packages Distances problem with Distances.Jaccard : very slow

2016-06-13 Thread Mauro
I am not sure I quite understand. But it looks like you know how to improve the Jaccard distance code, so why not make a pull request at Distances.jl? > function myjaccard2(a::Array{Float64,1}, b::Array{Float64,1}) >num = 0 >den = 0 >for i in 1:length(a) >

Re: [julia-users] Re: Plotting lots of data

2016-06-13 Thread Mauro
I also found that GR is a lot faster than PyPlot, so give that a try. On Mon, 2016-06-13 at 09:57, Andreas Lobinger wrote: > Hello colleague, > > On Sunday, June 12, 2016 at 10:31:06 PM UTC+2, CrocoDuck O'Ducks wrote: >> >> Hi there! >> >> I have been experimenting a little

[julia-users] Re: Plotting lots of data

2016-06-13 Thread Andreas Lobinger
Hello colleague, On Sunday, June 12, 2016 at 10:31:06 PM UTC+2, CrocoDuck O'Ducks wrote: > > Hi there! > > I have been experimenting a little with many plotting packages recently. > Being used to Matlab PyPlot seemed to work well for me... until this bug >

[julia-users] Re: How can I define an anonymous function with keyword arguments

2016-06-13 Thread Jussi Piitulainen
maanantai 13. kesäkuuta 2016 4.53.14 UTC+3 Xiaoqing Rong-Mullins kirjoitti: > > The methods I've tried do not allow me to define an anonymous function > with keyword arguments: > > julia> VERSION > v"0.4.5" > > The following trick seems to work. I think this is called eta-expansion (in lambda