[julia-users] Re: Wavelets.

2014-08-02 Thread Tobias Knopp
I have some very simple Matlab code laying around that I have written 
myself. It is capable of doing 1D, 2D but potentially any dimension. The 
wavelet is given as a parameter and there are some defaults. I needed it as 
a sparsity transformation for some compressed sensing work I have done.

So nothing fancy but if you think this would be useful I could create a 
package. Even better it would be of course to get some real wavelet expert 
to make a full featured package.

There was some package announced on the mailing list but it was GPL, which 
is not ok for my use case.

Cheers,

Tobi

Am Samstag, 2. August 2014 07:53:19 UTC+2 schrieb David A.:
>
> Regarding the actual wavelets package license, I just wanted to suggest 
> the PyWavelets package which is done in C and seems very complete. It has a 
> MIT license:
> http://www.pybytes.com/pywavelets/
>
> Is it already possible in Julia to make a 2D decomposition / 
> reconstruction, to decompose images?
>
>
>

[julia-users] Re: Wavelets.

2014-08-02 Thread Tomas Krehlik
There are two packages and some general package is discussed in here 
. The 
authors have also their own packages. I think the gummif's one does what 
you would like. Disclaimer: I am one of them...

Best.

On Saturday, 2 August 2014 07:53:19 UTC+2, David A. wrote:
>
> Regarding the actual wavelets package license, I just wanted to suggest 
> the PyWavelets package which is done in C and seems very complete. It has a 
> MIT license:
> http://www.pybytes.com/pywavelets/
>
> Is it already possible in Julia to make a 2D decomposition / 
> reconstruction, to decompose images?
>
>
>

[julia-users] Re: Wavelets.

2014-08-02 Thread Tobias Knopp
Thanks for the link https://github.com/gummif/Wavelets.jl looks very good 
and is MIT licensed.

Am Samstag, 2. August 2014 10:30:52 UTC+2 schrieb Tomas Krehlik:
>
> There are two packages and some general package is discussed in here 
> . The 
> authors have also their own packages. I think the gummif's one does what 
> you would like. Disclaimer: I am one of them...
>
> Best.
>
> On Saturday, 2 August 2014 07:53:19 UTC+2, David A. wrote:
>>
>> Regarding the actual wavelets package license, I just wanted to suggest 
>> the PyWavelets package which is done in C and seems very complete. It has a 
>> MIT license:
>> http://www.pybytes.com/pywavelets/
>>
>> Is it already possible in Julia to make a 2D decomposition / 
>> reconstruction, to decompose images?
>>
>>
>>

[julia-users] Re: Run Julia job on several workers on a cluster

2014-08-02 Thread Florian Oswald
Hi Ken,

sorry can i just ask you a question on this? Thibaut (post below) was 
actually able to use your function to set Julia up on our departmental SGE 
cluster and it works fine. That facility is down with a disk failure for 
the time being though, so I have been trying to get going on a different 
PBS cluster. I can do interactive on one node, but I am stuck going across 
nodes. 
I'm not sure I understand what you mean when you say "convert to IB 
interface names". The names on my PBS_NODEFILE are the same for each node, 
i.e. all CPUs on node 1 are called node 1. 

I wrote this up in more detail in this SO 
post. 
http://stackoverflow.com/questions/25089733/julia-on-pbs-cluster-what-to-give-to-addprocs

It ends up throwing an SSH error. Do you have any clue what might be going 
wrong here? Thanks!

Florian

On Wednesday, 7 May 2014 20:52:17 UTC+1, ken...@sdsc.edu wrote:
>
>
> I've run parallel julia on a Torque cluster with Infiniband.  I start an 
> interactive session with qsub -I,
> look for allocated nodes in $PBS_NODEFILE, convert to IB interface names, 
> and addprocs.
>
> filestream = open(ENV["PBS_NODEFILE"])
> seekstart(filestream)
> linearray = readlines(filestream)
> strippedarray = similar(linearray)
> for i in 1:length(linearray)
> strippedarray[i] = strip(linearray[i]) * "-ipoib.ipoib"
> end
> for i in 1:length(strippedarray)
>  singlearray = [strip(strippedarray[i])]
>  addprocs(singlearray)
> end
> print(workers())
>
> To start an interactive job, depending on your node configuration and 
> queue names:
> qsub -I -l nodes=2:ppn=32,walltime=00:30:00 -q normal
>
> When you get your nodes, start julia with the above setup file with:
> julia --load setupfilename
>
> This should addprocs then give you the julia prompt.
>
> But it looks like something is wrong with your modules?
>
> On Friday, April 25, 2014 5:09:57 AM UTC-7, Isaac wrote:
>>
>> Hi All,
>>  
>>  I also tried to submit the julia jobs on the cluster but failed. I wrote 
>> the job script as follows:
>> f
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *or((i = 1; i < 10; i++))doecho "# cd /data#PBS -l 
>> walltime=00:10:00module add gcc/4.7.2module add julia/0.2.0module load 
>> juliainclude("test.jl")test($i)">test1job$i;qsub test1job$i;done*
>> I got the errors: 
>> julia/0.2.0(16):ERROR:151: Module 'julia/0.2.0' depends on one of the 
>> module(s) 'gcc/4.7.2'
>> julia/0.2.0(16):ERROR:102: Tcl command execution failed: prereq gcc/4.7.2
>>
>> /cm/local/apps/torque/current/mom_priv/jobs/1053.cluster.SC: line 7: 
>> syntax error near unexpected token `a0d0.jl'
>> /cm/local/apps/torque/current/mom_priv/jobs/1053.cluster.SC: line 7: 
>> `include(a0d0.jl)'
>>
>> Does anybody know how to write the job script to submit julia job on a 
>> cluster? Could you give an example?
>> Thanks in advance.
>>
>> Isaac
>>
>>  
>>
>>
>>

[julia-users] Finding common values in arrays.

2014-08-02 Thread Ben Ward
Given a variable number of arrays, or an array of arrays, what is the best 
Julian way to find the values that occur in all of them? So for

a = [1,2,3,4,5]
b = [6,7,3,4,9]

would return 3 and 4?

I thought about using .== for every possible pair of the N arrays but I 
wondered if there was a better way?

Thanks,
Ben.


[julia-users] Re: Finding common values in arrays.

2014-08-02 Thread Michael Hatherly


intersect(a, b) should work for that. It also can take a variable number of 
arrays/iterables. There’s also ∩ (type \cap at the REPL), which is the 
synonym for intersect if you like Unicode.

— Mike
​


[julia-users] Best way to eliminate parameters from a parametric type

2014-08-02 Thread Jutho
Suppose I have some type T{P1,P2,P3} depending some parameters. I don't 
know which type exactly, except that it originates from a type hierarchy 
which has 3 parameters. What is the best way to construct, given e.g. a 
variable of type T{P1,P2,P3} with specific values for P1, P2, P3, to 
construct the 'super' type T{P1,P2}. If TT = T{Float64,Float64,Float64} 
then I know I could do  TT.parameters = (TT.parameters[1], 
TT.parameters[2], TypeVar(P3) ). But it turns out that is not yet 
completely identical to T{Float64,Float64}, although TT==T{Float64,Float64} 
and TT===T{Float64,Float64} evaluate to true. However, not all fields of TT 
seem to be identical to those of T{Float64,Float64}. What is the 
recommended strategy ? Is there a specific method for doing this?



Re: [julia-users] Re: emacs ess julia trouble

2014-08-02 Thread Sarvagnan Subramanian
Ah thanks! One last question, what should the input be for "(setq 
inferior-julia-program-name)" in .emacs? Should this be the location of the 
julia binary?


