Re: [julia-users] Error: zeros(UTF8String, 5)
Le vendredi 16 janvier 2015 à 14:29 +0800, K leo a écrit : julia A=zeros(UTF8String, 5) ERROR: `zero` has no method matching zero(::Type{UTF8String}) in zeros at array.jl:169 This used to work, but with the new update it doesn't. Any idea? Doesn't work on 0.3.4 either. But what would you expect zero(UTF8String) to return? A string isn't a number. More broadly, why do you need this feature? Regards _ _ _(_)_ | A fresh approach to technical computing (_) | (_) (_)| Documentation: http://docs.julialang.org _ _ _| |_ __ _ | Type help() for help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.3.5 (2015-01-08 22:33 UTC) _/ |\__'_|_|_|\__'_| | Official http://julialang.org release |__/ | x86_64-linux-gnu
Re: [julia-users] Re: inv() return incorrect result
Ah I see, that helps. Thanks ppl =) On Friday, January 16, 2015 at 11:56:39 AM UTC+8, Andreas Noack wrote: Rounding can make a numerically singular matrix regular so that is probably what we are seeing here. You initial covariance matrix is actually singular, but when copied from the mail or read from a file it becomes non-singular. You try the following julia A = randn(15, 14);B = A*A'; # B is singular except for floating point errors julia norm(inv(B)*B - I) 219.10806398211932 julia C = round(B, 9); julia norm(inv(C)*C - I) 3.5885069748862715e-6 2015-01-15 21:54 GMT-05:00 ShaoWei Teo tooku...@gmail.com javascript:: Thanks for helping with the troubleshoot. Oh my, this is really weird! I simplified the problem and post it here, which I realised could not reproduce the result. More on this later. The original problem is to calculate the inverse of a covariance matrix. Let's say my input is:- h = 0.001508 0.013789 -0.00104 0.005551 0.004493 -0.00884 0.013144 0.017682 -0.00487 0.000629 -0.05168 -0.00023 0.002338 0.007286 0.007799 0.000526 -0.00334 -0.00314 -0.00392 -0.00752 -0.00797 -0.00741 -0.00271 -0.00521 -0.02595 -0.00841 -0.00058 0.007486 -0.01012 -0.0026 0.002072 0.003723 0.002328 0.007764 0.007441 -0.00261 0.018319 0.023409 0.000208 0.016593 -0.02026 0.000187 0.004628 0.004931 0.015028 -0.00523 0.002056 -0.00962 0.031875 -0.0027 -0.00029 0.005102 -0.00589 -0.00548 0.004088 -0.01538 -0.00087 -0.02139 -0.01081 0.006092 -0.00728 0.019137 -0.00297 0.001239 0.010175 -0.00556 0.019964 0.014191 -0.00666 0.008469 -0.05717 -0.00424 -0.03361 -0.00972 0.011719 0.002002 0.006843 -0.00058 0.023126 0.014145 0.008645 0.008639 0.013656 0.009018 0.010999 0.058236 -0.00115 -0.01331 0.009285 0.014607 0.007854 -0.02343 0.011951 -0.01901 -0.022 0.004033 -0.03805 -0.03497 0.010243 -0.02748 -0.05395 0.009717 -0.01425 0.009262 -0.0257 0.003396 0.001709 -0.00489 0.024266 0.018609 -0.01335 0.013088 0.012458 -0.00599 0.014979 0.049237 -0.00056 0.01015 -0.00691 0.019328 0.002141 -0.01978 0.009303 -0.0404 -0.02996 0.005715 -0.02302 -0.02434 0.008846 -0.02494 -0.00902 0.011864 -0.00023 0.014309 -0.027 0.010168 -0.03179 0.006432 0.010828 -0.05265 0.006049 -0.05946 -0.04611 0.004026 -0.02481 -0.01016 0.010103 -0.00369 0.007764 -0.01631 -0.00382 0.031399 -0.00182 0.016132 0.039641 -0.00495 0.040496 0.046879 -0.00186 0.032187 0.012492 -0.0045 0.033889 -0.00991 0.027912 -0.00523 0.028394 -0.00907 0.004339 0.006011 -0.00727 0.01518 0.004874 -0.00712 0.005307 0.053483 -0.00014 0.036373 -0.00403 0.012531 My cond(cov(h)) is about 6e17 while norm(cov(h) * inv(cov(h)) - eye(cov(h))) is 1408.688. I calculated inv(cov(h)) in Float64 to be:- 4.75E+19 3.89E+18 -1.11E+20 -1.89E+19 -1.35E+19 -3.23E+19 -2.19E+19 1.48E+19 8.26E+19 3.33E+19 -3E+18 -5.33E+19 -6.8E+17 -1.21E+19 -2.26E+19 1.14E+19 3.97E+17 -2.55E+19 -4.83E+18 -1.5E+18 -3.85E+18 -5.46E+18 3.2E+18 1.42E+19 6.92E+18 -7.8E+17 -8.86E+18 -1.5E+17 -2.23E+18 -3.66E+18 -1.09E+20 -2.19E+19 7.71E+19 1.32E+19 1.69E+19 -5.48E+18 -7.86E+18 -9.20E+18 -4.46E+19 -7.46E+18 1.62E+18 -5.59E+19 8.33E+18 3.78E+19 2.44E+18 -1.40E+19 -3.22E+18 1.13E+19 1.56E+18 3.46E+18 2.36E+18 -1E+18 -1.5E+18 -1.04E+19 -1.7E+18 2.02E+17 -4.88E+18 1.1E+18 5.44E+18 1.32E+18 -2.70E+19 -3.3E+18 2.21E+19 5.03E+18 4.52E+17 -8.11E+18 8.83E+17 -2.2E+18 -9.9E+17 -2.9E+18 5.99E+17 -1.08E+19 1.52E+18 6.55E+18 4.46E+17 -5.92E+19 -1.05E+19 3.87E+18 3.32E+18 -2.1E+18 -3.68E+19 -1.27E+19 1.24E+18 3.30E+19 1.06E+19 -4.3E+16 -6.71E+19 5.03E+18 1.70E+19 -1.08E+19 -1.41E+19 -4.91E+18 -1.17E+19 -2.41E+18 1.96E+18 -7.24E+18 -8.54E+18 1.64E+18 7.68E+18 6.67E+18 -5.3E+17 -2.55E+19 1.92E+18 6.66E+18 -4.06E+18 1.61E+19 3.10E+18 -9.71E+18 -1.8E+18 -1.9E+18 2.49E+18 1.46E+18 1.07E+18 3.73E+18 4.8E+17 -2E+17 9.73E+18 -1.2E+18 -5.32E+18 1.63E+17 1.26E+20 2.18E+19 -6.20E+19 -1.43E+19 -5.43E+18 4.30E+19 1.29E+19 5.47E+18 -7.31E+18 -3.5E+18 -1.5E+18 9.79E+19 -9.62E+18 -3.80E+19 9.95E+18 3.03E+19 6.18E+18 -4.4E+18 -1.3E+18 -2.28E+18 1.10E+19 6.51E+18 9.52E+16 -6.15E+18 -2.46E+18 1.8E+17 2.28E+19 -2.45E+18 -9.54E+18 7.3E+17 -2.79E+18 -7.1E+17 1.68E+18 2.15E+17 5.85E+17 7.67E+16 -4.3E+17 -2.1E+17 -1.56E+18 6.91E+16 3.89E+16 -2.42E+18 2.7E+17 1.18E+18 -2.3E+17 -3.91E+19 -1.00E+19 -7.10E+19 -9.82E+18 -6.21E+18 -5.39E+19 -2.96E+19 1.08E+19 8.47E+19 2.61E+19 -2.94E+18 -7.40E+19 4.43E+18 1.06E+19 -1.11E+19 -2.7E+18 1.79E+16 9.56E+18 1.67E+18 7.85E+17 2.75E+18 2.29E+18 -1.3E+18 -6.85E+18 -2.8E+18 3.03E+17 4.47E+18 -3.7E+16 5.68E+17 1.46E+18 -2.27E+19 -1.9E+18 4.34E+19 7.95E+18 3.61E+18 6.70E+18 7.85E+18 -5.46E+18 -2.58E+19 -1.09E+19 1.30E+18 1.02E+19 7E+17 5.64E+18 5.54E+18 -2.08E+19 -3.04E+18 -1.5E+18 9.1E+17 -6.6E+17 -1.31E+19 -4.3E+18 7.45E+17 1.52E+19 1.35E+18 -3.6E+17 -1.03E+19 1.26E+18 4.36E+18 1.42E+18 In BigFloat, I get:- 4.77E+80 1.49E+80 -4.60E+80 -5.23E+79 -1.22E+80
Re: [julia-users] Error: zeros(UTF8String, 5)
I think there might have been a package that defined something like this once. Do you get this error from a package?
[julia-users] Re: should I use types
@Erik Schnetter Would you suggest: type Packet{T} ID:::Vector{T} position::Vector{Vector3{T}} direction::Vector{Vector3{T}} energy::Vector{T} time:::Vector{T} end instead of Vector{Packet} ? Is this, because Packet is to big for the registers, but Vector3 alone might fit? I made simple benchmark to test this hypothesis, but I'm not sure if I implemented them to correctly test this assumption. The results where, that it doesn't make a difference. https://gist.github.com/SimonDanisch/50a1fd0a7672bade57ea Am Mittwoch, 14. Januar 2015 05:34:55 UTC+1 schrieb tugul...@gmail.com: I am writing a monte carlo radiation transport code (for applications in astrophysics), where I follow the temporal and spacial evolution of millions of whats called monte-carlo packets. And I am wondering whether if I should use the Julia's type system, if so how should I implement it and also if there is any performance loss/gain. Let's say I define a type like following (based on this example tutorial http://forio.com/labs/julia-studio/tutorials/advanced/1/): type Packet{T} ID::{T} position::Vector{T} direction::Vector{T} energy::{T} time::{T} end obviously this could make the code much more easier to read than a version with all information represented in separate arrays. But beside this elegance, is there anything else I should know about types? when I apply this to millions of objects will there be any effect to the performance? thanks,
[julia-users] Re: Error: zeros(UTF8String, 5)
I want the array to be initialized with every element being . Can't say about 0.3.4, but it definitely worked under 0.3.3. Are there any other easy ways for what I want? On Friday, January 16, 2015, Milan Bouchet-Valat nalimi...@club.fr wrote: Le vendredi 16 janvier 2015 à 14:29 +0800, K leo a écrit : julia A=zeros(UTF8String, 5) ERROR: `zero` has no method matching zero(::Type{UTF8String}) in zeros at array.jl:169 This used to work, but with the new update it doesn't. Any idea? Doesn't work on 0.3.4 either. But what would you expect zero(UTF8String) to return? A string isn't a number. More broadly, why do you need this feature? Regards _ _ _(_)_ | A fresh approach to technical computing (_) | (_) (_)| Documentation: http://docs.julialang.org _ _ _| |_ __ _ | Type help() for help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.3.5 (2015-01-08 22:33 UTC) _/ |\__'_|_|_|\__'_| | Official http://julialang.org release |__/ | x86_64-linux-gnu
[julia-users] Re: Error: zeros(UTF8String, 5)
You can do it with an array comprehension like: [ for i=1:5]
[julia-users] Re: Error: zeros(UTF8String, 5)
On Friday, January 16, 2015 at 6:59:19 AM UTC-5, K leo wrote: I want the array to be initialized with every element being . Can't say about 0.3.4, but it definitely worked under 0.3.3. Are there any other easy ways for what I want? If anything, this should be ones(UTF8String, n). Since * is the string-concatenation operator, then and is the identity element for concatenation, then one(UTF8String) should give .
Re: [julia-users] Re: Error: zeros(UTF8String, 5)
Le vendredi 16 janvier 2015 à 19:59 +0800, K leo a écrit : I want the array to be initialized with every element being . Can't say about 0.3.4, but it definitely worked under 0.3.3. Are there any other easy ways for what I want? As Ivar said, this was probably defined in some package, not in base Julia: _ _ _ _(_)_ | A fresh approach to technical computing (_) | (_) (_)| Documentation: http://docs.julialang.org _ _ _| |_ __ _ | Type help() for help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.3.3 _/ |\__'_|_|_|\__'_| | |__/ | x86_64-redhat-linux julia A=zeros(UTF8String, 5) ERROR: `zero` has no method matching zero(::Type{UTF8String}) in zeros at ./array.jl:169 Regards On Friday, January 16, 2015, Milan Bouchet-Valat nalimi...@club.fr wrote: Le vendredi 16 janvier 2015 à 14:29 +0800, K leo a écrit : julia A=zeros(UTF8String, 5) ERROR: `zero` has no method matching zero(::Type{UTF8String}) in zeros at array.jl:169 This used to work, but with the new update it doesn't. Any idea? Doesn't work on 0.3.4 either. But what would you expect zero(UTF8String) to return? A string isn't a number. More broadly, why do you need this feature? Regards _ _ _(_)_ | A fresh approach to technical computing (_) | (_) (_)| Documentation: http://docs.julialang.org _ _ _| |_ __ _ | Type help() for help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.3.5 (2015-01-08 22:33 UTC) _/ |\__'_|_|_|\__'_| | Official http://julialang.org release |__/ | x86_64-linux-gnu
Re: [julia-users] Where Clauses
Hello, Shea, I don't think there are any plans for this, specifically. It could, however, mostly be done now with macros. (The biggest missing part is that `where` can't be paired with `end` right now, so you'd still need a `begin` after the where.) As an aside, if you haven't seen it yet, you might be interested in PatternDispatch.jl, which addresses dispatch on values. Cheers, Kevin On Thu, Jan 15, 2015 at 2:56 PM, Shea Valentine nonlinearga...@gmail.com wrote: Any chance 'where' clauses are in the pipeline? It would pretty much just be syntactic sugar, where the code preceding where would be the same as the last line of a 'begin ... end' block. It would obviously be welcome for people coming from languages like Haskell, and is arguably prettier. Examples: sorter(x::Array) = begin if isempty(x) return x else pivot = x[1] smaller = filter(i- i pivot, x[2:end]) larger = filter(i- i = pivot, x[2:end]) end [sorter(smaller), pivot, sorter(larger)] end Would become sorter(x::Array) = [sorter(smaller), pivot, sorter(larger)] where if isempty(x) return x else pivot = x[1] smaller = filter(i- i pivot, x[2:end]) larger = filter(i- i = pivot, x[2:end]) end end Which makes the first line express the core functionality, and the code in the 'where' block details of that functionality. More interestingly function derivative(f) return function(x) h = x == 0 ? sqrt(eps(Float64)) : sqrt(eps(Float64)) * x xph = x + h dx = xph - x f1 = f(xph) f0 = f(x) return (f1 - f0) / dx end end could be written as derivative(f) = derived where derived(x) = (f1 - f0) / dx where h = x == 0 ? sqrt(eps(Float64)) : sqrt(eps(Float64)) * x xph = x + h dx = xph - x f1 = f(xph) f0 = f(x) end end Which seems like a more natural way to higher-order function when using the 'f(x)=' idiom. Finally, mixed with a magical future with pattern matching (dispatch on scalars) we could have code like this: sorter([]) = [] sorter(x::Array) = [sorter(smaller), pivot, sorter(larger)] where pivot = x[1] smaller = filter(i- i pivot, x[2:end]) larger = filter(i- i = pivot, x[2:end]) end
Re: [julia-users] Re: Error: zeros(UTF8String, 5)
I believe DataFrames.jl used to define this, at least. Cheers, Kevin On Fri, Jan 16, 2015 at 5:54 AM, Milan Bouchet-Valat nalimi...@club.fr wrote: Le vendredi 16 janvier 2015 à 19:59 +0800, K leo a écrit : I want the array to be initialized with every element being . Can't say about 0.3.4, but it definitely worked under 0.3.3. Are there any other easy ways for what I want? As Ivar said, this was probably defined in some package, not in base Julia: _ _ _ _(_)_ | A fresh approach to technical computing (_) | (_) (_)| Documentation: http://docs.julialang.org _ _ _| |_ __ _ | Type help() for help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.3.3 _/ |\__'_|_|_|\__'_| | |__/ | x86_64-redhat-linux julia A=zeros(UTF8String, 5) ERROR: `zero` has no method matching zero(::Type{UTF8String}) in zeros at ./array.jl:169 Regards On Friday, January 16, 2015, Milan Bouchet-Valat nalimi...@club.fr wrote: Le vendredi 16 janvier 2015 à 14:29 +0800, K leo a écrit : julia A=zeros(UTF8String, 5) ERROR: `zero` has no method matching zero(::Type{UTF8String}) in zeros at array.jl:169 This used to work, but with the new update it doesn't. Any idea? Doesn't work on 0.3.4 either. But what would you expect zero(UTF8String) to return? A string isn't a number. More broadly, why do you need this feature? Regards _ _ _(_)_ | A fresh approach to technical computing (_) | (_) (_)| Documentation: http://docs.julialang.org _ _ _| |_ __ _ | Type help() for help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.3.5 (2015-01-08 22:33 UTC) _/ |\__'_|_|_|\__'_| | Official http://julialang.org release |__/ | x86_64-linux-gnu
[julia-users] Re: Julia cannot compute factorial(21) while Octave can
factorial(BigInt(21)) works On Monday, January 12, 2015 at 10:10:06 PM UTC-5, Carlos Baptista wrote: I understand that factorial(21) is quite a large number and therefore an OverflowError is perfectly understandable. However, with Octave I can go up to factorial(170) (if I go higher I receive Inf). Is there a way to go beyond factorial(20) in Julia?
[julia-users] Facebook Open Sources Torch (Deep Learning Library)
Thought this could be interesting to some: http://torch.ch/ Would have been cool if they had used Julia instead of LUAjit =) And OpenCL, instead of going for the Vendor lock -.- Nevertheless, it's an interesting library! Best, Simon
Re: [julia-users] Facebook Open Sources Torch (Deep Learning Library)
Hi Simon, just in case you are looking for a Julia-based deep learning framework, there is Mocha.jl (https://github.com/pluskid/Mocha.jl), which is very well designed and documented, and a pleasure to use. cheers, rene Am 16.01.2015 um 19:27 schrieb Simon Danisch sdani...@gmail.com: Thought this could be interesting to some: http://torch.ch/ Would have been cool if they had used Julia instead of LUAjit =) And OpenCL, instead of going for the Vendor lock -.- Nevertheless, it's an interesting library! Best, Simon
Re: [julia-users] Facebook Open Sources Torch (Deep Learning Library)
I haven't used it in a long while, but torch has been around for a lot longer than Julia--even the version which uses Lua--so Julia wasn't really an option for it. At any rate, Julia is slowly gaining similar functionality. Cheers! Kevin On Friday, January 16, 2015, Simon Danisch sdani...@gmail.com wrote: Thought this could be interesting to some: http://torch.ch/ Would have been cool if they had used Julia instead of LUAjit =) And OpenCL, instead of going for the Vendor lock -.- Nevertheless, it's an interesting library! Best, Simon
Re: [julia-users] Re: Julia cannot compute factorial(21) while Octave can
Thanks Frank :) , similar answers were already given On 16/01/2015, Frank Kampas fkam...@gmail.com wrote: factorial(BigInt(21)) works On Monday, January 12, 2015 at 10:10:06 PM UTC-5, Carlos Baptista wrote: I understand that factorial(21) is quite a large number and therefore an OverflowError is perfectly understandable. However, with Octave I can go up to factorial(170) (if I go higher I receive Inf). Is there a way to go beyond factorial(20) in Julia? -- Regards, C. F. Baptista
Re: [julia-users] Facebook Open Sources Torch (Deep Learning Library)
Torch has been around in various incarnations since ~2002, and the LuaJIT version (Torch7) was released in 2011. I think the big news here is the release of a set of Facebook-originated libraries deep learning libraries: https://research.facebook.com/blog/879898285375829/fair-open-sources-deep-learning-modules-for-torch/ On Fri, Jan 16, 2015 at 2:42 PM, Kevin Squire kevin.squ...@gmail.com wrote: I haven't used it in a long while, but torch has been around for a lot longer than Julia--even the version which uses Lua--so Julia wasn't really an option for it. At any rate, Julia is slowly gaining similar functionality. Cheers! Kevin On Friday, January 16, 2015, Simon Danisch sdani...@gmail.com wrote: Thought this could be interesting to some: http://torch.ch/ Would have been cool if they had used Julia instead of LUAjit =) And OpenCL, instead of going for the Vendor lock -.- Nevertheless, it's an interesting library! Best, Simon
Re: [julia-users] ANN node-julia 1.0.0
This is super cool. I wonder if it wouldn't be possible allow Julia to operate on JavaScript typed arrays in-place? On Fri, Jan 16, 2015 at 4:20 PM, Kevin Squire kevin.squ...@gmail.com wrote: Hi Jeff, can you share a link? Cheers, Kevin On Fri, Jan 16, 2015 at 1:06 PM, Jeff Waller truth...@gmail.com wrote: So I'm happy to announce version 1.0.0 of node-julia, a Julia engine embedded in node, and io.js now too. It's been a pretty long road and I owe many people (perhaps reading this now) a lot. I've said many times (maybe not on this forum) that enabling people is the important part and I hope this tool does that. Some of the new features supported since my first update here (in Sept). * both asynchronous and synchronous processing uses libuv (inside joke) * use of Javascript typed arrays were possible * Julia composites in JavaScript as (the opaque) JRef * functionalized Scripts All those keywords are probably not that interesting, but I can share this which might be. I've done some early testing on simple matrix multiplications (will blog, but not done), and it turns out it's actually faster to copy the array from JavaScript into the Julia engine multiply and then copy the result back out than to use JavaScript directly for most matrices (maybe not 3x3). And when compared to the other popular linear algebra packages for node, Julia-within-node can be a lot faster -- sometimes 1000x faster.
Re: [julia-users] ANN node-julia 1.0.0
On Friday, January 16, 2015 at 4:26:30 PM UTC-5, Stefan Karpinski wrote: This is super cool. I wonder if it wouldn't be possible allow Julia to operate on JavaScript typed arrays in-place? Hmm, maybe! With some caveats first the good news. Here's where the Javascript array buffer is obtained https://github.com/waTeim/node-julia/blob/master/src/NativeArray.h#L59 Here's the relevant part of the copy from Javascript to C++: it's ptr to ptr https://github.com/waTeim/node-julia/blob/master/src/request.cpp#L225 And here it is again from C++ to julia a buffer handoff https://github.com/waTeim/node-julia/blob/master/src/rvalue.cpp#L175 Caveats. this is all happening in separate threads v8 has its own memory management, however, ArrayBuffers can be neutered https://github.com/joyent/node/blob/master/deps/v8/include/v8.h#L2761 node heap size is 2G, having but maybe neutering means it no longer takes part in the calculations Javascript Typed arrays are 1D only. there's implicit row-major to column major transformation going on So multidimensional stuff might be a pain, but vector transfer of ownership? yea probably.
Re: [julia-users] Question about the allotted hours of JuliaBox
Could you email the julia-box mailing list https://groups.google.com/forum/#!forum/julia-box with this question? On Fri, Jan 16, 2015 at 2:56 AM, Xiaowei Zhang xiaowei.w.zh...@gmail.com wrote: Hi all, I'm preparing a course on Monte Carlo simulation and would like try Julia as the teaching language, though the students may use any language they prefer to do their homework. JuliaBox seems a good platform given that no local installation is needed, which might intimidate some students and prevent them from leaving their comfort zone. However, I noticed that there is an item in my JuliaBox account that indicates Time remaining: x hours y minutes (out of allotted 6 hours). Does this mean that the Julia session/instance will be disconnected after 6-hours' usage? This certainly won't be a problem during my 2-hour lectures. But I'm concerned that when students work on their homework assignments/projects on JuliaBox, it'd be quite unpleasant to be disconnected while running a lengthy MC computation. Any suggestions? Thanks, Xiaowei
[julia-users] Re: Facebook Open Sources Torch (Deep Learning Library)
Yes, that's a good link! And they say they're the fastest around, so I guess it's worth looking at their code and get some inspirations from it ;) Am Freitag, 16. Januar 2015 19:27:56 UTC+1 schrieb Simon Danisch: Thought this could be interesting to some: http://torch.ch/ Would have been cool if they had used Julia instead of LUAjit =) And OpenCL, instead of going for the Vendor lock -.- Nevertheless, it's an interesting library! Best, Simon
[julia-users] Creating a type to store parameters in, and constructors with keyword arguments
Suppose I have a model which contains many parameters. I'd like to store my parameters in a type, for example type Parameters sigma::Real xi::Real eta::Real beta::Real rho::Real agrid::FloatRange end and then I need to assign some values to my parameters. The natural way I see to do this is params = Parameters(1,2,3,4,5,linrange(1,10,10)) or something like that. However, the fact that I need to remember the order in which I defined these parameters means there is some chance of error. In reality I have about 20 parameters, so defining them this way would be quite annoying. It would be nice if there was a constructor that would let me use keyword arguments, as in params = Parameters(sigma=1,xi=2,eta=3,beta=4,rho=5,agrid=linrange(1,10,10)) . I know I could write my own constructor and use keyword arguments, but then I think I'd still need to use the ordered constructor to write that one. Is there an easy way to do this? Maybe a macro that could automatically define a constructor with keyword arguments?(I don't know much about metaprogramming). Alternatively, is there is a cleaner way to store parameters that doesn't use types? --- I did find a related post here. https://groups.google.com/forum/#!searchin/julia-users/constructor$20keyword$20arguments/julia-users/xslxrihfO30/jV2awP5tbpEJ . Someone suggests that you can define a constructor like, Foo(;bar=1, baz=2) = new(bar, baz) which does what I want. Is there a way to macro that so that it's automatically defined for every field in the type?
Re: [julia-users] Execute a function with a timeout / time limit?
Have you tried using tasks with start_timer and interrupt? On Tue, Jan 13, 2015 at 7:42 AM, Robert Feldt robert.fe...@gmail.com wrote: Is there any way to run a function a maximum time without adding additional procs? I now use an implementation based on this StackOverflow answer: http://stackoverflow.com/questions/23809515/julia-can-you-set-a-time-limit-on-eval but it requires waiting to add the procs, making sure code loads on all procs etc. Is there some simpler/shorter/quicker way? Best regards, Robert Feldt
[julia-users] Re: Facebook Open Sources Torch (Deep Learning Library)
LeCun programs using Torch/Lua so it was expected. On Friday, January 16, 2015 at 1:27:56 PM UTC-5, Simon Danisch wrote: Thought this could be interesting to some: http://torch.ch/ Would have been cool if they had used Julia instead of LUAjit =) And OpenCL, instead of going for the Vendor lock -.- Nevertheless, it's an interesting library! Best, Simon