Re: [julia-users] Accuracy of timing macros

2014-06-04 Thread gael . mcdon
In recent tests, the best distribution estimator was a geometric mean because the elapsed-time distribution was log-normal. If each iteration is not too short (to avoid timing inaccuracies) and not too long (to avoid spending a day benchmarking), you'd better get each elapsed-time individually

[julia-users] Re: exponential integral

2014-06-04 Thread Hans W Borchers
Well, if only double precision is requested, you can compute E1 (or Ei) for real x in, say, 20 lines of julia code, using a combined approach of series expansion and continued fractions -- see Abramowitz and Stegun, Chapter 5. The other one, Ei or E1, is then given by the equation above. I

Re: [julia-users] Referencing function scope variables from @async blocks

2014-06-04 Thread Menyoung Lee
It seems to localize single variables but not arrays. I could even implement an async that I could interrupt by updating values in a global array. I actually don't know of any sane way to do this, i.e., interrupt a task or an async bloc from the main thread? global x = zeros(1) @async begin

[julia-users] Merging array of expr's into one expr?

2014-06-04 Thread Robert Feldt
In a macro I need to first define a large number of functions and then merge them into one block and return that as the code from the macro. Is there a simpler/smarter way than what I currently do, which is based on explicitly adding using Base.Test # We want to find a way to merge the

[julia-users] package proposal