Re: [julia-users] Re: emacs ess julia trouble

2014-08-02 Thread Douglas Bates
Yes.


[julia-users] sizehint for Set objects

2014-08-02 Thread Ed Scheinerman
I work a good deal with Set objects. When I found the sizehint function, I 
thought this would be useful to use as the data structure supporting my 
sets would be pre-allocated to be large enough for what I anticipated 
putting therein. But sizehint doesn't apply to Set objects:

julia> A = Set()
Set{Any}()

julia> sizehint(A,1000)
ERROR: no method sizehint(Set{Any},Int64)

It appears that, under the hood, Set objects are built on top of Dict 
objects. So one can do this:

julia> sizehint(A.dict,1000)
Dict{Any,Nothing}()

But if the implementation of Set changes, this breaks. 

So I'm voicing all this to request that sizehint(Set) be implemented. 




[julia-users] Re: Wavelets.

2014-08-02 Thread David A.
Yes, that package seems good, it has image decomposition and MIT license. 
Thanks, I'll check it out more indepth.

On Saturday, August 2, 2014 5:42:55 AM UTC-3, Tobias Knopp wrote:
>
> Thanks for the link https://github.com/gummif/Wavelets.jl looks very good 
> and is MIT licensed.
>
> Am Samstag, 2. August 2014 10:30:52 UTC+2 schrieb Tomas Krehlik:
>>
>> There are two packages and some general package is discussed in here 
>> . 
>> The authors have also their own packages. I think the gummif's one does 
>> what you would like. Disclaimer: I am one of them...
>>
>> Best.
>>
>> On Saturday, 2 August 2014 07:53:19 UTC+2, David A. wrote:
>>>
>>> Regarding the actual wavelets package license, I just wanted to suggest 
>>> the PyWavelets package which is done in C and seems very complete. It has a 
>>> MIT license:
>>> http://www.pybytes.com/pywavelets/
>>>
>>> Is it already possible in Julia to make a 2D decomposition / 
>>> reconstruction, to decompose images?
>>>
>>>
>>>

[julia-users] Re: Joint Statistics Meeting in Boston

2014-08-02 Thread Ethan Anderes
Thanks Viral. I'm thinking that next year (it will be in Seattle I think) 
we should try and get a session going with some Julia talks. It would be 
good exposure.

Cheers!

On Friday, August 1, 2014 11:49:19 AM UTC-7, Viral Shah wrote:
>
> You could try drop by at Julia Central. Perhaps email Jiahao directly.
>
> -viral
>
> On Wednesday, July 30, 2014 10:16:00 PM UTC+5:30, Ethan Anderes wrote:
>>
>> There is a big statistics conference in Boston going on the first week of 
>> August (JSM ). Since Boston 
>> seems to be ground zero for Julia development I was hoping to find a Julia 
>> event or two. Is anyone speaking on Julia? Are there any meet ups planned?
>>
>> Cheers,
>> Ethan
>> ​
>>
>

Re: [julia-users] Re: emacs ess julia trouble

2014-08-02 Thread Sarvagnan Subramanian
Thanks!

On Saturday, August 2, 2014 7:23:20 PM UTC+5:30, Douglas Bates wrote:
>
> Yes.



Re: [julia-users] Re: Strange LLVM error

2014-08-02 Thread Jason
>
> I guess it won't take nothing to calculate the matrix. The problem is
> printing or showing it.
>

Spot on Pablo, in fact the size of the matrix is only 4MB!


Re: [julia-users] sizehint for Set objects

2014-08-02 Thread Stefan Karpinski
Would you be willing to take a crack at making a pull request? This should
be a one-liner, somewhere in the base/set.jl file with the obvious
definition.


On Sat, Aug 2, 2014 at 10:04 AM, Ed Scheinerman <
edward.scheiner...@gmail.com> wrote:

> I work a good deal with Set objects. When I found the sizehint function,
> I thought this would be useful to use as the data structure supporting my
> sets would be pre-allocated to be large enough for what I anticipated
> putting therein. But sizehint doesn't apply to Set objects:
>
> julia> A = Set()
> Set{Any}()
>
> julia> sizehint(A,1000)
> ERROR: no method sizehint(Set{Any},Int64)
>
> It appears that, under the hood, Set objects are built on top of Dict
> objects. So one can do this:
>
> julia> sizehint(A.dict,1000)
> Dict{Any,Nothing}()
>
> But if the implementation of Set changes, this breaks.
>
> So I'm voicing all this to request that sizehint(Set) be implemented.
>
>
>


Re: [julia-users] can't add packages

2014-08-02 Thread Stefan Karpinski
Julia is just using the git program, so the problem here must be with git
connecting to github.com over the git protocol. Can you try doing

git clone -q -b metadata-v2 git://github.com/JuliaLang/METADATA.jl METADATA

at the command line? Hopefully you can narrow it down to a failing case.


On Sat, Aug 2, 2014 at 2:56 AM, Shubham Bhushan 
wrote:

> I am able to use git protocol there's no problem with that, git works out
> of the box. However somehow julia can't connect to github. I added julia
> from the ppa .
>
>
> On Sat, Aug 2, 2014 at 9:07 AM, Stefan Karpinski 
> wrote:
>
>> You are most likely behind a firewall. Can you clone packages from github
>> manually using the git protocol? Can you telnet to github.com on
>> port 9418?
>>
>>
>> On Fri, Aug 1, 2014 at 5:48 PM, Shubham Bhushan 
>> wrote:
>>
>>> please help I can't add any packages I really really want to use julia
>>> but i can't and the mailing list is terrible. But still I am hoping someone
>>> will help.
>>>  so here's what I am getting
>>> julia> Pkg.init()
>>> INFO: Initializing package repository /home/shubham/.julia/v0.2
>>> INFO: Cloning METADATA from git://github.com/JuliaLang/METADATA.jl
>>> fatal: unable to connect to github.com:
>>> github.com[0: 192.30.252.131]: errno=Connection timed out
>>>
>>> ERROR: failed process: Process(`git clone -q -b metadata-v2 git://
>>> github.com/JuliaLang/METADATA.jl METADATA`, ProcessExited(128)) [128]
>>>  in pipeline_error at process.jl:476
>>>  in run at process.jl:453
>>>  in anonymous at no file:43
>>>  in cd at file.jl:22
>>>  in init at pkg/dir.jl:41
>>>  in init at pkg.jl:15
>>>
>>>
>>> please help.
>>>
>>>
>>>
>>
>
>
> --
> http://about.me/shubham.bhushan
>


Re: [julia-users] Best way to eliminate parameters from a parametric type

2014-08-02 Thread Leah Hanson
T{P1,P2,P3} is a family of types; each member specifies all three type
parameters. There are no "super type" relationships within the family of T
types; they are just all members of the same family (think "set") of types.

Could you explain what you're trying to achieve? I don't think that making
a type with only 2 of it's three parameters defined makes sense, so maybe
we can find another way to achieve the same goal.

-- Leah


On Sat, Aug 2, 2014 at 6:37 AM, Jutho  wrote:

> Suppose I have some type T{P1,P2,P3} depending some parameters. I don't
> know which type exactly, except that it originates from a type hierarchy
> which has 3 parameters. What is the best way to construct, given e.g. a
> variable of type T{P1,P2,P3} with specific values for P1, P2, P3, to
> construct the 'super' type T{P1,P2}. If TT = T{Float64,Float64,Float64}
> then I know I could do  TT.parameters = (TT.parameters[1],
> TT.parameters[2], TypeVar(P3) ). But it turns out that is not yet
> completely identical to T{Float64,Float64}, although TT==T{Float64,Float64}
> and TT===T{Float64,Float64} evaluate to true. However, not all fields of TT
> seem to be identical to those of T{Float64,Float64}. What is the
> recommended strategy ? Is there a specific method for doing this?
>
>


