Re: [julia-users] Re: Julia idiom for something like CLOS's call-next-method

2014-07-17 Thread Stefan Karpinski
I've occasionally found cases where invoke seems to be the only non-annoying way to accomplish some dispatch, but it's remarkably rare. Still, it does seem to happen. On Wed, Jul 16, 2014 at 11:55 PM, Markus Roberts wrote: > > Thank you both...invoke(bar,(Fu,),f) has exactly the semantics I was

Re: [julia-users] Re: build-in function to find inverse of a matrix

2014-07-17 Thread Tobias Knopp
Indeed it is one of the first things one learns in numerical lectures that one has to avoid explicitely calculating an inverse matrix. Still, I think that there various small problems in geometry where I don't see an issue of invering a 2x2 or 3x3 matrix. It depends, as so often, a lot on the co

Re: [julia-users] Re: build-in function to find inverse of a matrix

2014-07-17 Thread Andreas Lobinger
Hello colleague, On Thursday, July 17, 2014 6:25:27 AM UTC+2, Stefan Karpinski wrote: > > It's a bit of numerical computing lore that inv is bad – both for > performance and for numerical accuracy. It turns out it may not be so bad > after all, but everyone

Re: [julia-users] Re: build-in function to find inverse of a matrix

2014-07-17 Thread Tomas Lycken
If the inverse of a matrix is your final result, rather than some intermediate calculation, it might still be possible to use \ (and, at least in some cases, advantageous): julia> A = rand(10,10) julia> @time inv(A) elapsed time: 0.002185216 seconds (21336 bytes allocated) julia> @time inv(A)

[julia-users] Correct (and fast) way to calculate the "inverse zip" on a list of tuples?