2014-06-04 Thread Andrei Berceanu
I do now know how many of you are familiar with the PHCpack ( http://homepages.math.uic.edu/~jan/phcpack_doc_html/index.html) code for solving (very large) polynomial systems without the need for initial guessing, by using homotopy continuation methods. They have a github repository as well at

Re: [julia-users] Accuracy of timing macros

2014-06-04 Thread Andreas Lobinger
Hello colleague, On Wednesday, June 4, 2014 4:36:12 AM UTC+2, John Myles White wrote: I’m not sure there’s any single correct way to do benchmarks without information about what you’re trying to optimize. If you’re trying to optimize the experience of people using your code, I think it’s

[julia-users] How to create a copy of a function but with less arguments?

2014-06-04 Thread joanenric barcelo
First of all, sorry if the question in the title is not well explained. Basically, what I want to know if some of you guys know a nicer way to do the following: function f2(a, b, c) return a+b+c end f = function f1(a,b) f2(3,a,b) end so f(1,1) is 5 What I want to do is to create a new

[julia-users] Re: How to create a copy of a function but with less arguments?

2014-06-04 Thread Tomas Lycken
I don't think you can avoid f1 completely, but there is a one-line syntax to obtain the same thing: f1(a,b) = f2(3,a,b) I can't imagine a syntax to express that thing that is more compact yet equally expressive. // T On Wednesday, June 4, 2014 12:37:47 PM UTC+2, joanenric barcelo wrote:

[julia-users] How to read and change the content of web pages to the vector ?

2014-06-04 Thread paul analyst
How to read and change the content of web pages to the vector [word1, word2, word3, wordlast]? Paul

Re: [julia-users] Re: How to create a copy of a function but with less arguments?

2014-06-04 Thread Mauro
You can also make an anonymous function and assign it to a variable: ff = (x,y) - f2(3,x,y) But Thomas' suggestion is nicer: f(a,b) = f2(3,a,b) The anonymous function approach is shorter if you need to pass it to a function, e.g.: map(x - f2(3,4,x), 1:5) But I think they have not the same

[julia-users] Re: Strange macro behavior?

2014-06-04 Thread Abe Schneider
Here's a simple example of what I'm observing: testmodule.jl module testmodule export @wrapexpr # if I put foo here, everything works # foo(x, y) = x*y macro wrapexpr(expr) quote (x, y) - $(expr) end end end and testscript.jl: using testmodule foo(x, y) = x*y fn1 = @wrapexpr x+y

[julia-users] Re: How to create a copy of a function but with less arguments?

2014-06-04 Thread joanenric barcelo
Thanks for the one-line expression. Hence, if I want to assign this new function to the existing variable f using one line, I can do f = f1(a,b) = f2(3, a, b) It will work for me! Joan El miércoles, 4 de junio de 2014 11:39:40 UTC+1, Tomas Lycken escribió: I don't think you can avoid f1

Re: [julia-users] Merging array of expr's into one expr?

2014-06-04 Thread Mauro
This works: parse(reduce(*, map(string, ex_funcs))) as was suggested in this thread for symbols: https://groups.google.com/d/msg/julia-dev/KJNOrV45sZo/zE2_fVzQrS4J Still seems a bit ugly. Any better ways? On Wed, 2014-06-04 at 08:58, robert.fe...@gmail.com wrote: In a macro I need to first

[julia-users] Re: package proposal

2014-06-04 Thread Hans W Borchers
As I once thought about writing an R package rPHCpack, I would be *very* interested in having access to PHCpack in Julia. What I did not understand: (1) do you suggest someone else writes such a package, (2) is this a kind of poll for such a package, (3) are you going to code such a wrapper

Re: [julia-users] Merging array of expr's into one expr?

2014-06-04 Thread Ivar Nesje
@mauro I think there is a single function that combines map and reduce http://docs.julialang.org/en/release-0.2/stdlib/base/#Base.mapreduce. Also it seems like parse(string(ex_funcs...)) would do the same job. What about instead enclosing them in a block expression? I'm not sure

[julia-users] How to calculate all Euclidean distances between two sets of points in a 3-dimensional space

2014-06-04 Thread Carlos Baptista
Let's say I have two sets of points in a 3-dimensional space represented by arrays of sizes Nx3 and Mx3. What is the most efficient way to calculate the distances between all points of set 1 against all points of set 2? This is a (not so efficient example) of what I want to accomplish:

[julia-users] Keeping allocated memory when shrinking an array?

2014-06-04 Thread Magnus Lie Hetland
I have an array that will typically grow and shrink quite a bit – but I'd rather not have stuff move around or perform any costly memory operations because of this. My current solution is to simply store the current size as a Uint, and then manually check whether I can append to it by simply

Re: [julia-users] Re: How to create a copy of a function but with less arguments?

2014-06-04 Thread Jacob Quinn
It's still an open issue: https://github.com/JuliaLang/julia/issues/1864, though there have been talks on how to improve. -Jacob On Wed, Jun 4, 2014 at 8:10 AM, Mauro mauro...@runbox.com wrote: Is that a fact? That would be sad, since it would mean that a functional style suffers a

Re: [julia-users] How to calculate all Euclidean distances between two sets of points in a 3-dimensional space

2014-06-04 Thread Carlos Baptista
Yes I have seen it. I tried something with the function pairwise, but I did not really get what I want. If I have two sets of sizes N and M respectively, I expect as return value a matrix of size NxM. What I got out of pairwise is smaller than that.

Re: [julia-users] How to calculate all Euclidean distances between two sets of points in a 3-dimensional space

2014-06-04 Thread Dahua Lin
See the document here: https://github.com/JuliaStats/Distance.jl#computing-pairwise-distances On Wednesday, June 4, 2014 8:15:51 AM UTC-5, Dahua Lin wrote: The Distance package assumes that *each column is a point*. Since Julia uses column-major layout for arrays, using column-major ways

[julia-users] Re: package proposal

2014-06-04 Thread Andrei Berceanu
It is basically a call for collaborators on such a package. I am willing to contribute although I am quite new to Julia. On Wednesday, June 4, 2014 1:28:55 PM UTC+2, Hans W Borchers wrote: As I once thought about writing an R package rPHCpack, I would be *very* interested in having access

Re: [julia-users] Function like argument type specifiers for variables?

2014-06-04 Thread Andrew Simper
Thankyou very much for pointing that out, it was not obvious to me what was going on! I would have expected if I just wrote int64(4) as the last line would return that value, but if an assignment was deliberately done by the coder I expected it would be honoured and then the left hand side

Re: [julia-users] Keeping allocated memory when shrinking an array?

2014-06-04 Thread Magnus Lie Hetland
On Wednesday, June 4, 2014 2:55:26 PM UTC+2, Ivar Nesje wrote: I think push!() is faster because the other option is accessing an array that contains `#undef` values (Julia speak for a NULL pointer) and this is slower than accessing a regular array that does not contain #undef. See:

Re: [julia-users] How to create a copy of a function but with less arguments?

2014-06-04 Thread gael . mcdon
*Arrays* function f1(a, b, c) return (a.^2)*sum(a).*c.+exp(-b) end function f2(a, b, c=3) return (a.^2).*sum(a).*c.+exp(-b) end f3(a, b) = f1(a, b, 3) f4 = (a, b) - f1(a, b, 3) a = rand(1000); b = rand(1000); julia @time for i=1:1 f1(a, b, 3) end elapsed time: 0.813792743 seconds

Re: [julia-users] How to create a copy of a function but with less arguments?

2014-06-04 Thread Ethan Anderes
Extending on what Miguel suggested, for a small number of optional arguments I tend to prefer the following equivalent way which shows off the multiple dispatch: f1(a, b, c) = a + b + c f1(a,b) = f1(a, b, 3) On Wednesday, June 4, 2014 5:51:16 AM UTC-7, Miguel Bazdresch wrote: You can also

[julia-users] Re: package proposal

2014-06-04 Thread Tony Kelman
Sounds interesting, I'd certainly play with it. This is probably the first piece of code I've seen in public that's written in Ada though - having never built an Ada library before, getting it set up to easily install through Julia's package manager sounds like it would be the hardest part.

Re: [julia-users] Keeping allocated memory when shrinking an array?

2014-06-04 Thread Isaiah Norton
You can take a pointer to an array and reinterpret it as a smaller array, which sounds like (sort of) what you want. https://gist.github.com/anonymous/e8042c8bffe49c3aa886 (whether this is more performant and/or a good idea is left as an exercise :) On Wed, Jun 4, 2014 at 10:22 AM, Magnus Lie

[julia-users] @parallel for not using all julia processes?

2014-06-04 Thread Jutho
Dear Julia users, I am trying to use Julia's parallel capabilities to do a simple parameter sweep. I am probably doing something wrong, but top seems to indicate that half om my julia processes are doing nothing at all: This is my workflow (not very pro, but it suits my case for now) I start

[julia-users] Re: @parallel for not using all julia processes?

2014-06-04 Thread Jutho
I probably already have an idea what's going on. How are the different tasks distributed over the different Julia processes? Is the for loop immediately cut into pieces where e.g. process 1 will handle the cases iter=1:10, process 2 handles the cases iter=11:20 and so on? For different values

[julia-users] Optim.jl feature request: user-supplied initial inverse hessian

2014-06-04 Thread Thomas Covert
When calling for a BFGS or L-BFGS optimization in Optim.jl, the initial inverse hessian is set to the identity matrix. I am running into some trouble with this design decision, as my objective function is numerically unstable at the first function evaluation point x0 - (I \ g0), where x0 is

Re: [julia-users] Optim.jl feature request: user-supplied initial inverse hessian

2014-06-04 Thread John Myles White
Exposing the option to control the initial approximate Hessian would be a good idea. If you don’t mind, I’d encourage you to put a little time into learning GitHub since it will make it a lot easier in the future for you to help fix problems you’re running into. Fixing our line search routine

[julia-users] Re: Strange macro behavior?

2014-06-04 Thread David Moon
I have a pending pull request #6910 to fix macros to behave as you expect, but until that gets integrated you will need to use the esc function in your macro to tell the macro system that x, y, and expr are in the macro caller's context, not the macro definition's context. There is no

Re: [julia-users] Optim.jl feature request: user-supplied initial inverse hessian

2014-06-04 Thread Dahua Lin
I open a Github issue here: https://github.com/JuliaOpt/Optim.jl/issues/59 Dahua On Wednesday, June 4, 2014 10:43:56 AM UTC-5, John Myles White wrote: Exposing the option to control the initial approximate Hessian would be a good idea. If you don’t mind, I’d encourage you to put a little

[julia-users] Building Julia on Blue Gene/Q

2014-06-04 Thread Justin Wozniak
Hi all I am trying to call Julia from the Swift language (https://sites.google.com/site/exmcomputing/swift-t) and run it on large computers like the Blue Gene/Q. (This technique currently allows us to run Python, R, and Tcl on many cores.) I have been able to get the basic embedded Julia

Re: [julia-users] How to create a copy of a function but with less arguments?

2014-06-04 Thread John Myles White
Now that we have optional positional arguments, this can be done more tersely as: f1(a, b, c = 3) = a + b + c On Jun 4, 2014, at 7:34 AM, Ethan Anderes ethanande...@gmail.com wrote: Extending on what Miguel suggested, for a small number of optional arguments I tend to prefer the following

Re: [julia-users] Accuracy of timing macros

2014-06-04 Thread Joshua Job
I want a theoretically pure measurement for an algorithm. I'm not sure how I would go about counting CPU instructions, however, since the algorithm is only a heuristic one and my only guide for how long it takes on a given set of instances is to run it and see how long it took. Is there some

Re: [julia-users] Building Julia on Blue Gene/Q

2014-06-04 Thread Keno Fischer
Power PC shouldn't be a problem. The real problem on BG/Q is that you can't allocate extra executable memory after the program has started (or so I've been told). When I last talked about this with Hal Finkel (he works on BG/Q support for LLVM), he thought that it ought to be possible to just

Re: [julia-users] domain specific high-level optimization

2014-06-04 Thread Kevin Squire
On Tuesday, June 3, 2014, Stefan Karpinski stefan.karpin...@gmail.com wrote: Shouldn't be hard though. For a few terms (which should be the most common use case), this is true. I'm curious what's possible now when the number of terms grows. Early in grad school, I vaguely remember this

Re: [julia-users] How to read and change the content of web pages to the vector ?

2014-06-04 Thread Paul Analyst
Any help ? How to read and change the content of web pages to the vector [word1, word2, word3, wordlast]? W dniu 2014-06-04 12:47, paul analyst pisze: How to read and change the content of web pages to the vector [word1, word2, word3, wordlast]? Paul

Re: [julia-users] How to read and change the content of web pages to the vector ?

2014-06-04 Thread John Myles White
I don't really understand what you mean by web page. -- John On Jun 4, 2014, at 9:20 AM, Paul Analyst paul.anal...@mail.com wrote: Any help ? How to read and change the content of web pages to the vector [word1, word2, word3, wordlast]? W dniu 2014-06-04 12:47, paul analyst

Re: [julia-users] Accuracy of timing macros

2014-06-04 Thread Stefan Karpinski
On Wed, Jun 4, 2014 at 5:29 AM, Andreas Lobinger lobing...@gmail.com wrote: Especially i like Stefan's idea not to exclude the gc. https://github.com/JuliaLang/julia/issues/7119 – make it easier to know how much time is spent on GC out of total execution time.

Re: [julia-users] Function like argument type specifiers for variables?

2014-06-04 Thread Stefan Karpinski
The reason that assignments return the unconverted value of their right hand side is so that assignment chains behave as expected instead of the assignments to the right subtly and surprisingly affecting assignments to the left. Otherwise you would have unfortunate effects like this: function

Re: [julia-users] Optim.jl feature request: user-supplied initial inverse hessian

2014-06-04 Thread Thomas Covert
Thanks for the encouragement. Is there a good Julia-specific reference for how to do this? So far I have: 1) Set up a GitHub account 2) clicked the fork button on the Optim.jl page and cloned it to my machine (right now it lives in ~/github/Optimize.jl/ on my machine) 3) made my changes to my