Re: [julia-users] Best way to eliminate parameters from a parametric type

2014-08-02 Thread Jutho
Suppose I want to build a composite type
type X{A<:AbstractArray}
   list::Vector{A}
   individual::A
end

Now, al the elements of the list should be of some concrete type of 
AbstractArray{T,N}, whereas individual is required to be of the same 
concrete type of AbstractArray, have the same T, but can have a different 
N'. So if all the elements in the list are Float64 Arrays, then so should 
be individual. For AbstractArray this is less of an issue, since there are 
not many concrete types with arbitrary N. In my code, it is not actually 
the AbstractArray hierarchy that I am using, but some other hierarchy with 
several concrete types.

So I was thinking of writing an outer constructor that accepts a general 
list::Vector, does several consistency check, and tries to determine the 
concrete subtype, but without fixing the N. 

Op zaterdag 2 augustus 2014 19:06:02 UTC+2 schreef Leah Hanson:
>
> T{P1,P2,P3} is a family of types; each member specifies all three type 
> parameters. There are no "super type" relationships within the family of T 
> types; they are just all members of the same family (think "set") of types.
>
> Could you explain what you're trying to achieve? I don't think that making 
> a type with only 2 of it's three parameters defined makes sense, so maybe 
> we can find another way to achieve the same goal.
>
> -- Leah
>
>
> On Sat, Aug 2, 2014 at 6:37 AM, Jutho > 
> wrote:
>
>> Suppose I have some type T{P1,P2,P3} depending some parameters. I don't 
>> know which type exactly, except that it originates from a type hierarchy 
>> which has 3 parameters. What is the best way to construct, given e.g. a 
>> variable of type T{P1,P2,P3} with specific values for P1, P2, P3, to 
>> construct the 'super' type T{P1,P2}. If TT = T{Float64,Float64,Float64} 
>> then I know I could do  TT.parameters = (TT.parameters[1], 
>> TT.parameters[2], TypeVar(P3) ). But it turns out that is not yet 
>> completely identical to T{Float64,Float64}, although TT==T{Float64,Float64} 
>> and TT===T{Float64,Float64} evaluate to true. However, not all fields of TT 
>> seem to be identical to those of T{Float64,Float64}. What is the 
>> recommended strategy ? Is there a specific method for doing this?
>>
>>
>

Re: [julia-users] sizehint for Set objects

2014-08-02 Thread Ivar Nesje
Note that we're not lazy, but we know that contributing to Julia is highly 
addictive. We want more people to look at Base with a critical eye in order 
to discover inconsistencies like this.

If you don't want to try, the fix will be committed within an hour.

Ivar

kl. 18:30:55 UTC+2 lørdag 2. august 2014 skrev Stefan Karpinski følgende:
>
> Would you be willing to take a crack at making a pull request? This should 
> be a one-liner, somewhere in the base/set.jl file with the obvious 
> definition.
>
>
> On Sat, Aug 2, 2014 at 10:04 AM, Ed Scheinerman  > wrote:
>
>> I work a good deal with Set objects. When I found the sizehint function, 
>> I thought this would be useful to use as the data structure supporting my 
>> sets would be pre-allocated to be large enough for what I anticipated 
>> putting therein. But sizehint doesn't apply to Set objects:
>>
>> julia> A = Set()
>> Set{Any}()
>>
>> julia> sizehint(A,1000)
>> ERROR: no method sizehint(Set{Any},Int64)
>>
>> It appears that, under the hood, Set objects are built on top of Dict 
>> objects. So one can do this:
>>
>> julia> sizehint(A.dict,1000)
>> Dict{Any,Nothing}()
>>
>> But if the implementation of Set changes, this breaks. 
>>
>> So I'm voicing all this to request that sizehint(Set) be implemented. 
>>
>>
>>
>

Re: [julia-users] Re: emacs ess julia trouble

2014-08-02 Thread Ross Boylan
On Sat, 2014-08-02 at 06:11 -0700, Sarvagnan Subramanian wrote:
> Ah thanks! One last question, what should the input be for "(setq
> inferior-julia-program-name)" in .emacs? Should this be the location
> of the julia binary?
It should be the complete path for the binary, e.g.,
(setq inferior-julia-program-name "/usr/local/bin/julia")

Ross



Re: [julia-users] Re: JuliaLang questions posted on #StackOverflow by month from January 2012 to end of July 2014.

2014-08-02 Thread Jacob Quinn
I guess that's what happens when you get up to trying 6-7 different
implementations for a fix! :) It's definitely exciting to see Julia taking
off more and more. I think 0.3's release will be another huge boost going
forward.


On Fri, Aug 1, 2014 at 5:00 PM, Ivar Nesje  wrote:

