[julia-users] Re: Resources for GLAbstraction and the PerspectiveCamera method

2016-01-13 Thread kleinsplash
Thank you so very much :) 

On Tuesday, 12 January 2016 18:18:48 UTC+2, Simon Danisch wrote:
>
> In the case of GLAbstraction, with it's missing Documentation, it's best 
> to just open an issue there!
>
> I did that for you:  https://github.com/JuliaGL/GLAbstraction.jl/issues/33
>
>
> Am Dienstag, 12. Januar 2016 14:06:45 UTC+1 schrieb kleinsplash:
>>
>> Hi,
>>
>> Is there an API or somewhere I can find info on the args of 
>> PerspectiveCamera? Specifically for theta, translation, zoom, FOV and clip 
>> distances. I know my understanding is not up to scratch because translation 
>> and eyeposition seem similar, along with eyeposition and translation, zoom 
>> and FOV etc.. Basically I am just confusing myself with what needs to go 
>> where and ending up with a blank image render. 
>>
>> https://github.com/JuliaGL/GLAbstraction.jl/blob/master/src/GLCamera.jl
>>
>> Thx
>>
>  
>


[julia-users] Re: good approach to run julia scripts in parallel in a PC

2016-01-13 Thread 'Greg Plowman' via julia-users

You might be able to use pmap: 
http://docs.julialang.org/en/release-0.4/manual/parallel-computing/#parallel-map-and-loops
http://docs.julialang.org/en/release-0.4/stdlib/parallel/?highlight=pmap#Base.pmap

Perhaps something like:

@everywhere function test1(p)
println("doing stuff with $p")
return 2*p
end

function main()
parameters = collect(0.001:0.001:0.6)
results = pmap(test1, parameters)
end

main()


On Wednesday, January 13, 2016 at 1:32:08 AM UTC+11, Charles Santana wrote:
>
> Hi julians,
>
> Parallel computing is not my focus, but I would like to run a  julia 
> script in parallel in my PC in order to save time. The PC has an 8-core 
> processor so I would like to run at least 4 replicates of my script 
> (test1.jl) at the same time, each one with one different parameter. 
>
> So far I was working on a cluster and I was using qsub in order to submit 
> my jobs. I didn't need to configure anything. I had a quota of 20 jobs, so 
> if I launched 200 jobs 20 of them would run and the others would be in a 
> queue waiting for their moment to run. 
>
> Now I would like to run my scripts in my machine and I would like to do 
> something similar. For me it is fine if I wait for the current jobs to 
> finish running in order to launch another bunch of jobs. As well as it is 
> fine if I launch a new job for each experiment that finishes. The easiest 
> option the best :)
>
> My script does not receive any file as input, but it writes the outputs to 
> unique files (the file names are unique for each job). 
>
> Do you recommend a good way to do it in Julia? Let's say my script is 
> called "test1.jl". So far I was trying the following code to call my jobs:
>
> function main() 
> parameters = collect(0.001:0.001:0.6);
> @parallel for(p in parameters)
> command1 = `/home/cdesantana/Downloads/julia -p 4 
> /home/cdesantana/Experiments/test1.jl $p`;
> run(command1);
> end 
> end
>
> main();
>
> I really don't understand what is happening here, but I am sure it is not 
> working 4 jobs of my scripts... :(
>
> cdesantana@c-de-santana:~/Data/Dendritics/poster2016$ ps aux|grep julia
> cdesant+  1964  3.7  1.3 9214696 107356 pts/10 Sl   15:20   0:01 
> /home/cdesantana/Downloads/julia/julia script.jl
> cdesant+  1994 92.2  2.7 9489844 214388 pts/10 Rl   15:20   0:31 
> /home/cdesantana/Downloads/julia/julia -p4 
> /home/cdesantana/Experiments/test1.jl 1 0.001
> cdesant+  2013  8.7  1.5 9189424 120340 ?  Ssl  15:20   0:02 
> /home/cdesantana/Downloads/julia/usr/bin/julia -Cnative 
> -J/home/cdesantana/Downloads/julia/usr/lib/julia/sys.so --bind-to 
> 192.168.89.174 --worker
> cdesant+  2016  9.2  1.6 9288520 131600 ?  Ssl  15:20   0:03 
> /home/cdesantana/Downloads/julia/usr/bin/julia -Cnative 
> -J/home/cdesantana/Downloads/julia/usr/lib/julia/sys.so --bind-to 
> 192.168.89.174 --worker
> cdesant+  2018  6.7  1.6 9353972 131772 ?  Ssl  15:20   0:02 
> /home/cdesantana/Downloads/julia/usr/bin/julia -Cnative 
> -J/home/cdesantana/Downloads/julia/usr/lib/julia/sys.so --bind-to 
> 192.168.89.174 --worker
> cdesant+  2023  7.7  1.6 9419496 131604 ?  Ssl  15:20   0:02 
> /home/cdesantana/Downloads/julia/usr/bin/julia -Cnative 
> -J/home/cdesantana/Downloads/julia/usr/lib/julia/sys.so --bind-to 
> 192.168.89.174 --worker
> cdesant+  2159  0.0  0.0  11716   892 pts/10   S+   15:21   0:00 grep 
> --color=auto julia
>
> I was expecting that it would be running my script 4 times, each one with 
> one different value of $p (0.001, 0.002, 0.003, 0.004). 
>
> Any suggestion? My machine has ubuntu installed so I am fine if I need to 
> combine Linux programs with Julia.
>
> Many thanks in advance for any help! 
>
> Best,
>
> Charles
> -- 
> Um axé! :)
>
> --
> Charles Novaes de Santana, PhD
> https://github.com/cndesantana
>


[julia-users] Re: Shell commands in Julia 0.4.2 in Windows 10

2016-01-13 Thread Tony Kelman
You can manually go through a shell via `cmd /C echo hello`, or better 
(slower to start but much more sane and useful) `powershell -Command "echo 
hello"`


On Tuesday, January 12, 2016 at 7:36:08 PM UTC-8, Jason Bates wrote:
>
> Hi All,
>
> I am having issues executing shell commands from within Julia (either in 
> the REPL or via the iJulia notebook) on Windows 10.  I can run actual 
> programs from within Julia, but all attempts at executing shell commands 
> produce an error.
>
> For instance, the example from the documentation:
>
> julia> run(`echo hello`)
>
> produces
>
> julia> run(`echo hello`)
> ERROR: could not spawn `echo hello`: no such file or directory (ENOENT)
>  in _jl_spawn at process.jl:262
>
> I get the same result using the semi-colon shortcut, both in the REPL and 
> within iJulia.
>
> However, I am able to call windows programs from within Julia 
> successfully.  For instance, 
>
> julia> run(`notepad`)
>
> successfully spawns a notepad window.
>
> Has anyone else run into this or similar issues on Win10?  Google searches 
> have turned up empty.  Further, the issue appears to be exclusive to Julia; 
> shell magic commands within iPython still execute correctly.
>
>
> Thanks,
>
> Jason Bates
>


[julia-users] reason for inner constructor in Dates

2016-01-13 Thread Tamas Papp
Hi,

I am reading the code of Base libraries to improve my understanding and
style. In base/dates/types.jl, I noticed