[julia-users] Generate a block diagonal sparse matrix?

2014-06-04 Thread Douglas Bates
Is there a function in Base to generate a sparse block-diagonal matrix from the diagonal blocks which themselves are stored as SparseMatrixCSC objects? I thought I should ask before reinventing the wheel.

Re: [julia-users] Optim.jl feature request: user-supplied initial inverse hessian

2014-06-04 Thread David Einstein
I have found it most convenient to make a branch on the code in .julia and work from there, then everything will work as if it were the normal package. The package in the .julia directory is just a clone of the project on GitHub. This is probably morally wrong somehow, but it is convenient.

[julia-users] Re: exponential integral

2014-06-04 Thread Steven G. Johnson
On Wednesday, June 4, 2014 2:54:22 AM UTC-4, Hans W Borchers wrote: Well, if only double precision is requested, you can compute E1 (or Ei) for real x in, say, 20 lines of julia code, using a combined approach of series expansion and continued fractions -- see Abramowitz and Stegun,

Re: [julia-users] Optim.jl feature request: user-supplied initial inverse hessian

2014-06-04 Thread Matt Bauman
On Wednesday, June 4, 2014 2:45:25 PM UTC-4, David Einstein wrote: I have found it most convenient to make a branch on the code in .julia and work from there, then everything will work as if it were the normal package. The package in the .julia directory is just a clone of the project on