> Unfortunately lots of other things on the internet is growing
> exponentially, so it's not necessarily us that comes out on top.
>
> Also from the github traffic data (hope it's OK to share this), we
> had 74,369 views on github last two weeks divided by 6,710 unique visitors.
> The most popular issue was @quinnj 's PR #7671
>  with 453 views among 93
> unique visitors (4.8 page loads per visitor). Clearly a lot of thought went
> into how append! should behave when convert fails.
>
> Ivar
>
> kl. 22:37:10 UTC+2 fredag 1. august 2014 skrev Stefan Karpinski følgende:
>>
>> That appears to be exponential growth doubling every three months. Soon
>> all of StackOverflow will be questions about Julia. Similarly, traffic to
>> julialang.org has been doubling every nine months, so in a few years
>> most traffic on the Internet will be people visiting the Julia website.
>>
>> On Fri, Aug 1, 2014 at 4:21 PM, Stu Thompson  wrote:
>>
>>> Correct.
>>>
>>>
>>>
>>>
>>> Stu Thompson   /forio  |  +1 (415) 518 32 19  |  forio.com
>>> 
>>>
>>>
>>>
>>> On Fri, Aug 1, 2014 at 1:17 PM, Douglas Bates  wrote:
>>>
 What are the lines on the plot?  I am assuming that the magenta color
 is the raw counts and the green is some kind of smoothed values (moving
 averages?).


 On Friday, August 1, 2014 3:03:36 PM UTC-5, Stu Thompson wrote:
>
> Hi folks,
>
> I wanted to share a graph with everyone: JuliaLang questions posted on
> #StackOverflow by month from January 2012 to end of July 2014.
>
>
>
> ​I've been putting this together for since the beginning of the year
> as one of my metrics for gauging the growth of the Julia user community.
>  It is really exciting to see such a huge tick upwards lately.
>
> Cheers,
>
> Stu
>
>
>
> Stu Thompson   /forio  |  +1 (415) 518 32 19  |  forio.com
> 
>
>
>>>
>>


Re: [julia-users] Re: What's new in Julia 3.0?

2014-08-02 Thread Jacob Quinn
Do note that the imminent release is **0.3**, not *3.0*. There's been a
little confusion around about Julia's versioning, so just thought I'd
clarify.


On Fri, Aug 1, 2014 at 8:35 AM, Daniel Carrera  wrote:

> Thanks!
>
>
> On 1 August 2014 14:04, Ivar Nesje  wrote:
>
>> https://github.com/julialang/julia/blob/master/NEWS.md
>>
>> Currently we only have caching of object code for Base, but there is some
>> tricks you can use to include extra packages in addition to Base when you
>> compile.
>>
>> kl. 14:00:23 UTC+2 fredag 1. august 2014 skrev Daniel Carrera følgende:
>>>
>>> Hello,
>>>
>>> As the title suggests, I'd like to know what are the key features or
>>> improvements in the upcoming Julia 3.0 (whenever it is released).
>>>
>>> One feature that I hope to see is either faster compiles or caching. One
>>> of the big selling points of Julia is its speed, but the fact that it has
>>> to recompile itself constantly every time you run a program really gets in
>>> the way of performance. I imagine that the solution is to cache object code
>>> so that you only compile the stuff that has changed since the last run. I
>>> am also sure that this is easier said than done. Does Julia 3.0 include any
>>> work in this area?
>>>
>>> Cheers,
>>> Daniel.
>>>
>>
>
>
> --
> When an engineer says that something can't be done, it's a code phrase
> that means it's not fun to do.
>


Re: [julia-users] Re: What's new in Julia 3.0?

2014-08-02 Thread Ivar Nesje
How come I did not notice. I hope we never make stupid enough mistakes in 
1.0 that we will ever need a 2.X release (and even worse a 3.0 release). 

kl. 20:27:35 UTC+2 lørdag 2. august 2014 skrev Jacob Quinn følgende:
>
> Do note that the imminent release is **0.3**, not *3.0*. There's been a 
> little confusion around about Julia's versioning, so just thought I'd 
> clarify.
>
>
> On Fri, Aug 1, 2014 at 8:35 AM, Daniel Carrera  > wrote:
>
>> Thanks!
>>
>>
>> On 1 August 2014 14:04, Ivar Nesje > 
>> wrote:
>>
>>> https://github.com/julialang/julia/blob/master/NEWS.md
>>>
>>> Currently we only have caching of object code for Base, but there is 
>>> some tricks you can use to include extra packages in addition to Base when 
>>> you compile.
>>>
>>> kl. 14:00:23 UTC+2 fredag 1. august 2014 skrev Daniel Carrera følgende:

 Hello,

 As the title suggests, I'd like to know what are the key features or 
 improvements in the upcoming Julia 3.0 (whenever it is released).

 One feature that I hope to see is either faster compiles or caching. 
 One of the big selling points of Julia is its speed, but the fact that it 
 has to recompile itself constantly every time you run a program really 
 gets 
 in the way of performance. I imagine that the solution is to cache object 
 code so that you only compile the stuff that has changed since the last 
 run. I am also sure that this is easier said than done. Does Julia 3.0 
 include any work in this area?

 Cheers,
 Daniel.

>>>
>>
>>
>> -- 
>> When an engineer says that something can't be done, it's a code phrase 
>> that means it's not fun to do.
>>  
>
>

Re: [julia-users] Re: ANN: EM algorithm for regularized L0 regression. More regreg Julia code out there?

2014-08-02 Thread Robert Feldt
Just to close this off I did some more experiments and it is clear that 
using the "\"-based solving is the main performance enhancement (2-25 times 
faster for N & M in the 10:5000 range I've tested with!) while 
UniformScaling gives a rather small improvement (few percent) on top of 
that (expected since the latter scales only with N and not with M) and not 
always. 

Even for N > M the "\"-based solving is faster, actually relatively more so 
than when N << M.

As usual, Julia's performance is overall impressive with the optimized L0 
EM algorithm being practical (run time less than 20 secs) even for M being 
500,000 (if N is < 200 and k < 8).

p-values below are from Wilcoxon test which is used to run as few repeated 
executions as possible in determining a speed difference.

Cheers,

Robert

N = 500, M = 5000, k = 2
| Row # | Function| Avg   | Reps | Relative | p  | Signif 
slower? |
| 1 | "solve   "  | "0.34sec" | 6| 1.0  | 1.0| ""   
  |
| 2 | "unisc & solve" | "0.36sec" | 6| 1.07 | 0.026  | "*" 
   |
| 3 | "unisc" | "0.69sec" | 4| 2.04 | 0.0095 | "**" 
  |
| 4 | "original " | "0.75sec" | 4| 2.25 | 0.0095 | "**" 
  |

N = 5000, M = 500, k = 2
| Row # | Function| Avg| Reps | Relative | p | Signif 
slower? |
| 1 | "unisc & solve" | "8.93sec"  | 4| 1.0  | 1.0   | ""   
  |
| 2 | "solve   "  | "9.11sec"  | 4| 1.02 | 0.029 | "*" 
   |
| 3 | "unisc" | "3.71mins" | 4| 25.0 | 0.029 | "*" 
   |
| 4 | "original " | "3.71mins" | 4| 25.0 | 0.029 | "*" 
   |

N = 5000, M = 5000, k = 2
| Row # | Function | Avg| Reps | Relative | p   | 
Signif slower? |
| 1 | "solve   "   | "38.13sec" | 15   | 1.0  | 1.0 | ""   
  |
| 2 | "unisc & solve"  | "38.75sec" | 15   | 1.02 | 0.77| ""   
  |
| 3 | "unisc " | "5.40mins" | 4| 8.5  | 0.00052 | "***" 
 |
| 4 | "original  " | "5.42mins" | 4| 8.53 | 0.00052 | "***" 
 |

N = 200, M = 50, k = 2
| Row # | Function  | Avg| Reps | Relative | p | 
Signif slower? |
| 1 | "unisc & solve  " | "5.28 sec" | 5| 1.0  | 1.0   | "" 
|
| 2 | "solve  " | "5.45 sec" | 5| 1.03 | 0.016 | 
"*"|
| 3 | "original   " | "9.65 sec" | 4| 1.83 | 0.016 | 
"*"|

N = 200, M = 50, k = 8
| Row # | Function  | Avg | Reps | Relative | p   | 
Signif slower? |
| 1 | "unisc & solve  " | "20.04 sec" | 15   | 1.0  | 1.0 | 
"" |
| 2 | "solve  " | "20.28 sec" | 15   | 1.01 | 0.93| 
"" |
| 3 | "original   " | "47.91 sec" | 4| 2.39 | 0.00052 | 
"***"  |

>

Re: [julia-users] sizehint for Set objects

2014-08-02 Thread Kevin Squire
(Hope this isn't a disappointment, but this was implemented already in
v0.3.)


On Sat, Aug 2, 2014 at 10:59 AM, Ivar Nesje  wrote:

> Note that we're not lazy, but we know that contributing to Julia is highly
> addictive. We want more people to look at Base with a critical eye in order
> to discover inconsistencies like this.
>
> If you don't want to try, the fix will be committed within an hour.
>
> Ivar
>
> kl. 18:30:55 UTC+2 lørdag 2. august 2014 skrev Stefan Karpinski følgende:
>>
>> Would you be willing to take a crack at making a pull request? This
>> should be a one-liner, somewhere in the base/set.jl file with the obvious
>> definition.
>>
>>
>>  On Sat, Aug 2, 2014 at 10:04 AM, Ed Scheinerman 
>> wrote:
>>
>>> I work a good deal with Set objects. When I found the sizehint
>>> function, I thought this would be useful to use as the data structure
>>> supporting my sets would be pre-allocated to be large enough for what I
>>> anticipated putting therein. But sizehint doesn't apply to Set objects:
>>>
>>> julia> A = Set()
>>> Set{Any}()
>>>
>>> julia> sizehint(A,1000)
>>> ERROR: no method sizehint(Set{Any},Int64)
>>>
>>> It appears that, under the hood, Set objects are built on top of Dict
>>> objects. So one can do this:
>>>
>>> julia> sizehint(A.dict,1000)
>>> Dict{Any,Nothing}()
>>>
>>> But if the implementation of Set changes, this breaks.
>>>
>>> So I'm voicing all this to request that sizehint(Set) be implemented.
>>>
>>>
>>>
>>


[julia-users] [ANN] SuffixArrays.jl

2014-08-02 Thread Jacob Quinn
Hey all,

I finally got around to playing around with a suffix array implementation 
and wanted to share. It's a pure julia port of sais 
, by Yuta Mori and while not 
the bleeding edge fastest suffix array sorting algorithm out there, I 
personally think it's the best bang for your buck (in terms of a relatively 
simple implementation and platform independence).

