[julia-users] Re: Easy way to precompile all installed packages?

2016-02-18 Thread Oliver Schulz
The best I've come up with so far is

for pkg in vcat(["IJulia"], collect(keys(Pkg.installed(
if !isdefined(Symbol(pkg))
info("Importing $(pkg)...")
try (@eval import $(Symbol(pkg))) catch end
end
end

I had to manually add IJulia because it's installed site-wide (in my case). 
The try/catch prevents an abort if precompilation of a package fails (e.g. 
because Julia has to be reloaded, as happens with some packages). I found 
that I usually need to run this at least twice, from a clean state (empty 
".julia/lib").




On Wednesday, February 17, 2016 at 12:58:10 PM UTC+1, Oliver Schulz wrote:
>
> Is there an easy way to precompile all installed packages, e.g. after a 
> `Pkg.update()`?
>
> This would come in handy when using a cluster of Julia machines (using an 
> shared home dir on a network filesystem), to ensure precompilation is done 
> before all machines load (and start precompiling) packages (e.g. from a 
> shared home directory via a network filesystem).
>
> Also, as precompilation of many packages can take quite a bit of time, it 
> would be nice to be able to choose when it happens (i.e. right now, instead 
> later when I may want to give a tutorial or so ;-) ).
>
> Sorry if this is somewhere in the docs, I didn't find anything about it. 
> I'd love to be able to just do `Pkg.update(precompile = true)` or so.
>
>
> Cheers,
>
> Oliver
>
>

[julia-users] Re: Is the Actor model for parallelism a good paradigm for Julia

2016-02-18 Thread Oliver Schulz
Hi,

in case you're interested, I'm working on a Julia task/channel based actor 
framework: https://github.com/daqcore/Actors.jl

It's registered, but still in an early stage and doesn't support 
inter-proccess/inter-host actor messages yet - though I hope to add that 
soon. Also, it probably will need to change quite a bit once Julia 
multi-threading lands. :-) 


Cheers,

Oliver



On Tuesday, February 2, 2016 at 1:48:48 AM UTC+1, Lyndon White wrote:
>
> Hi,
>
> So I do a lot of batch processing, for machine learning.
> I have a lot of RAM, 45Gb, and 12 cores.
>
> My normal method for parallel processing is to replicate any common shared 
> read-only memory across all workers, using @everywhere.
> Then process my data with pmap, or a variation of my own pmapreduce.
>
> On my work yesterday, I couldnot replicate my common shared memory across 
> all workers, as it was too large (17Gb).
> So I left it on processor 1, and told the workers to do a remotecall_fetch 
> to retrieve it.
> This seems to have worked very well, as the workers quickly get out of 
> sync so beg from processor 1 at different times.
> And processor 1 is normally unused til the worker are all done anyway.
>
> I was thinking about it after I went home, and realised that this was a 
> very rough approximation of the Actor model
> (If I am recalling the Actor 
> model correctly).
>
> What I am thinking,
> is I could have 1 worker per service -- where a service is combination of 
> data and functions that operate on it.
> Which is more than 1 worker per core.
> When ever a worker needs that data, it remotecall_fetches the function on 
> the services worker.
> (Potentially it does smarter things than a remotecall_fetch, so it is 
> unblocking.)
>
>
> Is this sensible?
>
>

[julia-users] Re: Easy way to precompile all installed packages?

2016-02-18 Thread Tony Kelman
Base.compilecache may be more reliable here.


On Thursday, February 18, 2016 at 2:41:39 AM UTC-8, Oliver Schulz wrote:
>
> The best I've come up with so far is
>
> for pkg in vcat(["IJulia"], collect(keys(Pkg.installed(
> if !isdefined(Symbol(pkg))
> info("Importing $(pkg)...")
> try (@eval import $(Symbol(pkg))) catch end
> end
> end
>
> I had to manually add IJulia because it's installed site-wide (in my 
> case). The try/catch prevents an abort if precompilation of a package fails 
> (e.g. because Julia has to be reloaded, as happens with some packages). I 
> found that I usually need to run this at least twice, from a clean state 
> (empty ".julia/lib").
>
>
>
>
> On Wednesday, February 17, 2016 at 12:58:10 PM UTC+1, Oliver Schulz wrote:
>>
>> Is there an easy way to precompile all installed packages, e.g. after a 
>> `Pkg.update()`?
>>
>> This would come in handy when using a cluster of Julia machines (using an 
>> shared home dir on a network filesystem), to ensure precompilation is done 
>> before all machines load (and start precompiling) packages (e.g. from a 
>> shared home directory via a network filesystem).
>>
>> Also, as precompilation of many packages can take quite a bit of time, it 
>> would be nice to be able to choose when it happens (i.e. right now, instead 
>> later when I may want to give a tutorial or so ;-) ).
>>
>> Sorry if this is somewhere in the docs, I didn't find anything about it. 
>> I'd love to be able to just do `Pkg.update(precompile = true)` or so.
>>
>>
>> Cheers,
>>
>> Oliver
>>
>>

[julia-users] Re: Easy way to precompile all installed packages?

2016-02-18 Thread Oliver Schulz
But Base.compilecache compiles every time right, not just when necessary? 
So when looping over all packages after a "Pkg.update()", it would 
recompile everything,
no matter if outdated or not?

On Thursday, February 18, 2016 at 1:07:07 PM UTC+1, Tony Kelman wrote:
>
> Base.compilecache may be more reliable here.
>
>
> On Thursday, February 18, 2016 at 2:41:39 AM UTC-8, Oliver Schulz wrote:
>>
>> The best I've come up with so far is
>>
>> for pkg in vcat(["IJulia"], collect(keys(Pkg.installed(
>> if !isdefined(Symbol(pkg))
>> info("Importing $(pkg)...")
>> try (@eval import $(Symbol(pkg))) catch end
>> end
>> end
>>
>> I had to manually add IJulia because it's installed site-wide (in my 
>> case). The try/catch prevents an abort if precompilation of a package fails 
>> (e.g. because Julia has to be reloaded, as happens with some packages). I 
>> found that I usually need to run this at least twice, from a clean state 
>> (empty ".julia/lib").
>>
>>
>>
>>
>> On Wednesday, February 17, 2016 at 12:58:10 PM UTC+1, Oliver Schulz wrote:
>>>
>>> Is there an easy way to precompile all installed packages, e.g. after a 
>>> `Pkg.update()`?
>>>
>>> This would come in handy when using a cluster of Julia machines (using 
>>> an shared home dir on a network filesystem), to ensure precompilation is 
>>> done before all machines load (and start precompiling) packages (e.g. from 
>>> a shared home directory via a network filesystem).
>>>
>>> Also, as precompilation of many packages can take quite a bit of time, 
>>> it would be nice to be able to choose when it happens (i.e. right now, 
>>> instead later when I may want to give a tutorial or so ;-) ).
>>>
>>> Sorry if this is somewhere in the docs, I didn't find anything about it. 
>>> I'd love to be able to just do `Pkg.update(precompile = true)` or so.
>>>
>>>
>>> Cheers,
>>>
>>> Oliver
>>>
>>>

[julia-users] ANN CustomREPLComepletions - custom string completions in function arguments (HDF5, NetCDF...)

2016-02-18 Thread Fabian Gans
I want to share an (unregistered) package called CustomREPLComepletions 
https://github.com/meggart/CustomREPLCompletions.jl. It hooks into the REPL 
completion system and lets you add individual completions depending on the 
function surrounding the current cursor. 

For example, if after the following lines:

using CustomREPLCompletions
d=Dict("aa"=>5,"bb"=>6)
d["

hit the tab key twice and the completion suggestions will be "aa" and "bb". 

Another example, and the main reason I put this together is when reading 
files containing some kind of datastructure:

using CustomREPLCompletions, HDF5
data = h5read("myfile.h5"," # hit tab after the "

This will look up the groups and variables stored in myfile.h5 and so you 
can tab-complete yourself through the file's hierarchy. 
I wanted to find out if anyone besides me would find this useful and if yes 
how to best integrate this into the packages it concerns. 

Fabian




Re: [julia-users] ANN CustomREPLComepletions - custom string completions in function arguments (HDF5, NetCDF...)

2016-02-18 Thread Tom Breloff
Sounds very useful! I have a scenario that probably fits... When using
PyCall I always find myself pressing tab to see what methods are defined on
a python object:

"obj[:get_something]()["... Crap... Gotta look at the docs...

It would be awesome if you gave a quick how-to for something like that.

On Thursday, February 18, 2016, Fabian Gans  wrote:

> I want to share an (unregistered) package called CustomREPLComepletions
> https://github.com/meggart/CustomREPLCompletions.jl. It hooks into the
> REPL completion system and lets you add individual completions depending on
> the function surrounding the current cursor.
>
> For example, if after the following lines:
>
> using CustomREPLCompletions
> d=Dict("aa"=>5,"bb"=>6)
> d["
>
> hit the tab key twice and the completion suggestions will be "aa" and
> "bb".
>
> Another example, and the main reason I put this together is when reading
> files containing some kind of datastructure:
>
> using CustomREPLCompletions, HDF5
> data = h5read("myfile.h5"," # hit tab after the "
>
> This will look up the groups and variables stored in myfile.h5 and so you
> can tab-complete yourself through the file's hierarchy.
> I wanted to find out if anyone besides me would find this useful and if
> yes how to best integrate this into the packages it concerns.
>
> Fabian
>
>
>


Re: [julia-users] ANN CustomREPLComepletions - custom string completions in function arguments (HDF5, NetCDF...)

2016-02-18 Thread Mauro
> Sounds very useful! I have a scenario that probably fits... When using
> PyCall I always find myself pressing tab to see what methods are defined on
> a python object:
>
> "obj[:get_something]()["... Crap... Gotta look at the docs...
>
> It would be awesome if you gave a quick how-to for something like that.

I just tried that but it doesn't seem to work (yet?).  That would be the
killer feature!

> On Thursday, February 18, 2016, Fabian Gans  wrote:
>
>> I want to share an (unregistered) package called CustomREPLComepletions
>> https://github.com/meggart/CustomREPLCompletions.jl. It hooks into the
>> REPL completion system and lets you add individual completions depending on
>> the function surrounding the current cursor.
>>
>> For example, if after the following lines:
>>
>> using CustomREPLCompletions
>> d=Dict("aa"=>5,"bb"=>6)
>> d["
>>
>> hit the tab key twice and the completion suggestions will be "aa" and
>> "bb".
>>
>> Another example, and the main reason I put this together is when reading
>> files containing some kind of datastructure:
>>
>> using CustomREPLCompletions, HDF5
>> data = h5read("myfile.h5"," # hit tab after the "
>>
>> This will look up the groups and variables stored in myfile.h5 and so you
>> can tab-complete yourself through the file's hierarchy.
>> I wanted to find out if anyone besides me would find this useful and if
>> yes how to best integrate this into the packages it concerns.
>>
>> Fabian
>>
>>
>>


Re: [julia-users] ANN CustomREPLComepletions - custom string completions in function arguments (HDF5, NetCDF...)

2016-02-18 Thread Fabian Gans
I forgot to mention, this is currently targeted at julia 0.5, it needs the 
new function types. It should work for nightlies. 

On Thursday, February 18, 2016 at 3:23:41 PM UTC+1, Mauro wrote:
>
> > Sounds very useful! I have a scenario that probably fits... When using 
> > PyCall I always find myself pressing tab to see what methods are defined 
> on 
> > a python object: 
> > 
> > "obj[:get_something]()["... Crap... Gotta look at the 
> docs... 
> > 
> > It would be awesome if you gave a quick how-to for something like that. 
>
> I just tried that but it doesn't seem to work (yet?).  That would be the 
> killer feature! 
>
> > On Thursday, February 18, 2016, Fabian Gans  > wrote: 
> > 
> >> I want to share an (unregistered) package called CustomREPLComepletions 
> >> https://github.com/meggart/CustomREPLCompletions.jl. It hooks into the 
> >> REPL completion system and lets you add individual completions 
> depending on 
> >> the function surrounding the current cursor. 
> >> 
> >> For example, if after the following lines: 
> >> 
> >> using CustomREPLCompletions 
> >> d=Dict("aa"=>5,"bb"=>6) 
> >> d[" 
> >> 
> >> hit the tab key twice and the completion suggestions will be "aa" and 
> >> "bb". 
> >> 
> >> Another example, and the main reason I put this together is when 
> reading 
> >> files containing some kind of datastructure: 
> >> 
> >> using CustomREPLCompletions, HDF5 
> >> data = h5read("myfile.h5"," # hit tab after the " 
> >> 
> >> This will look up the groups and variables stored in myfile.h5 and so 
> you 
> >> can tab-complete yourself through the file's hierarchy. 
> >> I wanted to find out if anyone besides me would find this useful and if 
> >> yes how to best integrate this into the packages it concerns. 
> >> 
> >> Fabian 
> >> 
> >> 
> >> 
>


Re: [julia-users] Reading one field from a file

2016-02-18 Thread Stefan Karpinski
I would do this with a loop over each line and a regex to parse each line
and then parse to interpret each field. That's the standard way to do this
sort of thing in Python, Perl, Ruby, etc.

On Wed, Feb 17, 2016 at 1:25 PM, Victor Liu  wrote:

> I have a text file of the following format:
>
> --- snip ---
> Nx Ny
> dx dy
>
> v(x1,y1)
> v(x2,y2)
> ...
> v(xNx,y1)
> v(x1,y2)
> ...
> v(xNx,yNy)
> --- snip ---
>
> In C, I would normally use fscanf to read in the four fields at the top
> first, then loop through and read in the rest.
> What is the idiomatic way of achieving the same thing in Julia? I would
> like the list of numbers to end up in a matrix of the proper size.
> As far as I can tell, there's no simple way of reading only one textual
> field from a file at a time.
>


Re: [julia-users] Bug #15077 still present

2016-02-18 Thread Stefan Karpinski
I'll forward to Jeff so he sees this.

On Wed, Feb 17, 2016 at 1:59 PM, Scott Jones 
wrote:

> I just wanted to warn people that the bug in #15077 is still present,
> there is a small bug in the change #15096 that Jeff merged yesterday.
> Line 536 of dict.jl:
> if index - index0 > maxprobe
> should be
> if ((index - index0) & (newsz - 1)) > maxprobe
> instead, to correctly handle wrapping around the end of the hash table.
>
> Since I am no longer able to submit a PR to fix this, hopefully somebody
> else can shortly.
> Thanks, Scott
>
>


Re: [julia-users] Re: Unitful.jl for physical units

2016-02-18 Thread Stefan Karpinski
That requires an implementation of ΔT
, which I don't think we have unless
ICU has it.

On Wed, Feb 17, 2016 at 8:06 AM, Scott Jones 
wrote:

> Is there anything to convert to/from Julia's UT seconds (which are tied to
> the Earth's rotation), and SI seconds?
>
>
> On Friday, February 12, 2016 at 3:23:22 PM UTC-5, Andrew Keller wrote:
>>
>> I'm happy to share a package I wrote for using physical units in Julia,
>> Unitful.jl . Much credit
>> and gratitude is due to Keno Fischer for the SIUnits.jl
>>  package which served as my
>> inspiration. This is a work in progress, but I think perhaps a serviceable
>> one depending on what you're doing.
>>
>> Like SIUnits.jl, this package encodes units in the type signature to
>> avoid run-time performance penalties. From there, the implementations
>> diverge. The package is targeted to Julia 0.5 / master, as there are some
>> limitations with how promote_op is used in Julia 0.4 (#13803)
>> . I decided it wasn't
>> worth targeting 0.4 if the behavior would be inconsistent.
>>
>> Some highlights include:
>>
>>- Non-SI units are treated on the same footing as SI units, with only
>>a few exceptions (unit conversion method). Use whatever weird units
>>you want.
>>- Support for units like micron / (meter Kelvin), where some of the
>>units could cancel out but you don't necessarily want them to.
>>- Support for LinSpace and other Range types. Probably there are
>>still some glitches to be found, though.
>>- Support for rational exponents of units.
>>- Some tests (see these for usage examples).
>>
>> Please see the documentation for a comprehensive discussion, including
>> issues / to do list, as well as how to add your own units, etc.
>> Comments and feedback are welcome.
>>
>> Best,
>> Andrew Keller
>>
>


Re: [julia-users] ANN CustomREPLComepletions - custom string completions in function arguments (HDF5, NetCDF...)

2016-02-18 Thread Stefan Karpinski
The issue here is that you have to evaluate the expression to the left of
the cursor, which could entail running arbitrary code. Which may be fine,
but we haven't taken that step yet.

On Thu, Feb 18, 2016 at 9:02 AM, Tom Breloff  wrote:

> Sounds very useful! I have a scenario that probably fits... When using
> PyCall I always find myself pressing tab to see what methods are defined on
> a python object:
>
> "obj[:get_something]()["... Crap... Gotta look at the
> docs...
>
> It would be awesome if you gave a quick how-to for something like that.
>
>
> On Thursday, February 18, 2016, Fabian Gans  wrote:
>
>> I want to share an (unregistered) package called CustomREPLComepletions
>> https://github.com/meggart/CustomREPLCompletions.jl. It hooks into the
>> REPL completion system and lets you add individual completions depending on
>> the function surrounding the current cursor.
>>
>> For example, if after the following lines:
>>
>> using CustomREPLCompletions
>> d=Dict("aa"=>5,"bb"=>6)
>> d["
>>
>> hit the tab key twice and the completion suggestions will be "aa" and
>> "bb".
>>
>> Another example, and the main reason I put this together is when reading
>> files containing some kind of datastructure:
>>
>> using CustomREPLCompletions, HDF5
>> data = h5read("myfile.h5"," # hit tab after the "
>>
>> This will look up the groups and variables stored in myfile.h5 and so you
>> can tab-complete yourself through the file's hierarchy.
>> I wanted to find out if anyone besides me would find this useful and if
>> yes how to best integrate this into the packages it concerns.
>>
>> Fabian
>>
>>
>>


[julia-users] Growth patterns of programming languages developed at Github

2016-02-18 Thread mschauer
Hi,

I made a chart for languages developed on github  
(https://github.com/showcases/programming-languages) contrasting the 
acquisition of new contributors to main github repository (GH) with new 
tagged questions on stackoverflow (SO). 

One of the tenets of the Julia community is that the "two language problem" 
hinders the development of language ecosystems: the users of a language 
have limited means of contributing to the ecosystem if development of the 
language itself and its libraries has to resort to lower level programming 
languages for various of reasons.  Then there is the frequent issue whether 
the "ecosystem" is mature or if it shows sustainable rate of growth. For 
julia I often see that there is a very natural transition from the first 
install to the first commit to JuliaLang/julia. 

The charts show "tagged questions per month on stackoverflow" and "first 
commits by users who never commited before per month", identified by unique 
username, so counting Jeff four or five times. There are some patterns, 
like languages of theoretical interest (dylan), mature languages in wide 
use with small teams (ruby) or languages attracting new developers at a 
high rate while gaining traction in the public at a later point (elixir). 
Nice to see that julia is welcoming new contributors at a top rate.






growth2.pdf
Description: Adobe PDF document


Re: [julia-users] ANN CustomREPLComepletions - custom string completions in function arguments (HDF5, NetCDF...)

2016-02-18 Thread Fabian Gans
Yes I was also thinking about if evaluating all other arguments is a good 
idea. My first thought was about performance and the conclusion was that 
when one does work interactively on the REPL, one wants to do this 
evaluation anyway. There are, of course issues with mutating functions like 
when typing this:

using NetCDF
ncwrite(scale!(x,2),"myfile.nc","

and when you tab-complete now, your have already applied the scale! 
function to the first argument. Maybe I should add some big warnings in the 
package text. 






[julia-users] Re: Unitful.jl for physical units

2016-02-18 Thread Jeffrey Sarnoff
Money (fiat value) as an econophysical dimension, with currencies the given 
units of measure and exchange rates the interconversion ratios with 
bid-asked spreads the ratios' associated uncertainties.  The 
interconversion ratios & uncertainties are dynamic rather than internal 
system characteristics. 

*(  atsign other, See the need for concretable prototypes that then are 
further elaborable, and each elaboration just works as a distinct concrete 
leaf type? ) *


On Thursday, February 18, 2016 at 12:26:32 AM UTC-5, Eric Forgy wrote:
>
> This is cool (Unitful.jl and SIUnits.jl). I imagine similar work can be 
> done for currencies?
>


Re: [julia-users] Bug #15077 still present

2016-02-18 Thread Jeff Bezanson
It would be great if somebody can come up with a test case for this,
but so far I can't. I think the current code is correct --- albeit
unintentionally. The reason is that rehashing by itself cannot cause a
wrapped-around clump of keys to grow, because when rehashing keys can
only move to higher indexes. In #15077 what happened was that keys
that used to be at some low index ended up at the end of a clump of
keys that straddled the middle of the table, making the clump bigger
than before. But I don't think this can happen for a wrapped-around
set of keys. Hopefully people will check my reasoning here.

Probably still worth making this change though just to be defensive.
Just don't get mad at me for committing the change without a test case
:)


On Wed, Feb 17, 2016 at 1:59 PM, Scott Jones  wrote:
> I just wanted to warn people that the bug in #15077 is still present, there
> is a small bug in the change #15096 that Jeff merged yesterday.
> Line 536 of dict.jl:
> if index - index0 > maxprobe
> should be
> if ((index - index0) & (newsz - 1)) > maxprobe
> instead, to correctly handle wrapping around the end of the hash table.
>
> Since I am no longer able to submit a PR to fix this, hopefully somebody
> else can shortly.
> Thanks, Scott
>


Re: [julia-users] ANN CustomREPLComepletions - custom string completions in function arguments (HDF5, NetCDF...)

2016-02-18 Thread Fabian Gans
Ok, I just pushed a change so that only things like literal strings, 
numbers and symbols get evaluated during tab-completion, no function calls. 
The examples mentioned above still work, except if one of the left-side 
function arguments is the result of a function call or macro. So


h5read(getfilename(),"  -> tab

will do autocompletion according to what is in Base.




[julia-users] Re: Unitful.jl for physical units

2016-02-18 Thread Kristoffer Carlsson
Just for your info, you likely exclude a lot of non native speakers (like me) 
from understanding your point when you go 17th century poet style. 

Adjust your language to the audience and all that.. 

[julia-users] Convert a collection to an array

2016-02-18 Thread Chris Nabold


I have a collection ySol:
julia> ySol=collect(ySol)
21-element Array{Any,1}:
 1x2 Array{Float64,2}:
 9000.0  0.0
 1x2 Array{Float64,2}:
 8998.79  -4.80427
 1x2 Array{Float64,2}:
 8995.29  -9.0677
 1x2 Array{Float64,2}:
 8989.86  -12.4678
 1x2 Array{Float64,2}:
 8982.97  -14.9547
 1x2 Array{Float64,2}:
 8975.04  -16.66
 1x2 Array{Float64,2}:
 8966.41  -17.7772
 1x2 Array{Float64,2}:
 8957.33  -18.4864
 1x2 Array{Float64,2}:
 8947.97  -18.9266
 1x2 Array{Float64,2}:
 8938.43  -19.195
 1x2 Array{Float64,2}:
 8928.79  -19.3559
 1x2 Array{Float64,2}:
 8919.09  -19.4502
 1x2 Array{Float64,2}:
 8909.35  -19.5037
 1x2 Array{Float64,2}:
 8899.59  -19.5323
 1x2 Array{Float64,2}:
 8889.82  -19.5457
 1x2 Array{Float64,2}:
 8880.04  -19.5498
 1x2 Array{Float64,2}:
 8870.27  -19.5484
 1x2 Array{Float64,2}:
 8860.5  -19.5435
 1x2 Array{Float64,2}:
 8850.73  -19.5366
 1x2 Array{Float64,2}:
 8840.96  -19.5285
 1x2 Array{Float64,2}:
 8831.2  -19.5196
How can I convert it into an array of dimension 20,2
eg yy=zeros(20,2)
yy=ySol
Thank you for your help


[julia-users] Re: Convert a collection to an array

2016-02-18 Thread Tomas Lycken


If it’s not longer than that, you can easily do that with hcat:

julia> ySol = [rand(2) for _ in 1:20]
20-element Array{Array{Float64,1},1}:
 [0.6383963589240325,0.952443724507759]  
 [0.8543445393734637,0.5497614848396764] 
 [0.7180883594522589,0.2699980988282249] 
 [0.879654133666188,0.008079464648794499]
 [0.32422181761199975,0.2699464303552557]
 [0.26787882268244223,0.4271951131306577]
 [0.2613014121460324,0.9629053122741955] 
 [0.3473409046077083,0.8228842149724882] 
 [0.9074984806753585,0.5398222579191083] 
 [0.850898493473214,0.10093766734240517] 
 [0.7103469388877257,0.6295378284694306] 
 [0.7598286632595868,0.9313542937160446] 
 [0.7174343129435241,0.9971075729799896] 
 [0.49861954369803874,0.3683763032284182]
 [0.8145463614876596,0.616519930503598]  
 [0.6922945697041882,0.646282075186712]  
 [0.8108510573789565,0.20586283678616368]
 [0.46599068004928035,0.7351678286521091]
 [0.6932932362204158,0.8608833557510405] 
 [0.1747785273075091,0.9016114746811359] 

julia> hcat(ySol...)'
20x2 Array{Float64,2}:
 0.638396  0.952444  
 0.854345  0.549761  
 0.718088  0.269998  
 0.879654  0.00807946
 0.324222  0.269946  
 0.267879  0.427195  
 0.261301  0.962905  
 0.347341  0.822884  
 0.907498  0.539822  
 0.850898  0.100938  
 0.710347  0.629538  
 0.759829  0.931354  
 0.717434  0.997108  
 0.49862   0.368376  
 0.814546  0.61652   
 0.692295  0.646282  
 0.810851  0.205863  
 0.465991  0.735168  
 0.693293  0.860883  
 0.174779  0.901611

Note, however, that splatting like this isn’t very performant (yet…) so if 
you need to do this in a tight loop, or for a much longer array ySol, you 
should consider other options.

// T

On Thursday, February 18, 2016 at 7:23:55 PM UTC+1, Chris Nabold wrote:


>
> I have a collection ySol:
> julia> ySol=collect(ySol)
> 21-element Array{Any,1}:
>  1x2 Array{Float64,2}:
>  9000.0  0.0
>  1x2 Array{Float64,2}:
>  8998.79  -4.80427
>  1x2 Array{Float64,2}:
>  8995.29  -9.0677
>  1x2 Array{Float64,2}:
>  8989.86  -12.4678
>  1x2 Array{Float64,2}:
>  8982.97  -14.9547
>  1x2 Array{Float64,2}:
>  8975.04  -16.66
>  1x2 Array{Float64,2}:
>  8966.41  -17.7772
>  1x2 Array{Float64,2}:
>  8957.33  -18.4864
>  1x2 Array{Float64,2}:
>  8947.97  -18.9266
>  1x2 Array{Float64,2}:
>  8938.43  -19.195
>  1x2 Array{Float64,2}:
>  8928.79  -19.3559
>  1x2 Array{Float64,2}:
>  8919.09  -19.4502
>  1x2 Array{Float64,2}:
>  8909.35  -19.5037
>  1x2 Array{Float64,2}:
>  8899.59  -19.5323
>  1x2 Array{Float64,2}:
>  8889.82  -19.5457
>  1x2 Array{Float64,2}:
>  8880.04  -19.5498
>  1x2 Array{Float64,2}:
>  8870.27  -19.5484
>  1x2 Array{Float64,2}:
>  8860.5  -19.5435
>  1x2 Array{Float64,2}:
>  8850.73  -19.5366
>  1x2 Array{Float64,2}:
>  8840.96  -19.5285
>  1x2 Array{Float64,2}:
>  8831.2  -19.5196
> How can I convert it into an array of dimension 20,2
> eg yy=zeros(20,2)
> yy=ySol
> Thank you for your help
>
​


[julia-users] Re: Convert a collection to an array

2016-02-18 Thread Tomas Lycken


Sorry, I misread your dimensions. vcat(ySol...) will solve the problem 
correctly for you :)

julia> ySol = [rand(2)' for _ in 1:20]
20-element Array{Array{Float64,2},1}:
 1x2 Array{Float64,2}:
 0.751346  0.212002  
...
 1x2 Array{Float64,2}:
 0.52188  0.121669   

julia> vcat(ySol...)
20x2 Array{Float64,2}:
 0.7513460.212002 
...
 0.52188 0.121669

// T

On Thursday, February 18, 2016 at 7:35:15 PM UTC+1, Tomas Lycken wrote:

If it’s not longer than that, you can easily do that with hcat:
>
> julia> ySol = [rand(2) for _ in 1:20]
> 20-element Array{Array{Float64,1},1}:
>  [0.6383963589240325,0.952443724507759]  
>  [0.8543445393734637,0.5497614848396764] 
>  [0.7180883594522589,0.2699980988282249] 
>  [0.879654133666188,0.008079464648794499]
>  [0.32422181761199975,0.2699464303552557]
>  [0.26787882268244223,0.4271951131306577]
>  [0.2613014121460324,0.9629053122741955] 
>  [0.3473409046077083,0.8228842149724882] 
>  [0.9074984806753585,0.5398222579191083] 
>  [0.850898493473214,0.10093766734240517] 
>  [0.7103469388877257,0.6295378284694306] 
>  [0.7598286632595868,0.9313542937160446] 
>  [0.7174343129435241,0.9971075729799896] 
>  [0.49861954369803874,0.3683763032284182]
>  [0.8145463614876596,0.616519930503598]  
>  [0.6922945697041882,0.646282075186712]  
>  [0.8108510573789565,0.20586283678616368]
>  [0.46599068004928035,0.7351678286521091]
>  [0.6932932362204158,0.8608833557510405] 
>  [0.1747785273075091,0.9016114746811359] 
>
> julia> hcat(ySol...)'
> 20x2 Array{Float64,2}:
>  0.638396  0.952444  
>  0.854345  0.549761  
>  0.718088  0.269998  
>  0.879654  0.00807946
>  0.324222  0.269946  
>  0.267879  0.427195  
>  0.261301  0.962905  
>  0.347341  0.822884  
>  0.907498  0.539822  
>  0.850898  0.100938  
>  0.710347  0.629538  
>  0.759829  0.931354  
>  0.717434  0.997108  
>  0.49862   0.368376  
>  0.814546  0.61652   
>  0.692295  0.646282  
>  0.810851  0.205863  
>  0.465991  0.735168  
>  0.693293  0.860883  
>  0.174779  0.901611
>
> Note, however, that splatting like this isn’t very performant (yet…) so if 
> you need to do this in a tight loop, or for a much longer array ySol, you 
> should consider other options.
>
> // T
>
> On Thursday, February 18, 2016 at 7:23:55 PM UTC+1, Chris Nabold wrote:
>
>
>>
>> I have a collection ySol:
>> julia> ySol=collect(ySol)
>> 21-element Array{Any,1}:
>>  1x2 Array{Float64,2}:
>>  9000.0  0.0
>>  1x2 Array{Float64,2}:
>>  8998.79  -4.80427
>>  1x2 Array{Float64,2}:
>>  8995.29  -9.0677
>>  1x2 Array{Float64,2}:
>>  8989.86  -12.4678
>>  1x2 Array{Float64,2}:
>>  8982.97  -14.9547
>>  1x2 Array{Float64,2}:
>>  8975.04  -16.66
>>  1x2 Array{Float64,2}:
>>  8966.41  -17.7772
>>  1x2 Array{Float64,2}:
>>  8957.33  -18.4864
>>  1x2 Array{Float64,2}:
>>  8947.97  -18.9266
>>  1x2 Array{Float64,2}:
>>  8938.43  -19.195
>>  1x2 Array{Float64,2}:
>>  8928.79  -19.3559
>>  1x2 Array{Float64,2}:
>>  8919.09  -19.4502
>>  1x2 Array{Float64,2}:
>>  8909.35  -19.5037
>>  1x2 Array{Float64,2}:
>>  8899.59  -19.5323
>>  1x2 Array{Float64,2}:
>>  8889.82  -19.5457
>>  1x2 Array{Float64,2}:
>>  8880.04  -19.5498
>>  1x2 Array{Float64,2}:
>>  8870.27  -19.5484
>>  1x2 Array{Float64,2}:
>>  8860.5  -19.5435
>>  1x2 Array{Float64,2}:
>>  8850.73  -19.5366
>>  1x2 Array{Float64,2}:
>>  8840.96  -19.5285
>>  1x2 Array{Float64,2}:
>>  8831.2  -19.5196
>> How can I convert it into an array of dimension 20,2
>> eg yy=zeros(20,2)
>> yy=ySol
>> Thank you for your help
>>
> ​
>
​


Re: [julia-users] GIF 3D plot

2016-02-18 Thread Miguel Bazdresch
Gaston has support for 3D plots and can save them to GIF files. Take a look
at the documentation here:
https://bitbucket.org/mbaz/gaston/downloads/gastondoc-0.5.5.pdf

I recommend using Gaston "master" instead of the latest release; it has a
lot of bugfixes and improvements. The docs for 3-d plotting and saving a
file are still current, though.

-- mb

On Mon, Feb 15, 2016 at 10:28 AM,  wrote:

> Does anyone know how can I have a 3D plot as a GIF?
> I'm not sure if I can use PyPlot or Gaston to do that. If someone has an
> example I appreciate if you could share.
>
> Thanks!
>


[julia-users] Re: Unitful.jl for physical units

2016-02-18 Thread Jeffrey Sarnoff
Kristoffer,

I am glad that you said this.  In the future, I will write and be 
respectful of that.

Kind regards,

Jeffrey Sarnoff

On Thursday, February 18, 2016 at 12:51:19 PM UTC-5, Kristoffer Carlsson 
wrote:
>
> Just for your info, you likely exclude a lot of non native speakers (like 
> me) from understanding your point when you go 17th century poet style. 
>
> Adjust your language to the audience and all that.. 
>


Re: [julia-users] ANN CustomREPLComepletions - custom string completions in function arguments (HDF5, NetCDF...)

2016-02-18 Thread Daniel Høegh
Yes it does, it uses type inference to determine the return type of a function 
call. This way the determination of the argument type is effect free. You could 
maybe hook your package into the logic in REPLCompletion.jl in base.

[julia-users] Re: Unitful.jl for physical units

2016-02-18 Thread Jeffrey Sarnoff
I am thinking about how Currencies would fit with software for handling SI 
and other physical dimensions and the usual units of measure.
The following approach seems workable and (mostly) not disruptive to the 
working and evolving code Andrew Keller offers the community.

A currency behaves as a representation of, or a stand-in or proxy for all 
the banknotes, sovereign wealth and other property interests of a nation.
Two or more currencies for which there is a market that allows one to be 
converted into another at an agreed upon, current rate of exchange are not 
that different from two or more units of length or units of time that are 
allowed to be converted into one another using a predefined multiplicative 
ratio.

 (now, 1.0 US Dollar = 8.45536 Swedish Krona, refreshing the page, now 
1.0 US Dollar = 8.45518 Swedish Krona)

The most impactful distinction is that rates of exchange are dynamic while 
the physical conversion factors (BIPM standards, CODATA values) persist.
However currencies may be accommodated, it must protect our ability work 
with units with ease and with invisibly amortized processing overhead.
So, the request that gets the appropriate exchange rate to use when 
converting from one currency to another must come from the Units code in a 
way that does not require other physical unit conversions to operate any 
differently.

One of the things on Andrew's future to do list is allow measures and their 
uncertainties to be used and to interact respecting the uncertainty math.
In any currency exchange trade, there is a buyer and a seller.  Usually, 
when they (or their requests) meet, they disagree.  The buyer wants to pay 
as little as possible and the seller wants to receive as much as possible. 
That separation is called the bid-ask spread (the buyer bids, the seller 
asks); almost always it is very, very small relative to the total value 
being exchanged.  The uncertainties associated with physical measures and 
conversions usually are very, very small relative to the total quantity 
being determined or the value being mapped into different units.  When 
uncertainty management is introduced, it is conceivable that currency 
support could take advantage of that analogous role.



[julia-users] Pkg.update() fails after installation

2016-02-18 Thread Tony Kelman
As in the "Cannot pull with rebase...?" thread, what does `git diff` say when 
run from the package directory? If you do `git checkout -- filename` on each of 
the files with changes, does `git diff` then show anything?


Re: [julia-users] Re: Unitful.jl for physical units

2016-02-18 Thread Mauro
Concerning exchange rates, this is a good read:
http://www.mathstat.dal.ca/~selinger/accounting/tutorial.html#4
In particular the referenced section.

On Thu, 2016-02-18 at 21:30, Jeffrey Sarnoff  wrote:
> I am thinking about how Currencies would fit with software for handling SI
> and other physical dimensions and the usual units of measure.
> The following approach seems workable and (mostly) not disruptive to the
> working and evolving code Andrew Keller offers the community.
>
> A currency behaves as a representation of, or a stand-in or proxy for all
> the banknotes, sovereign wealth and other property interests of a nation.
> Two or more currencies for which there is a market that allows one to be
> converted into another at an agreed upon, current rate of exchange are not
> that different from two or more units of length or units of time that are
> allowed to be converted into one another using a predefined multiplicative
> ratio.
>
>  (now, 1.0 US Dollar = 8.45536 Swedish Krona, refreshing the page, now
> 1.0 US Dollar = 8.45518 Swedish Krona)
>
> The most impactful distinction is that rates of exchange are dynamic while
> the physical conversion factors (BIPM standards, CODATA values) persist.
> However currencies may be accommodated, it must protect our ability work
> with units with ease and with invisibly amortized processing overhead.
> So, the request that gets the appropriate exchange rate to use when
> converting from one currency to another must come from the Units code in a
> way that does not require other physical unit conversions to operate any
> differently.
>
> One of the things on Andrew's future to do list is allow measures and their
> uncertainties to be used and to interact respecting the uncertainty math.
> In any currency exchange trade, there is a buyer and a seller.  Usually,
> when they (or their requests) meet, they disagree.  The buyer wants to pay
> as little as possible and the seller wants to receive as much as possible.
> That separation is called the bid-ask spread (the buyer bids, the seller
> asks); almost always it is very, very small relative to the total value
> being exchanged.  The uncertainties associated with physical measures and
> conversions usually are very, very small relative to the total quantity
> being determined or the value being mapped into different units.  When
> uncertainty management is introduced, it is conceivable that currency
> support could take advantage of that analogous role.


[julia-users] isapprox Fallback

2016-02-18 Thread Jared Crean
I am comparing two arrays that contain both numbers and strings using 
FactCheck and got an error

  Error   :: (line:-1)
data_code => roughly(data_ref,atol=1.0e-13)
MethodError: `isapprox` has no method matching 
isapprox(::SubString{ASCIIString}, ::SubString{ASCIIString})


so I defined a new method:

import Base.isapprox

# generic fallback
function isapprox(a::SubString{ASCIIString}, b::SubString{ASCIIString})
  return a == b
end


and now I get the error:

  Error   :: (line:-1)
data_code => roughly(data_ref,atol=1.0e-13)
MethodError: `isapprox` has no method matching 
isapprox(::SubString{ASCIIString}, ::SubString{ASCIIString})
Closest candidates are:
  isapprox(::SubString{ASCIIString}, ::SubString{ASCIIString})


I get a similar error if I don't restrict the argument types of isapprox:

  Error   :: (line:-1)
data_code => roughly(data_ref,atol=1.0e-13)
MethodError: `isapprox` has no method matching 
isapprox(::SubString{ASCIIString}, ::SubString{ASCIIString})
Closest candidates are:
  isapprox(::Any, ::Any)


In all cases the backtrace is:

 in anonymous at no file:46
 in anonymous at /users/creanj/.julia/v0.4/FactCheck/src/FactCheck.jl:140
 in anonymous at /users/creanj/.julia/v0.4/FactCheck/src/FactCheck.jl:142
 in do_fact at /users/creanj/.julia/v0.4/FactCheck/src/FactCheck.jl:201
 in anonymous at 
/users/creanj/.julia/v0.4/PumiInterface/test/pdepumiinterface.jl:142
 in facts at /users/creanj/.julia/v0.4/FactCheck/src/FactCheck.jl:315
 in include at ./boot.jl:253
 in include_from_node1 at ./loading.jl:133
 in include at ./boot.jl:253
 in include_from_node1 at loading.jl:133
 in process_options at ./client.jl:312
 in _start at ./client.jl:412


Why does  isapprox(::SubString{ASCIIString}, ::SubString{ASCIIString}) not 
match the fallback I defined?
Here is a minimal example (although it generates a slightly different error:
 MethodError: `isapprox` has no method matching isapprox(::ASCIIString, 
::ASCIIString)
): 

using FactCheck

import Base.isapprox

function isapprox(a, b)
  return a == b
end

facts("- A non working example -") do

  a = [1.5, "abc"]
  @fact a => roughly(a, atol=1e-14)
end


  Jared Crean



[julia-users] Re: Pkg.update() fails after installation

2016-02-18 Thread Hua Chai
I saw people posted the same issue earlier and here is what I did following 
some of the advice here in this mailing list:

I ran 'git diff' in the folder C:\Users\Hua\.julia\v0.4\METADATA and then 
ran 'git checkout --' to try to restore the files. (screenshot is 
attached.)
However the same problem persists.



On Thursday, February 18, 2016 at 12:15:05 AM UTC-5, Hua Chai wrote:
>
> I just installed the Julia+Juno bundle (downloaded from Julialang.org) and 
> ran the following code:
>
> Pkg.status()
> Pkg.update()
>
> and the result is "failed process: Process(git pull --rebase -q, 
> ProcessExited(1))[1] in pipeline_error at process.jl:555", while the 
> console shows "error: Cannot pull with rebase: You have unstaged changes."
>
> Does anyone know what this is all about and what should I do? Thanks!
>


Re: [julia-users] Pkg.update() fails after installation

2016-02-18 Thread Hua Chai (Ken)
It shows five files with changed mode. (See attached screenshot)
After I do 'git checkout --filename' on each of them and do 'git diff'
again, exactly the same five files still show up.

On Thu, Feb 18, 2016 at 3:42 PM, Tony Kelman  wrote:

> As in the "Cannot pull with rebase...?" thread, what does `git diff` say
> when run from the package directory? If you do `git checkout -- filename`
> on each of the files with changes, does `git diff` then show anything?
>


[julia-users] macro esc nested @everywhere issue

2016-02-18 Thread thr
Hi,

I can't explain the behaviour of this:

macro wtf1()
return esc(
:(begin
@show a
@everywhere const b = a
@show b
end))
end

macro wtf2()
return esc(
:(begin
@show c
const d = c
@show d
end))
end

@everywhere const a = 0
@wtf1
@everywhere const a = 1
@wtf1
@everywhere const a = 2
@wtf1

println()

const c = 0
@wtf2
const c = 1
@wtf2
const c = 2
@wtf2

results in:

a = 0
b = 0
WARNING: redefining constant a
a = 1
WARNING: redefining constant b
b = 0
WARNING: redefining constant a
a = 2
WARNING: redefining constant b
b = 1

c = 0
d = 0
WARNING: redefining constant c
c = 1
WARNING: redefining constant d
d = 1
WARNING: redefining constant c
c = 2
WARNING: redefining constant d
d = 2

Why do the outputs of the two macros differ? Shouldn't it be the same?

And why does julia warn me about the redefinition of b when it doesn't 
really redefine it. (line 5 and 6 of the output)



Re: [julia-users] Pkg.update() fails after installation

2016-02-18 Thread Stefan Karpinski
The permissions of these files got changed somehow.

On Thu, Feb 18, 2016 at 3:52 PM, Hua Chai (Ken)  wrote:

> It shows five files with changed mode. (See attached screenshot)
> After I do 'git checkout --filename' on each of them and do 'git diff'
> again, exactly the same five files still show up.
>
> On Thu, Feb 18, 2016 at 3:42 PM, Tony Kelman  wrote:
>
>> As in the "Cannot pull with rebase...?" thread, what does `git diff` say
>> when run from the package directory? If you do `git checkout -- filename`
>> on each of the files with changes, does `git diff` then show anything?
>>
>
>


[julia-users] Re: ccall, dlopen when dll contains a class

2016-02-18 Thread Alex Mellnik
Sorry to reopen an old thread.  I'm trying to do something similar and 
haven't been able to figure it out so far.  Isaiah, I noticed that your 
COMCall.jl library is not on GitHub anymore.  Is this code still floating 
around anywhere or is there a different suggested route?

In my case, I have a dll (written in c# I think) which is currently being 
called from Python using win32com 
.
 
 I would like to call the dll directly from Julia without going through 
PyCall (although this works).  I don't have the source for that dll but a 
simple example is:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SimpleLibrary
{
public class MyClass
{
public static double MySum(double a, double b)
{
return a + b;
}

public static double NoArgs()
{
return 1.4;
}

}
}

Naively trying to call these with ccal like 

ccall( ("SimpleLibrary.MyClass.MySum", "SimplyLibrary"), Float32, (1.2, 
3.1))

gives a "wrong number of arguments" error.  Is there any easy (or failing 
that, hard) way to do this?


Re: [julia-users] Re: ccall, dlopen when dll contains a class

2016-02-18 Thread Isaiah Norton
>
>  Is there any easy (or failing that, hard) way to do this?


COM aside, the first issue is that this syntax isn't quite right:


> ccall( ("SimpleLibrary.MyClass.MySum", "SimplyLibrary"), Float32, (1.2,
> 3.1))


There are a couple things to change here:
- need argument types, as a tuple, after the return type.
- `double` is equivalent to Float64 on all platforms, rather than Float32.
(for convenience, there is a `Cdouble` alias)
- argument values (or variables) need to be passed individually.

So it should look like:

ccall( ("SimpleLibrary.MyClass.MySum", "SimplyLibrary"), Cdouble, (Cdouble,
Cdouble), 1.2, 3.1)

The bigger issue here is going to be finding the function.
"SimpleLibrary.MyClass.MySum" is probably not going to work (a C symbol
won't look like that). Unless the DLL explicitly exports a C symbol, you
will probably need to query the COM registry, then the interface, and build
an appropriate dispatch table. See this article for a discussion of how to
do it from C, which could be replicated in pure Julia:
http://www.codeproject.com/Articles/13601/COM-in-plain-C

(if you only need a few functions from a given interface, that should be
 straightforward, but a generic interface is a bit involved)

On Thu, Feb 18, 2016 at 6:32 PM, Alex Mellnik  wrote:

> Sorry to reopen an old thread.  I'm trying to do something similar and
> haven't been able to figure it out so far.  Isaiah, I noticed that your
> COMCall.jl library is not on GitHub anymore.  Is this code still floating
> around anywhere or is there a different suggested route?
>
> In my case, I have a dll (written in c# I think) which is currently being
> called from Python using win32com
> .
> I would like to call the dll directly from Julia without going through
> PyCall (although this works).  I don't have the source for that dll but a
> simple example is:
>
> using System;
> using System.Collections.Generic;
> using System.Linq;
> using System.Text;
> using System.Threading.Tasks;
>
> namespace SimpleLibrary
> {
> public class MyClass
> {
> public static double MySum(double a, double b)
> {
> return a + b;
> }
>
> public static double NoArgs()
> {
> return 1.4;
> }
>
> }
> }
>
> Naively trying to call these with ccal like
>
> ccall( ("SimpleLibrary.MyClass.MySum", "SimplyLibrary"), Float32, (1.2,
> 3.1))
>
> gives a "wrong number of arguments" error.  Is there any easy (or failing
> that, hard) way to do this?
>


[julia-users] Re: isapprox Fallback

2016-02-18 Thread Steven G. Johnson
It is not enough to define isapprox(string, string).   To use isapprox for 
[1.5, "foo"] you need an isapprox method for Array{Any}. 

However, I would be inclined to say you should re-consider using isapprox 
in such cases.  (What does it mean for two strings to be "approximately" 
equal?)

Note that isapprox on two numeric arrays is *not* the same as elementwise 
isapprox.  So it's not necessarily a good idea to have a fallback method 
isapprox(a::Array, b::Array) = mapreduce(ab -> isapprox(ab[1], ab[2]), &, 
true, zip(a,b)) 


Re: [julia-users] Options for constructing a 3D surface from a point cloud

2016-02-18 Thread Igor
Chris , I'm interested in this area too.  Please post here if you come up with 
some solution you would like.

Best regards, Igor