[julia-users] Rounding and the IEEE rule

2014-06-04 Thread Hans W Borchers
Many programming languages and scientific computing systems follow the round half to even tie-breaking rule; this is also the default rounding mode in the IEEE standard for floating-point arithmetic (IEEE 754). So in R or Python (with NumPy), but not in, e.g., MATLAB) we have round(0.5)

Re: [julia-users] Optim/DualNumbers question (maybe a math question?)

2014-06-04 Thread Miles Lubin
Any idea why type inference is failing on full(chol(A, :U)) ? It can't be determined from the types of the arguments what the result will be, because you could give different symbols to access different parts of the factorization. I think this was a design choice to make it easier to

Re: [julia-users] Rounding and the IEEE rule

2014-06-04 Thread Stefan Karpinski
We follow C, Fortran, Matlab, Python and most other programming languages here. R and NumPy's rule is pretty unusual; it has some nice statistical properties (it's apparently known as statistician's rounding), but is quite awkward for general programming tasks.

Re: [julia-users] Rounding and the IEEE rule

2014-06-04 Thread John Myles White
One question: I have the impression that the round() function is not affected by the currently chosen rounding rule in Julia. Is that right? -- John On Jun 4, 2014, at 2:48 PM, Stefan Karpinski ste...@karpinski.org wrote: We follow C, Fortran, Matlab, Python and most other programming