Compared to state of the art, the sais algorithm is consistently within 
1.5-2.5x of the fastest (see detailed benchmarks here 
), and 
handily beats all other algorithms in terms of memory usage. The native 
julia implementation is around 10x faster than the Java sais implementation 
and only 1.2-1.3x slower than the native C. I still need to spin up a 
direct comparison of this julia version vs. Go's standard library 
implementation, which is based on the qsufsort algorithm (though benchmarks 
show sais always beating it). 

There's still some more work on the interface to do and implementing some 
algorithms that build on the suffix array, so for now the only 
functionality is getting the sorted suffix array for a string/corpus. I'm 
also planning on playing around with some distributed/parallel features for 
the core algorithm to see what other shenanigans are possible.

https://github.com/quinnj/SuffixArrays.jl

-Jacob


Re: [julia-users] sizehint for Set objects

2014-08-02 Thread Ed Scheinerman
Not a disappointment at all! I look forward to 0.3 being officially 
released. Thank you.


On Saturday, August 2, 2014 4:00:12 PM UTC-4, Kevin Squire wrote:
>
> (Hope this isn't a disappointment, but this was implemented already in 
> v0.3.)
>
>
> On Sat, Aug 2, 2014 at 10:59 AM, Ivar Nesje  > wrote:
>
>> Note that we're not lazy, but we know that contributing to Julia is 
>> highly addictive. We want more people to look at Base with a critical eye 
>> in order to discover inconsistencies like this.
>>
>> If you don't want to try, the fix will be committed within an hour.
>>
>> Ivar
>>
>> kl. 18:30:55 UTC+2 lørdag 2. august 2014 skrev Stefan Karpinski følgende:
>>>
>>> Would you be willing to take a crack at making a pull request? This 
>>> should be a one-liner, somewhere in the base/set.jl file with the obvious 
>>> definition.
>>>
>>>
>>>  On Sat, Aug 2, 2014 at 10:04 AM, Ed Scheinerman >> > wrote:
>>>
 I work a good deal with Set objects. When I found the sizehint 
 function, I thought this would be useful to use as the data structure 
 supporting my sets would be pre-allocated to be large enough for what I 
 anticipated putting therein. But sizehint doesn't apply to Set objects:

 julia> A = Set()
 Set{Any}()

 julia> sizehint(A,1000)
 ERROR: no method sizehint(Set{Any},Int64)

 It appears that, under the hood, Set objects are built on top of Dict 
 objects. So one can do this:

 julia> sizehint(A.dict,1000)
 Dict{Any,Nothing}()

 But if the implementation of Set changes, this breaks. 

 So I'm voicing all this to request that sizehint(Set) be implemented. 



>>>
>

[julia-users] [Ann] JuliaOpt/ECOS.jl - lightweight solver for LPs + SOCPs

2014-08-02 Thread Iain Dunning
The JuliaOpt team is pleased to announce ECOS.jl 
, a wrapper for the linear program and 
second-order cone program solver ECOS .

In METADATA now!

Credit goes to João Felipe Santos (@jfsantos) for starting this particular 
version of the wrapper, with contributions from other members of JuliaOpt 
community  as well 
help with binaries from @tkelman and @staticfloat.

ECOS.jl supports the MathProgBase interface, allowing it to be used from 
JuMP  (for LPs) and from CVX.jl in the 
near future when it is released.



Re: [julia-users] Re: ANN: EM algorithm for regularized L0 regression. More regreg Julia code out there?

2014-08-02 Thread Iain Dunning
The \ method may also be more numerically stable.

On Saturday, August 2, 2014 3:49:10 PM UTC-4, Robert Feldt wrote:
>
> Just to close this off I did some more experiments and it is clear that 
> using the "\"-based solving is the main performance enhancement (2-25 times 
> faster for N & M in the 10:5000 range I've tested with!) while 
> UniformScaling gives a rather small improvement (few percent) on top of 
> that (expected since the latter scales only with N and not with M) and not 
> always. 
>
> Even for N > M the "\"-based solving is faster, actually relatively more 
> so than when N << M.
>
> As usual, Julia's performance is overall impressive with the optimized L0 
> EM algorithm being practical (run time less than 20 secs) even for M being 
> 500,000 (if N is < 200 and k < 8).
>
> p-values below are from Wilcoxon test which is used to run as few repeated 
> executions as possible in determining a speed difference.
>
> Cheers,
>
> Robert
>
> N = 500, M = 5000, k = 2
> | Row # | Function| Avg   | Reps | Relative | p  | Signif 
> slower? |
> | 1 | "solve   "  | "0.34sec" | 6| 1.0  | 1.0| "" 
> |
> | 2 | "unisc & solve" | "0.36sec" | 6| 1.07 | 0.026  | "*" 
>|
> | 3 | "unisc" | "0.69sec" | 4| 2.04 | 0.0095 | "**"   
> |
> | 4 | "original " | "0.75sec" | 4| 2.25 | 0.0095 | "**"   
> |
>
> N = 5000, M = 500, k = 2
> | Row # | Function| Avg| Reps | Relative | p | Signif 
> slower? |
> | 1 | "unisc & solve" | "8.93sec"  | 4| 1.0  | 1.0   | "" 
> |
> | 2 | "solve   "  | "9.11sec"  | 4| 1.02 | 0.029 | "*" 
>|
> | 3 | "unisc" | "3.71mins" | 4| 25.0 | 0.029 | "*" 
>|
> | 4 | "original " | "3.71mins" | 4| 25.0 | 0.029 | "*" 
>|
>
> N = 5000, M = 5000, k = 2
> | Row # | Function | Avg| Reps | Relative | p   | 
> Signif slower? |
> | 1 | "solve   "   | "38.13sec" | 15   | 1.0  | 1.0 | ""   
>   |
> | 2 | "unisc & solve"  | "38.75sec" | 15   | 1.02 | 0.77| ""   
>   |
> | 3 | "unisc " | "5.40mins" | 4| 8.5  | 0.00052 | 
> "***"  |
> | 4 | "original  " | "5.42mins" | 4| 8.53 | 0.00052 | 
> "***"  |
>
> N = 200, M = 50, k = 2
> | Row # | Function  | Avg| Reps | Relative | p | 
> Signif slower? |
> | 1 | "unisc & solve  " | "5.28 sec" | 5| 1.0  | 1.0   | 
> "" |
> | 2 | "solve  " | "5.45 sec" | 5| 1.03 | 0.016 | 
> "*"|
> | 3 | "original   " | "9.65 sec" | 4| 1.83 | 0.016 | 
> "*"|
>
> N = 200, M = 50, k = 8
> | Row # | Function  | Avg | Reps | Relative | p   
> | Signif slower? |
> | 1 | "unisc & solve  " | "20.04 sec" | 15   | 1.0  | 1.0 
> | "" |
> | 2 | "solve  " | "20.28 sec" | 15   | 1.01 | 0.93   
>  | "" |
> | 3 | "original   " | "47.91 sec" | 4| 2.39 | 0.00052 
> | "***"  |
>
>>

