Re: [julia-users] High memory consumption with loops

2016-08-25 Thread vavasis
I don't have any suggestions about the performance, but I do have a code 
correctness suggestion.  It appears from your code snippet that you are 
using dictionaries called "effectiveness" and "resource_fines", and that 
the keys to these dictionaries are a mutable type.  This can lead to subtle 
program bugs.  For example, the following code sequence:

d = Dict{Array{Int,1},Float64}()
a = [4,5,6]
d[a] = 9.1
a[2] = 4

will leave internal indexing structure of d in a corrupted state.  It is 
safer to use immutables as keys for Dict.  If you must use mutables, then 
whenever you assign a dictionary entry it is safest to insert a 'deepcopy' 
operation; e.g., the above snippet can be fixed by substituting the 
following for d[a]=9.1:
   d[deepcopy(a)] = 9.1

-- Steve Vavasis


On Thursday, August 25, 2016 at 2:21:30 AM UTC-4, Venil Noronha wrote:
>
> I've also tried to @profile, however, julia libraries seem to be executed 
> the most.
>
> Venil
>
> On Wednesday, August 24, 2016 at 11:16:53 PM UTC-7, Venil Noronha wrote:
>>
>> I've just been able to @time the loop so far to see allocations at 
>> iteration level. I haven't yet tried @code_warntype; I'll probably do that 
>> next and see if I can get somewhere.
>>
>> Thanks,
>> Venil
>>
>> On Wednesday, August 24, 2016 at 5:37:17 PM UTC-7, Tim Holy wrote:
>>>
>>> What have you tried so far? See http://docs.julialang.org/en/latest/manual/ 
>>>
>>> performance-tips/#tools 
>>> , 
>>> esp. @code_warntype. 
>>>
>>> --Tim 
>>>
>>> On Wednesday, August 24, 2016 1:55:23 PM CDT Venil Noronha wrote: 
>>> > The following code seems to consume a lot of memory. Could anyone spot 
>>> what 
>>> > I'm doing wrong here? I'm also using the JuMP library. 
>>> > 
>>> > function initUtilityConstraint() 
>>> > c = categories[1] 
>>> > me = attack_methods[1] 
>>> > t = teams[1] 
>>> > tuple = Simulate.cmt(c, me, t) 
>>> > w = windows[1] 
>>> > r = resources[1] 
>>> > wrtuple = Simulate.wr(w, r) 
>>> > for ni in 1:size(list,1), c in categories,* f in flights* 
>>> > performloop(ni, c, f, tuple, wrtuple) 
>>> > end 
>>> > end 
>>> > 
>>> > function performloop(ni, c, f, tuple, wrtuple) 
>>> > fi = findfirst(flights, f) 
>>> > for w in windows, me in attack_methods 
>>> > tuple.c = c 
>>> > tuple.m = me 
>>> > total = 0.0 
>>> > for t in teams 
>>> > tuple.t = t 
>>> > strat = linearizeStrategyS(f, c, t, w, ni) 
>>> > total = total + effectiveness[tuple]*strat 
>>> > end 
>>> > 
>>> > total = ( total*(flight_vals[fi]*(-1)) + flight_vals[fi] ) 
>>> > 
>>> > for w2 in owindows, r2 in resources 
>>> > wrtuple.w = w2 
>>> > wrtuple.r = r2 
>>> > over = linearizeOverflow(w2, r2, ni) 
>>> > total = total - resource_fines[wrtuple]*over 
>>> > end 
>>> > # println(string( sc[c], "<=", ( total*(flight_vals[fi]*(-1)) 
>>> + 
>>> > flight_vals[fi] ))) 
>>> > @addConstraint(m, sc[c] <= total) 
>>> > end 
>>> > end 
>>> > 
>>> > Following are the stats for piece this code. Stats were recorded using 
>>> > @time. 
>>> > 
>>> > For 1 item in the flights array, it takes about 620KB to execute the 
>>> > performloop method - peak memory consumption by the program is 
>>> 8.84GBs. 
>>> > 2 flights - 1.02MB per iteration of performloop - peak 8.88GBs. 
>>> > 3 flights - 3.45MB - 9.60GBs 
>>> > 4 flights - 4.35MB - 10.24GBs 
>>> > 5 flights - 10.8MB - 15.63GBs 
>>> > 
>>> > It'd be great if someone could help me with this asap! 
>>> > 
>>> > Thanks. 
>>>
>>>
>>>

Re: [julia-users] Is the master algorithm on the roadmap?

2016-08-25 Thread Kevin Liu
Tim Holy, I am watching your keynote speech at JuliaCon 2016 where you 
mention the best optimization is not doing the computation at all. 

Domingos talks about that in his book, where an efficient kind of learning 
is by analogy, with no model at all, and how numerous scientific 
discoveries have been made that way, e.g. Bohr's analogy of the solar 
system to the atom. Analogizers learn by hypothesizing that entities with 
similar known properties have similar unknown ones. 

MLN can reproduce structure mapping, which is the more powerful type of 
analogy, that can make inferences from one domain (solar system) to another 
(atom). This can be done by learning formulas that don't refer to any of 
the specific relations in the source domain (general formulas). 

Seth and Tim have been helping me a lot with putting the pieces together 
for MLN in the repo I created , and 
more help is always welcome. I would like to write MLN in idiomatic Julia. 
My question at the moment to you and the community is how to keep mappings 
of first-order harmonic functions type-stable in Julia? I am just 
getting acquainted with the type field. 

On Tuesday, August 9, 2016 at 9:02:25 AM UTC-3, Kevin Liu wrote:
>
> Helping me separate the process in parts and priorities would be a lot of 
> help. 
>
> On Tuesday, August 9, 2016 at 8:41:03 AM UTC-3, Kevin Liu wrote:
>>
>> Tim Holy, what if I could tap into the well of knowledge that you are to 
>> speed up things? Can you imagine if every learner had to start without 
>> priors? 
>>
>> > On Aug 9, 2016, at 07:06, Tim Holy  wrote: 
>> > 
>> > I'd recommend starting by picking a very small project. For example, 
>> fix a bug 
>> > or implement a small improvement in a package that you already find 
>> useful or 
>> > interesting. That way you'll get some guidance while making a positive 
>> > contribution; once you know more about julia, it will be easier to see 
>> your 
>> > way forward. 
>> > 
>> > Best, 
>> > --Tim 
>> > 
>> >> On Monday, August 8, 2016 8:22:01 PM CDT Kevin Liu wrote: 
>> >> I have no idea where to start and where to finish. Founders' help 
>> would be 
>> >> wonderful. 
>> >> 
>> >>> On Tuesday, August 9, 2016 at 12:19:26 AM UTC-3, Kevin Liu wrote: 
>> >>> After which I have to code Felix into Julia, a relational optimizer 
>> for 
>> >>> statistical inference with Tuffy  
>> >>> inside, for enterprise settings. 
>> >>> 
>>  On Tuesday, August 9, 2016 at 12:07:32 AM UTC-3, Kevin Liu wrote: 
>>  Can I get tips on bringing Alchemy's optimized Tuffy 
>>   in Java to Julia while showing 
>> the 
>>  best of Julia? I am going for the most correct way, even if it means 
>>  coding 
>>  Tuffy into C and Julia. 
>>  
>> > On Sunday, August 7, 2016 at 8:34:37 PM UTC-3, Kevin Liu wrote: 
>> > I'll try to build it, compare it, and show it to you guys. I 
>> offered to 
>> > do this as work. I am waiting to see if they will accept it. 
>> > 
>> >> On Sunday, August 7, 2016 at 6:15:50 PM UTC-3, Stefan Karpinski 
>> wrote: 
>> >> Kevin, as previously requested by Isaiah, please take this to some 
>> >> other forum or maybe start a blog. 
>> >> 
>> >>> On Sat, Aug 6, 2016 at 10:53 PM, Kevin Liu  
>> wrote: 
>> >>> Symmetry-based learning, Domingos, 2014 
>> >>> 
>> https://www.microsoft.com/en-us/research/video/symmetry-based-learning 
>> >>> / 
>> >>> 
>> >>> Approach 2: Deep symmetry networks generalize convolutional 
>> neural 
>> >>> networks by tying parameters and pooling over an arbitrary 
>> symmetry 
>> >>> group, 
>> >>> not just the translation group. In preliminary experiments, they 
>> >>> outperformed convnets on a digit recognition task. 
>> >>> 
>>  On Friday, August 5, 2016 at 4:56:45 PM UTC-3, Kevin Liu wrote: 
>>  Minsky died of a cerebral hemorrhage at the age of 88.[40] 
>>   Ray 
>>  Kurzweil  says he 
>> was 
>>  contacted by the cryonics organization Alcor Life Extension 
>>  Foundation 
>>   
>>  seeking 
>>  Minsky's body.[41] 
>>  <
>> https://en.wikipedia.org/wiki/Marvin_Minsky#cite_note-Kurzweil-41> 
>>  Kurzweil believes that Minsky was cryonically preserved by Alcor 
>> and 
>>  will be revived by 2045.[41] 
>>  <
>> https://en.wikipedia.org/wiki/Marvin_Minsky#cite_note-Kurzweil-41> 
>>  Minsky 
>>  was a member of Alcor's Scientific Advisory Board 
>>  .[42] 
>>  <
>> https://en.wikipedia.org/wiki/Marvin_Minsky#cite_note-AlcorBoard-42> 
>>  

Re: [julia-users] Differential Equations Package

2016-08-25 Thread Chris Rackauckas
This has already been done. As of last night we have JuliaDiffEq 
 where we have moved Sundials and ODE. 
DifferentialEquations will follow soon, and I am talking with the owner of 
ODEInterface to see if that should go there as well (and if it should be 
expanded). 

If you have any ideas, open an issue on the Roadmap repo. We should find 
out what the other SDE/PDE packages are and coordinate efforts/APIs. The 
other SDE packages are pretty basic, and I don't think it would be useful 
to deal with simple things like StochasticEuler. Bridge.jl may be 
interesting: I know that it may need to be needed by DifferentialEquations 
for more easily implementing stochastic integral equations and a few high 
weak order methods, so it would be nice to pull it into the group. The idea 
would that others could do similar tasks easier if this is all coordinated 
together.