Re: [julia-users] Rounding and the IEEE rule

2014-06-04 Thread Stefan Karpinski
This isn't really related to IEEE rounding modes. Floating-point rounding modes are about choosing which of the closest representable floating-point values an operation should produce when the true value is between them. The round function is a well-defined mathematical function regardless of IEEE

[julia-users] Re: Strange macro behavior?

2014-06-04 Thread Abe Schneider
I should add, I suspect that 'esc' can only be used in a quote block, so I tried this instead: macro wrapexpr(expr) quote ($(esc(x)), $(esc(y))) - $(esc(expr)) end end But get: ERROR: x not defined On Wednesday, June 4, 2014 11:44:43 AM UTC-4, David Moon wrote: I have a pending

[julia-users] Re: GSOC 3D Visualizations plotting API - Make a wish!

2014-06-04 Thread Simon Danisch
Sorry for the long silence! The things you posted were really inspiring, and I'm trying to incorporate what I can! I actually started coding and I'm posting the updates on my blog: http://randomphantasies.wordpress.com/ Please feel free to comment the progress on Github, the Blog, or here ;)

[julia-users] Re: Vague BoundsError()

2014-06-04 Thread Bill McLean
Developing in Julia, I find I am missing the nice diagnostics that gfortran provides with -fcheck=bounds, that is, the name of the array and which index is out of bounds (for multidimensional arrays). All I am getting from Julia is the line number of the beginning of the for-loop that

Re: [julia-users] Rounding and the IEEE rule

2014-06-04 Thread Kevin Squire
Couldn't this be provided by the get_rounding/set_rounding/with_rounding framework? On Wed, Jun 4, 2014 at 2:59 PM, Stefan Karpinski ste...@karpinski.org wrote: This isn't really related to IEEE rounding modes. Floating-point rounding modes are about choosing which of the closest

Re: [julia-users] Rounding and the IEEE rule

2014-06-04 Thread Stefan Karpinski
It could, but it shouldn't. The rounding mode and how you round to integers are completely different matters. On Wed, Jun 4, 2014 at 8:16 PM, Kevin Squire kevin.squ...@gmail.com wrote: Couldn't this be provided by the get_rounding/set_rounding/with_rounding framework? On Wed, Jun 4, 2014

[julia-users] Inspecting JLD files

2014-06-04 Thread Samuel Colvin
I'm sure this has been asked before, but I can't find an answer. Given a .jld files, how do I inspect it to list the variables it contains? Right now I'm resorting to before=Set(names(Main)) @load data.jld after = Set(names(Main)) varnames = collect(setdiff(after,before)) That works but is

[julia-users] Variable values into a table (postgres)

2014-06-04 Thread Douglas Teixeira Goncalves
Hi guys, I've tried to insert some values into a table (postgres) I was successful when I put: query(INSERT INTO sum_access(contact_id,sum_reg) VALUES ('1','10')) But, when I replace the integer values for variables like: value = 10 sum = 15 query(INSERT INTO