[julia-users] Re: compile time conditional statements and julia?

2014-08-02 Thread vavasis
Dear Julia colleagues,

I'm reviving this old thread because I am also trying to create two 
versions of my balanced-tree code, the fast version and the debug version, 
and I am trying to figure out the appropriate way for one source-code file 
to yield two versions.  In C++, the usual technique is a -DDEBUG 
compilation flag, followed by #ifdef DEBUG ... #else ... #endif macros.  

I thought that maybe in Julia I could accomplish this with ordinary "if" 
statements  since the compiler could optimize away unused branches, but it 
doesn't seem to work:

module testcodegen1

function t1(x::Float64)
s = 0.0
for i = 1 : 2000
s += sin(x)
end
s
end

function t2(x::Float64)
s = 0.0
for i = 1 : 2000
if true
s += sin(x)
else
s += sin(2*x)
end
end
s
end

end

Clearly t1 and t2 are equivalent, but t2 has an unreachable code branch 
that could be optimized away.  However, the compiler doesn't seem to 
recognize this:  

julia> tic(); testcodegen1.t1(3.0);  toc()
tic(); testcodegen1.t1(3.0);  toc()
elapsed time: 0.216690647 seconds
0.216690647

julia> tic(); testcodegen1.t2(3.0);  toc()
tic(); testcodegen1.t2(3.0);  toc()
elapsed time: 0.53437478 seconds
0.53437478

It seems that using ordinary 'if' statements to distinguish the debugging 
mode entails a big performance hit.

Thanks for the help,
Steve Vavasis




On Wednesday, May 29, 2013 1:46:21 PM UTC-4, Simon Hardy-Francis wrote:
>
>
>
> Consider this simple Perl script:
>
> use strict;
> use Time::HiRes;
>
> my $t1 = Time::HiRes::time;
> foreach (1..5000) {
> }
> my $t2 = Time::HiRes::time;
>
> my $t3 = Time::HiRes::time;
> my $debug = 0;
> foreach (1..5000) {
>if ($debug) { printf qq[my debug line: %u], $_; }
> }
> my $t4 = Time::HiRes::time;
>
> my $t5 = Time::HiRes::time;
> use constant DEBUG => 0;
> foreach (1..5000) {
>if (DEBUG) { printf qq[my debug line: %u], $_; }
> }
> my $t6 = Time::HiRes::time;
>
> printf qq[%f seconds for plain loop\n], $t2 - $t1;
> printf qq[%f seconds for negative if() loop \n], $t4 - $t3;
> printf qq[%f seconds for compiled out loop \n], $t6 - $t5;
>
> The output is:
>
> $ perl example.pl 
> 1.372535 seconds for plain loop
> 1.899815 seconds for negative if() loop 
> 1.370118 seconds for compiled out loop 
>
> The nice thing is that "if (DEBUG) { printf qq[my debug line: %u], $_; }" 
> line gets compiled away and there is no resulting negative if() at 
> run-time. This technique is very useful for instrumenting Perl code with 
> verbose logging which doesn't slow down production code (by executing many 
> negative 'if' statements) when verbosity is dialed down.
>
> Is there an equivalent way to achieve the same performance results in 
> julia?
>
> Thanks,
> Simon
>


Re: [julia-users] Re: compile time conditional statements and julia?

2014-08-02 Thread Jameson Nash
constant propagation is almost implemented in inference.jl (it's quite
similar to type propagation), but it isn't active now:
https://github.com/JuliaLang/julia/issues/5560

On Sat, Aug 2, 2014 at 8:33 PM,  wrote:

> Dear Julia colleagues,
>
> I'm reviving this old thread because I am also trying to create two
> versions of my balanced-tree code, the fast version and the debug version,
> and I am trying to figure out the appropriate way for one source-code file
> to yield two versions.  In C++, the usual technique is a -DDEBUG
> compilation flag, followed by #ifdef DEBUG ... #else ... #endif macros.
>
> I thought that maybe in Julia I could accomplish this with ordinary "if"
> statements  since the compiler could optimize away unused branches, but it
> doesn't seem to work:
>
> module testcodegen1
>
> function t1(x::Float64)
> s = 0.0
> for i = 1 : 2000
> s += sin(x)
> end
> s
> end
>
> function t2(x::Float64)
> s = 0.0
> for i = 1 : 2000
> if true
> s += sin(x)
> else
> s += sin(2*x)
> end
> end
> s
> end
>
> end
>
> Clearly t1 and t2 are equivalent, but t2 has an unreachable code branch
> that could be optimized away.  However, the compiler doesn't seem to
> recognize this:
>
> julia> tic(); testcodegen1.t1(3.0);  toc()
> tic(); testcodegen1.t1(3.0);  toc()
> elapsed time: 0.216690647 seconds
> 0.216690647
>
> julia> tic(); testcodegen1.t2(3.0);  toc()
> tic(); testcodegen1.t2(3.0);  toc()
> elapsed time: 0.53437478 seconds
> 0.53437478
>
> It seems that using ordinary 'if' statements to distinguish the debugging
> mode entails a big performance hit.
>
> Thanks for the help,
> Steve Vavasis
>
>
>
>
> On Wednesday, May 29, 2013 1:46:21 PM UTC-4, Simon Hardy-Francis wrote:
>>
>>
>>
>> Consider this simple Perl script:
>>
>> use strict;
>> use Time::HiRes;
>>
>> my $t1 = Time::HiRes::time;
>> foreach (1..5000) {
>> }
>> my $t2 = Time::HiRes::time;
>>
>> my $t3 = Time::HiRes::time;
>> my $debug = 0;
>> foreach (1..5000) {
>>if ($debug) { printf qq[my debug line: %u], $_; }
>> }
>> my $t4 = Time::HiRes::time;
>>
>> my $t5 = Time::HiRes::time;
>> use constant DEBUG => 0;
>> foreach (1..5000) {
>>if (DEBUG) { printf qq[my debug line: %u], $_; }
>> }
>> my $t6 = Time::HiRes::time;
>>
>> printf qq[%f seconds for plain loop\n], $t2 - $t1;
>> printf qq[%f seconds for negative if() loop \n], $t4 - $t3;
>> printf qq[%f seconds for compiled out loop \n], $t6 - $t5;
>>
>> The output is:
>>
>> $ perl example.pl
>> 1.372535 seconds for plain loop
>> 1.899815 seconds for negative if() loop
>> 1.370118 seconds for compiled out loop
>>
>> The nice thing is that "if (DEBUG) { printf qq[my debug line: %u], $_; }"
>> line gets compiled away and there is no resulting negative if() at
>> run-time. This technique is very useful for instrumenting Perl code with
>> verbose logging which doesn't slow down production code (by executing many
>> negative 'if' statements) when verbosity is dialed down.
>>
>> Is there an equivalent way to achieve the same performance results in
>> julia?
>>
>> Thanks,
>> Simon
>>
>


[julia-users] why no abstract 'set' type?

2014-08-02 Thread vavasis
Dear Julia Colleagues,

I'm writing a balanced-tree library in Julia.  Balanced trees can be used 
to implement a sort-order dictionary, which is a particular implementation 
of the "Associative" abstract type, so I write:

type SortOrderDict{K,V} <: Associative{K,V}

where SortOrderDict is my own project.

They can also be used to implement multimaps (like Dict  except with 
repeated keys) and sorted sets.  For sorted sets I'd like to say:

type SortedSet{K} <: AbstractSet{K}