for T in (:Year,:Month,:Week,:Day)
@eval immutable $T <: DatePeriod
value::Int64
$T(v::Number) = new(v)
end
end

which expands to code like

immutable Year <: DatePeriod
  value::Int64
  Year(v::Number) = new(v)
end

I have a simple question: what is the reason for defining the inner
constructor? Wouldn't

immutable Year <: DatePeriod
  value::Int64
end

automatically define one, except for restricting to ::Number? If that is
the reason, I would like to understand why.

Best,

Tamas


[julia-users] Re: Problems with Pycall and scipy

2016-01-13 Thread cdm

on a JuliaBox session notebook running an 0.4.2 kernel, your code evaluates 
to:

In [3]:

sp.gmres(np.eye(5,5),np.zeros(5))

/home/juser/.local/lib/python2.7/site-packages/numpy/core/fromnumeric.py:2499: 
VisibleDeprecationWarning: `rank` is deprecated; use the `ndim` attribute or 
function instead. To find the rank of a matrix see `numpy.linalg.matrix_rank`.
  VisibleDeprecationWarning)

Out[3]:

([0.0,0.0,0.0,0.0,0.0],0)



[julia-users] Re: Problems with Pycall and scipy

2016-01-13 Thread cdm

on a JuliaBox session notebook running an 0.4.2 kernel, your code evaluates 
to:

In [3]: sp.gmres(np.eye(5,5),np.zeros(5))

/home/juser/.local/lib/python2.7/site-packages/numpy/core/fromnumeric.py:2499: 
VisibleDeprecationWarning: ‘rank‘ is deprecated; use the ‘ndim‘ attribute 
or function instead. To find the rank of a matrix see ‘numpy.linalg.matrix 
rank‘. VisibleDeprecationWarning)


Out[3]: ([0.0,0.0,0.0,0.0,0.0],0) 


[julia-users] Re: ANN: Sphinx extensions for Julia

2016-01-13 Thread Jeffrey Sarnoff
Thank you Sebastian.

Please show a function that has one explicitly typed argument to the 
autodoc example, if it autodocs that argument's type.
Consider recognizing arguments that have default values and autodoc the 
default value.
Consider having a few keywords that you could set to autodoc them+their 
body in idunno, italic, Large, Small, serif, monospace ... 
for instance
   Requires( White Queen's Rook took Black King's Bishop  ) 
   Assumes( the rain in Spain falls mainly on the plain )  




On Wednesday, January 13, 2016 at 10:53:58 AM UTC-5, Sebastian Krämer wrote:
>
> Sphinx  is a python framework that makes it 
> easy to create beautiful documentation for all kinds of projects. Languages 
> besides python are supported via plugins that allow to account for language 
> specific features. In the past two months I wrote such an extension for the 
> Julia language which not only implements Julia specific constructs but also 
> allows to automatically extract docstrings from Julia code. It is finally 
> in a state where I think it might be useful for other people. The project 
> itself can be found on github
>
> https://github.com/bastikr/sphinx-julia
>
> and is documented at
>
> http://bastikr.github.io/sphinx-julia/
>
> I really would appreciate feedback and bug reports!
>


[julia-users] Re: Variable scope in a function

2016-01-13 Thread Brandon Booth
Thank you, I wouldn't have caught that in million years. The feed may not 
include awards so that is my check to see if there are any. I can use size 
or some other test though.

Thanks again.

Brandon


