[julia-users] Re: Optimizing Function Injection in Julia

2016-01-31 Thread Christopher Alexander
Yea, can someone explain the proper syntax here? What would be the case if I wanted to build a callable type? What if I want to do something like this? call{T <: MyAbstractType)(t::T, a::Int) = t.a + a Thanks! Chris On Sunday, January 31, 2016 at 4:27:00 AM UTC-5, Bryan Rivera wrote: > > I

Re: [julia-users] Re: Optimizing Function Injection in Julia

2016-01-31 Thread Bryan Rivera
"the type parameter can simply be replaced with the abstract type itself. " I believe I was having trouble with this. Could be part of the bug.

Re: [julia-users] Re: Optimizing Function Injection in Julia

2016-01-31 Thread Bryan Rivera
Yichao, try it on 0.5.0-dev+2422 julia> type SomeCallBack z::Int end julia> (_::SomeCallBack)(c) = _.z + c julia> s = SomeCallBack(24) SomeCallBack(24) julia> s(10) 34 On Sunday, January 31, 2016 at 4:01:09 PM UTC-5, Yichao Yu wrote: > > On Sun, Jan 31, 2016 at

Re: [julia-users] Re: Optimizing Function Injection in Julia

2016-01-31 Thread Yichao Yu
On Sun, Jan 31, 2016 at 4:25 PM, Bryan Rivera wrote: > Working on 0.5.0-dev+2422: > > julia> type SomeCallBack >z::Int >end > > julia> (_::SomeCallBack)(c) = _.z + c > > julia> s = SomeCallBack(24) > > SomeCallBack(24) > > julia> s(10) > > 34 > >

Re: [julia-users] Escher example problem

2016-01-31 Thread Shashi Gowda
I believe this to be fixed now? On Mon, Jan 11, 2016 at 1:09 PM, Leonardo wrote: > Hi, I've a problem running Escher's example plotting.jl caused by Gadfly: > > WARNING: using Gadfly.render in module Main conflicts with an existing > identifier. > WARNING: Method definition

Re: [julia-users] Escher global and local context

2016-01-31 Thread Shashi Gowda
Hi Leonardo If you have a single Escher process serving multiple requests and you want to share some state between them, my recommendation would be to put the shared data in signal, which can optionally be persisted to disk/DB something like if !isdefined(:my_global_var) # this condition makes

[julia-users] Re: SharedArray / parallel question

2016-01-31 Thread Christopher Alexander
Is this something that would really only be solved by proper multi-threading? On Saturday, January 30, 2016 at 12:49:50 PM UTC-5, Christopher Alexander wrote: > > I can confirm that I do not see the seg fault issue in 0.5 (the latest > master), but I am getting fundamentally different results

Re: [julia-users] Re: Optimizing Function Injection in Julia

2016-01-31 Thread Yichao Yu
On Sun, Jan 31, 2016 at 1:10 PM, Christopher Alexander wrote: > Yea, can someone explain the proper syntax here? What would be the case if > I wanted to build a callable type? What if I want to do something like > this? > > call{T <: MyAbstractType)(t::T, a::Int) = t.a + a

[julia-users] Plotting with Plot

2016-01-31 Thread digxx
I use Plot as Plotting Device with Gadfly Backend and used savefig("testfile") to save my previously plotted figure.. Apparently it has some issues with the font. Do I need to load it in Julia seperately? (julia.exe:6312): Pango-WARNING **: couldn't load font "Helvetica Not-Rotated

Re: [julia-users] Escher global and local context

2016-01-31 Thread Shashi Gowda
On Sun, Jan 31, 2016 at 11:41 PM, Shashi Gowda wrote: > Hi Leonardo > > put the shared data in signal, which can optionally be persisted to disk/DB > I meant to say "put the shared data in a global signal"

[julia-users] Sparse matrix memory preallocation?

2016-01-31 Thread Gabriel Goh
Generating a sparse matrix from scratch seems to be quite memory intensive. and slow. Say I wish to create a large block diagonal matrix with 2x2 block entries. Doing it naively is quite slow function f(k) M = spzeros(2*k,2*k) for i = 1:k D = (i-1)*2 + 1:i*2 M[D,D] = randn(2,2)

[julia-users] Re: Optimizing Function Injection in Julia

2016-01-31 Thread Bryan Rivera
Working on 0.5.0-dev+2422: julia> type SomeCallBack z::Int end julia> (_::SomeCallBack)(c) = _.z + c julia> s = SomeCallBack(24) SomeCallBack(24) julia> s(10) 34 julia> @code_llvm s(10) define i64 @julia_SomeCallBack_23730(%jl_value_t*, i64) #0 { top: %2 =