where AbstractSet{K} would also include Set{K} and IntSet as subtypes. 
 However, there is no such abstract type in Julia, and I'm wondering why it 
was omitted.

Thanks,
Steve Vavasis

P.S. Something unexpected and very helpful happened with these types:  When 
I created a SortOrderDict and assigned it to x, and then I typed just 'x' 
into the shell, I got a really nice printout of my SortOrderDict (it 
printed out like a Dict, except in the sorted order of the keys). This 
happened even though I never wrote a single line of code for printing out 
SortOrderDicts!  I suppose this happened because Julia has a default way to 
print out any Associate{K,V} type.



Re: [julia-users] why no abstract 'set' type?

2014-08-02 Thread Jacob Quinn
See https://github.com/JuliaLang/julia/issues/5533
On Aug 2, 2014 9:51 PM,  wrote:

> Dear Julia Colleagues,
>
> I'm writing a balanced-tree library in Julia.  Balanced trees can be used
> to implement a sort-order dictionary, which is a particular implementation
> of the "Associative" abstract type, so I write:
>
> type SortOrderDict{K,V} <: Associative{K,V}
>
> where SortOrderDict is my own project.
>
> They can also be used to implement multimaps (like Dict  except with
> repeated keys) and sorted sets.  For sorted sets I'd like to say:
>
> type SortedSet{K} <: AbstractSet{K}
>
> where AbstractSet{K} would also include Set{K} and IntSet as subtypes.
>  However, there is no such abstract type in Julia, and I'm wondering why it
> was omitted.
>
> Thanks,
> Steve Vavasis
>
> P.S. Something unexpected and very helpful happened with these types:
>  When I created a SortOrderDict and assigned it to x, and then I typed just
> 'x' into the shell, I got a really nice printout of my SortOrderDict (it
> printed out like a Dict, except in the sorted order of the keys). This
> happened even though I never wrote a single line of code for printing out
> SortOrderDicts!  I suppose this happened because Julia has a default way to
> print out any Associate{K,V} type.
>
>


Re: [julia-users] Re: compile time conditional statements and julia?

2014-08-02 Thread Tim Holy
There's something else wrong. It makes no sense that the time hit should be so 
large; evaluating sin is _expensive_, much more than a conditional, especially 
since this one will work perfectly with the CPU's branch-point prediction.

I tried it using @time rather than tic/toc, and the extra information provided 
by @time revealed that there is allocation -> some kind of type problem. 
(Basically you should always use @time in preference to tic/toc, it's just 
much more informative.) Then, I left the `if` in place but commented out the 
`else` part, and the performance of the two functions became identical. So 
there's something about the else branch that's messing up type inference (and 
as far as I can tell it shouldn't, so it's probably a bug).

Can you please file an issue?

--Tim


On Saturday, August 02, 2014 09:03:40 PM Jameson Nash wrote:
> constant propagation is almost implemented in inference.jl (it's quite
> similar to type propagation), but it isn't active now:
> https://github.com/JuliaLang/julia/issues/5560
> 
> On Sat, Aug 2, 2014 at 8:33 PM,  wrote:
> > Dear Julia colleagues,
> > 
> > I'm reviving this old thread because I am also trying to create two
> > versions of my balanced-tree code, the fast version and the debug version,
> > and I am trying to figure out the appropriate way for one source-code file
> > to yield two versions.  In C++, the usual technique is a -DDEBUG
> > compilation flag, followed by #ifdef DEBUG ... #else ... #endif macros.
> > 
> > I thought that maybe in Julia I could accomplish this with ordinary "if"
> > statements  since the compiler could optimize away unused branches, but it
> > doesn't seem to work:
> > 
> > module testcodegen1
> > 
> > function t1(x::Float64)
> > 
> > s = 0.0
> > for i = 1 : 2000
> > 
> > s += sin(x)
> > 
> > end
> > s
> > 
> > end
> > 
> > function t2(x::Float64)
> > 
> > s = 0.0
> > for i = 1 : 2000
> > 
> > if true
> > 
> > s += sin(x)
> > 
> > else
> > 
> > s += sin(2*x)
> > 
> > end
> > 
> > end
> > s
> > 
> > end
> > 
> > end
> > 
> > Clearly t1 and t2 are equivalent, but t2 has an unreachable code branch
> > that could be optimized away.  However, the compiler doesn't seem to
> > recognize this:
> > 
> > julia> tic(); testcodegen1.t1(3.0);  toc()
> > tic(); testcodegen1.t1(3.0);  toc()
> > elapsed time: 0.216690647 seconds
> > 0.216690647
> > 
> > julia> tic(); testcodegen1.t2(3.0);  toc()
> > tic(); testcodegen1.t2(3.0);  toc()
> > elapsed time: 0.53437478 seconds
> > 0.53437478
> > 
> > It seems that using ordinary 'if' statements to distinguish the debugging
> > mode entails a big performance hit.
> > 
> > Thanks for the help,
> > Steve Vavasis
> > 
> > On Wednesday, May 29, 2013 1:46:21 PM UTC-4, Simon Hardy-Francis wrote:
> >> Consider this simple Perl script:
> >> 
> >> use strict;
> >> use Time::HiRes;
> >> 
> >> my $t1 = Time::HiRes::time;
> >> foreach (1..5000) {
> >> }
> >> my $t2 = Time::HiRes::time;
> >> 
> >> my $t3 = Time::HiRes::time;
> >> my $debug = 0;
> >> foreach (1..5000) {
> >> 
> >>if ($debug) { printf qq[my debug line: %u], $_; }
> >> 
> >> }
> >> my $t4 = Time::HiRes::time;
> >> 
> >> my $t5 = Time::HiRes::time;
> >> use constant DEBUG => 0;
> >> foreach (1..5000) {
> >> 
> >>if (DEBUG) { printf qq[my debug line: %u], $_; }
> >> 
> >> }
> >> my $t6 = Time::HiRes::time;
> >> 
> >> printf qq[%f seconds for plain loop\n], $t2 - $t1;
> >> printf qq[%f seconds for negative if() loop \n], $t4 - $t3;
> >> printf qq[%f seconds for compiled out loop \n], $t6 - $t5;
> >> 
> >> The output is:
> >> 
> >> $ perl example.pl
> >> 1.372535 seconds for plain loop
> >> 1.899815 seconds for negative if() loop
> >> 1.370118 seconds for compiled out loop
> >> 
> >> The nice thing is that "if (DEBUG) { printf qq[my debug line: %u], $_; }"
> >> line gets compiled away and there is no resulting negative if() at
> >> run-time. This technique is very useful for instrumenting Perl code with
> >> verbose logging which doesn't slow down production code (by executing
> >> many
> >> negative 'if' statements) when verbosity is dialed down.
> >> 
> >> Is there an equivalent way to achieve the same performance results in
> >> julia?
> >> 
> >> Thanks,
> >> Simon



[julia-users] How can Julia find JAGS?

2014-08-02 Thread KK Sasa

When the JAGS had been installed and added a path "C:\Program 
Files\JAGS\JAGS-3.4.0\x64\bin" to system variable on WIndows 7 x64, I turn 
Julia's REPL to shell mode and then command run(`jags`). But, it return 
error like "Error: could not spawn `jags`: no such file or directory 
(ENOENT)". 

I have tried Windows' Command Prompt out and simply command: jags, it can 
find jags. But how to make Julia find JAGS?

Thanks :)



Re: [julia-users] How can Julia find JAGS?

