Re: [julia-users] Re: How can I find the common elements of two matrix(or arrays)?

2016-07-21 Thread Joshua Ballanco
Use `enumerate`: julia> a = [1,3,5,8] julia> b = [1,2,5,7] julia> intersect(enumerate(a), enumerate(b)) 2-element Array{Tuple{Int64,Int64},1}: (1,1) (3,5) On July 5, 2016 at 13:20:15, siyu song (siyuphs...@gmail.com) wrote: Good to know this method. Thanks a lot. 在 2016年7月6日星期三

[julia-users] Working with DataFrame columns types that are Nullable

2016-07-21 Thread John Best
I've got ODBC.jl set up to retrieve a couple of queries. This works, but it is returning a DataFrame with column eltypes of Nullable{Int64}, Nullable{Dec64}, etc. I'd like to convert the numeric element types to Float64 for use in my analysis (which was written based on reading .csv's of the

[julia-users] Re: Julia at the SIAM Annual Conference

2016-07-21 Thread Chris Rackauckas
Wait until next year. I can't present on Julia codes there until they're published (adviser's rules). I think in general that would apply a to a lot of people: started getting involved during v0.3, did a project in v0.4 which is now submitted, but won't be out there to present until next year.

[julia-users] Re: Julia at the SIAM Annual Conference

2016-07-21 Thread Sheehan Olver
Julia Computing sponsored the bags. Though I was surprised there was no booth.. On Tuesday, July 12, 2016 at 9:33:49 AM UTC+10, Xiangxi Gao wrote: > > So I am crashing the SIAM annual conference held at the Boston Westin > Hotel this year from 7/11 to 7/15 and noticed a lot of Mathworks folks

Re: [julia-users] A foolproof question about ylim

2016-07-21 Thread Yichao Yu
On Thu, Jul 21, 2016 at 7:03 PM, wrote: > > > How can I get ylim when using PyPlot? I tried all the suggestions I found on > stackoverflow. None of them works, e.g. get_ylim(). Here is the error: > > ERROR: LoadError: UndefVarError: get_ylim not defined > > Can anyone give

Re: [julia-users] Re: accessing an expression's global scope from macro

2016-07-21 Thread Yichao Yu
On Thu, Jul 21, 2016 at 7:02 PM, Marius Millea wrote: > > > On Thu, Jul 21, 2016 at 11:37 PM, Cedric St-Jean > wrote: >> >> Neat macro. >> >>> >>> For this though, my macro needs to somehow figure out that "inc" was also >>> defined with @self

[julia-users] A foolproof question about ylim

2016-07-21 Thread chobbes158
How can I get ylim when using PyPlot? I tried all the suggestions I found on stackoverflow. None of them works, e.g. get_ylim(). Here is the error: ERROR: LoadError: UndefVarError: get_ylim not defined Can anyone give me an example of getting the current ylim? Thanks!!

Re: [julia-users] Re: accessing an expression's global scope from macro

2016-07-21 Thread Marius Millea
On Thu, Jul 21, 2016 at 11:37 PM, Cedric St-Jean wrote: > Neat macro. > > >> For this though, my macro needs to somehow figure out that "inc" was also >> defined with @self (since it shouldn't blindly add self as a first arg so >> other non-@self'ed function calls). Is

[julia-users] Re: I can't believe this spped-up !

2016-07-21 Thread 'Greg Plowman' via julia-users
and also compare (note the @sync) @time @sync @parallel for i in 1:10 sleep(1) end Also note that using reduction with @parallel will also wait: z = @parallel (*) for i = 1:n A end On Friday, July 22, 2016 at 3:11:15 AM UTC+10, Kristoffer Carlsson wrote: > > > julia> @time for i in

[julia-users] Pipeline interoperability with IOStream and IOBuffer

2016-07-21 Thread William Wong
Hello, I'm trying to continue the discussion of https://github.com/JuliaLang/julia/issues/15479 julia> run(pipeline(IOBuffer("a xyz b"), `grep xyz`)) ERROR: MethodError: `uvtype` has no method matching uvtype(::Base.AbstractIOBuffer{Array{UInt8,1}}) in _jl_spawn at process.jl:253 in

RE: [julia-users] What does Base.box mean in code_warntype?

2016-07-21 Thread David Anthoff
Ah, ok, so I can just safely ignore it! Thanks, David > -Original Message- > From: julia-users@googlegroups.com [mailto:julia- > us...@googlegroups.com] On Behalf Of Yichao Yu > Sent: Thursday, July 21, 2016 2:40 PM > To: Julia Users > Subject: Re:

Re: [julia-users] What does Base.box mean in code_warntype?

2016-07-21 Thread Yichao Yu
On Thu, Jul 21, 2016 at 5:33 PM, David Anthoff wrote: > Thanks everyone for the answers! > > I guess Tim's email in particular means that the presence of box might > indicate a problem, or not ;) Base.box in the ast doesn't indicate a problem. Any type instability should be

[julia-users] Re: accessing an expression's global scope from macro

2016-07-21 Thread Cedric St-Jean
Neat macro. > For this though, my macro needs to somehow figure out that "inc" was also > defined with @self (since it shouldn't blindly add self as a first arg so > other non-@self'ed function calls). Is this possible in Julia? > You could have a global Set that would contain the names of

[julia-users] Re: Strange performance issue in filling in a matrix column

2016-07-21 Thread Gunnar Farnebäck
fill_W1! allocates memory because it makes copies when constructing the right hand sides. fill_W2 allocates memory in order to construct the comprehensions (that you then discard). In both cases memory allocation could plausibly be avoided by a sufficiently smart compiler, but until Julia

RE: [julia-users] What does Base.box mean in code_warntype?

2016-07-21 Thread David Anthoff
Thanks everyone for the answers! I guess Tim's email in particular means that the presence of box might indicate a problem, or not ;) I guess it would be nice if there was some (easy) way to figure out whether things get boxed or not, apart from looking at the assembler/llvm code. >

[julia-users] Re: Calling all users of ParallelAccelerator.

2016-07-21 Thread André Lage
Hi Todd, First, congratulations to @acc team for the great job! We are implementing a new version of CloudArray (https://github.com/gsd-ufal/CloudArray.jl) by using Parallel.Accelerator.jl. We are implementing a cloud service for processing fully PolSAR images, real PolSAR images from NASA

[julia-users] Re: JuliaCon schedule announced

2016-07-21 Thread David P. Sanders
Thanks! El jueves, 21 de julio de 2016, 17:26:09 (UTC+2), Viral Shah escribió: > > Both these tutorials are up now. The others seem are there. > > -viral > > On Sunday, July 17, 2016 at 1:00:17 AM UTC-4, Tony Kelman wrote: >> >> I don't see the tutorial that David Sanders gave, or the one that I

Re: [julia-users] howto import fix_dec?

2016-07-21 Thread Jeffrey Sarnoff
thanks, I think I found the problem -- my float() function should force Float64 On Thursday, July 21, 2016 at 4:36:53 PM UTC-4, Jeffrey Sarnoff wrote: > > I thought I could specialize fix_dec(), the catchall is something like > `fix_dec(x::AbstractFloat, n::Int)` and I had intended to define

[julia-users] Re: `abs` has no method matching abs(::Array{Any,1})

2016-07-21 Thread Ping Hou
Yes, it works. Thank you so much for your help! On Thursday, July 21, 2016 at 4:11:24 PM UTC-4, Gabriel Gellner wrote: > > Can you just cast the array to Float64 or whatever numeric type you need > to column to be? > > On Thursday, July 21, 2016 at 9:50:14 AM UTC-7, Ping Hou wrote: >> >> Hi, >>

Re: [julia-users] howto import fix_dec?

2016-07-21 Thread Jeffrey Sarnoff
I thought I could specialize fix_dec(), the catchall is something like `fix_dec(x::AbstractFloat, n::Int)` and I had intended to define `fix_dec{P}(x::ArbFloat{P}, n::Int)`. On Thursday, July 21, 2016 at 4:31:37 PM UTC-4, Yichao Yu wrote: > > On Thu, Jul 21, 2016 at 3:42 PM, Jeffrey Sarnoff >

Re: [julia-users] accessing an expression's global scope from macro

2016-07-21 Thread Yichao Yu
On Thu, Jul 21, 2016 at 4:01 PM, Marius Millea wrote: > In an attempt to make some numerical code (ie something thats basically just > a bunch of equations) more readable, I am trying to write a macro that lets > me write the code more succinctly. The code uses parameters

Re: [julia-users] howto import fix_dec?

2016-07-21 Thread Yichao Yu
On Thu, Jul 21, 2016 at 3:42 PM, Jeffrey Sarnoff wrote: > I got this error > ERROR: StackOverflowError: > in fix_dec(::ArbFloats.ArbFloat{116}, ::Int64) at ./printf.jl:932 (repeats > 8 times) > > > I tried to import Base.fix_dec, Core.fix_dec to override the

[julia-users] Re: `abs` has no method matching abs(::Array{Any,1})

2016-07-21 Thread Gabriel Gellner
Can you just cast the array to Float64 or whatever numeric type you need to column to be? On Thursday, July 21, 2016 at 9:50:14 AM UTC-7, Ping Hou wrote: > > Hi, > > I encountered a problem when I running my code. > > LoadError: MethodError: `abs` has no method matching abs(::Array{Any,1}) >

[julia-users] accessing an expression's global scope from macro

2016-07-21 Thread Marius Millea
In an attempt to make some numerical code (ie something thats basically just a bunch of equations) more readable, I am trying to write a macro that lets me write the code more succinctly. The code uses parameters from some data structure, call it "mytype", so its littered with "t.a", "t.b",

[julia-users] howto import fix_dec?

2016-07-21 Thread Jeffrey Sarnoff
I got this error ERROR: StackOverflowError: in fix_dec(::ArbFloats.ArbFloat{116}, ::Int64) at ./printf.jl:932 (repeats 8 times) I tried to import Base.fix_dec, Core.fix_dec to override the definition -- neither worked.

[julia-users] Re: Function `copyconvert`?

2016-07-21 Thread Kristoffer Carlsson
Discussion: https://github.com/JuliaLang/julia/issues/12441 On Thursday, July 21, 2016 at 2:49:19 PM UTC-4, gTcV wrote: > > I recently frequently encounter the situation where I need to both copy as > well as optionally convert an object. It turns out `convert` on its own > will not do the job

Re: [julia-users] Composite Type Array

2016-07-21 Thread Stefan Karpinski
It's a little unclear what you want to do that you can't figure out how to accomplish. You can allocate an uninitialized vector of ExampleEvent objects: julia> type ExampleEvent fld1::ASCIIString fld2::Int16 fld3::Int64 fld4::Int64

[julia-users] Re: unable to connect to FTP using IP address

2016-07-21 Thread Samuel Massinon
Hi Yared, The error you are getting is something LibCURL is erring on, as described here. https://curl.haxx.se/libcurl/c/libcurl-errors.html If I try using curl with your settings, I get ~ $ curl -u anonymous '192.168.251.200/dataOnFTP.bin' Enter host password for user 'anonymous': curl: (7)

[julia-users] Composite Type Array

2016-07-21 Thread maxent219
Hi I was working on processing large data sets & historically I've used structs in C++ & other languages for this type of task. I attempted to use a Composite Type in Julia & preallocate a large array before filling it w/values as my algo processes the data. My example was: type

[julia-users] Function `copyconvert`?

2016-07-21 Thread gTcV
I recently frequently encounter the situation where I need to both copy as well as optionally convert an object. It turns out `convert` on its own will not do the job in this case as it doesn't create a copy if the conversion is trivial: julia> v = Vector{Int}(); julia>

[julia-users] Re: Converting from ColorTypes to Tuple

2016-07-21 Thread Nate
Another quick solution is to just create an array/tuple that PyPlot will recognize as an RGB array/tuple: myColors = distinguishable_colors(N) PyPlot_myColors = [[red(i), green(i), blue(i)] for i in myColors] You can also save yourself the time from needing to call the new color scheme for every

Re: [julia-users] Array printing in 0.5

2016-07-21 Thread daycaster
Yes, true, I just copied it so that I knew what character it was.

[julia-users] Re: I can't believe this spped-up !

2016-07-21 Thread Kristoffer Carlsson
julia> @time for i in 1:10 sleep(1) end 10.054067 seconds (60 allocations: 3.594 KB) julia> @time @parallel for i in 1:10 sleep(1) end 0.195556 seconds (28.91 k allocations: 1.302 MB) 1-element Array{Future,1}: Future(1,1,8,#NULL) On Thursday, July

[julia-users] Re: I can't believe this spped-up !

2016-07-21 Thread Nathan Smith
in Jupyer notebook, add processors with addprocs(N) On Thursday, 21 July 2016 12:59:02 UTC-4, Nathan Smith wrote: > > To be clear, you need to compare the final 'z' not the final 'A' to check > if your calculations are consistent. The matrix A does not change through > out this calculation,

[julia-users] Re: I can't believe this spped-up !

2016-07-21 Thread Nathan Smith
To be clear, you need to compare the final 'z' not the final 'A' to check if your calculations are consistent. The matrix A does not change through out this calculation, but the matrix z does. Also, there is no parallelism with the @parallel loop unless your start julia with 'julia -np N' where

[julia-users] Re: Help Julia win a performance comparison!

2016-07-21 Thread Chris Rackauckas
Nevermind. You have a non-zero probability of having zero offspring since it's Poisson. This works if every element is at least 1. However, you can have the population size decrease, which then causes errors if you resize first. But then you still want to put the new elements in the first n

[julia-users] Re: I can't believe this spped-up !

2016-07-21 Thread Ferran Mazzanti
Nathan, the execution of these two functions gives essentially the same timings, no matter of many processes I have added with addprocs() Very surprising to me... Of course I prefer the speeded-up version :) Best, Ferran. On Thursday, July 21, 2016 at 6:40:14 PM UTC+2, Nathan Smith wrote: > >

Re: [julia-users] Array printing in 0.5

2016-07-21 Thread Stefan Karpinski
The output format isn't intended to be valid input format in either version of Julia, e.g. on 0.4: julia> 2x3 ERROR: UndefVarError: x3 not defined in eval(::Module, ::Any) at ./boot.jl:234 in macro expansion at ./REPL.jl:92 [inlined] in (::Base.REPL.##1#2{Base.REPL.REPLBackend})() at

[julia-users] Array printing in 0.5

2016-07-21 Thread daycaster
(I'm just untangling some confusion on my end. Is the following correct?) In 0.4, array dimensions were printed like this: julia> zeros(2,3) 2x3 Array{Float64,2}: 0.0 0.0 0.0 0.0 0.0 0.0 In 0.5, the "x" is replaced with a "×": julia> zeros(2,3) 2×3

[julia-users] Re: I can't believe this spped-up !

2016-07-21 Thread Ferran Mazzanti
Hi Nathan, I posted the codes, so you can check if they do the same thing or not. These went to separate cells in Jupyter, nothing more and nothing less. Not even a single line I didn't post. And yes I understand your line of reasoning, so that's why I got astonished also. But I can see what is

[julia-users] Re: I can't believe this spped-up !

2016-07-21 Thread Ferran Mazzanti
I posted this because I also find the results... astonishingly surprising. Howeverm the timings are apparently real, as the first one took more than 1.5mins on my wrist watch, and the second calculation was instantly. And no, no function wrapping whatsoever... On Thursday, July 21, 2016 at

[julia-users] Re: I can't believe this spped-up !

2016-07-21 Thread Nathan Smith
Try comparing these two function: function serial_example() A = [[1.0 1.001];[1.002 1.003] z = A for i in 1:10 z *= A end return z end function parallel_example() A = [[1.0 1.001]; [1.002 1.003]] z = @parallel (*) for i in 1:10 A

[julia-users] Re: I can't believe this spped-up !

2016-07-21 Thread Nathan Smith
Hey Ferran, You should be suspicious when your apparent speed up surpasses the level of parallelism available on your CPU. I looks like your codes don't actually compute the same thing. I'm assuming you're trying to compute the matrix exponential of A (A^10) by repeatedly multiplying

[julia-users] Re: I can't believe this spped-up !

2016-07-21 Thread Chris Rackauckas
I wouldn't expect that much of a change unless you have a whole lot of cores (even then, wouldn't expect this much of a change). Is this wrapped in a function when you're timing it? On Thursday, July 21, 2016 at 9:00:47 AM UTC-7, Ferran Mazzanti wrote: > > Hi, > > mostly showing my

[julia-users] I can't believe this spped-up !

2016-07-21 Thread Ferran Mazzanti
Hi, mostly showing my astonishment, but I can even understand the figures in this stupid parallelization code A = [[1.0 1.0001];[1.0002 1.0003]] z = A tic() for i in 1:10 z *= A end toc() A produces elapsed time: 105.458639263 seconds 2x2 Array{Float64,2}: 1.0 1.0001 1.0002

[julia-users] Re: Help Julia win a performance comparison!

2016-07-21 Thread Chris Rackauckas
I see it now. Sum the elements to resize the array, and then loop through backwards adding the values (so that way you don't overwrite what you haven't used). On Thursday, July 21, 2016 at 8:34:11 AM UTC-7, Kristoffer Carlsson wrote: > > Sum the elements and resize the array to that length?

[julia-users] Re: Coveralls and coverage issues

2016-07-21 Thread Kristoffer Carlsson
Cached...

[julia-users] Re: Coveralls and coverage issues

2016-07-21 Thread Kristoffer Carlsson
Sometimes the badge image is cashed and can be quite hard to update. Ctrl + F5 sometimes work.

[julia-users] Re: Performance issues with stochastic simulation

2016-07-21 Thread Chris Rackauckas
You can change line 70 to be in place with a loop: for i in 1:length(x) x[i] = x[i] + deltax[i] end I don't think you can do x[:] =x .+deltax as fancy syntax here since the x is part of the statement though (you can check). This should cut out an allocation here and bring down the time.

[julia-users] Re: Help Julia win a performance comparison!

2016-07-21 Thread Kristoffer Carlsson
Sum the elements and resize the array to that length?

[julia-users] Re: JuliaCon schedule announced

2016-07-21 Thread Viral Shah
Both these tutorials are up now. The others seem are there. -viral On Sunday, July 17, 2016 at 1:00:17 AM UTC-4, Tony Kelman wrote: > > I don't see the tutorial that David Sanders gave, or the one that I gave. > Might be others missing too?

Re: [julia-users] Re: JuliaCon schedule announced

2016-07-21 Thread Viral Shah
I doubt we are going to be able to do much at this point. Andreas and I are checking with the video person, but not looking promising on this front. -viral On Tuesday, July 19, 2016 at 1:39:40 AM UTC-4, Christian Peel wrote: > > I saw quite a few videos with the same problem. > > On Mon, Jul

[julia-users] Re: FFT, PSD and Windowing functions

2016-07-21 Thread Yared Melese
Hi Islam, Thanks for your input I was able to find all windowing functions; however, there is nothing about PSD ( power spectral density). In python and matlab, there is function pwelch which does both windowing and FFT and wondering if there is the same function in Julia. Here is simple

[julia-users] Re: Help Julia win a performance comparison!

2016-07-21 Thread Chris Rackauckas
Let me explain. The easy place to add an in-place operation with resize! would be with the RNG call, rpois. I used resize! to make the Poisson RNG go a little faster. It's now: function rpois!(n::Int,p::Vector{Float64},out::Vector{Int}) resize!(out,n) for i in 1:n @inbounds

[julia-users] Re: Coveralls and coverage issues

2016-07-21 Thread Simon Frost
Odd; refresh on Chrome wasn't refreshing properly. Fancy looking at my code speed question ;) ? On Thursday, July 21, 2016 at 3:49:01 PM UTC+1, Chris Rackauckas wrote: > > Click refresh when you're on the repo readme? It updated on my screen, > refresh to make sure you're not displaying the

[julia-users] Strange performance issue in filling in a matrix column

2016-07-21 Thread Michael Prange
I'm a new user, so have mercy in your responses. I've written a method that takes a matrix and vector as input and then fills in column icol of that matrix with the vector of given values that have been shifted upward by ishift indices with periodic boundary conditions. To make this clear,

[julia-users] Performance issues with stochastic simulation

2016-07-21 Thread Simon Frost
Dear All, I'm having some issues with code speed for some Gillespie type simulations. The toy model is described here: http://phylodynamics.blogspot.co.uk/2013/06/comparing-performance-of-r-and-rcpp-for.html http://phylodynamics.blogspot.co.uk/2013/06/an-sir-model-in-julia.html I get good

[julia-users] Re: Coveralls and coverage issues

2016-07-21 Thread Chris Rackauckas
Click refresh when you're on the repo readme? It updated on my screen, refresh to make sure you're not displaying the site from cache. On Thursday, July 21, 2016 at 7:41:47 AM UTC-7, Simon Frost wrote: > > Dear Chris, > > Yes, I am an idiot ;) > > Any idea why the badge isn't updating? > > Best

[julia-users] Re: Coveralls and coverage issues

2016-07-21 Thread Simon Frost
Dear Chris, Yes, I am an idiot ;) Any idea why the badge isn't updating? Best Simon On Thursday, July 21, 2016 at 9:06:51 AM UTC+1, Chris Rackauckas wrote: > > Look at the files it's trying to cover... it's DataFrames.jl :) > > I sent you a pull request to fix your travis.yml to be for your

Re: [julia-users] Help Julia win a performance comparison!

2016-07-21 Thread Tom Breloff
I had the same thought. Could just make a new AbstractArray which keeps a larger array and tracks the current usage. I bet it's 10 lines of code to make it generic. On Thursday, July 21, 2016, Christoph Ortner wrote: > > feels like one may want a little auxiliary

[julia-users] name of current executable (similar to Bash $0)

2016-07-21 Thread Curtis Vogt
I believe what you want is the constant `PROGRAM_FILE`. http://julia.readthedocs.io/en/latest/stdlib/constants/#Base.PROGRAM_FILE

[julia-users] name of current executable (similar to Bash $0)

2016-07-21 Thread Tamas Papp
I using a script written in Julia, called with the shebang line #!/usr/bin/env julia Now I would like to have symlinks of a different name to the script, and have it perform slighly different tasks depending on which name was used. In Bash, I would use $0, is there something equivalent in Julia?

[julia-users] Re: Help Julia win a performance comparison!

2016-07-21 Thread Christoph Ortner
feels like one may want a little auxiliary package that can make available small chunks from a long pre-allocated vector. On Thursday, 21 July 2016 10:37:12 UTC+1, Chris Rackauckas wrote: > > Maybe. I thought about that, but I don't think that satisfies the "elegant > and compactness"

[julia-users] Re: Help Julia win a performance comparison!

2016-07-21 Thread Chris Rackauckas
Maybe. I thought about that, but I don't think that satisfies the "elegant and compactness" requirement, unless there's an easy way to do the growing without too much extra code hanging around. On Thursday, July 21, 2016 at 1:54:10 AM UTC-7, Christoph Ortner wrote: > > could still preallocate

[julia-users] Re: Help Julia win a performance comparison!

2016-07-21 Thread Christoph Ortner
could still preallocate and grow as needed? On Thursday, 21 July 2016 02:48:58 UTC+1, Chris Rackauckas wrote: > > Most of the arrays are changing size each time though, since they > represent a population which changes each timestep. > > On Wednesday, July 20, 2016 at 6:47:39 PM UTC-7, Steven G.

[julia-users] Re: Coveralls and coverage issues

2016-07-21 Thread Chris Rackauckas
Look at the files it's trying to cover... it's DataFrames.jl :) I sent you a pull request to fix your travis.yml to be for your package. On Thursday, July 21, 2016 at 12:16:35 AM UTC-7, Simon Frost wrote: > > Dear All, > > I'm trying to get code coverage working, but despite having some tests -

[julia-users] Coveralls and coverage issues

2016-07-21 Thread Simon Frost
Dear All, I'm trying to get code coverage working, but despite having some tests - at the moment, just running examples - I get 0% coverage http://github.com/sdwfrost/Gillespie.jl Is this because I'm just using 'include' in runtests.jl? Best Simon