Re: [julia-users] ERROR: LoadError: OutOfMemoryError()

2016-01-31 Thread jda
I eventually resolved this problem. I found a place in my code where I was using the less efficient diag(sparse(vector)) instead of the more efficient diagm(vector). This ended up being crucial for performance. Now my code is running on both machines with simply the laptop running slower as

[julia-users] Need Ref on UInt32 but not Float64

2016-01-31 Thread Bryan Rivera
For some reason I need to specify Ref{UInt32} instead of just UInt32. Float64 does not seem to require the same. Can anyone explain this behavior? function callbackfun(a::UInt32, b::Float64, c::UInt32) ... end cfunction(callbackfun, Void, (Ref{UInt32},Float64,Ref{UInt32})) typedef

Re: [julia-users] Escher example problem

2016-01-31 Thread Leonardo
Yes, this error don't occurr anymore, but other errors occurr (reported in another message) Thanks Leonardo Il 31/01/2016 19:11, Shashi Gowda ha scritto: I believe this to be fixed now? On Mon, Jan 11, 2016 at 1:09 PM, Leonardo > wrote:

[julia-users] recommended graphics packages for multiple curves on a single canvas

2016-01-31 Thread Michael Landis
Can anyone recommend a graphics capable of plotting multiple curves on a single canvas. Python's pyplot/matplotlib multi-curve capabilities appear to be unavailable within Julia (maybe I'm doing it wrong).

[julia-users] Re: deep learning for regression?

2016-01-31 Thread Jason Eckstein
The reason why most of the deep learning focus is on classification is because image classification and voice recognition is where all the research money and focus is for the large companies that are investing in machine learning, i.e. Google, Baidu, Facebook, Microsoft, etc Also a number

[julia-users] Re: jl_call function in c++ code

2016-01-31 Thread Shamika
I rooted the input arguments but I'm not able to access the output arguments. If jl_value_t *ret = (jl_array_t*)jl_call(func,args,nargs); returns a double matrix and a double scalar, could you show me how to access each output argument. If you could point me to some example code, that would

[julia-users] Re: Optimizing Function Injection in Julia

2016-01-31 Thread Bryan Rivera
Cedric, I refactored the problem and this works well. What do you mean "I would favor using a regular function call with a descriptive name"? I was thinking replace `Base.call` with a function name. But that does not work if the function is in the top-level scope in another file. On

[julia-users] Re: Optimizing Function Injection in Julia

2016-01-31 Thread Bryan Rivera
Cedric, I refactored the problem and this works well. What do you mean "I would favor using a regular function call with a descriptive name"? I am taking that to mean replace `Base.call` with a function name. But that does not work if the function is in top-level scope in another file. On

[julia-users] Re: Optimizing Function Injection in Julia

2016-01-31 Thread Bryan Rivera
I just realized #13412 has been merged. What should this look like now that `Base.call(...)` is deprecated? Thinking something like: (_::SomeCallBack)(c) = _.z + c On Sunday, January 31, 2016 at 3:47:03 AM UTC-5, Bryan Rivera wrote: > > Cedric,

[julia-users] Escher global and local context

2016-01-31 Thread Leonardo
Hi all, I want write an application with a Web UI (e.g. a chat) that has a local state (specific for each client) and global one (a state bind to web server). These requirements are useful for example to permit communications between different client (e.g. into a chat) and/or handle centralized

[julia-users] Anonymous functions now faster? Need for functors?

2016-01-31 Thread Ben Ward
Hi, I just saw this merged PR . In the past I used the functor trick of defining a type, and then a call method for the type, and passing this to a function, to get past the anonymous function inefficiency. Does this PR mean (to a mortal like me)

Re: [julia-users] Anonymous functions now faster? Need for functors?

2016-01-31 Thread Mauro
> Hi, > > I just saw this merged PR . > > In the past I used the functor trick of defining a type, and then a call > method for the type, and passing this to a function, to get past the > anonymous function inefficiency. > > Does this PR mean (to a

[julia-users] Re: Optimizing Function Injection in Julia

2016-01-31 Thread Cedric St-Jean
On Sunday, January 31, 2016 at 4:27:00 AM UTC-5, Bryan Rivera wrote: > > I just realized #13412 has > been merged. > > What should this look like now that `Base.call(...)` is deprecated? > It will be once Julia 0.5 is released (and it still has no

[julia-users] Re: Optimizing Function Injection in Julia

2016-01-31 Thread Cedric St-Jean
On Sunday, January 31, 2016 at 3:47:03 AM UTC-5, Bryan Rivera wrote: > > What do you mean "I would favor using a regular function call with a > descriptive name"? > > I was thinking replace `Base.call` with a function name. > Yes, that's what I meant. It depends on the context, sometimes