[julia-users] Re: Strange macro behavior?

2014-06-04 Thread Abe Schneider
I got it to work with: macro wrapexpr(expr) x = :x y = :y quote $(esc(quote ($x, $y) - $expr end)) end end I think the problem before was that the entire anonymous function has to be escaped. I also don't claim to understand hygiene well enough to really understand what that means.

Re: [julia-users] Re: PEG Parser

2014-06-04 Thread Abe Schneider
I'll try to get around to comparing against the DataFrames version and profiling this week. I got stuck trying to figure out the action semantics. On Tuesday, May 27, 2014 6:58:42 PM UTC-4, John Myles White wrote: I'd be really interested to see how this parser compares with DataFrames.

Re: [julia-users] Inspecting JLD files

2014-06-04 Thread Tim Holy
https://github.com/timholy/HDF5.jl/blob/master/doc/hdf5.md#getting-information The things that work for plain HDF5 files should also work for JLD. If not, it should be viewed as a bug (barring things I'm not thinking of ATM). --Tim On Wednesday, June 04, 2014 05:56:23 PM Samuel Colvin wrote:

[julia-users] Is there a julia package manager/ full (stable) release available?

2014-06-04 Thread yi lu
Hi all, It seems there are a lot of packages out there, and most package are hosted on github. The only way I know to install a package is Pkg.add(some package). So it seems inconvenient to use a package, say PyPlot, because I have to download and install it first every new package uninstalled.

Re: [julia-users] @parallel for not using all julia processes?

2014-06-04 Thread Amit Murthy
https://github.com/amitmurthy/MessageUtils.jl could be useful for your own task distribution. On Wed, Jun 4, 2014 at 9:39 PM, Kevin Squire kevin.squ...@gmail.com wrote: It is the case currently that the array itself is divided up evenly. One way to deal with this (in the back end) is work

Re: [julia-users] Variable values into a table (postgres)

2014-06-04 Thread Douglas Teixeira Goncalves
Thanks Kevin! and if I want to insert values from an Array? For example: out_table = Array(Int64,5) sum = 0 for i in 1:5 out_table[i] = 0 sum+=1 query(INSERT INTO test(id,sum) VALUES ('$value[i]','$sum')) end I have this message:

Re: [julia-users] Variable values into a table (postgres)

2014-06-04 Thread Douglas Teixeira Goncalves
Thanks Kevin! and if I want to insert values from an Array? out_table = Array(Int64,5) sum = 0 for i in 1:5 out_table[i] = 0 sum+=1 query(INSERT INTO test(id,soma) VALUES ('$out_table[i]','$sum')) end I got this message: [ODBC] 22P02: ERROR: invalid input syntax for integer:

Re: [julia-users] Variable values into a table (postgres)

2014-06-04 Thread Douglas Teixeira Goncalves
It worked with: out_table = Array(Int64,5) sum = 0 value = 0 for i in 1:5 out_table[i] = 0 sum+=1 value = out_table[i] query(INSERT INTO test(id,soma) VALUES ('$value','$sum')) end Thanks! On Wednesday, June 4, 2014 9:11:11 PM UTC-7, Douglas

Re: [julia-users] How to read and change the content of web pages to the vector ?

2014-06-04 Thread John Myles White
I'm still lost. Do you want to print out the text for an HTML table to STDOUT? -- John On Jun 4, 2014, at 9:33 AM, Kevin Squire kevin.squ...@gmail.com wrote: I would think web page = HTML document. On Wednesday, June 4, 2014, John Myles White johnmyleswh...@gmail.com wrote: I don't

[julia-users] Re: Generate a block diagonal sparse matrix?

2014-06-04 Thread Tony Kelman
I added blkdiag() for sparse matrices a few months back (was the first thing I did when I started using Julia). Let me know if it doesn't do what you're looking for. On Wednesday, June 4, 2014 11:33:16 AM UTC-7, Douglas Bates wrote: Is there a function in Base to generate a sparse

[julia-users] Is there a julia package manager/ full (stable) release available?

2014-06-04 Thread Ivar Nesje
There are definitely plans to create more complete distributions that include the most commonly used 3. party packages. Currently we don't do that, because it requires some changes to the distribution system, and nobody has done that (yet). We would also need to make a decision about what to