2014-08-02 Thread Jameson Nash
jags is distributed as jags.bat, but jags.bat is defined as not executable
in windows. This is because Windows doesn't let you spawn arbitrary files.
The command prompt implements various workarounds for this, but libuv has
chosen not to try to duplicate them.  It seems your options are either to
spawn a command interpreter `cmd jags` or call `jags-terminal` directly

(neither of these is what the command prompt does, since the command prompt
actually sources the files directly, thus modifying the callee's
environment)


On Sat, Aug 2, 2014 at 11:39 PM, KK Sasa  wrote:

>
> When the JAGS had been installed and added a path "C:\Program
> Files\JAGS\JAGS-3.4.0\x64\bin" to system variable on WIndows 7 x64, I
> turn Julia's REPL to shell mode and then command run(`jags`). But, it
> return error like "Error: could not spawn `jags`: no such file or
> directory (ENOENT)".
>
> I have tried Windows' Command Prompt out and simply command: jags, it can
> find jags. But how to make Julia find JAGS?
>
> Thanks :)
>
>


Re: [julia-users] How can Julia find JAGS?

2014-08-02 Thread KK Sasa
Hi Jameson,

1) run(`cmd jags`) lets Julia go into command prompt, and then input jags will 
go into JAGS mode. Can it come back to Julia again?

2) run(`jags-terminal`) seems find JAGS but fails to load JAGS' modules, it 
says "module could not be found".

Any suggestions?

Thank you.

Jameson於 2014年8月3日星期日UTC+8下午12時26分17秒寫道:
>
> jags is distributed as jags.bat, but jags.bat is defined as not executable 
> in windows. This is because Windows doesn't let you spawn arbitrary files. 
> The command prompt implements various workarounds for this, but libuv has 
> chosen not to try to duplicate them.  It seems your options are either to 
> spawn a command interpreter `cmd jags` or call `jags-terminal` directly
>
> (neither of these is what the command prompt does, since the command 
> prompt actually sources the files directly, thus modifying the callee's 
> environment)
>
>

Re: [julia-users] How can Julia find JAGS?

2014-08-02 Thread Jameson Nash
run(`cmd /c jags`) -- the /c flag is needed to tell cmd to run the command

run(`jags-terminal`) -- the batch script jags.bat sets a few environment
variables you would probably need to duplicate if you decide to go this
route (e.g. ENV["VAR"] = "VALUE")


On Sun, Aug 3, 2014 at 1:18 AM, KK Sasa  wrote:

> Hi Jameson,
>
> 1) run(`cmd jags`) lets Julia go into command prompt, and then input jags will
> go into JAGS mode. Can it come back to Julia again?
>
> 2) run(`jags-terminal`) seems find JAGS but fails to load JAGS' modules,
> it says "module could not be found".
>
> Any suggestions?
>
> Thank you.
>
> Jameson於 2014年8月3日星期日UTC+8下午12時26分17秒寫道:
>
>> jags is distributed as jags.bat, but jags.bat is defined as not
>> executable in windows. This is because Windows doesn't let you spawn
>> arbitrary files. The command prompt implements various workarounds for
>> this, but libuv has chosen not to try to duplicate them.  It seems your
>> options are either to spawn a command interpreter `cmd jags` or call
>> `jags-terminal` directly
>>
>> (neither of these is what the command prompt does, since the command
>> prompt actually sources the files directly, thus modifying the callee's
>> environment)
>>
>>


Re: [julia-users] How can Julia find JAGS?

2014-08-02 Thread KK Sasa
Thanks.

run(`cmd /c jags`) directly goes into JAGS mode. After running my JAGS 
model, can it go back to Julia mode?

Jameson於 2014年8月3日星期日UTC+8下午1時35分58秒寫道:
>
> run(`cmd /c jags`) -- the /c flag is needed to tell cmd to run the command
>
> run(`jags-terminal`) -- the batch script jags.bat sets a few environment 
> variables you would probably need to duplicate if you decide to go this 
> route (e.g. ENV["VAR"] = "VALUE")
>
>
> On Sun, Aug 3, 2014 at 1:18 AM, KK Sasa > 
> wrote:
>
>> Hi Jameson,
>>
>> 1) run(`cmd jags`) lets Julia go into command prompt, and then input jags 
>> will go into JAGS mode. Can it come back to Julia again?
>>
>> 2) run(`jags-terminal`) seems find JAGS but fails to load JAGS' modules, 
>> it says "module could not be found".
>>
>> Any suggestions?
>>
>> Thank you.
>>
>> Jameson於 2014年8月3日星期日UTC+8下午12時26分17秒寫道:
>>
>>> jags is distributed as jags.bat, but jags.bat is defined as not 
>>> executable in windows. This is because Windows doesn't let you spawn 
>>> arbitrary files. The command prompt implements various workarounds for 
>>> this, but libuv has chosen not to try to duplicate them.  It seems your 
>>> options are either to spawn a command interpreter `cmd jags` or call 
>>> `jags-terminal` directly
>>>
>>> (neither of these is what the command prompt does, since the command 
>>> prompt actually sources the files directly, thus modifying the callee's 
>>> environment)
>>>
>>>
>

Re: [julia-users] How can Julia find JAGS?

2014-08-02 Thread Jameson Nash
disclaimer: I know *nothing* about JAGS

if you exit the JAGS terminal, it should drop back to the Julia REPL console

if you want deeper integration, you may want to see what JAGS has for a
C-interface, and make a Julia package around providing access to that


On Sun, Aug 3, 2014 at 1:52 AM, KK Sasa  wrote:

> Thanks.
>
> run(`cmd /c jags`) directly goes into JAGS mode. After running my JAGS
> model, can it go back to Julia mode?
>
> Jameson於 2014年8月3日星期日UTC+8下午1時35分58秒寫道:
>>
>> run(`cmd /c jags`) -- the /c flag is needed to tell cmd to run the command
>>
>> run(`jags-terminal`) -- the batch script jags.bat sets a few environment
>> variables you would probably need to duplicate if you decide to go this
>> route (e.g. ENV["VAR"] = "VALUE")
>>
>>
>> On Sun, Aug 3, 2014 at 1:18 AM, KK Sasa  wrote:
>>
>>> Hi Jameson,
>>>
>>> 1) run(`cmd jags`) lets Julia go into command prompt, and then input jags
>>> will go into JAGS mode. Can it come back to Julia again?
>>>
>>> 2) run(`jags-terminal`) seems find JAGS but fails to load JAGS'
>>> modules, it says "module could not be found".
>>>
>>> Any suggestions?
>>>
>>> Thank you.
>>>
>>> Jameson於 2014年8月3日星期日UTC+8下午12時26分17秒寫道:
>>>
 jags is distributed as jags.bat, but jags.bat is defined as not
 executable in windows. This is because Windows doesn't let you spawn
 arbitrary files. The command prompt implements various workarounds for
 this, but libuv has chosen not to try to duplicate them.  It seems your
 options are either to spawn a command interpreter `cmd jags` or call
 `jags-terminal` directly

 (neither of these is what the command prompt does, since the command
 prompt actually sources the files directly, thus modifying the callee's
 environment)


>>


Re: [julia-users] How can Julia find JAGS?

2014-08-02 Thread KK Sasa
Got it. Thank you.

JAGS' command "exit" can go back to Julia REPL.

Jameson於 2014年8月3日星期日UTC+8下午2時01分49秒寫道:
>
> disclaimer: I know *nothing* about JAGS
>
> if you exit the JAGS terminal, it should drop back to the Julia REPL 
> console
>
> if you want deeper integration, you may want to see what JAGS has for a 
> C-interface, and make a Julia package around providing access to that
>
>
>