2014-07-17 Thread Tomas Lycken
I have an array of 2-tuples of floats, created as julia> mytuples = (Float64,Float64)[(v.x, v.y for v in vs] # slightly more complicated in actual code 136-element Array{(Float64,Float64),1}: (4.0926,-2.55505) (4.170826,-2.586752) ... Now, I’d like to split this into two arrays of floats

[julia-users] Correct (and fast) way to "inverse zip" a large collection?

2014-07-17 Thread Tomas Lycken
I have an array of 2-tuples of floats, created as ```julia julia> mytuples = (Float64,Float64)[(v.x, v.y for v in vs] # slightly more complicated in actual code 136-element Array{(Float64,Float64),1}: (4.0926,-2.55505) (4.170826,-2.586752) ... ``` Now, I'd like to split this into two arrays

[julia-users] Re: any packages for AI usage

2014-07-17 Thread Abe Schneider
In my "spare" time I've been working on a Torch7-like interface for MLPs. I remember seeing at least one other person working on a NN library (and I suspect there are likely other offerings in the works). On Wednesday, July 16, 2014 7:01:03 PM UTC-4, Alan Chan wrote: > > namely, different linear

[julia-users] Re: PSA: Julia 0.3-RC1 packages working well again

2014-07-17 Thread Ivar Nesje
You can actually start running it immediately for any package that does claim to be 0.2 compatible. If they are not compatible, they should not use any functionality that is deprecated in 0.3. The best option will probably be to run PkgEvaluator with deprecations removed (a few weeks before the

Re: [julia-users] Re: ways to improve performance of a non-integer power?

2014-07-17 Thread Job van der Zwan
On Wednesday, 16 July 2014 22:47:58 UTC+2, Stefan Karpinski wrote: > > On Wed, Jul 16, 2014 at 12:39 PM, Florian Oswald > wrote: > >> do you think this log issue may be worth a mention in the performance >> tips section of the manual? I would have never guessed that there could be >> a fast/slow

Re: [julia-users] Re: Jupyter project

2014-07-17 Thread Job van der Zwan
On Wednesday, 16 July 2014 23:25:19 UTC+2, Luke Stagner wrote: > > The is also the alchemical symbol for oil > ༜ > That can be narratively made to fit with a bit of work. Julia: removing the mental friction from technical computing!

[julia-users] Populating a DArray from file...

2014-07-17 Thread Einar Otnes
Dear experts, I need to populate a DArray by reading data from file. My computer doesn't have enough memory to store the whole array so I cannot just use distribute() to generate a DArray from an Array. Since DArray doesn't seem to have setindex! defined, I don't know how to move forward. Do I

[julia-users] Why A * zeros(..) is faster than A * ones(..)?

2014-07-17 Thread Andrei Zh
I continue investigating matrix multiplication performance. Today I found that multiplication by array of zeros(..) is several times faster than multiplication by array of ones(..) or random numbers: julia> A = rand(200, 100) ... julia> @time for i=1:1000 A * rand(100, 200) end elapsed time:

[julia-users] Re: Correct (and fast) way to calculate the "inverse zip" on a list of tuples?

2014-07-17 Thread David Gonzales
it is possible to use two indices in a comprehension: mat = [x[y] for x in mytuples,y=1:2] now mat[:,1] is your first vector, and mat[:,2] is the second. On Thursday, July 17, 2014 12:37:20 PM UTC+3, Tomas Lycken wrote: > > I have an array of 2-tuples of floats, created as > > julia> mytuples

[julia-users] Re: Why A * zeros(..) is faster than A * ones(..)?

2014-07-17 Thread Tomas Lycken
Funny... I can't reproduce this on my machine. What happens if you explicitly `gc()` between the various scenarios (i.e. time multiplication by random, call `gc()`, then time multiplication by zeros)? What happens if you time multiplication by random a few times in a row? A few zeros in a row?

[julia-users] Re: ways to improve performance of a non-integer power?

2014-07-17 Thread Simon Byrne
On Wednesday, 16 July 2014 20:39:39 UTC+1, Florian Oswald wrote: > > myexp(parameter * mylog(x) ) > > and it does make a sizeable difference. I'll try your version right now. > Keep in mind that this is going to be less accurate than using an x^y function, as you can be approximately |y*log(x)|

[julia-users] Append! resulting in #undef elements. Intended behavior?

2014-07-17 Thread Jan Strube
Hi List! I'm a particle physicist just getting started with some julia. I've been using some python in the past but now I'm trying to use analyzing some lab data as an excuse to learn Julia. So far it looks like I'm going to stick with it for a while. I've been trying to play with basic image

Re: [julia-users] Re: ways to improve performance of a non-integer power?

2014-07-17 Thread Florian Oswald
hi simon, very interesting to know indeed! I'll keep that in mind. thanks! On 17 July 2014 13:10, Simon Byrne wrote: > > On Wednesday, 16 July 2014 20:39:39 UTC+1, Florian Oswald wrote: >> >> myexp(parameter * mylog(x) ) >> >> and it does make a sizeable difference. I'll try your version right

[julia-users] Re: Correct (and fast) way to calculate the "inverse zip" on a list of tuples?

2014-07-17 Thread Tomas Lycken
That's neat! Thanks! However, it only got me *almost* there - my next step was to use these arrays as function arguments, so I want to use `...` splatting. However, `foo([x[y] for x in mytuples,y=1:2]...)` will splat the entire matrix element-wise, instead of row-wise. Is there a way to get it

[julia-users] Re: any packages for AI usage

2014-07-17 Thread Avik Sengupta
Svaksha maintains a hand curated list of Julia resources. Note that not all of them are registered in METADATA. https://github.com/svaksha/Julia.jl/blob/master/AI.md Regards - Avik On Thursday, 17 July 2014 11:59:25 UTC+1, Abe Schneider wrote: > > In my "spare" time I've been working on a Torc

[julia-users] Re: Why A * zeros(..) is faster than A * ones(..)?

2014-07-17 Thread Jutho
I don't know about the zeros, but one issue with your timings is certainly that you also measure the time to generate the random numbers, which is most probably not negligible. Op donderdag 17 juli 2014 13:54:54 UTC+2 schreef Andrei Zh: > > I continue investigating matrix multiplication performa

[julia-users] finding all roots of complex function

2014-07-17 Thread Andrei Berceanu
Hi guys, I would like to know if Julia (itself or though some existing package) can be used to find all the roots of a *complex*, 2 variable function F(x,y). Here x and y are real, so F:R -> C. Thanks, Andrei

[julia-users] Re: finding all roots of complex function

2014-07-17 Thread Andrei Berceanu
I should perhaps mention that this is part of a bigger scheme, to first find all the poles of G(x,y)/F(x,y) and then use the residue theorem for solving a complex integral of the type integral( G(x,y)/F(x,y), (x,y)) On Thursday, July 17, 2014 3:15:45 PM UTC+2, Andrei Berceanu wrote: > > Hi guy

Re: [julia-users] Re: Julia idiom for something like CLOS's call-next-method

2014-07-17 Thread Jameson Nash
There's a second pattern, similar to Keno's, that can also often help avoid needing invoke: function f(::Abstract) check_invariants(x) # does work on x end check_invariants(::Abstract) = nothing check_invariants(x::Subtype) = (x.y == 4 && error("f(x) is undefined for x.y=4")) On Thu, Jul 17,

Re: [julia-users] Append! resulting in #undef elements. Intended behavior?

2014-07-17 Thread Jacob Quinn
Hi Jan, You have your syntax a little mixed up. The usage of: Type[] actually declares an empty array with element type of `Type`. So you're first line: x = Array[] is actually creating an array of arrays. Likewise, you're seeing the error in Array[1] Because you're trying to put an Int[1]

[julia-users] Re: Correct (and fast) way to calculate the "inverse zip" on a list of tuples?

2014-07-17 Thread David Gonzales
its possible to nest comprehensions: [ [x[y] for x in mytuple] for y=1:2 ] this expression can be splatted like you suggested. On Thursday, July 17, 2014 3:53:42 PM UTC+3, Tomas Lycken wrote: > > That's neat! Thanks! > > However, it only got me *almost* there - my next step was to use these >

[julia-users] Re: Correct (and fast) way to calculate the "inverse zip" on a list of tuples?

2014-07-17 Thread Tomas Lycken
Ah, great thanks! On Thursday, July 17, 2014 3:48:39 PM UTC+2, David Gonzales wrote: > > its possible to nest comprehensions: > [ [x[y] for x in mytuple] for y=1:2 ] > this expression can be splatted like you suggested. > > On Thursday, July 17, 2014 3:53:42 PM UTC+3, Tomas Lycken wrote: >> >>

[julia-users] Re: Why A * zeros(..) is faster than A * ones(..)?

2014-07-17 Thread Tomas Lycken
@Jutho: My gut reaction was the same thing, but then I should be able to reproduce the results, right? All three invocations take about 1.2-1.5 seconds on my machine. // T On Thursday, July 17, 2014 3:06:08 PM UTC+2, Jutho wrote: > > I don't know about the zeros, but one issue with your timings

Re: [julia-users] Why A * zeros(..) is faster than A * ones(..)?

2014-07-17 Thread Jutho Haegeman
In principle, it’s also best to wrap all of this in a function, although it doesn’t seem to matter that much for this case (on my machine). I get little over 0.6 seconds for the first, and about 0.55 s for the second and third. That sounds consistent with my expectation. Note also that the stat

[julia-users] Re: Why A * zeros(..) is faster than A * ones(..)?

2014-07-17 Thread Andrei Zh
@Jutho: precomputing matrices doesn't make too much difference: julia> R = rand(100, 200 ... julia> Z = zeros(100, 200) ... julia> O = ones(100, 200) ... julia> @time for i=1:1000 A * R end elapsed time: 2.845228639 seconds (32008 bytes allocated, 8.31% gc time) julia> @time for

Re: [julia-users] Re: Why A * zeros(..) is faster than A * ones(..)?

2014-07-17 Thread Tim Holy
I get this: julia> @time for i = 1:10 A*R end elapsed time: 7.428557846 seconds (320001120 bytes allocated, 1.43% gc time) julia> @time for i = 1:10 A*Z end elapsed time: 7.233144631 seconds (320001120 bytes allocated, 1.46% gc time) No difference. Are you using a different BLAS than OpenBLAS?

Re: [julia-users] Re: Why A * zeros(..) is faster than A * ones(..)?

2014-07-17 Thread Andrei Zh
@Tim: seems like that - Base.blas_vendor() returns :unknown, while Base.libblas_name equals "libblas.so.3". Is there a way to switch to OpenBLAS? On Thursday, July 17, 2014 5:21:24 PM UTC+3, Tim Holy wrote: > > I get this: > > julia> @time for i = 1:10 A*R end > elapsed time: 7.428557846 sec

Re: [julia-users] Re: Why A * zeros(..) is faster than A * ones(..)?

2014-07-17 Thread Andrei Zh
Ok, OpenBLAS wasn't installed on this laptop, after installing Base.blas_vendor() changed. I'll repeat my tests in evening and port results. On Thursday, July 17, 2014 5:47:44 PM UTC+3, Andrei Zh wrote: > > @Tim: seems like that - Base.blas_vendor() returns :unknown, while > Base.libblas_name

[julia-users] Re: Call for Unicode julia source examples

2014-07-17 Thread Ben Arthur
thanks for the reply. i didn't not realize, and am glad to hear, that many functions have unicode equivalents in base.

Re: [julia-users] Re: Why A * zeros(..) is faster than A * ones(..)?

2014-07-17 Thread Andrei Zh
After switching to OpenBLAS results became the same for zero- and non-zero-matrices. For example, for R and Z of size (1000, 2000) results are as follows: julia> @time for i=1:10 A*R end elapsed time: 1.733125403 seconds (320001120 bytes allocated, 6.63% gc time) julia> @time for i=1:10 A*

[julia-users] Re: finding all roots of complex function

2014-07-17 Thread Steven G. Johnson
On Thursday, July 17, 2014 9:19:04 AM UTC-4, Andrei Berceanu wrote: > > I should perhaps mention that this is part of a bigger scheme, to first > find all the poles of G(x,y)/F(x,y) and then use the residue theorem for > solving a complex integral of the type > integral( G(x,y)/F(x,y), (x,y))

[julia-users] [newb] namespaces?

2014-07-17 Thread Neal Becker
One thing that surprises me, coming from a largely python background, is there seems to be little use of namespaces in julia. For example, it seems that everything in the standard library is just part of one global namespace. If true, this does seem to go against trends in modern design, I beli

Re: [julia-users] Re: Capture the output of Julia's console

2014-07-17 Thread Steven G. Johnson
As I understand it, the REPL makes a private copy of the output-stream descriptors early on, which is why you can't redirect them.This is actually quite useful behavior, because otherwise it would be impossible to debug code using redirect_stdout etc. in the REPL (because the REPL would sto

Re: [julia-users] Re: Capture the output of Julia's console

2014-07-17 Thread Steven G. Johnson
On Wednesday, July 16, 2014 11:17:32 PM UTC-4, Laszlo Hars wrote: > > > the STDERR behavior was intentional > 1) It just does not seem to be logical: warning messages still get written > to STDERR. Why? And what is the use of STDERR, in general? STDERR is in the > documentation, without telling a

Re: [julia-users] [newb] namespaces?

2014-07-17 Thread Leah Hanson
Packages are each in their own module, which are namespaces. Because generic functions "own" all their scattered methods, there is less of a need to hide functions with the same name inside different namespaces in Julia. Could you be more specific about what you're concerned could happen? (for ex

Re: [julia-users] Re: Capture the output of Julia's console

2014-07-17 Thread Laszlo Hars
> you wouldn't necessarily expect to see documentation of the REPL's low-level terminal-communication internals I understand. However, as we learn the language we use the REPL. It is the first thing we see of Julia. A clear distinction in the documentation would be really helpful telling what of

[julia-users] Re: ANN: GraphLayout.jl

2014-07-17 Thread Iain Dunning
Version 0.2 now has arrows and IJulia inline output! On Friday, July 4, 2014 3:54:33 PM UTC-4, Iain Dunning wrote: > > Like I said, pure Julia, but otherwise pretty basic. It is the "fdp" > "filter" from GraphViz. > > On Friday, July 4, 2014 3:42:50 PM UTC-4, Tony Fong wrote: >> >> How is it comp

[julia-users] Re: [newb] namespaces?

2014-07-17 Thread Iain Dunning
With multiple dispatch, this matters a lot less. Modules pick up the rest of the slack for when it does matter though. On Thursday, July 17, 2014 2:14:14 PM UTC-4, Neal Becker wrote: > > One thing that surprises me, coming from a largely python background, is > there > seems to be little use of

Re: [julia-users] Append! resulting in #undef elements. Intended behavior?

2014-07-17 Thread Simon Kornblith
The fact that append! grows the array on failure seems like a bug nonetheless. If convert throws it seems preferable to leave the array as is. I'll file an issue. Simon On Thursday, July 17, 2014 9:34:21 AM UTC-4, Jacob Quinn wrote: > > Hi Jan, > > You have your syntax a little mixed up. The us

[julia-users] question about doc

2014-07-17 Thread Comer Duncan
I just looked at the docs in the section on Performance Tips. There is an example: norm(A::Vector) = sqrt(real(dot(x,x)))norm(A::Matrix) = max(svd(A)[2]) It would seem that the first case is a typo. I would have thought that it should read norm(A::Vector) = sqrt(real(dot(A,A))) Is this true?

Re: [julia-users] Re: Capture the output of Julia's console

2014-07-17 Thread Laszlo Hars
> We explained to you several times how to capture multi-line input. You missed my points again. This was not the issue in this thread. Still, if you look at the code snippets I posted here, you can see that I knew how to handle multi-line input. I did not need your "friendly" reminder or explan

[julia-users] Waiting on multiple subprocesses to finish?

2014-07-17 Thread Elliot Saba
I was reading the docs , and it seems to me that it's saying I can use tasks to run multiple subprocesses at once. E.g., if I have some long-running subprocesses such as `sleep 10`, I should be able to wrap each in a Tas

Re: [julia-users] Waiting on multiple subprocesses to finish?

2014-07-17 Thread Tim Holy
Check out the implementation of multi.jl:pmap (the part in the @sync and @async blocks), it's a great example. --Tim On Thursday, July 17, 2014 04:23:48 PM Elliot Saba wrote: > I was reading the docs > s>, and it seem

[julia-users] Re: question about doc

2014-07-17 Thread Steven G. Johnson
It's a typo, thanks. Should be fixed now.

Re: [julia-users] Waiting on multiple subprocesses to finish?

2014-07-17 Thread Kevin Squire
Note that the tasks all run in the same thread, so if any of the tasks (or the main process) have a long running computation which does not yield, the other processes won't run. I believe that `sleep 10` falls in this category, although I'm not 100% certain. Cheers, Kevin On Thu, Jul 17, 201

[julia-users] Re: any packages for AI usage

2014-07-17 Thread Alan Chan
Great. Very useful. Thanks. On Thursday, July 17, 2014 9:01:20 AM UTC-4, Avik Sengupta wrote: > > Svaksha maintains a hand curated list of Julia resources. Note that not > all of them are registered in METADATA. > > https://github.com/svaksha/Julia.jl/blob/master/AI.md > > Regards > - > Avik > >

Re: [julia-users] Append! resulting in #undef elements. Intended behavior?

2014-07-17 Thread Ivar Nesje
https://github.com/JuliaLang/julia/issues/7642

[julia-users] Populating a DArray from file...

2014-07-17 Thread Ivar Nesje
Bigger than memory smells of mmap_array http://docs.julialang.org/en/latest/stdlib/base/#Base.mmap_array

Re: [julia-users] Waiting on multiple subprocesses to finish?

2014-07-17 Thread Elliot Saba
Thanks, I'll take a look, although I have the gut feeling that these functions are targeted toward multiple processes. -E On Thu, Jul 17, 2014 at 4:49 PM, Tim Holy wrote: > Check out the implementation of multi.jl:pmap (the part in the @sync and > @async blocks), it's a great example. > > --Tim

Re: [julia-users] Waiting on multiple subprocesses to finish?

2014-07-17 Thread Elliot Saba
I'm trying to run shell commands in parallel. Shouldn't waiting for a process to finish just call wait() which then invokes the scheduler? Or did I misread the above linked paragraph completely wrong? Specifically, I'm talking about the sections that say: The basic function for waiting for an e

Re: [julia-users] Append! resulting in #undef elements. Intended behavior?

2014-07-17 Thread Jan Strube
Thank you for reporting the issue. I wasn't sure, but I thought I'd mention this as long as it's still a RC. Jan On Friday, July 18, 2014 4:55:36 AM UTC+9, Simon Kornblith wrote: > > The fact that append! grows the array on failure seems like a bug > nonetheless. If convert throws it seems pref

Re: [julia-users] Waiting on multiple subprocesses to finish?

2014-07-17 Thread Jameson Nash
you can also call `spawn` (or `open`) rather than `run` to run a process asynchronously in the current task (it returns a process handle rather than a return value): function run(cmds::AbstractCmd, args...) ps = spawn(cmds, spawn_opts_inherit(args...)...) success(ps) ? nothing : pipelin

Re: [julia-users] Waiting on multiple subprocesses to finish?

2014-07-17 Thread Elliot Saba
Great! That answers it, Jameson. Thanks! On Thu, Jul 17, 2014 at 8:48 PM, Jameson Nash wrote: > you can also call `spawn` (or `open`) rather than `run` to run a process > asynchronously in the current task (it returns a process handle rather than > a return value): > > > function run(cmds::Ab