My goal is to have DifferentialEquations.jl wrap all of the solvers here. 
You can already use Sundials, ODEInterface, and ODE from 
DifferentialEquations. More coordination is likely required to make the PDE 
packages compatible (and I don't know of very many, JuliaFEM and HP-FEM?). 
Probably the toolings for making FEM meshes and things like that should 
spawn out to their own package and become more complete.  Of course, others 
will have their own reason for having compatible APIs.

I just setup a  unified Gitter . I 
think we should have the current ODE and DifferentialEquations Gitters 
merge to this JuliaDiffEq one so that way it will be easier to find help.

On Thursday, August 25, 2016 at 3:09:49 PM UTC-7, Christoph Ortner wrote:
>
> A separate organisation would be really welcome especially if it means 
> coordination of efforts on the development of DE-related work.
>


Re: [julia-users] Differential Equations Package

2016-08-25 Thread Christoph Ortner
A separate organisation would be really welcome especially if it means 
coordination of efforts on the development of DE-related work.


[julia-users] local "_" declared twice

2016-08-25 Thread Christoph Ortner
Is this intended behaviour or a bug? 

julia> maximum( t for (t,_,_) in zip(x,y,z) )
ERROR: syntax: local "_" declared twice


julia> x = rand(3); y = rand(3); z = rand(3);


julia> for (t, _, _) in zip(x, y, z)
  println(t)
  end
0.5059694701992228
0.6291609082858327
0.298657434448903


julia> maximum( t for (t,_,_) in zip(x,y,z) )
ERROR: syntax: local "_" declared twice






[julia-users] TK dependency woes

2016-08-25 Thread Lewis Levin
It is a bit beyond me to debug what follows.

My Python build works fine.  PyPlot within Julia works fine.

 I suspect the problem is with the ImageView package.

objc[34842]: Class TKApplication is implemented in both 
/Library/Frameworks/Tk.framework/Versions/8.5/Tk and /usr/lib/libtk.dylib. 
One of the two will be used. Which one is undefined.

objc[34842]: Class TKMenu is implemented in both 
/Library/Frameworks/Tk.framework/Versions/8.5/Tk and /usr/lib/libtk.dylib. 
One of the two will be used. Which one is undefined.

objc[34842]: Class TKContentView is implemented in both 
/Library/Frameworks/Tk.framework/Versions/8.5/Tk and /usr/lib/libtk.dylib. 
One of the two will be used. Which one is undefined.

objc[34842]: Class TKWindow is implemented in both 
/Library/Frameworks/Tk.framework/Versions/8.5/Tk and /usr/lib/libtk.dylib. 
One of the two will be used. Which one is undefined.

*ERROR: LoadError: LoadError: LoadError: LoadError: Tk.TclError("error 
initializing Tcl: Can't find a usable init.tcl in the following 
directories: \n
/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts 
/Applications/Julia-0.4.6.app/Contents/Resources/julia/lib/tcl8.5 
/Applications/Julia-0.4.6.app/Contents/Resources/lib/tcl8.5 
/Applications/Julia-0.4.6.app/Contents/Resources/julia/library 
/Applications/Julia-0.4.6.app/Contents/Resources/library 
/Applications/Julia-0.4.6.app/Contents/Resources/tcl8.5.9/library 
/Applications/Julia-0.4.6.app/Contents/tcl8.5.9/library\n\n/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/init.tcl:
 
version conflict for package \"Tcl\": have 8.5.9, need exactly 
8.5.17\nversion conflict for package \"Tcl\": have 8.5.9, need exactly 
8.5.17\nwhile executing\n\"package require -exact Tcl 8.5.17\"\n
(file 
\"/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/init.tcl\" 
line 19)\ninvoked from within\n\"source 
/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/init.tcl\"\n  
  (\"uplevel\" body line 1)\ninvoked from within\n\"uplevel #0 [list 
source \$tclfile]\"\n\n\nThis probably means that Tcl wasn't installed 
properly.\n")*

* in init at /Users/lewislevin/.julia/v0.4/Tk/src/tkwidget.jl:58*

* in include at 
/Applications/Julia-0.4.6.app/Contents/Resources/julia/lib/julia/sys.dylib*

* in include_from_node1 at 
/Applications/Julia-0.4.6.app/Contents/Resources/julia/lib/julia/sys.dylib*

* in include at 
/Applications/Julia-0.4.6.app/Contents/Resources/julia/lib/julia/sys.dylib*

* in include_from_node1 at 
/Applications/Julia-0.4.6.app/Contents/Resources/julia/lib/julia/sys.dylib*

* in require at 
/Applications/Julia-0.4.6.app/Contents/Resources/julia/lib/julia/sys.dylib*

* in include at 
/Applications/Julia-0.4.6.app/Contents/Resources/julia/lib/julia/sys.dylib*

* in include_from_node1 at 
/Applications/Julia-0.4.6.app/Contents/Resources/julia/lib/julia/sys.dylib*

* in require at 
/Applications/Julia-0.4.6.app/Contents/Resources/julia/lib/julia/sys.dylib*

* in include at 
/Applications/Julia-0.4.6.app/Contents/Resources/julia/lib/julia/sys.dylib*

* in include_from_node1 at 
/Applications/Julia-0.4.6.app/Contents/Resources/julia/lib/julia/sys.dylib*

*while loading /Users/lewislevin/.julia/v0.4/Tk/src/tkwidget.jl, in 
expression starting on line 454*

*while loading /Users/lewislevin/.julia/v0.4/Tk/src/Tk.jl, in expression 
starting on line 37*

*while loading /Users/lewislevin/.julia/v0.4/ImageView/src/ImageView.jl, in 
expression starting on line 14*

*while loading /Users/lewislevin/Dropbox/Online Coursework/Stanford Machine 
Learning/Assignments/julia-ex7/ex7.jl, in expression starting on line 23*


Re: [julia-users] Invalid history file (~/.julia_history) format

2016-08-25 Thread Andy Dobson
Ah, OK.  Seems odd.  

On Thursday, August 25, 2016 at 3:37:37 PM UTC+1, Kristoffer Carlsson wrote:
>
> On my work laptop and the school computers Julia always likes to put its 
> stuff in Z: which is the network drive. It means that students that try to 
> use Julia get really bad package experience because it is super slow to run 
> Pkg stuff on the network drive.



[julia-users] Re: another new 2D plotting library for Julia

2016-08-25 Thread Igor
Thanks Henri!  I will install julia 0.5 rc3 and use it for my internal 
testing. Before I worked on version 4


>

[julia-users] Re: ArrayFire.jl - GPU Programming in Julia

2016-08-25 Thread Deniz Yuret
Thanks for this great package Ranjan.  I'd like to contribute to the 
development -- in particular integration with CUDNN, CUSPARSE, etc. under 
the JuliaGPU ecosystem, if others have not started doing so already.  With 
CUDNN, for example, I wrapped the low level library code to use CudaArrays, 
then implemented a high level interface.  Do you see a problem using 
AFArrays in the same way using kernels from other libraries or custom 
kernels?  Also I am not sure about the right place for this cross library 
support: should it go under ArrayFire.jl or CUDNN.jl?

best,
deniz



On Monday, June 20, 2016 at 10:46:24 PM UTC+3, Kaj Wiik wrote:
>
>
> For anyone trying to get things working in Ubuntu (Xenial) environment...
>
> I could not get ArrayFire.jl working with the binary libraries, compiling 
> from source was quite easy and everything works now fine.
>
> On Friday, June 10, 2016 at 8:08:42 AM UTC+3, ran...@juliacomputing.com 
> wrote:
>>
>> Hello, 
>>
>> We are pleased to announce ArrayFire.jl, a library for GPU and 
>> heterogeneous computing in Julia: (
>> https://github.com/JuliaComputing/ArrayFire.jl). We look forward to your 
>> feedback and your contributions as well! 
>>
>> For more information, check out Julia Computing's latest blog post: 
>> http://juliacomputing.com/blog/2016/06/09/julia-gpu.html
>>
>> Thanks,
>> Ranjan
>> Julia Computing, Inc. 
>>
>

Re: [julia-users] Invalid history file (~/.julia_history) format

2016-08-25 Thread Andy Dobson
It's "M:" and "\\"

I don't know why that would be the case - this is an old network drive that 
I never use.  (I also didn't know how to look that up!)



On Thursday, August 25, 2016 at 1:58:34 PM UTC+1, Tony Kelman wrote:
>
> Looks like this is resolved now, but just for completeness, what are 
> ENV["HOMEDRIVE"] and ENV["HOMEPATH"] on your system?
>
> On Thursday, August 25, 2016 at 4:17:59 AM UTC-7, Andy Dobson wrote:
>>
>> Ah - no - I've got it!  Now it works!  Thank you all very much, 
>> especially Kristoffer!
>>
>>
>>
>> On Thursday, August 25, 2016 at 12:13:09 PM UTC+1, Andy Dobson wrote:
>>>
>>> It doesn't seem to. I've tried searching for %.julia_history% to get at 
>>> hidden files - is there some other trick to find it?
>>>
>>>
>>>
>>> On Thursday, August 25, 2016 at 11:56:22 AM UTC+1, Kristoffer Carlsson 
>>> wrote:

 Does that file exist? If so, removing it should fix your problems.

 On Thursday, August 25, 2016 at 12:54:31 PM UTC+2, Andy Dobson wrote:
>
> It says:
>
> "M:\\.julia_history"
>
> (This is not where the program files are written/held - they are on 
> the C-drive, and all outputs are written to a separate networked drive).  
>
> On Wednesday, August 24, 2016 at 6:05:27 PM UTC+1, Kristoffer Carlsson 
> wrote:
>>
>> What does it say when you run 
>>
>> Base.REPL.find_hist_file()
>>
>>
>>
>> On Wednesday, August 24, 2016 at 6:31:58 PM UTC+2, Andy Dobson wrote:
>>>
>>> I've uninstalled everything again, and I *think* I've deleted all 
>>> julia-related files, but when I re-install Julia I still get the same 
>>> error 
>>> message.  
>>>
>>>
>>> On Wednesday, August 24, 2016 at 1:12:25 PM UTC+1, Kristoffer 
>>> Carlsson wrote:

 It is likely "~/.juliarc" that is the file you are after.

 On Wednesday, August 24, 2016 at 11:47:16 AM UTC+2, Andy Dobson 
 wrote:
>
> Hi Kristoffer,
>
> I don't know if this is the right file 
> (/julia-0.4.6/etc/julia/juliarc), but this is what it says:
>
> # This file should contain site-specific commands to be executed 
> on Julia startup
> # Users should store their own personal commands in homedir(), in 
> a file named .juliarc.jl
>
> # Set up environment for Julia Windows binary distribution
> ENV["PATH"] = 
> JULIA_HOME*";"*joinpath(JULIA_HOME,"..","Git","bin")*";"*ENV["PATH"]
>
>
> Should there be more here? 
>
>
> On Wednesday, August 24, 2016 at 10:36:10 AM UTC+1, Kristoffer 
> Carlsson wrote:
>>
>> Maybe you can look into the .juliarc file at the line where it is 
>> telling you the error is and see if anything looks strange.
>>
>> On Wednesday, August 24, 2016 at 11:11:54 AM UTC+2, Andy Dobson 
>> wrote:
>>>
>>> No, it didn't create another one. I think you're right and I 
>>> didn't delete what Julia was looking for. But it seems very strange 
>>> that 
>>> this error message appeared without any sort of prompt - I'm not 
>>> doing 
>>> anything that I haven't been doing for the last 6 months.
>>>
>>>
>>> On Tuesday, August 23, 2016 at 1:51:54 PM UTC+1, Stefan 
>>> Karpinski wrote:

 That's strange. Did it create a ~/.julia_history file after you 
 deleted the old one? If so, what's in it?

 I wonder if the ~/.julia_history file you deleted was not the 
 one that Julia's looking at.

 On Tue, Aug 23, 2016 at 8:10 AM, Andy Dobson <
 a_d_m_...@hotmail.com> wrote:

> Hi All, 
>
> This morning when starting Julia 0.4.3 (which I've been using 
> daily since February) I received this error message : 
>
> -
> ERROR: Invalid history file (~/.julia_history) format: 
> If you have a history file left over from an older version of 
> Julia, 
> try renaming or deleting it. 
> Invalid character: '#' at line 465034 
>  in error at error.jl:22 
>
> - 
>
> A thread on this site ("PSA: new ~/.julia_history 
> format") suggested deleting the julia_history file. I tried 
> this, and it did not work. Next I uninstalled Julia and 
> re-installed the 
> latest (0.4.6) version. The error message is the same.   
>
> Can anybody suggest a solution? I'm running on Windows 7 
> Enterprise. 

Re: [julia-users] Invalid history file (~/.julia_history) format

2016-08-25 Thread Kristoffer Carlsson
On my work laptop and the school computers Julia always likes to put its stuff 
in Z: which is the network drive. It means that students that try to use Julia 
get really bad package experience because it is super slow to run Pkg stuff on 
the network drive.

Re: [julia-users] Invalid history file (~/.julia_history) format

2016-08-25 Thread Kristoffer Carlsson
I already made a PR for it. Sorry for stealing it.

Re: [julia-users] Invalid history file (~/.julia_history) format

2016-08-25 Thread Stefan Karpinski
I opened an issue to include the path of the .julia_history file in this
error: https://github.com/JuliaLang/julia/issues/18223. If anyone is
looking for a pretty easy way to get started contributing to Julia (make a
PR, get feedback, etc.) this is a nice easy intro issue :)

On Thu, Aug 25, 2016 at 8:58 AM, Tony Kelman  wrote:

> Looks like this is resolved now, but just for completeness, what are
> ENV["HOMEDRIVE"] and ENV["HOMEPATH"] on your system?
>
>
> On Thursday, August 25, 2016 at 4:17:59 AM UTC-7, Andy Dobson wrote:
>>
>> Ah - no - I've got it!  Now it works!  Thank you all very much,
>> especially Kristoffer!
>>
>>
>>
>> On Thursday, August 25, 2016 at 12:13:09 PM UTC+1, Andy Dobson wrote:
>>>
>>> It doesn't seem to. I've tried searching for %.julia_history% to get at
>>> hidden files - is there some other trick to find it?
>>>
>>>
>>>
>>> On Thursday, August 25, 2016 at 11:56:22 AM UTC+1, Kristoffer Carlsson
>>> wrote:

 Does that file exist? If so, removing it should fix your problems.

 On Thursday, August 25, 2016 at 12:54:31 PM UTC+2, Andy Dobson wrote:
>
> It says:
>
> "M:\\.julia_history"
>
> (This is not where the program files are written/held - they are on
> the C-drive, and all outputs are written to a separate networked drive).
>
> On Wednesday, August 24, 2016 at 6:05:27 PM UTC+1, Kristoffer Carlsson
> wrote:
>>
>> What does it say when you run
>>
>> Base.REPL.find_hist_file()
>>
>>
>>
>> On Wednesday, August 24, 2016 at 6:31:58 PM UTC+2, Andy Dobson wrote:
>>>
>>> I've uninstalled everything again, and I *think* I've deleted all
>>> julia-related files, but when I re-install Julia I still get the same 
>>> error
>>> message.
>>>
>>>
>>> On Wednesday, August 24, 2016 at 1:12:25 PM UTC+1, Kristoffer
>>> Carlsson wrote:

 It is likely "~/.juliarc" that is the file you are after.

 On Wednesday, August 24, 2016 at 11:47:16 AM UTC+2, Andy Dobson
 wrote:
>
> Hi Kristoffer,
>
> I don't know if this is the right file
> (/julia-0.4.6/etc/julia/juliarc), but this is what it says:
>
> # This file should contain site-specific commands to be executed
> on Julia startup
> # Users should store their own personal commands in homedir(), in
> a file named .juliarc.jl
>
> # Set up environment for Julia Windows binary distribution
> ENV["PATH"] = JULIA_HOME*";"*joinpath(JULIA_
> HOME,"..","Git","bin")*";"*ENV["PATH"]
>
>
> Should there be more here?
>
>
> On Wednesday, August 24, 2016 at 10:36:10 AM UTC+1, Kristoffer
> Carlsson wrote:
>>
>> Maybe you can look into the .juliarc file at the line where it is
>> telling you the error is and see if anything looks strange.
>>
>> On Wednesday, August 24, 2016 at 11:11:54 AM UTC+2, Andy Dobson
>> wrote:
>>>
>>> No, it didn't create another one. I think you're right and I
>>> didn't delete what Julia was looking for. But it seems very strange 
>>> that
>>> this error message appeared without any sort of prompt - I'm not 
>>> doing
>>> anything that I haven't been doing for the last 6 months.
>>>
>>>
>>> On Tuesday, August 23, 2016 at 1:51:54 PM UTC+1, Stefan
>>> Karpinski wrote:

 That's strange. Did it create a ~/.julia_history file after you
 deleted the old one? If so, what's in it?

 I wonder if the ~/.julia_history file you deleted was not the
 one that Julia's looking at.

 On Tue, Aug 23, 2016 at 8:10 AM, Andy Dobson <
 a_d_m_...@hotmail.com> wrote:

> Hi All,
>
> This morning when starting Julia 0.4.3 (which I've been using
> daily since February) I received this error message :
> 
> -
> ERROR: Invalid history file (~/.julia_history) format:
> If you have a history file left over from an older version of
> Julia,
> try renaming or deleting it.
> Invalid character: '#' at line 465034
>  in error at error.jl:22
> 
> -
>
> A thread on this site ("PSA: new ~/.julia_history
> format") suggested deleting the julia_history file. I tried
> this, and it did not work. Next I uninstalled Julia and 
> re-installed the
> latest (0.4.6) version. The error message is the same.
>
> Can 

Re: [julia-users] Re: Tab completion for sub-modules names

2016-08-25 Thread Stefan Karpinski
That's right. This has nothing to do with Fruit being a submodule and
everything about it being a binding in Food that's not exported and
therefore not part of Food's externally facing interface.

On Thu, Aug 25, 2016 at 3:03 AM, Yichao Yu  wrote:

>
>
> On Thu, Aug 25, 2016 at 2:50 PM, Tony Kelman  wrote:
>
>> What version of Julia are you on? My memory might be hazy but there's a
>> chance this has been implemented recently on master? If not, then this does
>> sound like it would be useful to implement.
>>
>
> I believe imported and unexported symbols are intentionally not included
> in the auto completion.
>
>
>>
>>
>>
>> On Wednesday, August 24, 2016 at 4:49:50 PM UTC-7, Miguel Goncalves wrote:
>>>
>>> In the Julia REPL if I have a super-module Food which loads in a
>>> sub-module Fruit,
>>>
>>> module Food
>>>
>>> using Fruit
>>>
>>> include("nutrition.jl")
>>> export carbohydrate
>>> export fat
>>> export protein
>>>
>>> end
>>>
>>> then pressing tab after typing,
>>>
>>> Food.
>>>
>>> I get the list,
>>>
>>> carbohydratefatprotein
>>>
>>> But the sub-module Fruit does not show up for tab completion. However,
>>> after manually typing,
>>>
>>> Food.Fruit.
>>>
>>> I do have tab completion for everything which is exported by the Fruit
>>> sub-module.
>>>
>>> Could this behavior be changed to support tab completion for sub-modules
>>> names? This will facilitate working with nested modules.
>>>
>>
>


[julia-users] Re: another new 2D plotting library for Julia

2016-08-25 Thread Henri Girard
and the last one 
QTSMain::runQT() start [/home/pi/julia/usr/bin/]
WARNING: bytestring(p::Union{Ptr{Int8},Ptr{UInt8}}) is deprecated, use 
unsafe_string(p) instead.


Le jeudi 25 août 2016 12:01:30 UTC+2, Igor a écrit :
>
> Hello! 
> I made another 2D plotting library for Julia. Please try to test it if you 
> have some free time. Current version works only for Windows7 x64, but I'm 
> planning to make everything work for Fedora Linux also. 
>
> It is located here: https://github.com/ig-or/qwtwplot
> you'll have to read its description before the installation. 
>
> It is based on underlying "C" library, which I used to use for data 
> analysis for many years, but now I tried to make a Julia package out of it. 
> I'm new to github, so your comments will be very appreciated. 
>
> Best regards, Igor
>
>
>
>
>
>
>
>

Re: [julia-users] Performant methods for enclosing parameters?

2016-08-25 Thread Yichao Yu
On Thu, Aug 25, 2016 at 5:19 PM, Chris Rackauckas 
wrote:

> Oh it's that same issue? Thanks for pointing it out. That means every one
> of my performance problems are due to the same issue... that's both a good
> thing and a bad thing I guess. So would your suggestion just be to move
> forward doing things like this, knowing that this issue will get fixed? If
> it will be possible to have good performance with closures on a type like
> that, then I'll be moving forward with a larger design change
> 
>  in
> hopes that it will improve. But right now I'm in limbo because I don't know
> what to do about this!
>

That's why I also linked the workaround.


>
> On Thursday, August 25, 2016 at 1:43:56 AM UTC-7, Yichao Yu wrote:
>
>>
>>
>> On Thu, Aug 25, 2016 at 4:12 PM, Chris Rackauckas 
>> wrote:
>>
>>> It seems like a closure on a non bitstype still has issues, or is there
>>> something wrong with doing this?
>>>
>>> immutable Params
>>>   α::Float64
>>> end
>>>
>>> function test()
>>>   h = (t,u,du,p) -> @inbounds begin
>>> du[1] = 1.01u[1]
>>> du[2] = p.α*u[2]
>>>   end
>>>   h2 = (t,u,du) -> @inbounds begin
>>> du[1] = 1.01u[1]
>>> du[2] = 1.0*u[2]
>>>   end
>>>   const u = [0.1,0.2]
>>>   const du = zeros(2)
>>>   const p = Params(1.0)
>>>   l = (t,u,du) -> h(t,u,du,p)
>>>   println("Pass In Parameters")
>>>   @code_native h(1.0,u,du,p)
>>>   println("No Parameters")
>>>   @code_native h2(1.0,u,du)
>>>   println("Closures")
>>>   @code_native l(1.0,u,du)
>>> end
>>> test()
>>>
>>> Pass In Parameters
>>> .text
>>> Filename: replacement_macros_tests.jl
>>> pushq %rbp
>>> movq %rsp, %rbp
>>> Source line: 29
>>> movq (%rdi), %rax
>>> movsd (%rax), %xmm0   # xmm0 = mem[0],zero
>>> movabsq $140006850762016, %rcx  # imm = 0x7F55E29B1520
>>> mulsd (%rcx), %xmm0
>>> movq (%rsi), %rcx
>>> movsd %xmm0, (%rcx)
>>> Source line: 30
>>> movsd (%rdx), %xmm0   # xmm0 = mem[0],zero
>>> mulsd 8(%rax), %xmm0
>>> movsd %xmm0, 8(%rcx)
>>> popq %rbp
>>> retq
>>>
>>> No Parameters
>>> .text
>>> Filename: replacement_macros_tests.jl
>>> pushq %rbp
>>> movq %rsp, %rbp
>>> Source line: 33
>>> movq (%rdi), %rax
>>> movsd (%rax), %xmm0   # xmm0 = mem[0],zero
>>> movabsq $140006850762144, %rcx  # imm = 0x7F55E29B15A0
>>> mulsd (%rcx), %xmm0
>>> movq (%rsi), %rcx
>>> movsd %xmm0, (%rcx)
>>> Source line: 34
>>> movq 8(%rax), %rax
>>> movq %rax, 8(%rcx)
>>> popq %rbp
>>> retq
>>> nopw (%rax,%rax)
>>>
>>>
>>> Closures
>>> .text
>>> Filename: replacement_macros_tests.jl
>>> pushq %rbp
>>> movq %rsp, %rbp
>>> pushq %r15
>>> pushq %r14
>>> pushq %r13
>>> pushq %r12
>>> pushq %rbx
>>> subq $72, %rsp
>>> movq %rdx, %r14
>>> movq %rsi, %r15
>>> movsd %xmm0, -112(%rbp)
>>> movabsq $140007647692112, %rbx  # imm = 0x7F56121B4550
>>> movq %fs:0, %r12
>>> addq $-2672, %r12# imm = 0xF590
>>> xorpd %xmm0, %xmm0
>>> movupd %xmm0, -64(%rbp)
>>> movupd %xmm0, -80(%rbp)
>>> movq $0, -48(%rbp)
>>> movq $12, -104(%rbp)
>>> movq (%r12), %rax
>>> movq %rax, -96(%rbp)
>>> leaq -104(%rbp), %rax
>>> movq %rax, (%r12)
>>> movq $0, -88(%rbp)
>>> Source line: 39
>>> movq (%rdi), %rax
>>> movq (%rax), %r13
>>> testq %r13, %r13
>>> je L232
>>> movq %r13, -88(%rbp)
>>> movq %rbx, -80(%rbp)
>>> movabsq $jl_gc_pool_alloc, %rax
>>> movl $1432, %esi # imm = 0x598
>>> movl $16, %edx
>>> movq %r12, %rdi
>>> callq *%rax
>>> addq $1072064, %rbx  # imm = 0x105BC0
>>> movq %rbx, -8(%rax)
>>> movsd -112(%rbp), %xmm0   # xmm0 = mem[0],zero
>>> movsd %xmm0, (%rax)
>>> movq %rax, -72(%rbp)
>>> movq %r15, -64(%rbp)
>>> movq %r14, -56(%rbp)
>>> movq %r13, -48(%rbp)
>>> movabsq $jl_apply_generic, %rax
>>> movl $5, %esi
>>> leaq -80(%rbp), %rdi
>>> callq *%rax
>>> movq -96(%rbp), %rax
>>> movq %rax, (%r12)
>>> addq $72, %rsp
>>> popq %rbx
>>> popq %r12
>>> popq %r13
>>> popq %r14
>>> popq %r15
>>> popq %rbp
>>> retq
>>> L232:
>>> addq $1448, %rbx # imm = 0x5A8
>>> movabsq $jl_throw, %rax
>>> movq %rbx, %rdi
>>> callq *%rax
>>> nop
>>>
>>>
>>> Clearly the 3rd method (using a closure on a parameter type) has a lot
>>> more steps. My untrained eye says that means it's bad... is that simple
>>> analysis wrong?
>>>
>>>
>> The issue is https://github.com/JuliaLang/julia/issues/15276 See
>> https://github.com/JuliaLang/julia/issues/17395#issuecomment-241911387
>> for a workaround that works for me most of the time.
>>
>>


[julia-users] Re: another new 2D plotting library for Julia

2016-08-25 Thread Henri Girard
You got it perfect :)
Workd like a charm ...
Just some deprecating warning... (I use julia 0.5 rc3 console for testing 
and ijulia for better reading )
I change @unix with @static is_unix()

Base.ASCIIString is deprecated, use String instead (I haven't found it yet)
Thanks a lot for sharing :)
Henri


Le jeudi 25 août 2016 12:01:30 UTC+2, Igor a écrit :
>
> Hello! 
> I made another 2D plotting library for Julia. Please try to test it if you 
> have some free time. Current version works only for Windows7 x64, but I'm 
> planning to make everything work for Fedora Linux also. 
>
> It is located here: https://github.com/ig-or/qwtwplot
> you'll have to read its description before the installation. 
>
> It is based on underlying "C" library, which I used to use for data 
> analysis for many years, but now I tried to make a Julia package out of it. 
> I'm new to github, so your comments will be very appreciated. 
>
> Best regards, Igor
>
>
>
>
>
>
>
>

[julia-users] Re: another new 2D plotting library for Julia

2016-08-25 Thread Igor
Henry,
I'll try to add this.
Best regards, Igor

четверг, 25 августа 2016 г., 14:04:28 UTC+3 пользователь Henri Girard 
написал:
>
> Hi,
> I tried compiling it on ubuntu xenial 16.04, following your description, 
> it works fine. I would like to have it being able to install in 
> -DCMAKE_INSTALL_PREFIX=/usr but it says that manually variables are not 
> used. Could you add it ?
> In between I will link it in /usr/bin if necessary
> Thanks 
> Henri
>
> Le jeudi 25 août 2016 12:01:30 UTC+2, Igor a écrit :
>>
>> Hello! 
>> I made another 2D plotting library for Julia. Please try to test it if 
>> you have some free time. Current version works only for Windows7 x64, but 
>> I'm planning to make everything work for Fedora Linux also. 
>>
>> It is located here: https://github.com/ig-or/qwtwplot
>> you'll have to read its description before the installation. 
>>
>> It is based on underlying "C" library, which I used to use for data 
>> analysis for many years, but now I tried to make a Julia package out of it. 
>> I'm new to github, so your comments will be very appreciated. 
>>
>> Best regards, Igor
>>
>>
>>
>>
>>
>>
>>
>>

[julia-users] Re: Avoiding duplicate code when defining concrete subtypes of an abstract type

2016-08-25 Thread Ralph Smith
If you don't need the flexible interrelations provided by J. Sarnoff's 
approach, you might use metaprogramming like this:

abstract Cash


function _validate(p::Cash)
p.b >= 100 && throw(ArgumentError("Too much..."))
(p.b < 0 || p.a < 0) && throw(ArgumentError("Cannot have negative 
amounts"))
end


macro make_currency(C)
esc(quote
  type $C <: Cash
a::Int64
b::Int64
function $C(a::Int64,b::Int64)
  this = new(a,b)
  _validate(this)
  this
end
  end
  # other boilerplate specific to C goes here
end)
end


for t = (:Usd,:Gbp,:Whole)
# show(macroexpand(:(@make_currency $t))) # for debugging
@eval @make_currency($t)
end

# specialize for the exceptional case:
function _validate(p::Whole)
p.a < 0 && throw(ArgumentError("Cannot have negative amounts"))
p.b != 0 && throw(ArgumentError("Must be whole amount"))
end






On Wednesday, August 24, 2016 at 1:35:19 PM UTC-4, Cliff wrote:
>
> As an example of what I mean, suppose that I'm trying to make a currency 
> type for various currencies:
>
> abstract cash
>
> type usd <: cash
>   a::Int64
>   b::Int64
>   function usd(a,b)
> b>=100 && error("Too much of smaller currency unit (over 99).")
> (b<0 || a<0) && error("Cannot have negative amounts.")
> new(a,b)
>   end
> end
> type gbp <: cash
>   a::Int64
>   b::Int64
>   function gbp(a,b)
> b>=100 && error("Too much of smaller currency unit (over 99).")
> (b<0 || a<0) && error("Cannot have negative amounts.")
> new(a,b)
>   end
> end
>
> function Base.(:+){T<:cash}(x::T, y::T)
>   total = 100x.a+100y.a+x.b+y.b
>   return T(div(total, 100), total%100)
> end
>
> I'm able to define addition once for any subtype of cash. On the other 
> hand, I have to write out a large amount of almost identical code each time 
> I want to define a new subtype of cash. Is there some way I can define this 
> once in an abstract manner (with any manually specified constructor 
> overriding the general one), so that we could have something like:
>
> abstract cash
> general type T <: cash
>   a::Int64
>   b::Int64
>   function T(a::Int64,b::Int64)
> b>=100 && error("Too much of smaller currency unit (over 99).")
> (b<0 || a<0) && error("Cannot have negative amounts.")
> new(a,b)
>   end
> end
>
> type usd <: cash end
> type gbp <: cash end
> type whole <: cash
>   function whole(a,b)
> a<0 && error("Cannot have negative amounts.")
> b != 0 && error("Must be whole amount.")
> new(a,b)
>   end
> end
>
>
>

Re: [julia-users] Invalid history file (~/.julia_history) format

2016-08-25 Thread Tony Kelman
Looks like this is resolved now, but just for completeness, what are 
ENV["HOMEDRIVE"] and ENV["HOMEPATH"] on your system?

On Thursday, August 25, 2016 at 4:17:59 AM UTC-7, Andy Dobson wrote:
>
> Ah - no - I've got it!  Now it works!  Thank you all very much, especially 
> Kristoffer!
>
>
>
> On Thursday, August 25, 2016 at 12:13:09 PM UTC+1, Andy Dobson wrote:
>>
>> It doesn't seem to. I've tried searching for %.julia_history% to get at 
>> hidden files - is there some other trick to find it?
>>
>>
>>
>> On Thursday, August 25, 2016 at 11:56:22 AM UTC+1, Kristoffer Carlsson 
>> wrote:
>>>
>>> Does that file exist? If so, removing it should fix your problems.
>>>
>>> On Thursday, August 25, 2016 at 12:54:31 PM UTC+2, Andy Dobson wrote:

 It says:

 "M:\\.julia_history"

 (This is not where the program files are written/held - they are on the 
 C-drive, and all outputs are written to a separate networked drive).  

 On Wednesday, August 24, 2016 at 6:05:27 PM UTC+1, Kristoffer Carlsson 
 wrote:
>
> What does it say when you run 
>
> Base.REPL.find_hist_file()
>
>
>
> On Wednesday, August 24, 2016 at 6:31:58 PM UTC+2, Andy Dobson wrote:
>>
>> I've uninstalled everything again, and I *think* I've deleted all 
>> julia-related files, but when I re-install Julia I still get the same 
>> error 
>> message.  
>>
>>
>> On Wednesday, August 24, 2016 at 1:12:25 PM UTC+1, Kristoffer 
>> Carlsson wrote:
>>>
>>> It is likely "~/.juliarc" that is the file you are after.
>>>
>>> On Wednesday, August 24, 2016 at 11:47:16 AM UTC+2, Andy Dobson 
>>> wrote:

 Hi Kristoffer,

 I don't know if this is the right file 
 (/julia-0.4.6/etc/julia/juliarc), but this is what it says:

 # This file should contain site-specific commands to be executed on 
 Julia startup
 # Users should store their own personal commands in homedir(), in a 
 file named .juliarc.jl

 # Set up environment for Julia Windows binary distribution
 ENV["PATH"] = 
 JULIA_HOME*";"*joinpath(JULIA_HOME,"..","Git","bin")*";"*ENV["PATH"]


 Should there be more here? 


 On Wednesday, August 24, 2016 at 10:36:10 AM UTC+1, Kristoffer 
 Carlsson wrote:
>
> Maybe you can look into the .juliarc file at the line where it is 
> telling you the error is and see if anything looks strange.
>
> On Wednesday, August 24, 2016 at 11:11:54 AM UTC+2, Andy Dobson 
> wrote:
>>
>> No, it didn't create another one. I think you're right and I 
>> didn't delete what Julia was looking for. But it seems very strange 
>> that 
>> this error message appeared without any sort of prompt - I'm not 
>> doing 
>> anything that I haven't been doing for the last 6 months.
>>
>>
>> On Tuesday, August 23, 2016 at 1:51:54 PM UTC+1, Stefan Karpinski 
>> wrote:
>>>
>>> That's strange. Did it create a ~/.julia_history file after you 
>>> deleted the old one? If so, what's in it?
>>>
>>> I wonder if the ~/.julia_history file you deleted was not the 
>>> one that Julia's looking at.
>>>
>>> On Tue, Aug 23, 2016 at 8:10 AM, Andy Dobson <
>>> a_d_m_...@hotmail.com> wrote:
>>>
 Hi All, 

 This morning when starting Julia 0.4.3 (which I've been using 
 daily since February) I received this error message : 

 -
 ERROR: Invalid history file (~/.julia_history) format: 
 If you have a history file left over from an older version of 
 Julia, 
 try renaming or deleting it. 
 Invalid character: '#' at line 465034 
  in error at error.jl:22 

 - 

 A thread on this site ("PSA: new ~/.julia_history 
 format") suggested deleting the julia_history file. I tried 
 this, and it did not work. Next I uninstalled Julia and 
 re-installed the 
 latest (0.4.6) version. The error message is the same.   

 Can anybody suggest a solution? I'm running on Windows 7 
 Enterprise. 

 Thanks 

 Andy


>>>

Re: [julia-users] Proposed solution for writing Enums

2016-08-25 Thread Stefan Karpinski
They're still fairly informal:

   - https://github.com/JuliaLang/julia/issues/12139
   - https://github.com/JuliaLang/julia/issues/14052
   - https://github.com/JuliaLang/julia/issues/16878
   - https://github.com/JuliaLang/julia/issues/17115

Basically an extended issue proposing a design to solve a particular
problem.

On Wed, Aug 24, 2016 at 9:06 AM, Brian Rogoff  wrote:

> What's an example of a good Julep? I did some searching and couldn't find
> much. Is there a document somewhere about
> writing and submitting Julia Enhancement Proposals?
>
> On Tuesday, August 23, 2016 at 11:09:25 AM UTC-7, Stefan Karpinski wrote:
>>
>> On Tue, Aug 23, 2016 at 12:39 PM, Brian Rogoff  wrote:
>>
>>> It's a bit surprising that Julia doesn't have built in enums and a
>>> case/switch form. I'm glad that there's open
>>> issue https://github.com/JuliaLang/julia/issues/5410
>>> 
>>> to address the lack of case/switch. Is there any hope that
>>> we may see these (or at least the built in case/switch) in 1.0?
>>>
>>
>> It's certainly possible. The best way to make it happen is to write a
>> good Julep for how case/switch should behave and once there's general
>> agreement on the plan, make a PR to implement it.
>>
>


Re: [julia-users] Recursive/Circular parametric types

2016-08-25 Thread Tim Holy
That seems likely to work, though obviously some operations will not be 
inferrable. You might be just as happy with

type PhylogenyNode
kind::Symbol   # :clade, etc.
from::PhyologenyEdge
to::Vector{PhylogenyEdge}
confidence::Float64
end

type PhylogenyEdge
kind::Symbol  # :branch, etc.
from::PhylogenyNode
to::PhylogenyNode
end

and then manually dispatching on "kind". Here, everything is inferrable.

A favorite trick (not my invention, of course) is to have root nodes point to 
themselves, so that you don't have to define a separate type for empty.

Something to consider seriously is using an established package like 
LightGraphs and storing any metadata separately. If you really want/need 
separate types for the different nodes, one advantage of this strategy is that 
at least graph traversal will be fast (inferrable)---it's only the metadata 
lookup that will be type-unstable.

--Tim

On Thursday, August 25, 2016 3:26:39 AM CDT Ben Ward wrote:
> Hi Tim,
> 
> That's a shame, I was hoping that doing the above would let me create
> several different concrete PhylogenyNode and PhylogenyEdge types, that can
> be used together. I guess since this is an abuse I have to pair one
> concrete PhylogenyEdge type with one concrete PhylogenyNode type? I
> wondered is a valid alternative to do something like this:
> 
> abstract AbstractNode
> abstract PhylogenyNode <: AbstractNode
> abstract NetworkNode <: AbstractNode
> abstract AbstractEdge
> abstract PhylogenyEdge <: AbstractEdge
> abstract NetworkEdge <: AbstractEdge
> 
> type Branch <: PhylogenyEdge
>from::PhylogenyNode
>to::PhylogenyNode
>length::Float64
> 
> function Branch()
>x = new()
>length!(x, -1.0)
>return x
>end
> end
> 
> type Clade <: PhylogenyNode
>from::PhylogenyEdge
>to::Vector{PhylogenyEdge}
>confidence::Float64
> 
> function Clade()
>x = new()
>x.to = Vector{PhylogenyEdge}()
>confidence!(x, -1.0)
>return x
>end
> end
> 
> And define getters and setters in such a way that type assertions make
> things certain for the compiler?
> I saw that Jeff proposed a similar solution in julia issue #269 to handle
> circular type declarations.
> 
> On Wednesday, August 24, 2016 at 4:11:06 PM UTC+1, Tim Holy wrote:
> > I don't think that's type-stable. Since each node of each tree will also
> > be a
> > different type, I also think you'll end up hating life due to compile
> > times.
> > There's some (peripherally) relevant discussion at
> > http://docs.julialang.org/
> > 
> > en/latest/manual/performance-tips/#the-dangers-of-abusing-multiple-dispatc
> > h-
> > 
> > aka-more-on-types-with-values-as-parameters
> >  
> > > of-abusing-multiple-dispatch-aka-more-on-types-with-values-as-parameters>
> > 
> > Best,
> > --Tim
> > 
> > On Tuesday, August 23, 2016 3:28:17 PM CDT Ben Ward wrote:
> > > I'm doing some development and wondered if this kind of pattern is
> > > problematic:
> > > 
> > > abstract AbstractNode
> > > abstract PhylogenyNode <: AbstractNode
> > > abstract NetworkNode <: AbstractNode
> > > abstract AbstractEdge
> > > abstract PhylogenyEdge <: AbstractEdge
> > > abstract NetworkEdge <: AbstractEdge
> > > 
> > > type Branch{N <: PhylogenyNode} <: PhylogenyEdge
> > > 
> > > from::N{Branch}
> > > to::N{Branch}
> > > length::Float64
> > > 
> > > function Branch{N}(::Type{N})
> > > 
> > > x = new()
> > > length!(x, -1.0)
> > > return x
> > > 
> > > end
> > > 
> > > end
> > > 
> > > type Clade{E <: PhylogenyEdge} <: PhylogenyNode
> > > 
> > > from::E
> > > to::Vector{E}
> > > confidence::Float64
> > > 
> > > function Clade{E}(::Type{E})
> > > 
> > > x = new()
> > > x.to = Vector{E}()
> > > confidence!(x, -1.0)
> > > return x
> > > 
> > > end
> > > 
> > > end
> > > 
> > > 
> > > 
> > > As you can see both concrete types are parametric, and as a result there
> > 
> > is
> > 
> > > a certain circularity to it
> > > Clade{Branch{Clade{Branch{Clade{Branch} That ultimately ends in
> > > something like Clade{Branch{N<:PhylogenyNode}}. I'd like to know if this
> > 
> > is
> > 
> > > type-certain or not - the fact it terminates in N<:PhylogenyNode or
> > > E<:PhylogenyEdge makes me doubt it.




[julia-users] Re: another new 2D plotting library for Julia

2016-08-25 Thread Henri Girard
Only figure 5and 6 are working correctly, other windows show only graphic 
coordonnees
Regards
Henri


julia> using qwtwplot

julia> qwtwStart() # start 'qwtwc' library

julia> # draw thin blue 'sinus':
   tMax = 10.
10.0

julia> t = Array(linspace(0.,tMax, 1));

julia> n = length(t)
1

julia> y = sin(t);

julia> qfigure(1); # "1" the number of the first plot window

julia> # parameters: 'x' and 'y' data vectors, then 'name of this line', 
then 'style description', then 'line width'
   qplot(t, y, "blue line", "-b", 1)
qplot: error #2
debug: 
 in traceit(::String) at ./REPL[28]:5
 in qplot(::Array{Float64,1}, ::Array{Float64,1}, ::String, ::String, 
::Int64, ::Int64) at ./REPL[34]:20
 in qplot(::Array{Float64,1}, ::Array{Float64,1}, ::String, ::String, 
::Int64) at ./REPL[35]:4
 in eval(::Module, ::Any) at ./boot.jl:234
 in eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./REPL.jl:64
 in macro expansion at ./REPL.jl:95 [inlined]
 in (::Base.REPL.##3#4{Base.REPL.REPLBackend})() at ./event.jl:68: error #2

julia> # add green thick another sinus:
   y = sin(t .* 4.) + cos(t * 0.8);

julia> qplot(t, y, "thick green line", "-g", 4) #'x' and 'y' data vectors, 
then 'name of this line', then 'style description', then 'line width'
qplot: error #2
debug: 
 in traceit(::String) at ./REPL[28]:5
 in qplot(::Array{Float64,1}, ::Array{Float64,1}, ::String, ::String, 
::Int64, ::Int64) at ./REPL[34]:20
 in qplot(::Array{Float64,1}, ::Array{Float64,1}, ::String, ::String, 
::Int64) at ./REPL[35]:4
 in eval(::Module, ::Any) at ./boot.jl:234
 in eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./REPL.jl:64
 in macro expansion at ./REPL.jl:95 [inlined]
 in (::Base.REPL.##3#4{Base.REPL.REPLBackend})() at ./event.jl:68: error #2

julia> qtitle("first plot window") # add a title for the first plot
ERROR: UndefVarError: Uint8 not defined
 in qtitle(::String) at ./REPL[41]:3

julia> qxlabel("time (in seconds)") # put a label on X axis
ERROR: UndefVarError: Uint8 not defined
 in qxlabel(::String) at ./REPL[39]:3

julia> qylabel("happiness") # put a label on Y axis
ERROR: UndefVarError: Uint8 not defined
 in qylabel(::String) at ./REPL[40]:3

julia> #= By default, "ZOOM" mode is active. This means that
   now you can select some part of the plot with left mouse 
button.
   Right mouse button will return you back to the previous 
state.
   And try mouse wheel also.
   Button with a "hand" - it's a "pan mode".  It will shift all 
the plots, but not change scale.
   "disk" button - allow you to save image to a file
   "[]" buttom means "make square axis" i.e. make equal scale 
for X and Y axis.
   Real magic is in left and right buttons; see below about it.
   =#

   # create another plot, with high frequency signal
   noise = rand(n)
1-element Array{Float64,1}:
 0.33081  
 0.0136264
 0.168943 
 0.430904 
 0.177114 
 0.62316  
 0.195568 
 0.351368 
 0.0451744
 0.0403399
 ⋮
 0.229808 
 0.523299 
 0.8082   
 0.0341024
 0.914545 
 0.111771 
 0.892335 
 0.845571 
 0.565631 

julia> y = sin(t * 100.) + noise
1-element Array{Float64,1}:
 0.33081 
 0.11347 
 0.367632
 0.726453
 0.566569
 1.10263 
 0.76026 
 0.995639
 0.762586
 0.823723
 ⋮   
 0.402396
 0.79337 
 1.17305 
 0.490094
 1.45712 
 0.735501
 1.59099 
 1.61217 
 1.39251 

julia> qfigure(2)

julia> qplot(t, y, "sinus + noise", "-m", 2)
qplot: error #2
debug: 
 in traceit(::String) at ./REPL[28]:5
 in qplot(::Array{Float64,1}, ::Array{Float64,1}, ::String, ::String, 
::Int64, ::Int64) at ./REPL[34]:20
 in qplot(::Array{Float64,1}, ::Array{Float64,1}, ::String, ::String, 
::Int64) at ./REPL[35]:4
 in eval(::Module, ::Any) at ./boot.jl:234
 in eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./REPL.jl:64
 in macro expansion at ./REPL.jl:95 [inlined]
 in (::Base.REPL.##3#4{Base.REPL.REPLBackend})() at ./event.jl:68: error #2

julia> qtitle("frequency test")
ERROR: UndefVarError: Uint8 not defined
 in qtitle(::String) at ./REPL[41]:3

julia> # what is the frequency of our signal from last window?
   # pless "f" button, on new small window select "sinus + noise",
   # select "4" from combo box and close this small window
   # after this "frequency" plot will be created

   # add another line to the first plot:
   t1 = Array(linspace(0.,10., 5))
5-element Array{Float64,1}:
  0.0
  2.5
  5.0
  7.5
 10.0

julia> y1 = cos(t1 * 0.5)
5-element Array{Float64,1}:
  1.0 
  0.315322
 -0.801144
 -0.820559
  0.283662

julia> qfigure(1); # switch back to the first plot

julia> # if we do not need the lines, only symbols:
   qplot1(t1, y1, "points and line", " eb",  30)
ERROR: UndefVarError: Uint8 not defined
 in qplot1(::Array{Float64,1}, ::Array{Float64,1}, ::String, ::String, 
::Int64) at ./REPL[36]:7

julia> # parameters: 'x' and 'y' data vectors, then 'name of this line',
# then 'style description', then 'line width', and 

Re: [julia-users] Re: another new 2D plotting library for Julia

2016-08-25 Thread Michele Zaffalon
Did you notice that Igor said Windows 7 x64 only for the moment?

On Thu, Aug 25, 2016 at 1:27 PM, Henri Girard  wrote:
> That's what I got in julia, I put the so lib in /usr/lib/
> The linux app qwtw is working properly.
>
>
>
> julia> using qwtwplot
> ERROR: LoadError: KeyError: key "ALLUSERSPROFILE" not found
>  in access_env(::Base.##339#340, ::String) at ./env.jl:45
>  in getindex(::Base.EnvHash, ::String) at ./env.jl:73
>  in include_from_node1(::String) at ./loading.jl:426
>  in eval(::Module, ::Any) at ./boot.jl:234
>  in require(::Symbol) at ./loading.jl:357
> while loading /home/pi/.julia/v0.5/qwtwplot/src/qwtwplot.jl, in expression
> starting on line 4
>
> julia> Pkg.clone("https://github.com/ig-or/qwtwplot;)
> INFO: Cloning qwtwplot from https://github.com/ig-or/qwtwplot
> ERROR: qwtwplot already exists
>  in clone(::String, ::SubString{String}) at ./pkg/entry.jl:193
>  in clone(::String) at ./pkg/entry.jl:221
>  in
> (::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#clone,Tuple{String}})()
> at ./pkg/dir.jl:31
>  in
> cd(::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#clone,Tuple{String}},
> ::String) at ./file.jl:59
>  in #cd#1(::Array{Any,1}, ::Function, ::Function, ::String, ::Vararg{Any,N})
> at ./pkg/dir.jl:31
>  in clone(::String) at ./pkg/pkg.jl:151
>
> julia> Pkg.checkout("qwtwplot")
> INFO: Checking out qwtwplot master...
> INFO: Pulling qwtwplot latest master...
> INFO: No packages to install, update or remove
>
> julia> using qwtwplot
>
> julia> using qwtwplot
>
> julia> qwtwStart() # start 'qwtwc' library
> ERROR: UndefVarError: qwtwStart not defined
>
> julia> # draw thin blue 'sinus':
>tMax = 10.
> 10.0
>
> julia> t = Array(linspace(0.,tMax, 1));
>
> julia> n = length(t)
> 1
>
> julia> y = sin(t);
>
> julia> qfigure(1); # "1" the number of the first plot window
> ERROR: UndefVarError: qfigure not defined
>
> julia> # parameters: 'x' and 'y' data vectors, then 'name of this line',
> then 'style description', then 'line width'
>qplot(t, y, "blue line", "-b", 1)
> ERROR: UndefVarError: qplot not defined
>
> julia>
>
>
> Le jeudi 25 août 2016 12:01:30 UTC+2, Igor a écrit :
>>
>> Hello!
>> I made another 2D plotting library for Julia. Please try to test it if you
>> have some free time. Current version works only for Windows7 x64, but I'm
>> planning to make everything work for Fedora Linux also.
>>
>> It is located here: https://github.com/ig-or/qwtwplot
>> you'll have to read its description before the installation.
>>
>> It is based on underlying "C" library, which I used to use for data
>> analysis for many years, but now I tried to make a Julia package out of it.
>> I'm new to github, so your comments will be very appreciated.
>>
>> Best regards, Igor
>>
>>
>>
>>
>>
>>
>>
>


[julia-users] Re: another new 2D plotting library for Julia

2016-08-25 Thread Henri Girard
That's what I got in julia, I put the so lib in /usr/lib/
The linux app qwtw is working properly.



julia> using qwtwplot
ERROR: LoadError: KeyError: key "ALLUSERSPROFILE" not found
 in access_env(::Base.##339#340, ::String) at ./env.jl:45
 in getindex(::Base.EnvHash, ::String) at ./env.jl:73
 in include_from_node1(::String) at ./loading.jl:426
 in eval(::Module, ::Any) at ./boot.jl:234
 in require(::Symbol) at ./loading.jl:357
while loading /home/pi/.julia/v0.5/qwtwplot/src/qwtwplot.jl, in expression 
starting on line 4

julia> Pkg.clone("https://github.com/ig-or/qwtwplot;)
INFO: Cloning qwtwplot from https://github.com/ig-or/qwtwplot
ERROR: qwtwplot already exists
 in clone(::String, ::SubString{String}) at ./pkg/entry.jl:193
 in clone(::String) at ./pkg/entry.jl:221
 in 
(::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#clone,Tuple{String}})() 
at ./pkg/dir.jl:31
 in 
cd(::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#clone,Tuple{String}}, 
::String) at ./file.jl:59
 in #cd#1(::Array{Any,1}, ::Function, ::Function, ::String, 
::Vararg{Any,N}) at ./pkg/dir.jl:31
 in clone(::String) at ./pkg/pkg.jl:151

julia> Pkg.checkout("qwtwplot")
INFO: Checking out qwtwplot master...
INFO: Pulling qwtwplot latest master...
INFO: No packages to install, update or remove

julia> using qwtwplot

julia> using qwtwplot

julia> qwtwStart() # start 'qwtwc' library
ERROR: UndefVarError: qwtwStart not defined

julia> # draw thin blue 'sinus':
   tMax = 10.
10.0

julia> t = Array(linspace(0.,tMax, 1));

julia> n = length(t)
1

julia> y = sin(t);

julia> qfigure(1); # "1" the number of the first plot window
ERROR: UndefVarError: qfigure not defined

julia> # parameters: 'x' and 'y' data vectors, then 'name of this line', 
then 'style description', then 'line width'
   qplot(t, y, "blue line", "-b", 1)
ERROR: UndefVarError: qplot not defined

julia> 


Le jeudi 25 août 2016 12:01:30 UTC+2, Igor a écrit :
>
> Hello! 
> I made another 2D plotting library for Julia. Please try to test it if you 
> have some free time. Current version works only for Windows7 x64, but I'm 
> planning to make everything work for Fedora Linux also. 
>
> It is located here: https://github.com/ig-or/qwtwplot
> you'll have to read its description before the installation. 
>
> It is based on underlying "C" library, which I used to use for data 
> analysis for many years, but now I tried to make a Julia package out of it. 
> I'm new to github, so your comments will be very appreciated. 
>
> Best regards, Igor
>
>
>
>
>
>
>
>

Re: [julia-users] Invalid history file (~/.julia_history) format

2016-08-25 Thread Andy Dobson
Ah - no - I've got it!  Now it works!  Thank you all very much, especially 
Kristoffer!



On Thursday, August 25, 2016 at 12:13:09 PM UTC+1, Andy Dobson wrote:
>
> It doesn't seem to. I've tried searching for %.julia_history% to get at 
> hidden files - is there some other trick to find it?
>
>
>
> On Thursday, August 25, 2016 at 11:56:22 AM UTC+1, Kristoffer Carlsson 
> wrote:
>>
>> Does that file exist? If so, removing it should fix your problems.
>>
>> On Thursday, August 25, 2016 at 12:54:31 PM UTC+2, Andy Dobson wrote:
>>>
>>> It says:
>>>
>>> "M:\\.julia_history"
>>>
>>> (This is not where the program files are written/held - they are on the 
>>> C-drive, and all outputs are written to a separate networked drive).  
>>>
>>> On Wednesday, August 24, 2016 at 6:05:27 PM UTC+1, Kristoffer Carlsson 
>>> wrote:

 What does it say when you run 

 Base.REPL.find_hist_file()



 On Wednesday, August 24, 2016 at 6:31:58 PM UTC+2, Andy Dobson wrote:
>
> I've uninstalled everything again, and I *think* I've deleted all 
> julia-related files, but when I re-install Julia I still get the same 
> error 
> message.  
>
>
> On Wednesday, August 24, 2016 at 1:12:25 PM UTC+1, Kristoffer Carlsson 
> wrote:
>>
>> It is likely "~/.juliarc" that is the file you are after.
>>
>> On Wednesday, August 24, 2016 at 11:47:16 AM UTC+2, Andy Dobson wrote:
>>>
>>> Hi Kristoffer,
>>>
>>> I don't know if this is the right file 
>>> (/julia-0.4.6/etc/julia/juliarc), but this is what it says:
>>>
>>> # This file should contain site-specific commands to be executed on 
>>> Julia startup
>>> # Users should store their own personal commands in homedir(), in a 
>>> file named .juliarc.jl
>>>
>>> # Set up environment for Julia Windows binary distribution
>>> ENV["PATH"] = 
>>> JULIA_HOME*";"*joinpath(JULIA_HOME,"..","Git","bin")*";"*ENV["PATH"]
>>>
>>>
>>> Should there be more here? 
>>>
>>>
>>> On Wednesday, August 24, 2016 at 10:36:10 AM UTC+1, Kristoffer 
>>> Carlsson wrote:

 Maybe you can look into the .juliarc file at the line where it is 
 telling you the error is and see if anything looks strange.

 On Wednesday, August 24, 2016 at 11:11:54 AM UTC+2, Andy Dobson 
 wrote:
>
> No, it didn't create another one. I think you're right and I 
> didn't delete what Julia was looking for. But it seems very strange 
> that 
> this error message appeared without any sort of prompt - I'm not 
> doing 
> anything that I haven't been doing for the last 6 months.
>
>
> On Tuesday, August 23, 2016 at 1:51:54 PM UTC+1, Stefan Karpinski 
> wrote:
>>
>> That's strange. Did it create a ~/.julia_history file after you 
>> deleted the old one? If so, what's in it?
>>
>> I wonder if the ~/.julia_history file you deleted was not the one 
>> that Julia's looking at.
>>
>> On Tue, Aug 23, 2016 at 8:10 AM, Andy Dobson <
>> a_d_m_...@hotmail.com> wrote:
>>
>>> Hi All, 
>>>
>>> This morning when starting Julia 0.4.3 (which I've been using 
>>> daily since February) I received this error message : 
>>> -
>>> ERROR: Invalid history file (~/.julia_history) format: 
>>> If you have a history file left over from an older version of 
>>> Julia, 
>>> try renaming or deleting it. 
>>> Invalid character: '#' at line 465034 
>>>  in error at error.jl:22 
>>>
>>> - 
>>>
>>> A thread on this site ("PSA: new ~/.julia_history 
>>> format") suggested deleting the julia_history file. I tried 
>>> this, and it did not work. Next I uninstalled Julia and 
>>> re-installed the 
>>> latest (0.4.6) version. The error message is the same.   
>>>
>>> Can anybody suggest a solution? I'm running on Windows 7 
>>> Enterprise. 
>>>
>>> Thanks 
>>>
>>> Andy
>>>
>>>
>>

Re: [julia-users] Invalid history file (~/.julia_history) format

2016-08-25 Thread Andy Dobson
It doesn't seem to. I've tried searching for %.julia_history% to get at 
hidden files - is there some other trick to find it?



On Thursday, August 25, 2016 at 11:56:22 AM UTC+1, Kristoffer Carlsson 
wrote:
>
> Does that file exist? If so, removing it should fix your problems.
>
> On Thursday, August 25, 2016 at 12:54:31 PM UTC+2, Andy Dobson wrote:
>>
>> It says:
>>
>> "M:\\.julia_history"
>>
>> (This is not where the program files are written/held - they are on the 
>> C-drive, and all outputs are written to a separate networked drive).  
>>
>> On Wednesday, August 24, 2016 at 6:05:27 PM UTC+1, Kristoffer Carlsson 
>> wrote:
>>>
>>> What does it say when you run 
>>>
>>> Base.REPL.find_hist_file()
>>>
>>>
>>>
>>> On Wednesday, August 24, 2016 at 6:31:58 PM UTC+2, Andy Dobson wrote:

 I've uninstalled everything again, and I *think* I've deleted all 
 julia-related files, but when I re-install Julia I still get the same 
 error 
 message.  


 On Wednesday, August 24, 2016 at 1:12:25 PM UTC+1, Kristoffer Carlsson 
 wrote:
>
> It is likely "~/.juliarc" that is the file you are after.
>
> On Wednesday, August 24, 2016 at 11:47:16 AM UTC+2, Andy Dobson wrote:
>>
>> Hi Kristoffer,
>>
>> I don't know if this is the right file 
>> (/julia-0.4.6/etc/julia/juliarc), but this is what it says:
>>
>> # This file should contain site-specific commands to be executed on 
>> Julia startup
>> # Users should store their own personal commands in homedir(), in a 
>> file named .juliarc.jl
>>
>> # Set up environment for Julia Windows binary distribution
>> ENV["PATH"] = 
>> JULIA_HOME*";"*joinpath(JULIA_HOME,"..","Git","bin")*";"*ENV["PATH"]
>>
>>
>> Should there be more here? 
>>
>>
>> On Wednesday, August 24, 2016 at 10:36:10 AM UTC+1, Kristoffer 
>> Carlsson wrote:
>>>
>>> Maybe you can look into the .juliarc file at the line where it is 
>>> telling you the error is and see if anything looks strange.
>>>
>>> On Wednesday, August 24, 2016 at 11:11:54 AM UTC+2, Andy Dobson 
>>> wrote:

 No, it didn't create another one. I think you're right and I didn't 
 delete what Julia was looking for. But it seems very strange that this 
 error message appeared without any sort of prompt - I'm not doing 
 anything 
 that I haven't been doing for the last 6 months.


 On Tuesday, August 23, 2016 at 1:51:54 PM UTC+1, Stefan Karpinski 
 wrote:
>
> That's strange. Did it create a ~/.julia_history file after you 
> deleted the old one? If so, what's in it?
>
> I wonder if the ~/.julia_history file you deleted was not the one 
> that Julia's looking at.
>
> On Tue, Aug 23, 2016 at 8:10 AM, Andy Dobson <
> a_d_m_...@hotmail.com> wrote:
>
>> Hi All, 
>>
>> This morning when starting Julia 0.4.3 (which I've been using 
>> daily since February) I received this error message : 
>> -
>> ERROR: Invalid history file (~/.julia_history) format: 
>> If you have a history file left over from an older version of 
>> Julia, 
>> try renaming or deleting it. 
>> Invalid character: '#' at line 465034 
>>  in error at error.jl:22 
>> - 
>>
>> A thread on this site ("PSA: new ~/.julia_history 
>> format") suggested deleting the julia_history file. I tried 
>> this, and it did not work. Next I uninstalled Julia and re-installed 
>> the 
>> latest (0.4.6) version. The error message is the same.   
>>
>> Can anybody suggest a solution? I'm running on Windows 7 
>> Enterprise. 
>>
>> Thanks 
>>
>> Andy
>>
>>
>

[julia-users] Re: another new 2D plotting library for Julia

2016-08-25 Thread Henri Girard
Hi,
I tried compiling it on ubuntu xenial 16.04, following your description, it 
works fine. I would like to have it being able to install in 
-DCMAKE_INSTALL_PREFIX=/usr but it says that manually variables are not 
used. Could you add it ?
In between I will link it in /usr/bin if necessary
Thanks 
Henri

Le jeudi 25 août 2016 12:01:30 UTC+2, Igor a écrit :
>
> Hello! 
> I made another 2D plotting library for Julia. Please try to test it if you 
> have some free time. Current version works only for Windows7 x64, but I'm 
> planning to make everything work for Fedora Linux also. 
>
> It is located here: https://github.com/ig-or/qwtwplot
> you'll have to read its description before the installation. 
>
> It is based on underlying "C" library, which I used to use for data 
> analysis for many years, but now I tried to make a Julia package out of it. 
> I'm new to github, so your comments will be very appreciated. 
>
> Best regards, Igor
>
>
>
>
>
>
>
>

Re: [julia-users] Invalid history file (~/.julia_history) format

2016-08-25 Thread Kristoffer Carlsson
Does that file exist? If so, removing it should fix your problems.

On Thursday, August 25, 2016 at 12:54:31 PM UTC+2, Andy Dobson wrote:
>
> It says:
>
> "M:\\.julia_history"
>
> (This is not where the program files are written/held - they are on the 
> C-drive, and all outputs are written to a separate networked drive).  
>
> On Wednesday, August 24, 2016 at 6:05:27 PM UTC+1, Kristoffer Carlsson 
> wrote:
>>
>> What does it say when you run 
>>
>> Base.REPL.find_hist_file()
>>
>>
>>
>> On Wednesday, August 24, 2016 at 6:31:58 PM UTC+2, Andy Dobson wrote:
>>>
>>> I've uninstalled everything again, and I *think* I've deleted all 
>>> julia-related files, but when I re-install Julia I still get the same error 
>>> message.  
>>>
>>>
>>> On Wednesday, August 24, 2016 at 1:12:25 PM UTC+1, Kristoffer Carlsson 
>>> wrote:

 It is likely "~/.juliarc" that is the file you are after.

 On Wednesday, August 24, 2016 at 11:47:16 AM UTC+2, Andy Dobson wrote:
>
> Hi Kristoffer,
>
> I don't know if this is the right file 
> (/julia-0.4.6/etc/julia/juliarc), but this is what it says:
>
> # This file should contain site-specific commands to be executed on 
> Julia startup
> # Users should store their own personal commands in homedir(), in a 
> file named .juliarc.jl
>
> # Set up environment for Julia Windows binary distribution
> ENV["PATH"] = 
> JULIA_HOME*";"*joinpath(JULIA_HOME,"..","Git","bin")*";"*ENV["PATH"]
>
>
> Should there be more here? 
>
>
> On Wednesday, August 24, 2016 at 10:36:10 AM UTC+1, Kristoffer 
> Carlsson wrote:
>>
>> Maybe you can look into the .juliarc file at the line where it is 
>> telling you the error is and see if anything looks strange.
>>
>> On Wednesday, August 24, 2016 at 11:11:54 AM UTC+2, Andy Dobson wrote:
>>>
>>> No, it didn't create another one. I think you're right and I didn't 
>>> delete what Julia was looking for. But it seems very strange that this 
>>> error message appeared without any sort of prompt - I'm not doing 
>>> anything 
>>> that I haven't been doing for the last 6 months.
>>>
>>>
>>> On Tuesday, August 23, 2016 at 1:51:54 PM UTC+1, Stefan Karpinski 
>>> wrote:

 That's strange. Did it create a ~/.julia_history file after you 
 deleted the old one? If so, what's in it?

 I wonder if the ~/.julia_history file you deleted was not the one 
 that Julia's looking at.

 On Tue, Aug 23, 2016 at 8:10 AM, Andy Dobson  wrote:

> Hi All, 
>
> This morning when starting Julia 0.4.3 (which I've been using 
> daily since February) I received this error message : 
> -
> ERROR: Invalid history file (~/.julia_history) format: 
> If you have a history file left over from an older version of 
> Julia, 
> try renaming or deleting it. 
> Invalid character: '#' at line 465034 
>  in error at error.jl:22 
> - 
>
> A thread on this site ("PSA: new ~/.julia_history 
> format") suggested deleting the julia_history file. I tried this, 
> and it did not work. Next I uninstalled Julia and re-installed the 
> latest 
> (0.4.6) version. The error message is the same.   
>
> Can anybody suggest a solution? I'm running on Windows 7 
> Enterprise. 
>
> Thanks 
>
> Andy
>
>


Re: [julia-users] Invalid history file (~/.julia_history) format

2016-08-25 Thread Andy Dobson
It says:

"M:\\.julia_history"

(This is not where the program files are written/held - they are on the 
C-drive, and all outputs are written to a separate networked drive).  

On Wednesday, August 24, 2016 at 6:05:27 PM UTC+1, Kristoffer Carlsson 
wrote:
>
> What does it say when you run 
>
> Base.REPL.find_hist_file()
>
>
>
> On Wednesday, August 24, 2016 at 6:31:58 PM UTC+2, Andy Dobson wrote:
>>
>> I've uninstalled everything again, and I *think* I've deleted all 
>> julia-related files, but when I re-install Julia I still get the same error 
>> message.  
>>
>>
>> On Wednesday, August 24, 2016 at 1:12:25 PM UTC+1, Kristoffer Carlsson 
>> wrote:
>>>
>>> It is likely "~/.juliarc" that is the file you are after.
>>>
>>> On Wednesday, August 24, 2016 at 11:47:16 AM UTC+2, Andy Dobson wrote:

 Hi Kristoffer,

 I don't know if this is the right file 
 (/julia-0.4.6/etc/julia/juliarc), but this is what it says:

 # This file should contain site-specific commands to be executed on 
 Julia startup
 # Users should store their own personal commands in homedir(), in a 
 file named .juliarc.jl

 # Set up environment for Julia Windows binary distribution
 ENV["PATH"] = 
 JULIA_HOME*";"*joinpath(JULIA_HOME,"..","Git","bin")*";"*ENV["PATH"]


 Should there be more here? 


 On Wednesday, August 24, 2016 at 10:36:10 AM UTC+1, Kristoffer Carlsson 
 wrote:
>
> Maybe you can look into the .juliarc file at the line where it is 
> telling you the error is and see if anything looks strange.
>
> On Wednesday, August 24, 2016 at 11:11:54 AM UTC+2, Andy Dobson wrote:
>>
>> No, it didn't create another one. I think you're right and I didn't 
>> delete what Julia was looking for. But it seems very strange that this 
>> error message appeared without any sort of prompt - I'm not doing 
>> anything 
>> that I haven't been doing for the last 6 months.
>>
>>
>> On Tuesday, August 23, 2016 at 1:51:54 PM UTC+1, Stefan Karpinski 
>> wrote:
>>>
>>> That's strange. Did it create a ~/.julia_history file after you 
>>> deleted the old one? If so, what's in it?
>>>
>>> I wonder if the ~/.julia_history file you deleted was not the one 
>>> that Julia's looking at.
>>>
>>> On Tue, Aug 23, 2016 at 8:10 AM, Andy Dobson  
>>> wrote:
>>>
 Hi All, 

 This morning when starting Julia 0.4.3 (which I've been using daily 
 since February) I received this error message : 
 -
 ERROR: Invalid history file (~/.julia_history) format: 
 If you have a history file left over from an older version of 
 Julia, 
 try renaming or deleting it. 
 Invalid character: '#' at line 465034 
  in error at error.jl:22 
 - 

 A thread on this site ("PSA: new ~/.julia_history 
 format") suggested deleting the julia_history file. I tried this, 
 and it did not work. Next I uninstalled Julia and re-installed the 
 latest 
 (0.4.6) version. The error message is the same.   

 Can anybody suggest a solution? I'm running on Windows 7 
 Enterprise. 

 Thanks 

 Andy


>>>

Re: [julia-users] Recursive/Circular parametric types

2016-08-25 Thread Ben Ward
Hi Tim,

That's a shame, I was hoping that doing the above would let me create 
several different concrete PhylogenyNode and PhylogenyEdge types, that can 
be used together. I guess since this is an abuse I have to pair one 
concrete PhylogenyEdge type with one concrete PhylogenyNode type? I 
wondered is a valid alternative to do something like this:

abstract AbstractNode
abstract PhylogenyNode <: AbstractNode
abstract NetworkNode <: AbstractNode
abstract AbstractEdge
abstract PhylogenyEdge <: AbstractEdge
abstract NetworkEdge <: AbstractEdge

type Branch <: PhylogenyEdge
   from::PhylogenyNode
   to::PhylogenyNode
   length::Float64

function Branch()
   x = new()
   length!(x, -1.0)
   return x
   end
end

type Clade <: PhylogenyNode
   from::PhylogenyEdge
   to::Vector{PhylogenyEdge}
   confidence::Float64

function Clade()
   x = new()
   x.to = Vector{PhylogenyEdge}()
   confidence!(x, -1.0)
   return x
   end
end

And define getters and setters in such a way that type assertions make 
things certain for the compiler?
I saw that Jeff proposed a similar solution in julia issue #269 to handle 
circular type declarations.




On Wednesday, August 24, 2016 at 4:11:06 PM UTC+1, Tim Holy wrote:
>
> I don't think that's type-stable. Since each node of each tree will also 
> be a 
> different type, I also think you'll end up hating life due to compile 
> times. 
> There's some (peripherally) relevant discussion at http://docs.julialang.org/ 
>
> en/latest/manual/performance-tips/#the-dangers-of-abusing-multiple-dispatch- 
>
> aka-more-on-types-with-values-as-parameters 
> 
>  
>
> Best, 
> --Tim 
>
> On Tuesday, August 23, 2016 3:28:17 PM CDT Ben Ward wrote: 
> > I'm doing some development and wondered if this kind of pattern is 
> > problematic: 
> > 
> > abstract AbstractNode 
> > abstract PhylogenyNode <: AbstractNode 
> > abstract NetworkNode <: AbstractNode 
> > abstract AbstractEdge 
> > abstract PhylogenyEdge <: AbstractEdge 
> > abstract NetworkEdge <: AbstractEdge 
> > 
> > type Branch{N <: PhylogenyNode} <: PhylogenyEdge 
> > from::N{Branch} 
> > to::N{Branch} 
> > length::Float64 
> > 
> > function Branch{N}(::Type{N}) 
> > x = new() 
> > length!(x, -1.0) 
> > return x 
> > end 
> > end 
> > 
> > type Clade{E <: PhylogenyEdge} <: PhylogenyNode 
> > from::E 
> > to::Vector{E} 
> > confidence::Float64 
> > 
> > function Clade{E}(::Type{E}) 
> > x = new() 
> > x.to = Vector{E}() 
> > confidence!(x, -1.0) 
> > return x 
> > end 
> > end 
> > 
> > 
> > 
> > As you can see both concrete types are parametric, and as a result there 
> is 
> > a certain circularity to it 
> > Clade{Branch{Clade{Branch{Clade{Branch} That ultimately ends in 
> > something like Clade{Branch{N<:PhylogenyNode}}. I'd like to know if this 
> is 
> > type-certain or not - the fact it terminates in N<:PhylogenyNode or 
> > E<:PhylogenyEdge makes me doubt it. 
>
>
>

[julia-users] another new 2D plotting library for Julia

2016-08-25 Thread Igor
Hello! 
I made another 2D plotting library for Julia. Please try to test it if you 
have some free time. Current version works only for Windows7 x64, but I'm 
planning to make everything work for Fedora Linux also. 

It is located here: https://github.com/ig-or/qwtwplot
you'll have to read its description before the installation. 

It is based on underlying "C" library, which I used to use for data 
analysis for many years, but now I tried to make a Julia package out of it. 
I'm new to github, so your comments will be very appreciated. 

Best regards, Igor









Re: [julia-users] Performant methods for enclosing parameters?

2016-08-25 Thread Chris Rackauckas
Oh it's that same issue? Thanks for pointing it out. That means every one 
of my performance problems are due to the same issue... that's both a good 
thing and a bad thing I guess. So would your suggestion just be to move 
forward doing things like this, knowing that this issue will get fixed? If 
it will be possible to have good performance with closures on a type like 
that, then I'll be moving forward with a larger design change 

 in 
hopes that it will improve. But right now I'm in limbo because I don't know 
what to do about this!

On Thursday, August 25, 2016 at 1:43:56 AM UTC-7, Yichao Yu wrote:
>
>
>
> On Thu, Aug 25, 2016 at 4:12 PM, Chris Rackauckas  > wrote:
>
>> It seems like a closure on a non bitstype still has issues, or is there 
>> something wrong with doing this?
>>
>> immutable Params
>>   α::Float64
>> end
>>
>> function test()
>>   h = (t,u,du,p) -> @inbounds begin
>> du[1] = 1.01u[1]
>> du[2] = p.α*u[2]
>>   end
>>   h2 = (t,u,du) -> @inbounds begin
>> du[1] = 1.01u[1]
>> du[2] = 1.0*u[2]
>>   end
>>   const u = [0.1,0.2]
>>   const du = zeros(2)
>>   const p = Params(1.0)
>>   l = (t,u,du) -> h(t,u,du,p)
>>   println("Pass In Parameters")
>>   @code_native h(1.0,u,du,p)
>>   println("No Parameters")
>>   @code_native h2(1.0,u,du)
>>   println("Closures")
>>   @code_native l(1.0,u,du)
>> end
>> test()
>>
>> Pass In Parameters
>> .text
>> Filename: replacement_macros_tests.jl
>> pushq %rbp
>> movq %rsp, %rbp
>> Source line: 29
>> movq (%rdi), %rax
>> movsd (%rax), %xmm0   # xmm0 = mem[0],zero
>> movabsq $140006850762016, %rcx  # imm = 0x7F55E29B1520
>> mulsd (%rcx), %xmm0
>> movq (%rsi), %rcx
>> movsd %xmm0, (%rcx)
>> Source line: 30
>> movsd (%rdx), %xmm0   # xmm0 = mem[0],zero
>> mulsd 8(%rax), %xmm0
>> movsd %xmm0, 8(%rcx)
>> popq %rbp
>> retq
>>
>> No Parameters
>> .text
>> Filename: replacement_macros_tests.jl
>> pushq %rbp
>> movq %rsp, %rbp
>> Source line: 33
>> movq (%rdi), %rax
>> movsd (%rax), %xmm0   # xmm0 = mem[0],zero
>> movabsq $140006850762144, %rcx  # imm = 0x7F55E29B15A0
>> mulsd (%rcx), %xmm0
>> movq (%rsi), %rcx
>> movsd %xmm0, (%rcx)
>> Source line: 34
>> movq 8(%rax), %rax
>> movq %rax, 8(%rcx)
>> popq %rbp
>> retq
>> nopw (%rax,%rax)
>>
>>
>> Closures
>> .text
>> Filename: replacement_macros_tests.jl
>> pushq %rbp
>> movq %rsp, %rbp
>> pushq %r15
>> pushq %r14
>> pushq %r13
>> pushq %r12
>> pushq %rbx
>> subq $72, %rsp
>> movq %rdx, %r14
>> movq %rsi, %r15
>> movsd %xmm0, -112(%rbp)
>> movabsq $140007647692112, %rbx  # imm = 0x7F56121B4550
>> movq %fs:0, %r12
>> addq $-2672, %r12# imm = 0xF590
>> xorpd %xmm0, %xmm0
>> movupd %xmm0, -64(%rbp)
>> movupd %xmm0, -80(%rbp)
>> movq $0, -48(%rbp)
>> movq $12, -104(%rbp)
>> movq (%r12), %rax
>> movq %rax, -96(%rbp)
>> leaq -104(%rbp), %rax
>> movq %rax, (%r12)
>> movq $0, -88(%rbp)
>> Source line: 39
>> movq (%rdi), %rax
>> movq (%rax), %r13
>> testq %r13, %r13
>> je L232
>> movq %r13, -88(%rbp)
>> movq %rbx, -80(%rbp)
>> movabsq $jl_gc_pool_alloc, %rax
>> movl $1432, %esi # imm = 0x598
>> movl $16, %edx
>> movq %r12, %rdi
>> callq *%rax
>> addq $1072064, %rbx  # imm = 0x105BC0
>> movq %rbx, -8(%rax)
>> movsd -112(%rbp), %xmm0   # xmm0 = mem[0],zero
>> movsd %xmm0, (%rax)
>> movq %rax, -72(%rbp)
>> movq %r15, -64(%rbp)
>> movq %r14, -56(%rbp)
>> movq %r13, -48(%rbp)
>> movabsq $jl_apply_generic, %rax
>> movl $5, %esi
>> leaq -80(%rbp), %rdi
>> callq *%rax
>> movq -96(%rbp), %rax
>> movq %rax, (%r12)
>> addq $72, %rsp
>> popq %rbx
>> popq %r12
>> popq %r13
>> popq %r14
>> popq %r15
>> popq %rbp
>> retq
>> L232:
>> addq $1448, %rbx # imm = 0x5A8
>> movabsq $jl_throw, %rax
>> movq %rbx, %rdi
>> callq *%rax
>> nop
>>
>>
>> Clearly the 3rd method (using a closure on a parameter type) has a lot 
>> more steps. My untrained eye says that means it's bad... is that simple 
>> analysis wrong?
>>
>>
> The issue is https://github.com/JuliaLang/julia/issues/15276 See
> https://github.com/JuliaLang/julia/issues/17395#issuecomment-241911387 
> for a workaround that works for me most of the time.
>
>

Re: [julia-users] Performant methods for enclosing parameters?

2016-08-25 Thread Yichao Yu
On Thu, Aug 25, 2016 at 4:12 PM, Chris Rackauckas 
wrote:

> It seems like a closure on a non bitstype still has issues, or is there
> something wrong with doing this?
>
> immutable Params
>   α::Float64
> end
>
> function test()
>   h = (t,u,du,p) -> @inbounds begin
> du[1] = 1.01u[1]
> du[2] = p.α*u[2]
>   end
>   h2 = (t,u,du) -> @inbounds begin
> du[1] = 1.01u[1]
> du[2] = 1.0*u[2]
>   end
>   const u = [0.1,0.2]
>   const du = zeros(2)
>   const p = Params(1.0)
>   l = (t,u,du) -> h(t,u,du,p)
>   println("Pass In Parameters")
>   @code_native h(1.0,u,du,p)
>   println("No Parameters")
>   @code_native h2(1.0,u,du)
>   println("Closures")
>   @code_native l(1.0,u,du)
> end
> test()
>
> Pass In Parameters
> .text
> Filename: replacement_macros_tests.jl
> pushq %rbp
> movq %rsp, %rbp
> Source line: 29
> movq (%rdi), %rax
> movsd (%rax), %xmm0   # xmm0 = mem[0],zero
> movabsq $140006850762016, %rcx  # imm = 0x7F55E29B1520
> mulsd (%rcx), %xmm0
> movq (%rsi), %rcx
> movsd %xmm0, (%rcx)
> Source line: 30
> movsd (%rdx), %xmm0   # xmm0 = mem[0],zero
> mulsd 8(%rax), %xmm0
> movsd %xmm0, 8(%rcx)
> popq %rbp
> retq
>
> No Parameters
> .text
> Filename: replacement_macros_tests.jl
> pushq %rbp
> movq %rsp, %rbp
> Source line: 33
> movq (%rdi), %rax
> movsd (%rax), %xmm0   # xmm0 = mem[0],zero
> movabsq $140006850762144, %rcx  # imm = 0x7F55E29B15A0
> mulsd (%rcx), %xmm0
> movq (%rsi), %rcx
> movsd %xmm0, (%rcx)
> Source line: 34
> movq 8(%rax), %rax
> movq %rax, 8(%rcx)
> popq %rbp
> retq
> nopw (%rax,%rax)
>
>
> Closures
> .text
> Filename: replacement_macros_tests.jl
> pushq %rbp
> movq %rsp, %rbp
> pushq %r15
> pushq %r14
> pushq %r13
> pushq %r12
> pushq %rbx
> subq $72, %rsp
> movq %rdx, %r14
> movq %rsi, %r15
> movsd %xmm0, -112(%rbp)
> movabsq $140007647692112, %rbx  # imm = 0x7F56121B4550
> movq %fs:0, %r12
> addq $-2672, %r12# imm = 0xF590
> xorpd %xmm0, %xmm0
> movupd %xmm0, -64(%rbp)
> movupd %xmm0, -80(%rbp)
> movq $0, -48(%rbp)
> movq $12, -104(%rbp)
> movq (%r12), %rax
> movq %rax, -96(%rbp)
> leaq -104(%rbp), %rax
> movq %rax, (%r12)
> movq $0, -88(%rbp)
> Source line: 39
> movq (%rdi), %rax
> movq (%rax), %r13
> testq %r13, %r13
> je L232
> movq %r13, -88(%rbp)
> movq %rbx, -80(%rbp)
> movabsq $jl_gc_pool_alloc, %rax
> movl $1432, %esi # imm = 0x598
> movl $16, %edx
> movq %r12, %rdi
> callq *%rax
> addq $1072064, %rbx  # imm = 0x105BC0
> movq %rbx, -8(%rax)
> movsd -112(%rbp), %xmm0   # xmm0 = mem[0],zero
> movsd %xmm0, (%rax)
> movq %rax, -72(%rbp)
> movq %r15, -64(%rbp)
> movq %r14, -56(%rbp)
> movq %r13, -48(%rbp)
> movabsq $jl_apply_generic, %rax
> movl $5, %esi
> leaq -80(%rbp), %rdi
> callq *%rax
> movq -96(%rbp), %rax
> movq %rax, (%r12)
> addq $72, %rsp
> popq %rbx
> popq %r12
> popq %r13
> popq %r14
> popq %r15
> popq %rbp
> retq
> L232:
> addq $1448, %rbx # imm = 0x5A8
> movabsq $jl_throw, %rax
> movq %rbx, %rdi
> callq *%rax
> nop
>
>
> Clearly the 3rd method (using a closure on a parameter type) has a lot
> more steps. My untrained eye says that means it's bad... is that simple
> analysis wrong?
>
>
The issue is https://github.com/JuliaLang/julia/issues/15276 See
https://github.com/JuliaLang/julia/issues/17395#issuecomment-241911387 for
a workaround that works for me most of the time.


Re: [julia-users] Re: 0.5.0 rc3 error

2016-08-25 Thread Henri Girard

Yes... No cmake, no libssl-dev... Thanks. It's done now :)

Henri


Le 24/08/2016 à 21:14, Uwe Fechner a écrit :

If you want to see the real error, do not use parallel make.
Just type "make" instead of "make -j4".
My guess: You don't have libssl-dev installed.

On Wednesday, August 24, 2016 at 5:22:54 PM UTC+2, Henri Girard wrote:

git clone git://github.com/JuliaLang/julia.git


after : git checkout release-0.5

Before I got all dependances from ubuntu sudo apt build-dep julia
(I have the 0.5 binary in repo) but I would like to get the dev rc3.



Le 24/08/2016 à 14:47, Uwe Fechner a écrit :

Where did you get the source code from?

Which command did you execute, that resulted in this error?

On Wednesday, August 24, 2016 at 12:26:30 PM UTC+2, Henri Girard
wrote:

I have this error on ubuntu 16.04, any help ?


checking usable gmp.h at link time... yes
checking for GMP_NUMB_BITS and sizeof(mp_limb_t)
consistency... yes
checking for __gmpz_init in -lgmp... yes
checking if gmp.h version and libgmp version are the same...
(6.1.0/6.1.0) yes
checking for GMP library vs header correctness... yes
checking for double-to-integer conversion bug... no
checking if gmp_printf supports "%jd"... yes
checking if gmp_printf supports "%hhd"... yes
checking if gmp_printf supports "%lld"... yes
checking if gmp_printf supports "%Lf"... yes
checking if gmp_printf supports "%td"... yes
checking for __gmpn_rootrem... yes
checking for __gmpn_sbpi1_divappr_q... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating doc/Makefile
config.status: creating src/Makefile
config.status: creating tests/Makefile
config.status: creating tune/Makefile
config.status: creating src/mparam.h
config.status: executing depfiles commands
config.status: executing libtool commands
Makefile:81 : la recette pour la cible « julia-deps » a échouée
make: *** [julia-deps] Erreur 2
pi@pc:~/julia$







[julia-users] Re: making a sparse matrix with structural zeros?

2016-08-25 Thread Tony Kelman
A bit. Sparse matrices with stored zeros were mostly an "I know what I'm 
doing" feature until recently. If you're familiar with the CSC data 
structure you can also call the low-level SparseMatrixCSC constructor 
directly:

julia> SparseMatrixCSC(1, 1, [1,2], [1], [0])
1x1 sparse matrix with 1 Int64 entries:
[1, 1]  =  0


On Thursday, August 25, 2016 at 12:23:02 AM UTC-7, Gabriel Goh wrote:
>
> thats a bit of a hack, tho. Guess I can just target Julia 0.5 and ignore 
> this.
>
> On Thursday, August 25, 2016 at 12:01:03 AM UTC-7, Tony Kelman wrote:
>>
>> Try
>>
>> julia> flagval = -123456789
>> -123456789
>>
>> julia> A = sparse([1],[1],flagval)
>> 1×1 sparse matrix with 1 Int64 nonzero entries:
>> [1, 1]  =  -123456789
>>
>> julia> A.nzval[A.nzval .== flagval] = 0
>> 0
>>
>> julia> A
>> 1×1 sparse matrix with 1 Int64 nonzero entries:
>> [1, 1]  =  0
>>
>>
>>
>> On Wednesday, August 24, 2016 at 11:24:29 PM UTC-7, Gabriel Goh wrote:
>>>
>>> Say I want a 1x1 matrix with some structural zeros. Julia 0.4.* gives
>>>
>>> julia> sparse([1],[1], 0)
>>> 1x1 sparse matrix with 0 Int64 entries:
>>>
>>> while Julia 0.5 does
>>>
>>> julia> sparse([1],[1],0)
>>> 1×1 sparse matrix with 1 Int64 nonzero entries:
>>> [1, 1]  =  0
>>>
>>> the latter behavior is what I prefer, is there a way to emulate it in 
>>> Julia 0.4? 
>>>
>>

Re: [julia-users] Performant methods for enclosing parameters?

2016-08-25 Thread Chris Rackauckas
It seems like a closure on a non bitstype still has issues, or is there 
something wrong with doing this?

immutable Params
  α::Float64
end

function test()
  h = (t,u,du,p) -> @inbounds begin
du[1] = 1.01u[1]
du[2] = p.α*u[2]
  end
  h2 = (t,u,du) -> @inbounds begin
du[1] = 1.01u[1]
du[2] = 1.0*u[2]
  end
  const u = [0.1,0.2]
  const du = zeros(2)
  const p = Params(1.0)
  l = (t,u,du) -> h(t,u,du,p)
  println("Pass In Parameters")
  @code_native h(1.0,u,du,p)
  println("No Parameters")
  @code_native h2(1.0,u,du)
  println("Closures")
  @code_native l(1.0,u,du)
end
test()

Pass In Parameters
.text
Filename: replacement_macros_tests.jl
pushq %rbp
movq %rsp, %rbp
Source line: 29
movq (%rdi), %rax
movsd (%rax), %xmm0   # xmm0 = mem[0],zero
movabsq $140006850762016, %rcx  # imm = 0x7F55E29B1520
mulsd (%rcx), %xmm0
movq (%rsi), %rcx
movsd %xmm0, (%rcx)
Source line: 30
movsd (%rdx), %xmm0   # xmm0 = mem[0],zero
mulsd 8(%rax), %xmm0
movsd %xmm0, 8(%rcx)
popq %rbp
retq

No Parameters
.text
Filename: replacement_macros_tests.jl
pushq %rbp
movq %rsp, %rbp
Source line: 33
movq (%rdi), %rax
movsd (%rax), %xmm0   # xmm0 = mem[0],zero
movabsq $140006850762144, %rcx  # imm = 0x7F55E29B15A0
mulsd (%rcx), %xmm0
movq (%rsi), %rcx
movsd %xmm0, (%rcx)
Source line: 34
movq 8(%rax), %rax
movq %rax, 8(%rcx)
popq %rbp
retq
nopw (%rax,%rax)


Closures
.text
Filename: replacement_macros_tests.jl
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $72, %rsp
movq %rdx, %r14
movq %rsi, %r15
movsd %xmm0, -112(%rbp)
movabsq $140007647692112, %rbx  # imm = 0x7F56121B4550
movq %fs:0, %r12
addq $-2672, %r12# imm = 0xF590
xorpd %xmm0, %xmm0
movupd %xmm0, -64(%rbp)
movupd %xmm0, -80(%rbp)
movq $0, -48(%rbp)
movq $12, -104(%rbp)
movq (%r12), %rax
movq %rax, -96(%rbp)
leaq -104(%rbp), %rax
movq %rax, (%r12)
movq $0, -88(%rbp)
Source line: 39
movq (%rdi), %rax
movq (%rax), %r13
testq %r13, %r13
je L232
movq %r13, -88(%rbp)
movq %rbx, -80(%rbp)
movabsq $jl_gc_pool_alloc, %rax
movl $1432, %esi # imm = 0x598
movl $16, %edx
movq %r12, %rdi
callq *%rax
addq $1072064, %rbx  # imm = 0x105BC0
movq %rbx, -8(%rax)
movsd -112(%rbp), %xmm0   # xmm0 = mem[0],zero
movsd %xmm0, (%rax)
movq %rax, -72(%rbp)
movq %r15, -64(%rbp)
movq %r14, -56(%rbp)
movq %r13, -48(%rbp)
movabsq $jl_apply_generic, %rax
movl $5, %esi
leaq -80(%rbp), %rdi
callq *%rax
movq -96(%rbp), %rax
movq %rax, (%r12)
addq $72, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
L232:
addq $1448, %rbx # imm = 0x5A8
movabsq $jl_throw, %rax
movq %rbx, %rdi
callq *%rax
nop


Clearly the 3rd method (using a closure on a parameter type) has a lot more 
steps. My untrained eye says that means it's bad... is that simple analysis 
wrong?



[julia-users] Re: making a sparse matrix with structural zeros?

2016-08-25 Thread Gabriel Goh
thats a bit of a hack, tho. Guess I can just target Julia 0.5 and ignore 
this.

On Thursday, August 25, 2016 at 12:01:03 AM UTC-7, Tony Kelman wrote:
>
> Try
>
> julia> flagval = -123456789
> -123456789
>
> julia> A = sparse([1],[1],flagval)
> 1×1 sparse matrix with 1 Int64 nonzero entries:
> [1, 1]  =  -123456789
>
> julia> A.nzval[A.nzval .== flagval] = 0
> 0
>
> julia> A
> 1×1 sparse matrix with 1 Int64 nonzero entries:
> [1, 1]  =  0
>
>
>
> On Wednesday, August 24, 2016 at 11:24:29 PM UTC-7, Gabriel Goh wrote:
>>
>> Say I want a 1x1 matrix with some structural zeros. Julia 0.4.* gives
>>
>> julia> sparse([1],[1], 0)
>> 1x1 sparse matrix with 0 Int64 entries:
>>
>> while Julia 0.5 does
>>
>> julia> sparse([1],[1],0)
>> 1×1 sparse matrix with 1 Int64 nonzero entries:
>> [1, 1]  =  0
>>
>> the latter behavior is what I prefer, is there a way to emulate it in 
>> Julia 0.4? 
>>
>

Re: [julia-users] Differential Equations Package

2016-08-25 Thread Viral Shah
Perhaps JuliaMath is a good place for now. That is what I am going to 
suggest.

On Thursday, August 25, 2016 at 12:45:54 PM UTC+5:30, Viral Shah wrote:
>
> That's right. Perhaps we need a JuliaDiffEq organization to collect 
> various ODE, PDE, FEM related packages.
>
> -viral
>
> On Friday, June 10, 2016 at 11:31:04 PM UTC+5:30, Mauro wrote:
>>
>> On Fri, 2016-06-10 at 17:13, Chris Rackauckas  
>> wrote: 
>> ... 
>> > Thanks for helping me get more focus! Do you plan on moving to ODE.jl 
>> to 
>> > JuliaMath? When I hit the major release, I think we should be 
>> considering 
>> > bringing us together under some organization. 
>>
>> Thanks for the good discussion!  I don't know where ODE.jl goes, but it 
>> may well join JuliaMath.  I think there was/is a push to lighten the 
>> JuliaLang org because of CI time constraints. 
>>
>

Re: [julia-users] Differential Equations Package

2016-08-25 Thread Viral Shah
That's right. Perhaps we need a JuliaDiffEq organization to collect various 
ODE, PDE, FEM related packages.

-viral

On Friday, June 10, 2016 at 11:31:04 PM UTC+5:30, Mauro wrote:
>
> On Fri, 2016-06-10 at 17:13, Chris Rackauckas  wrote: 
> ... 
> > Thanks for helping me get more focus! Do you plan on moving to ODE.jl to 
> > JuliaMath? When I hit the major release, I think we should be 
> considering 
> > bringing us together under some organization. 
>
> Thanks for the good discussion!  I don't know where ODE.jl goes, but it 
> may well join JuliaMath.  I think there was/is a push to lighten the 
> JuliaLang org because of CI time constraints. 
>


Re: [julia-users] Re: Tab completion for sub-modules names

2016-08-25 Thread Yichao Yu
On Thu, Aug 25, 2016 at 2:50 PM, Tony Kelman  wrote:

> What version of Julia are you on? My memory might be hazy but there's a
> chance this has been implemented recently on master? If not, then this does
> sound like it would be useful to implement.
>

I believe imported and unexported symbols are intentionally not included in
the auto completion.


>
>
>
> On Wednesday, August 24, 2016 at 4:49:50 PM UTC-7, Miguel Goncalves wrote:
>>
>> In the Julia REPL if I have a super-module Food which loads in a
>> sub-module Fruit,
>>
>> module Food
>>
>> using Fruit
>>
>> include("nutrition.jl")
>> export carbohydrate
>> export fat
>> export protein
>>
>> end
>>
>> then pressing tab after typing,
>>
>> Food.
>>
>> I get the list,
>>
>> carbohydratefatprotein
>>
>> But the sub-module Fruit does not show up for tab completion. However,
>> after manually typing,
>>
>> Food.Fruit.
>>
>> I do have tab completion for everything which is exported by the Fruit
>> sub-module.
>>
>> Could this behavior be changed to support tab completion for sub-modules
>> names? This will facilitate working with nested modules.
>>
>


Re: [julia-users] Clone git repo from dropbox

2016-08-25 Thread Mauro
Whilst people do it successfully, it's probably a bad idea to have a git
repo on Dropbox (corruption could occur if it gets modified from several
machines).  You'd have to clone it from the file system though:
Pkg.clone("/path/to/drobox-folder/repo").  Cloning over https means that
there needs to be a git-server at the other end (I think), which dropbox
is not.

But why not use one of the git hosting sites?  Gitlab
https://about.gitlab.com/gitlab-com/ and bitbucket have free private
repos, if that is your concern.  Much better and safer.

On Wed, 2016-08-24 at 23:07, Nicklas Andersen  wrote:
> Hello
>
> Is there a way to clone a package from, for example, dropbox ?
> I've got dropbox set up as a git repo, but Pkg.clone("https://;) doesn't
> seem to like this kind of thing.
>
> Regards N


[julia-users] Re: making a sparse matrix with structural zeros?

2016-08-25 Thread Tony Kelman
Try

julia> flagval = -123456789
-123456789

julia> A = sparse([1],[1],flagval)
1×1 sparse matrix with 1 Int64 nonzero entries:
[1, 1]  =  -123456789

julia> A.nzval[A.nzval .== flagval] = 0
0

julia> A
1×1 sparse matrix with 1 Int64 nonzero entries:
[1, 1]  =  0



On Wednesday, August 24, 2016 at 11:24:29 PM UTC-7, Gabriel Goh wrote:
>
> Say I want a 1x1 matrix with some structural zeros. Julia 0.4.* gives
>
> julia> sparse([1],[1], 0)
> 1x1 sparse matrix with 0 Int64 entries:
>
> while Julia 0.5 does
>
> julia> sparse([1],[1],0)
> 1×1 sparse matrix with 1 Int64 nonzero entries:
> [1, 1]  =  0
>
> the latter behavior is what I prefer, is there a way to emulate it in 
> Julia 0.4? 
>


[julia-users] Re: Tab completion for sub-modules names

2016-08-25 Thread Tony Kelman
What version of Julia are you on? My memory might be hazy but there's a 
chance this has been implemented recently on master? If not, then this does 
sound like it would be useful to implement.


On Wednesday, August 24, 2016 at 4:49:50 PM UTC-7, Miguel Goncalves wrote:
>
> In the Julia REPL if I have a super-module Food which loads in a 
> sub-module Fruit,
>
> module Food
>
> using Fruit
>
> include("nutrition.jl")
> export carbohydrate
> export fat
> export protein
>
> end
>
> then pressing tab after typing,
>
> Food.
>
> I get the list,
>
> carbohydratefatprotein
>
> But the sub-module Fruit does not show up for tab completion. However, 
> after manually typing,
>
> Food.Fruit.
>
> I do have tab completion for everything which is exported by the Fruit 
> sub-module.
>
> Could this behavior be changed to support tab completion for sub-modules 
> names? This will facilitate working with nested modules.
>


[julia-users] making a sparse matrix with structural zeros?

2016-08-25 Thread Gabriel Goh
Say I want a 1x1 matrix with some structural zeros. Julia 0.4.* gives

julia> sparse([1],[1], 0)
1x1 sparse matrix with 0 Int64 entries:

while Julia 0.5 does

julia> sparse([1],[1],0)
1×1 sparse matrix with 1 Int64 nonzero entries:
[1, 1]  =  0

the latter behavior is what I prefer, is there a way to emulate it in Julia 
0.4? 


Re: [julia-users] High memory consumption with loops

2016-08-25 Thread Venil Noronha
I've also tried to @profile, however, julia libraries seem to be executed 
the most.

Venil

On Wednesday, August 24, 2016 at 11:16:53 PM UTC-7, Venil Noronha wrote:
>
> I've just been able to @time the loop so far to see allocations at 
> iteration level. I haven't yet tried @code_warntype; I'll probably do that 
> next and see if I can get somewhere.
>
> Thanks,
> Venil
>
> On Wednesday, August 24, 2016 at 5:37:17 PM UTC-7, Tim Holy wrote:
>>
>> What have you tried so far? See http://docs.julialang.org/en/latest/manual/ 
>>
>> performance-tips/#tools 
>> , 
>> esp. @code_warntype. 
>>
>> --Tim 
>>
>> On Wednesday, August 24, 2016 1:55:23 PM CDT Venil Noronha wrote: 
>> > The following code seems to consume a lot of memory. Could anyone spot 
>> what 
>> > I'm doing wrong here? I'm also using the JuMP library. 
>> > 
>> > function initUtilityConstraint() 
>> > c = categories[1] 
>> > me = attack_methods[1] 
>> > t = teams[1] 
>> > tuple = Simulate.cmt(c, me, t) 
>> > w = windows[1] 
>> > r = resources[1] 
>> > wrtuple = Simulate.wr(w, r) 
>> > for ni in 1:size(list,1), c in categories,* f in flights* 
>> > performloop(ni, c, f, tuple, wrtuple) 
>> > end 
>> > end 
>> > 
>> > function performloop(ni, c, f, tuple, wrtuple) 
>> > fi = findfirst(flights, f) 
>> > for w in windows, me in attack_methods 
>> > tuple.c = c 
>> > tuple.m = me 
>> > total = 0.0 
>> > for t in teams 
>> > tuple.t = t 
>> > strat = linearizeStrategyS(f, c, t, w, ni) 
>> > total = total + effectiveness[tuple]*strat 
>> > end 
>> > 
>> > total = ( total*(flight_vals[fi]*(-1)) + flight_vals[fi] ) 
>> > 
>> > for w2 in owindows, r2 in resources 
>> > wrtuple.w = w2 
>> > wrtuple.r = r2 
>> > over = linearizeOverflow(w2, r2, ni) 
>> > total = total - resource_fines[wrtuple]*over 
>> > end 
>> > # println(string( sc[c], "<=", ( total*(flight_vals[fi]*(-1)) + 
>> > flight_vals[fi] ))) 
>> > @addConstraint(m, sc[c] <= total) 
>> > end 
>> > end 
>> > 
>> > Following are the stats for piece this code. Stats were recorded using 
>> > @time. 
>> > 
>> > For 1 item in the flights array, it takes about 620KB to execute the 
>> > performloop method - peak memory consumption by the program is 8.84GBs. 
>> > 2 flights - 1.02MB per iteration of performloop - peak 8.88GBs. 
>> > 3 flights - 3.45MB - 9.60GBs 
>> > 4 flights - 4.35MB - 10.24GBs 
>> > 5 flights - 10.8MB - 15.63GBs 
>> > 
>> > It'd be great if someone could help me with this asap! 
>> > 
>> > Thanks. 
>>
>>
>>

Re: [julia-users] High memory consumption with loops

2016-08-25 Thread Venil Noronha
I've just been able to @time the loop so far to see allocations at 
iteration level. I haven't yet tried @code_warntype; I'll probably do that 
next and see if I can get somewhere.

Thanks,
Venil

On Wednesday, August 24, 2016 at 5:37:17 PM UTC-7, Tim Holy wrote:
>
> What have you tried so far? See http://docs.julialang.org/en/latest/manual/ 
>
> performance-tips/#tools 
> , 
> esp. @code_warntype. 
>
> --Tim 
>
> On Wednesday, August 24, 2016 1:55:23 PM CDT Venil Noronha wrote: 
> > The following code seems to consume a lot of memory. Could anyone spot 
> what 
> > I'm doing wrong here? I'm also using the JuMP library. 
> > 
> > function initUtilityConstraint() 
> > c = categories[1] 
> > me = attack_methods[1] 
> > t = teams[1] 
> > tuple = Simulate.cmt(c, me, t) 
> > w = windows[1] 
> > r = resources[1] 
> > wrtuple = Simulate.wr(w, r) 
> > for ni in 1:size(list,1), c in categories,* f in flights* 
> > performloop(ni, c, f, tuple, wrtuple) 
> > end 
> > end 
> > 
> > function performloop(ni, c, f, tuple, wrtuple) 
> > fi = findfirst(flights, f) 
> > for w in windows, me in attack_methods 
> > tuple.c = c 
> > tuple.m = me 
> > total = 0.0 
> > for t in teams 
> > tuple.t = t 
> > strat = linearizeStrategyS(f, c, t, w, ni) 
> > total = total + effectiveness[tuple]*strat 
> > end 
> > 
> > total = ( total*(flight_vals[fi]*(-1)) + flight_vals[fi] ) 
> > 
> > for w2 in owindows, r2 in resources 
> > wrtuple.w = w2 
> > wrtuple.r = r2 
> > over = linearizeOverflow(w2, r2, ni) 
> > total = total - resource_fines[wrtuple]*over 
> > end 
> > # println(string( sc[c], "<=", ( total*(flight_vals[fi]*(-1)) + 
> > flight_vals[fi] ))) 
> > @addConstraint(m, sc[c] <= total) 
> > end 
> > end 
> > 
> > Following are the stats for piece this code. Stats were recorded using 
> > @time. 
> > 
> > For 1 item in the flights array, it takes about 620KB to execute the 
> > performloop method - peak memory consumption by the program is 8.84GBs. 
> > 2 flights - 1.02MB per iteration of performloop - peak 8.88GBs. 
> > 3 flights - 3.45MB - 9.60GBs 
> > 4 flights - 4.35MB - 10.24GBs 
> > 5 flights - 10.8MB - 15.63GBs 
> > 
> > It'd be great if someone could help me with this asap! 
> > 
> > Thanks. 
>
>
>