On Tuesday, January 12, 2016 at 10:15:25 PM UTC-5, ele...@gmail.com wrote:
>
> IIUC isdefined(:awards) tests for a global variable called awards, so it 
> won't find a local variable called awards.  What are you trying to achieve 
> with this test?
>
> On Wednesday, January 13, 2016 at 12:48:50 PM UTC+10, Brandon Booth wrote:
>>
>> So this is the full function. Note lines 4 and 5 - even if I define the 
>> "awards" and "idvs" arrays in the function, it doesn't work. If I define 
>> them outside the function, it works fine.
>>
>> Thanks.
>>
>> Brandon
>>
>> function parsefeed(url,st,fin)
>>
>>   db = SQLite.DB("/home/brandon/Documents/FPDS/fpds.db")
>>   schema = Data.Schema(["piid","task","mod","obl_amt"], [ASCIIString, 
>> ASCIIString, ASCIIString, Float64],)
>>   sink = SQLite.Sink(schema,db,"feeds")
>>   awards = ETree[]   #this doesn't matter
>>   idvs = ETree[]#this doesn't matter
>>
>>   for x in st:10:fin
>> dfall = DataFrame([ASCIIString, ASCIIString, ASCIIString, Float64], 
>> [:piid, :task, :mod, :obl_amt], 0)
>> df = DataFrame([ASCIIString, ASCIIString, ASCIIString, Float64], 
>> [:piid, :task, :mod, :obl_amt], 1)
>>
>> pg = xp_parse(readall(get(string(url,"=",x
>> awards = xpath(pg,"/feed/entry/content/ns1:award")
>> idvs = xpath(pg,"/feed/entry/content/ns1:IDV")
>>
>> if isdefined(:awards)
>>   for award in awards
>> df[:piid] = 
>> string(LibExpat.find(award,"ns1:awardID/ns1:awardContractID/ns1:PIID#string"))
>> df[:task] = string(LibExpat.find(award, 
>> "ns1:referencedIDVID/ns1:PIID#string"))
>> df[:mod] = string(LibExpat.find(award, 
>> "ns1:awardID/ns1:awardContractID/ns1:modNumber#string"))
>> df[:obl_amt] = 
>> float64(LibExpat.find(award,"ns1:dollarValues/ns1:obligatedAmount#string"))
>> append!(dfall,df)
>>   end
>> end
>>
>> if isdefined(:idvs)
>>   for idv in idvs
>> df[:piid] = string(LibExpat.find(idv, 
>> "ns1:awardID/ns1:awardContractID/ns1:PIID#string"))
>> df[:task] = ""
>> df[:mod] = string(LibExpat.find(idv, 
>> "ns1:awardID/ns1:awardContractID/ns1:modNumber#string"))
>> df[:obl_amt] = 
>> float64(LibExpat.find(award,"ns1:dollarValues/ns1:obligatedAmount#string"))
>> append!(dfall,df)
>>   end
>> end
>>
>> if size(dfall,1) > 0
>>   source = convertdf(dfall) #Data.Table(dfall) doesn't work, but I 
>> copied the function from DataStreams and called it convertdf and that 
>> solves the problem.
>>   Data.stream!(source,sink)
>> end
>>   end
>> end
>>
>

Re: [julia-users] Moore foundation grant.

2016-01-13 Thread Lars Tonkard
+1 to request for news on the stats roadmap :) 

On Sunday, January 10, 2016 at 11:45:59 AM UTC-5, Nils Gudat wrote:
>
> Any news on the JuliaStats team's roadmap?
>
> On Thursday, December 17, 2015 at 11:20:45 PM UTC, Viral Shah wrote:
>>
>>
>> The JuliaStats team will be publishing a general plan on stats+df in a 
>> few days. I doubt we will have settled on all the df issues by then, but at 
>> least there will be something to start with. 
>>
>>
>> -viral 
>>
>>
>>
>> > On 17-Dec-2015, at 10:15 PM, Lampkld  wrote: 
>> > 
>> > Hi Viral, 
>> > 
>> > Any update on this (stats + df) by chance or idea when we can get one? 
>> Even a roadmap or some sort of vision or other details would help with   
>> decision making regarding infrastructure. 
>> > 
>> > Thanks! 
>> > 
>> > On Wednesday, November 11, 2015 at 3:00:50 AM UTC-5, Viral Shah wrote: 
>> > Yes, we are really excited. This grant is to focus on core Julia 
>> compiler infrastructure and key math libraries. Much of the libraries focus 
>> will be on statistical Computing. 
>> > -viral 
>> > 
>>
>>

[julia-users] Dictionary lookup using only the hash value

2016-01-13 Thread Ritchie Lee
As I understand it, Julia dicts use Base.hash when storing custom types as 
keys.  Is there a way to look up based on the hash alone?

e.g.,

type MyType
a::Int
end

Base.hash(x::MyType) = hash(x.a, hash(MyType))

x = MyType(1)
D = Dict{MyType, Bool}()
D[x] = true

Now, is there a way to lookup using h only? 

h = hash(x)
D[h]

Is this be safe to do?

Thanks!


[julia-users] Re: Variable scope in a function

2016-01-13 Thread Josh Langsfeld
The tipoff is that you had to quote 'awards' to become a symbol. That's an 
indicator that you're only referring to the variable name and not to any 
value it might have coming out of the xpath function.

On Wednesday, January 13, 2016 at 4:14:18 PM UTC-5, Brandon Booth wrote:
>
> Thank you, I wouldn't have caught that in million years. The feed may not 
> include awards so that is my check to see if there are any. I can use size 
> or some other test though.
>
> Thanks again.
>
> Brandon
>
>
> On Tuesday, January 12, 2016 at 10:15:25 PM UTC-5, ele...@gmail.com wrote:
>>
>> IIUC isdefined(:awards) tests for a global variable called awards, so it 
>> won't find a local variable called awards.  What are you trying to achieve 
>> with this test?
>>
>> On Wednesday, January 13, 2016 at 12:48:50 PM UTC+10, Brandon Booth wrote:
>>>
>>> So this is the full function. Note lines 4 and 5 - even if I define the 
>>> "awards" and "idvs" arrays in the function, it doesn't work. If I define 
>>> them outside the function, it works fine.
>>>
>>> Thanks.
>>>
>>> Brandon
>>>
>>> function parsefeed(url,st,fin)
>>>
>>>   db = SQLite.DB("/home/brandon/Documents/FPDS/fpds.db")
>>>   schema = Data.Schema(["piid","task","mod","obl_amt"], [ASCIIString, 
>>> ASCIIString, ASCIIString, Float64],)
>>>   sink = SQLite.Sink(schema,db,"feeds")
>>>   awards = ETree[]   #this doesn't matter
>>>   idvs = ETree[]#this doesn't matter
>>>
>>>   for x in st:10:fin
>>> dfall = DataFrame([ASCIIString, ASCIIString, ASCIIString, Float64], 
>>> [:piid, :task, :mod, :obl_amt], 0)
>>> df = DataFrame([ASCIIString, ASCIIString, ASCIIString, Float64], 
>>> [:piid, :task, :mod, :obl_amt], 1)
>>>
>>> pg = xp_parse(readall(get(string(url,"=",x
>>> awards = xpath(pg,"/feed/entry/content/ns1:award")
>>> idvs = xpath(pg,"/feed/entry/content/ns1:IDV")
>>>
>>> if isdefined(:awards)
>>>   for award in awards
>>> df[:piid] = 
>>> string(LibExpat.find(award,"ns1:awardID/ns1:awardContractID/ns1:PIID#string"))
>>> df[:task] = string(LibExpat.find(award, 
>>> "ns1:referencedIDVID/ns1:PIID#string"))
>>> df[:mod] = string(LibExpat.find(award, 
>>> "ns1:awardID/ns1:awardContractID/ns1:modNumber#string"))
>>> df[:obl_amt] = 
>>> float64(LibExpat.find(award,"ns1:dollarValues/ns1:obligatedAmount#string"))
>>> append!(dfall,df)
>>>   end
>>> end
>>>
>>> if isdefined(:idvs)
>>>   for idv in idvs
>>> df[:piid] = string(LibExpat.find(idv, 
>>> "ns1:awardID/ns1:awardContractID/ns1:PIID#string"))
>>> df[:task] = ""
>>> df[:mod] = string(LibExpat.find(idv, 
>>> "ns1:awardID/ns1:awardContractID/ns1:modNumber#string"))
>>> df[:obl_amt] = 
>>> float64(LibExpat.find(award,"ns1:dollarValues/ns1:obligatedAmount#string"))
>>> append!(dfall,df)
>>>   end
>>> end
>>>
>>> if size(dfall,1) > 0
>>>   source = convertdf(dfall) #Data.Table(dfall) doesn't work, but I 
>>> copied the function from DataStreams and called it convertdf and that 
>>> solves the problem.
>>>   Data.stream!(source,sink)
>>> end
>>>   end
>>> end
>>>
>>

[julia-users] Re: Embedding Julia Maths functions giving ErrorException

2016-01-13 Thread Chris Cheetham
Update:

>From the documentation:
http://docs.julialang.org/en/release-0.4/manual/mathematical-operations/

Rounding,Division and Sign functions seem to work fine. Anything beyond 
that Powers, Logs, Roots; Trigonometric results in an ErrorException


On Wednesday, January 13, 2016 at 7:38:03 PM UTC, Chris Cheetham wrote:
>
> Hi there,
> I have embedded Julia into a C application. All seems to be working fine, 
> however if I try to jl_eval_string any of the Maths functions - sin() cos() 
> tan() etc I get an ErrorException. Am I missing something?
> (Operators seem to be fine 1*1 for example)
>
> Thanks,
> Chris
>
>

[julia-users] Embedded Julia and Module problems

2016-01-13 Thread Chris Cheetham
Hi there,

I am having difficulties using Modules in any Julia scripts called via C.

In the simplest instance I am getting an 'ErrorException' if I try and 
JlEvalString("using MAT") and then try to call atand(x)


This also occurs if I EvalString an include to a script that would 
otherwise load modules/work fine if included directly through the Julia 
shell rather than via C. What am I missing? Any ideas?

Thanks,
Chris




[julia-users] Embedding Julia Maths functions giving ErrorException

2016-01-13 Thread Chris Cheetham
Hi there,
I have embedded Julia into a C application. All seems to be working fine, 
however if I try to jl_eval_string any of the Maths functions - sin() cos() 
tan() etc I get an ErrorException. Am I missing something?
(Operators seem to be fine 1*1 for example)

Thanks,
Chris



[julia-users] Re: ANN: Sphinx extensions for Julia

2016-01-13 Thread John Travers
This is excellent Sebastian -- just what I was looking for 
here: https://groups.google.com/d/topic/julia-users/XUh7KPo7Sec/discussion

Thank you very much!


On Wednesday, January 13, 2016 at 4:53:58 PM UTC+1, Sebastian Krämer wrote:
>
> Sphinx  is a python framework that makes it 
> easy to create beautiful documentation for all kinds of projects. Languages 
> besides python are supported via plugins that allow to account for language 
> specific features. In the past two months I wrote such an extension for the 
> Julia language which not only implements Julia specific constructs but also 
> allows to automatically extract docstrings from Julia code. It is finally 
> in a state where I think it might be useful for other people. The project 
> itself can be found on github
>
> https://github.com/bastikr/sphinx-julia
>
> and is documented at
>
> http://bastikr.github.io/sphinx-julia/
>
> I really would appreciate feedback and bug reports!
>


[julia-users] Beamforming code in Julia

2016-01-13 Thread Robert Luke
Are there any packages/snippets that implement time or frequency domain 
beamforming in Julia?


[julia-users] Re: Embedding Julia Maths functions giving ErrorException

2016-01-13 Thread Chris Cheetham
Another update, strangely some seem to work in the degree variants, for 
example sind() cosd() tand() work, however sin() cos() tan() result in an 
error exception. atand() however, which is in degrees does not work.Is 
anyone else experiencing this? 


On Wednesday, January 13, 2016 at 7:38:03 PM UTC, Chris Cheetham wrote:
>
> Hi there,
> I have embedded Julia into a C application. All seems to be working fine, 
> however if I try to jl_eval_string any of the Maths functions - sin() cos() 
> tan() etc I get an ErrorException. Am I missing something?
> (Operators seem to be fine 1*1 for example)
>
> Thanks,
> Chris
>
>

[julia-users] A question about chol()

2016-01-13 Thread Richard Dennis
Why is the following not okay?

s = [0.1 0.09; 0.09 0.5]
z = chol(s)
t = z[:,1]

This gives a dimension error.

The following does work

s = [0.1 0.09; 0.09 0.5]
z = chol(s)
y = convert(Array,z)
t = z[:,1]

Somehow it seems to me that the convert() should not be needed.


[julia-users] Help with using GPU backend and Mocha

2016-01-13 Thread kleinsplash
Hi, 

Pkg.test("Mocha") works for CPU.


But now I want to use my GPU backend; I set ENV["MOCHA_USE_CUDA"] = "true"

I find the device no issues 
* CUDA enabled [DEV=0] (MOCHA_USE_CUDA environment variable detected)

But I get the error: 

ERROR: LoadError: ccall: could not find function cublasCreate_v2 in library 
from here: Mocha/src/cuda/cublas.jl:50


EDIT: after a couple days of Pkg.update() I now have the error: 
ERROR: LoadError: ccall: could not find function cudnnCreate in library

Should I be linking libraries at runtime? how do I do that using Julia? I 
have put this on the issues list at Mocha (
https://github.com/pluskid/Mocha.jl/issues/172https://github.com/pluskid/Mocha.jl/issues/172
 
) - but I am wondering if 
it's just my noob status rather than an issue. 


Thx


Re: [julia-users] Moore foundation grant.

2016-01-13 Thread Simon Byrne
Hi All,

The roadmap has now been posted:
http://juliacomputing.com/blog/2016/01/14/stats-roadmap.html

Can I suggest that comments be posted to the julia-stats thread:
https://groups.google.com/d/topic/julia-stats/29l5yA87Qss/discussion

-Simon

On Wednesday, 13 January 2016 21:23:03 UTC, Lars Tonkard wrote:
>
> +1 to request for news on the stats roadmap :) 
>
> On Sunday, January 10, 2016 at 11:45:59 AM UTC-5, Nils Gudat wrote:
>>
>> Any news on the JuliaStats team's roadmap?
>>
>> On Thursday, December 17, 2015 at 11:20:45 PM UTC, Viral Shah wrote:
>>>
>>>
>>> The JuliaStats team will be publishing a general plan on stats+df in a 
>>> few days. I doubt we will have settled on all the df issues by then, but at 
>>> least there will be something to start with. 
>>>
>>>
>>> -viral 
>>>
>>>
>>>
>>> > On 17-Dec-2015, at 10:15 PM, Lampkld  wrote: 
>>> > 
>>> > Hi Viral, 
>>> > 
>>> > Any update on this (stats + df) by chance or idea when we can get one? 
>>> Even a roadmap or some sort of vision or other details would help with   
>>> decision making regarding infrastructure. 
>>> > 
>>> > Thanks! 
>>> > 
>>> > On Wednesday, November 11, 2015 at 3:00:50 AM UTC-5, Viral Shah wrote: 
>>> > Yes, we are really excited. This grant is to focus on core Julia 
>>> compiler infrastructure and key math libraries. Much of the libraries focus 
>>> will be on statistical Computing. 
>>> > -viral 
>>> > 
>>>
>>>

[julia-users] Re: What's the difference between unique(a) and union(a)

2016-01-13 Thread Dan
Essentially, not much. `union` accepts multiple arguments with multiple 
types, but `unique` accepts a single collection.
For example:
union(1,2,3,3) == unique([1,2,3,3])
This would probably make `union` slightly slower.

On Wednesday, January 13, 2016 at 11:58:18 PM UTC+2, Sheehan Olver wrote:
>
> Is there a difference between these two commands:
>
> *julia> **unique([1,2,3,3])*
>
> *3-element Array{Int64,1}:*
>
> * 1*
>
> * 2*
>
> * 3*
>
>
> *julia> **union([1,2,3,3])*
>
> *3-element Array{Int64,1}:*
>
> * 1*
>
> * 2*
>
> * 3*
>
>

[julia-users] Re: tip for using Julia on OS X

2016-01-13 Thread Bryan Rivera
This works on El Capitan:

sudo nano /etc/paths 



Add this line to end of file:

/Applications/Julia-0.4.2.app/Contents/Resources/julia/bin 



Ctrl-O then enter to save.


[julia-users] What's the difference between unique(a) and union(a)

2016-01-13 Thread Sheehan Olver
Is there a difference between these two commands:

*julia> **unique([1,2,3,3])*

*3-element Array{Int64,1}:*

* 1*

* 2*

* 3*


*julia> **union([1,2,3,3])*

*3-element Array{Int64,1}:*

* 1*

* 2*

* 3*



[julia-users] Re: Shell commands in Julia 0.4.2 in Windows 10

2016-01-13 Thread Tony Kelman
Unix shell commands that we happened to be getting from git are no longer on 
Julia's path. This is not temporary. Windows is not unix. If you want to use 
unix shell commands on windows, either download and add your own windows posix 
layer to your path (temporarily in juliarc, not permanently where it will break 
other software), or call powershell which has many aliases spelled the same as 
unix shell commands.

Re: [julia-users] Re: RFC: ROOT.jl, wrappers for the ROOT library from CERN

2016-01-13 Thread Oliver Schulz
Hi,

I played around a bit more, and managed to get the ROOT GUI (e.g. TBrowser 
or histogram in TCanvas) running from within Julia. One has to start a 
TTimer for some reason (else ROOT's event loop blocks for longs times), 
took some digging in TQRootApplication.cxx to discover that trick.

Anyhow if anyone's interested, here's a gist with a little demo (needs 
ROOT-5, for now, of course):

https://gist.github.com/oschulz/e471c2e6c7dcd7ea10a5

 It fills a histogram with a Gauss, draws it, and does a simple fit. Fun to 
see ROOT's fitter output on the Julia console.

I'm thinking about putting together a small Julia package ("CxxROOT.jl", 
maybe?), focused on TH1, TTree and GUI via "Cxx.jl" (won't cover as many 
classes as "ROOT.jl") - just to explore these things further, and as a 
stopgap to use ROOT+Julia for my work. Joosep, would you be interested, too?


Cheers,

Oliver


On Wednesday, January 13, 2016 at 1:01:54 AM UTC+1, Oliver Schulz wrote:
>
> That's great news - thanks a lot, Keno!
>
> On Tuesday, January 12, 2016 at 4:24:33 PM UTC+1, Keno Fischer wrote:
>>
>> Doesn't work with ROOT-6, though, as the LLVM instances
>>> of Cling and Julia seem to clash.
>>>
>>
>> I've been talking to the ROOT authors to get this resolved as well as 
>> getting better integration. 
>>
>

Re: [julia-users] Dictionary lookup using only the hash value

2016-01-13 Thread Mauro
No, this is not possible.  Dicts use the function Base.hashindex to
convert a hash into an index into the internal storage arrays (one for
keys, one for values, one a bool stating whether used or not, see [1]).  
However,
collisions are likely.  For instance, 1 and 18 map to the same index for
a length 16 internal storage array:

julia> Base.hashindex(1,16)
16

julia> Base.hashindex(18,16)
16

Thus you need to check for equality too: if the content of the key-array
at that location is not equal to the key, the next location is checked
until the key is found (or an empty slot is encountered and an error is
thrown).

[1] 
https://github.com/JuliaLang/julia/blob/5cbb72ca46791c6491a098399642c00daf97cec0/base/dict.jl#L390

On Wed, 2016-01-13 at 21:59, Ritchie Lee  wrote:
> As I understand it, Julia dicts use Base.hash when storing custom types as
> keys.  Is there a way to look up based on the hash alone?
>
> e.g.,
>
> type MyType
> a::Int
> end
>
> Base.hash(x::MyType) = hash(x.a, hash(MyType))
>
> x = MyType(1)
> D = Dict{MyType, Bool}()
> D[x] = true
>
> Now, is there a way to lookup using h only?
>
> h = hash(x)
> D[h]
>
> Is this be safe to do?
>
> Thanks!


Re: [julia-users] Fortran-formatted files

2016-01-13 Thread MA Laforge
Hi all,

Maybe I am missing something myself...  I too seem to find the Julia 
textfile reading facilities inadequate (or maybe I am using them wrong).

As Jacob Quinn suggested, I tried using readdlm, but it only seems to work 
for text files with a regular structure.  For example:
#Comments at start
#Comments at start
...
#Comments at start

#Regular table of data:
data1, data2, data3, ... dataN
data1, data2, data3, ... dataN
data1, data2, data3, ... dataN

..But alot of existing file formats are *not* this regular

..So I have developped a temporary workaround (still waiting for someone to 
show me what I am doing wrong).

*Solution*
My solution is not as flexible as the scanf() tool, but it works well with 
the 90% of file formats that don't need that level of control.  It is 
provided as part of the FileIO2 module:
https://github.com/ma-laforge/FileIO2.jl

The solution is based on a new type called "TextReader", constructed with:
reader = TextReader(::IO, splitter= [' ', '\t'])
(As with readdlm, you can add ',' to splitter for CSV files)

The goal of the TextReader object is to take control of an ::IO stream, and 
provide higher-level read functionnality.

To use it, you can open a text file using the "Base.open" method:
reader = open(FileIO2.TextReader, "MYTEXTFILE.TXT")

You can therfore read a regular file with the following pattern:
while !eof(reader)
data = read(reader, Int)
println("Read: $(typeof(data))(`$data`)")
end

And you can read a more irregular data with the following:
dataid = read(reader, AbstractString)
dataval = read(reader, Int)
dataid = read(reader, AbstractString)
dataval = read(reader, Int)
...

Note that the current method for `read(stream::IO, DataType)` considers the 
data stream to be binary... not text.  However, by dispatching on a 
TextReader object, we can re-define the behaviour to be more appropriate 
for the task at hand.

You can also let parse() auto-detect the type, for quick-and-dirty 
solutions:
dataany = read(reader, Any) #Might return an Int, String, Float, ...

Feel free to use it... but I suggest making a copy of the code.  The 
FileIO2 interface is still in the experimental phase. It *will* 
change/break your code.

*FileIO2 Comment*
The solution in the FileIO2.jl module looks a bit complicated because it 
ties into a File{}-type-based-system.  The different File{} types are used 
by Julia's dispatch system to call the appropriate open/read/write method 
(unique Julia signature).  This is not possible when using simple Strings 
to pass the filename.

FYI: Using the higher level API, one can use the simple, high-level call:
reader = open(File(:text, "MYTEXTFILE.TXT"))

This call uses Julia itrospection to detect text readers from any currently 
loaded module.

Note that only the "FileIO2.TextReader" object performs this service at the 
moment...


Regards,

MA


On Friday, March 7, 2014 at 4:20:30 PM UTC-5, Jacob Quinn wrote:
>
> Have you checked out `readdlm`? It's flexibility has grown over time and 
> serves most of my needs.
>
> http://docs.julialang.org/en/latest/stdlib/base/#Base.readdlm
>
> -Jacob
>


[julia-users] Re: Manipulating strings from user input

2016-01-13 Thread Jose Pereira
Hi Kristoffer, Thanks very much! Removing 'parse' works. I've learnt 
something new. :) Thanks. 

On Tuesday, 12 January 2016 20:59:46 UTC+8, Kristoffer Carlsson wrote:
>
> Why do you run "parse" on input()? This will parse a string to give a 
> expression which in this case just gives you a symbol.
>
> Removing the parse call makes thing work for me.
>
> On Tuesday, January 12, 2016 at 1:51:59 PM UTC+1, Jose Pereira wrote:
>>
>> Hi,
>> I need to use Julia's string functions to manipulate a string from a user 
>> input. Julia keeps giving an error. Strings defined directly in the code 
>> seem to work fine with Julia's string functions.
>>
>> From the code snippet below, the string defined for "b" gives the correct 
>> output.
>>
>> For "c", code fails at line 19 with the following error message:
>>
>> ERROR: LoadError: MethodError: 'get index' has no method matching 
>> getindex(::Symbol, ::Int64) 
>> in include at boot.jl:261
>> in include_from_node1 at loading.jl:304
>>
>> If line 19 is commented out, it fails at line 20 with the following error 
>> message:
>>
>> ERROR: LoadError: MethodError: 'length' has no method matching 
>> length(::Symbol) 
>> in include at boot.jl:261
>> in include_from_node1 at loading.jl:304
>>
>> Need suggestions on what is wrong/missing in my code.
>>
>> Thanks,
>> Jose
>>
>> 1b=string();
>> 2c=string();
>> 3
>> 4b="CGAT";
>> 5
>> 6#Input
>> 7 function input(prompt::AbstractString="")
>> 8  print("Enter first string\n")
>> 9  chomp(readline())
>> 10   end
>> 11   c=parse(input());
>> 12   println("You entered, ",c)
>> 13
>> 14   println("string b = ",b)
>> 15   println("1st char in string b = ",b[1])
>> 16   println("Length of string b = ",length(b))
>> 17
>> 18  println("string c = ",c)
>> 19  println("1st char in string c = ",c[1])
>> 20  println("Length of string c = ",length(c))
>>
>

[julia-users] Re: A question about chol()

2016-01-13 Thread cdm

chol() returns a matrix type ...

changing your final line to

   t = vcat(z)[:, 1]

avoids the explicit convert step.



i imagine there are other,
perhaps preferable, ways
to accomplish this ...



On Wednesday, January 13, 2016 at 12:48:50 PM UTC-8, Richard Dennis wrote:
>
> Why is the following not okay?
>
> s = [0.1 0.09; 0.09 0.5]
> z = chol(s)
> t = z[:,1]
>
> This gives a dimension error.
>
> The following does work
>
> s = [0.1 0.09; 0.09 0.5]
> z = chol(s)
> y = convert(Array,z)
> t = z[:,1]
>
> Somehow it seems to me that the convert() should not be needed.
>


[julia-users] [PyPlot] Saving figure into the file without pop up window

2016-01-13 Thread Alexandr
How can I save the plot into the file without showing the figure?

The code like this saves the figure but before it the figure shows up:

> using PyPlot
> 
> p=plot(x_vector)
> savefig("D:/test.PNG")

How can I save the plot directly into the file?

Thank you!

-- 
Alexandr


Re: [julia-users] Re: good approach to run julia scripts in parallel in a PC

2016-01-13 Thread Charles Novaes de Santana
Absolutely amazing!!! Thanks a lot, Greg! It works like a charm!

Best,

Charles

On 13 January 2016 at 11:20, 'Greg Plowman' via julia-users <
julia-users@googlegroups.com> wrote:

>
> You might be able to use pmap:
>
> http://docs.julialang.org/en/release-0.4/manual/parallel-computing/#parallel-map-and-loops
>
> http://docs.julialang.org/en/release-0.4/stdlib/parallel/?highlight=pmap#Base.pmap
>
> Perhaps something like:
>
> @everywhere function test1(p)
> println("doing stuff with $p")
> return 2*p
> end
>
> function main()
> parameters = collect(0.001:0.001:0.6)
> results = pmap(test1, parameters)
> end
>
> main()
>
>
> On Wednesday, January 13, 2016 at 1:32:08 AM UTC+11, Charles Santana wrote:
>>
>> Hi julians,
>>
>> Parallel computing is not my focus, but I would like to run a  julia
>> script in parallel in my PC in order to save time. The PC has an 8-core
>> processor so I would like to run at least 4 replicates of my script
>> (test1.jl) at the same time, each one with one different parameter.
>>
>> So far I was working on a cluster and I was using qsub in order to submit
>> my jobs. I didn't need to configure anything. I had a quota of 20 jobs, so
>> if I launched 200 jobs 20 of them would run and the others would be in a
>> queue waiting for their moment to run.
>>
>> Now I would like to run my scripts in my machine and I would like to do
>> something similar. For me it is fine if I wait for the current jobs to
>> finish running in order to launch another bunch of jobs. As well as it is
>> fine if I launch a new job for each experiment that finishes. The easiest
>> option the best :)
>>
>> My script does not receive any file as input, but it writes the outputs
>> to unique files (the file names are unique for each job).
>>
>> Do you recommend a good way to do it in Julia? Let's say my script is
>> called "test1.jl". So far I was trying the following code to call my jobs:
>>
>> function main()
>> parameters = collect(0.001:0.001:0.6);
>> @parallel for(p in parameters)
>> command1 = `/home/cdesantana/Downloads/julia -p 4
>> /home/cdesantana/Experiments/test1.jl $p`;
>> run(command1);
>> end
>> end
>>
>> main();
>>
>> I really don't understand what is happening here, but I am sure it is not
>> working 4 jobs of my scripts... :(
>>
>> cdesantana@c-de-santana:~/Data/Dendritics/poster2016$ ps aux|grep julia
>> cdesant+  1964  3.7  1.3 9214696 107356 pts/10 Sl   15:20   0:01
>> /home/cdesantana/Downloads/julia/julia script.jl
>> cdesant+  1994 92.2  2.7 9489844 214388 pts/10 Rl   15:20   0:31
>> /home/cdesantana/Downloads/julia/julia -p4
>> /home/cdesantana/Experiments/test1.jl 1 0.001
>> cdesant+  2013  8.7  1.5 9189424 120340 ?  Ssl  15:20   0:02
>> /home/cdesantana/Downloads/julia/usr/bin/julia -Cnative
>> -J/home/cdesantana/Downloads/julia/usr/lib/julia/sys.so --bind-to
>> 192.168.89.174 --worker
>> cdesant+  2016  9.2  1.6 9288520 131600 ?  Ssl  15:20   0:03
>> /home/cdesantana/Downloads/julia/usr/bin/julia -Cnative
>> -J/home/cdesantana/Downloads/julia/usr/lib/julia/sys.so --bind-to
>> 192.168.89.174 --worker
>> cdesant+  2018  6.7  1.6 9353972 131772 ?  Ssl  15:20   0:02
>> /home/cdesantana/Downloads/julia/usr/bin/julia -Cnative
>> -J/home/cdesantana/Downloads/julia/usr/lib/julia/sys.so --bind-to
>> 192.168.89.174 --worker
>> cdesant+  2023  7.7  1.6 9419496 131604 ?  Ssl  15:20   0:02
>> /home/cdesantana/Downloads/julia/usr/bin/julia -Cnative
>> -J/home/cdesantana/Downloads/julia/usr/lib/julia/sys.so --bind-to
>> 192.168.89.174 --worker
>> cdesant+  2159  0.0  0.0  11716   892 pts/10   S+   15:21   0:00 grep
>> --color=auto julia
>>
>> I was expecting that it would be running my script 4 times, each one with
>> one different value of $p (0.001, 0.002, 0.003, 0.004).
>>
>> Any suggestion? My machine has ubuntu installed so I am fine if I need to
>> combine Linux programs with Julia.
>>
>> Many thanks in advance for any help!
>>
>> Best,
>>
>> Charles
>> --
>> Um axé! :)
>>
>> --
>> Charles Novaes de Santana, PhD
>> https://github.com/cndesantana
>>
>


-- 
Um axé! :)

--
Charles Novaes de Santana, PhD
https://github.com/cndesantana


Re: [julia-users] Cannot pull with rebase...?

2016-01-13 Thread fabian
Thanks for the reply. Unfortunately, I cannot find any such folder. This is 
the binary 64-bit version of Julia 0.4.2 on W10x64pro. I expected this to 
just install and run, but apparently this is not the case, at least not on 
W10...


On Tuesday, January 12, 2016 at 4:48:22 PM UTC+1, Stefan Karpinski wrote:
>
> If you go into ~/.julia/v0.4/METADATA and do `git status` you should see 
> what's going on there.
>
> On Tue, Jan 12, 2016 at 10:41 AM,  
> wrote:
>
>> Hello all 
>> (first post)
>>
>> I just now downloaded version 0.4.2 of Julia, and installed it on my 
>> W10x64pro machine. I was going to use it to run the optimization packages, 
>> so I did the Pkg.update() on the Julia cmd line, as instructed here 
>> http://www.juliaopt.org/.
>>
>> To my surprise, i get the following error message:
>>
>> INFO: Updating METADATA...
>> error: Cannot pull with rebase: You have unstaged changes.
>> ERROR: failed process: Process(`git pull --rebase -q`, ProcessExited(1)) 
>> [1]
>>  in pipeline_error at process.jl:555
>>
>> I have not done any changes to any source, just DL'ed and installed the 
>> 64-bit binary for windows, and I have no clue what is going on... Does 
>> anyone have any ideas?
>>
>> Thanks.
>>
>
>

Re: [julia-users] Cannot pull with rebase...?

2016-01-13 Thread Christopher Alexander

In your user folder, you don't have a .julia folder?  It is hidden, so you 
might have to turn on hidden folders or access it via the command prompt. 
 If you are on a computer with a network drive, it might have put the 
folder in there.

On Wednesday, January 13, 2016 at 10:36:51 AM UTC-5, fab...@chalmers.se 
wrote:
>
> Thanks for the reply. Unfortunately, I cannot find any such folder. This 
> is the binary 64-bit version of Julia 0.4.2 on W10x64pro. I expected this 
> to just install and run, but apparently this is not the case, at least not 
> on W10...
>
>
> On Tuesday, January 12, 2016 at 4:48:22 PM UTC+1, Stefan Karpinski wrote:
>>
>> If you go into ~/.julia/v0.4/METADATA and do `git status` you should see 
>> what's going on there.
>>
>> On Tue, Jan 12, 2016 at 10:41 AM,  wrote:
>>
>>> Hello all 
>>> (first post)
>>>
>>> I just now downloaded version 0.4.2 of Julia, and installed it on my 
>>> W10x64pro machine. I was going to use it to run the optimization packages, 
>>> so I did the Pkg.update() on the Julia cmd line, as instructed here 
>>> http://www.juliaopt.org/.
>>>
>>> To my surprise, i get the following error message:
>>>
>>> INFO: Updating METADATA...
>>> error: Cannot pull with rebase: You have unstaged changes.
>>> ERROR: failed process: Process(`git pull --rebase -q`, ProcessExited(1)) 
>>> [1]
>>>  in pipeline_error at process.jl:555
>>>
>>> I have not done any changes to any source, just DL'ed and installed the 
>>> 64-bit binary for windows, and I have no clue what is going on... Does 
>>> anyone have any ideas?
>>>
>>> Thanks.
>>>
>>
>>

Re: [julia-users] Cannot pull with rebase...?

2016-01-13 Thread Stefan Karpinski
What is the result of `Pkg.dir()`  in the Julia REPL? That's where your
packages live and the METADATA repo.

On Wed, Jan 13, 2016 at 10:36 AM,  wrote:

> Thanks for the reply. Unfortunately, I cannot find any such folder. This
> is the binary 64-bit version of Julia 0.4.2 on W10x64pro. I expected this
> to just install and run, but apparently this is not the case, at least not
> on W10...
>
>
> On Tuesday, January 12, 2016 at 4:48:22 PM UTC+1, Stefan Karpinski wrote:
>>
>> If you go into ~/.julia/v0.4/METADATA and do `git status` you should see
>> what's going on there.
>>
>> On Tue, Jan 12, 2016 at 10:41 AM,  wrote:
>>
>>> Hello all
>>> (first post)
>>>
>>> I just now downloaded version 0.4.2 of Julia, and installed it on my
>>> W10x64pro machine. I was going to use it to run the optimization packages,
>>> so I did the Pkg.update() on the Julia cmd line, as instructed here
>>> http://www.juliaopt.org/.
>>>
>>> To my surprise, i get the following error message:
>>>
>>> INFO: Updating METADATA...
>>> error: Cannot pull with rebase: You have unstaged changes.
>>> ERROR: failed process: Process(`git pull --rebase -q`, ProcessExited(1))
>>> [1]
>>>  in pipeline_error at process.jl:555
>>>
>>> I have not done any changes to any source, just DL'ed and installed the
>>> 64-bit binary for windows, and I have no clue what is going on... Does
>>> anyone have any ideas?
>>>
>>> Thanks.
>>>
>>
>>


Re: [julia-users] Would the Complex{Bool}(false,true) == im approach be useful for Quaternion i,j,k?

2016-01-13 Thread Stefan Karpinski
That could be done but it doesn't seem useful enough to bother with. The
`im` constant is really just for notational convenience and doesn't make
anything faster.

On Tuesday, January 12, 2016, Jeffrey Sarnoff 
wrote:

> complex.jl defines im as Complex{Bool}(false,true).  Is there a reason
> that re is not defined as Complex{Bool}(true,false}?
>
> If I were to build a parameterized collection of Quaternion types
> (different from Quaternions.jl), including Quaternion{Bool} and
> Quaternion{FloatNN},
> is there an advantage obtained by defining the Quaternion `imaginary`
> units i,j,k as
>qi=Quaternion{Bool}(false,true,false,false};
> qj=Quaternion{Bool}(false,false,true,false}; qk
> =Quaternion{Bool}(false,false,false.true}?
> Would some of the op(Quaternion,Quaternion) math run faster (or jump
> higher)?
>
>
>
>
>
>


[julia-users] ANN: Sphinx extensions for Julia

2016-01-13 Thread Sebastian Krämer
Sphinx  is a python framework that makes it 
easy to create beautiful documentation for all kinds of projects. Languages 
besides python are supported via plugins that allow to account for language 
specific features. In the past two months I wrote such an extension for the 
Julia language which not only implements Julia specific constructs but also 
allows to automatically extract docstrings from Julia code. It is finally 
in a state where I think it might be useful for other people. The project 
itself can be found on github

https://github.com/bastikr/sphinx-julia

and is documented at

http://bastikr.github.io/sphinx-julia/

I really would appreciate feedback and bug reports!


Re: [julia-users] reason for inner constructor in Dates

2016-01-13 Thread Stefan Karpinski
I suspect it's because Jacob originally wrote this code  for 0.3 which
provided much less permissive default constructors which only worked with
exactly matching argument types.

On Wednesday, January 13, 2016, Tamas Papp  wrote:

> Hi,
>
> I am reading the code of Base libraries to improve my understanding and
> style. In base/dates/types.jl, I noticed
>
> for T in (:Year,:Month,:Week,:Day)
> @eval immutable $T <: DatePeriod
> value::Int64
> $T(v::Number) = new(v)
> end
> end
>
> which expands to code like
>
> immutable Year <: DatePeriod
>   value::Int64
>   Year(v::Number) = new(v)
> end
>
> I have a simple question: what is the reason for defining the inner
> constructor? Wouldn't
>
> immutable Year <: DatePeriod
>   value::Int64
> end
>
> automatically define one, except for restricting to ::Number? If that is
> the reason, I would like to understand why.
>
> Best,
>
> Tamas
>


Re: [julia-users] reason for inner constructor in Dates

2016-01-13 Thread Stefan Karpinski
Try pretending it with @which

On Wednesday, January 13, 2016, Tamas Papp  wrote:

> Can someone please explain me what happens when I call eg
>
> Dates.Year("100")
>
> ? From the constructor, only ::Number arguments should be accepted, yet
> this "just works" --- I am not sure it is intended though (I recall the
> manual saying somewhere that Julia does not treat strings as numbers).
>
> I reread certain parts of the manual, but I can't figure this out.
>
> Best,
>
> Tamas
>
> On Wed, Jan 13 2016, Stefan Karpinski wrote:
>
> > I suspect it's because Jacob originally wrote this code  for 0.3 which
> > provided much less permissive default constructors which only worked with
> > exactly matching argument types.
> >
> > On Wednesday, January 13, 2016, Tamas Papp  > wrote:
> >
> >> Hi,
> >>
> >> I am reading the code of Base libraries to improve my understanding and
> >> style. In base/dates/types.jl, I noticed
> >>
> >> for T in (:Year,:Month,:Week,:Day)
> >> @eval immutable $T <: DatePeriod
> >> value::Int64
> >> $T(v::Number) = new(v)
> >> end
> >> end
> >>
> >> which expands to code like
> >>
> >> immutable Year <: DatePeriod
> >>   value::Int64
> >>   Year(v::Number) = new(v)
> >> end
> >>
> >> I have a simple question: what is the reason for defining the inner
> >> constructor? Wouldn't
> >>
> >> immutable Year <: DatePeriod
> >>   value::Int64
> >> end
> >>
> >> automatically define one, except for restricting to ::Number? If that is
> >> the reason, I would like to understand why.
> >>
> >> Best,
> >>
> >> Tamas
> >>
>


Re: [julia-users] reason for inner constructor in Dates

2016-01-13 Thread Tamas Papp
Can someone please explain me what happens when I call eg

Dates.Year("100")

? From the constructor, only ::Number arguments should be accepted, yet
this "just works" --- I am not sure it is intended though (I recall the
manual saying somewhere that Julia does not treat strings as numbers).

I reread certain parts of the manual, but I can't figure this out.

Best,

Tamas

On Wed, Jan 13 2016, Stefan Karpinski wrote:

> I suspect it's because Jacob originally wrote this code  for 0.3 which
> provided much less permissive default constructors which only worked with
> exactly matching argument types.
>
> On Wednesday, January 13, 2016, Tamas Papp  wrote:
>
>> Hi,
>>
>> I am reading the code of Base libraries to improve my understanding and
>> style. In base/dates/types.jl, I noticed
>>
>> for T in (:Year,:Month,:Week,:Day)
>> @eval immutable $T <: DatePeriod
>> value::Int64
>> $T(v::Number) = new(v)
>> end
>> end
>>
>> which expands to code like
>>
>> immutable Year <: DatePeriod
>>   value::Int64
>>   Year(v::Number) = new(v)
>> end
>>
>> I have a simple question: what is the reason for defining the inner
>> constructor? Wouldn't
>>
>> immutable Year <: DatePeriod
>>   value::Int64
>> end
>>
>> automatically define one, except for restricting to ::Number? If that is
>> the reason, I would like to understand why.
>>
>> Best,
>>
>> Tamas
>>


[julia-users] Re: Factors in Sparse QR factorization

2016-01-13 Thread Andreas Noack
Eventually, we should support multiplying with Q in the same way it 
possible with dense QR. It will require that we introduce a Q type for 
sparse QR for which we can overload the usual matrix multiplication 
functions by appropriate calls to qmult. Notice however that qmult is only 
defined for multiplication with dense matrices. The C API only supports 
part of the functionality availible in SPQR. You could look into 
wrapping SuiteSparseQR_C_QR in a method similar to qr (i.e. not qrfact) 
which will give what you want. A PR would be very welcome.

Finally, you are probably aware, but notice that Q will have a lower 
sparcity than the original matrix so it is often recommened to avoid 
constructing it explicitly.

On Tuesday, January 12, 2016 at 8:34:48 AM UTC-5, Christopher Rinderspacher 
wrote:
>
> Dear All,
>
> I need direct access to Q and R of a sparse matrix for one of my 
> algorithms. Currently, it seems the API does not support this, although 
> internally spqr.jl implements qmult, which I presume I could use if it was 
> exposed to multiply Q with the identity (in a sparse format) to get Q. 
> Similarly with R. Are there any plans to expose appropriate APIs?
>
> Sincerely,
>
> Christopher
>


[julia-users] Re: Shell commands in Julia 0.4.2 in Windows 10

2016-01-13 Thread hustf

I for one really miss the shell commands, which disappeared with 0.4.2. 

Fortunately, cd still works, but that's about it. pwd() inside of Julia is 
not so bad, but you soon tire of typing readdir()  instead of just ;ls. If 
there are more than a few files in the directory, the output is truncated, 
too. For new users testing Julia from the documentation this gives a pretty 
bad impression.

Fortunately, this seems to be a temporary state of affairs, and with the 
new git library integrated with Julia, the package system will be a lot 
faster, too. There is an explanation in the thread below. Just don't follow 
the (my) advice and cut down your PATH. If you meet problems with it, try 
rearranging the PATH variable or put the julia and atom paths in the 
"system" and not "user" part of the definition. You need to be logged in to 
an administrator account to change the system PATH definitions, I believe.

You will likely see less issues than I did with the PATH since Juno/ Atom/ 
Lighttable (or whatever it's really called) is now updated and gives more 
flexibility.

https://groups.google.com/forum/#!searchin/julia-users/powershell/julia-users/pHonnw8X3iw/Vcbuj5amAwAJ
 



Re: [julia-users] Would the Complex{Bool}(false,true) == im approach be useful for Quaternion i,j,k?

2016-01-13 Thread Jeffrey Sarnoff
thanks

On Wednesday, January 13, 2016 at 9:29:54 AM UTC-5, Stefan Karpinski wrote:
>
> That could be done but it doesn't seem useful enough to bother with. The 
> `im` constant is really just for notational convenience and doesn't make 
> anything faster.
>
> On Tuesday, January 12, 2016, Jeffrey Sarnoff  > wrote:
>
>> complex.jl defines im as Complex{Bool}(false,true).  Is there a reason 
>> that re is not defined as Complex{Bool}(true,false}? 
>>
>> If I were to build a parameterized collection of Quaternion types 
>> (different from Quaternions.jl), including Quaternion{Bool} and 
>> Quaternion{FloatNN},
>> is there an advantage obtained by defining the Quaternion `imaginary` 
>> units i,j,k as 
>>qi=Quaternion{Bool}(false,true,false,false}; 
>> qj=Quaternion{Bool}(false,false,true,false}; qk 
>> =Quaternion{Bool}(false,false,false.true}?
>> Would some of the op(Quaternion,Quaternion) math run faster (or jump 
>> higher)?  
>>
>>
>>
>>
>>
>>

Re: [julia-users] [PyPlot] Saving figure into the file without pop up window

2016-01-13 Thread Yichao Yu
On Wed, Jan 13, 2016 at 11:20 AM, Alexandr  wrote:
> How can I save the plot into the file without showing the figure?
>
> The code like this saves the figure but before it the figure shows up:

This should only happen in interactive mode. Shouldn't happen when run
as a script or if you turn interactive mode off.

https://github.com/stevengj/PyPlot.jl#interactive-versus-julia-graphics

>
>> using PyPlot
>> 
>> p=plot(x_vector)
>> savefig("D:/test.PNG")
>
> How can I save the plot directly into the file?
>
> Thank you!
>
> --
> Alexandr