Re: [julia-users] randperm run time is slow
Another way to go about it, is to look at R's implementation of a random permutation and recreate it in Julia, hoping for similar performance. Having done so, the resulting Julia code is: function nrandperm(r::AbstractRNG, n::Integer) res = Array(typeof(n),n) if n == 0 return res end a = typeof(n)[i for i=1:n] nn = n @inbounds for i = 1:n j = floor(Int,nn*rand(r))+1 res[i] = a[j] a[j] = a[nn] nn -= 1 end return res end nrandperm(n::Integer) = nrandperm(Base.Random.GLOBAL_RNG, n) A size 1,000,000 permutation was generated x2 faster with this method. But, this method uses uniform floating random numbers, which might not be uniform on integers for large enough numbers. In general, it should be possible to optimize a more correct implementation. But if R envy is a driver, R performance is recovered with a pure Julia implementation (the R implementation is in C). On Saturday, January 23, 2016 at 7:26:49 AM UTC+2, Rafael Fourquet wrote: > > > Let's capture this as a Julia performance issue on github, > > if we can't figure out an easy way to speed this up right away. > > I think I remember having identified a potentially sub-optimal > implementation of this function few weeks back (perhaps no more than > what Tim suggested) and had planned to investigate further (when time > permits...) >
[julia-users] Re: Cannot pull with rebase when I try to use Pkg.update()
What does running "git diff" say the changes are to those files? If they're not changing anything that you want to keep locally, you can run "git checkout -- FixedEffectModels/versions/*/requires" to undo the changes. On Friday, January 22, 2016 at 4:30:34 PM UTC-8, Diogo Falcão wrote: > > I am trying to use Julia on Windows for the first time, and when I try to > run Pkg.update(), I got this error: > > error: Cannot pull with rebase: You have unstaged changes. > > > When I run "git status" in the METADATA folder, I got: > > > On branch metadata-v2 > Your branch is behind 'origin/metadata-v2' by 524 commits, and can be > fast-forwarded. > (use "git pull" to update your local branch) > Changes not staged for commit: > (use "git add ..." to update what will be committed) > (use "git checkout -- ..." to discard changes in working directory) > > modified: FixedEffectModels/versions/0.1.0/requires > modified: FixedEffectModels/versions/0.1.1/requires > modified: FixedEffectModels/versions/0.2.0/requires > modified: FixedEffectModels/versions/0.2.1/requires > modified: FixedEffectModels/versions/0.2.2/requires > > no changes added to commit (use "git add" and/or "git commit -a") > > > How can I solve this? Thanks > > -- > Esta mensagem pode conter informação confidencial e/ou privilegiada.Se > você não for o destinatário ou a pessoa autorizada a receber esta mensagem, > você não deve usar, copiar, divulgar, alterar e não tomar nenhuma ação em > relação a esta mensagem ou qualquer informação aqui contida.Se você recebeu > esta mensagem erroneamente, por favor entre em contato imediatamente ou > responsa por e-mail ao remetente e apague esta mensagem. Opiniões pessoais > do remetente não refletem, necessariamente, o ponto de vista da Neurotech, > o qual é divulgado somente por pessoas autorizadas. Antes de imprimir este > e-mail, veja se realmente é necessário. Ajude a preservar o meio ambiente. > > This message may contain confidential and/or privileged information. If > you are not the addressee or authorized to receive this for the > addressee, please, you must not use, copy, disclose, change, take any > action based on this message or any information herein. Personal opinions > of the sender do not necessarily reflect the view of Neurotech, which is > only divulged by authorized persons. Please consider the environment before > printing this email. >
Re: [julia-users] Tuples vs. vectors for indexing into an array
Feel free to add it! --Tim On Friday, January 22, 2016 05:41:02 PM Cedric St-Jean wrote: > I'll give it a try. It's missing scalar addition, though. > > CartesianIndex((4,5)) + 1 # error > > Thanks! > > On Friday, January 22, 2016 at 8:26:53 PM UTC-5, Tim Holy wrote: > > Check out CartesianIndex. It's a little annoying to type long names, but > > it > > supports all those operations, and julia already has all the indexing > > operations defined for it. > > > > --Tim > > > > On Friday, January 22, 2016 05:20:59 PM Cedric St-Jean wrote: > > > I manipulate a lot of images, and I have to deal with image coordinates > > > (aka indexes) all the time. I've been storing them as vectors so far, > > > > but > > > > > the inefficiency of creating a full-blown array object to store 2 > > > > integers > > > > > is gross (and it might add up, though it's hard to profile). OTOH, > > > > tuples > > > > > are very awkward, in particular because > > > > > > ind1 = (4, 5) > > > ind2 = (20, 67) > > > ind2 .- ind1 # not defined > > > ind1 .+ 1 # not defined either > > > > > > Is there any reason why I should _not_ define those operations? In > > > > general, > > > > > I don't want to implement a method I didn't create over a type I didn't > > > create, but this seems harmless enough...? Is there any consideration > > > > that > > > > > I'm missing? > > > > > > Cédric
Re: [julia-users] randperm run time is slow
Unfortunately, this makes the implementation GPL. If you can describe the algorithm in an issue on github, someone can do a cleanroom implementation. -viral On Saturday, January 23, 2016 at 3:17:19 PM UTC+5:30, Dan wrote: > > Another way to go about it, is to look at R's implementation of a random > permutation and recreate it in Julia, hoping for similar performance. > Having done so, the resulting Julia code is: > > function nrandperm(r::AbstractRNG, n::Integer) >res = Array(typeof(n),n) >if n == 0 > return res >end >a = typeof(n)[i for i=1:n] >nn = n >@inbounds for i = 1:n >j = floor(Int,nn*rand(r))+1 >res[i] = a[j] >a[j] = a[nn] >nn -= 1 >end >return res > end > nrandperm(n::Integer) = nrandperm(Base.Random.GLOBAL_RNG, n) > > A size 1,000,000 permutation was generated x2 faster with this method. > But, this method uses uniform floating random numbers, which might not be > uniform on integers for large enough numbers. In general, it should be > possible to optimize a more correct implementation. But if R envy is a > driver, R performance is recovered with a pure Julia implementation (the R > implementation is in C). > > On Saturday, January 23, 2016 at 7:26:49 AM UTC+2, Rafael Fourquet wrote: >> >> > Let's capture this as a Julia performance issue on github, >> > if we can't figure out an easy way to speed this up right away. >> >> I think I remember having identified a potentially sub-optimal >> implementation of this function few weeks back (perhaps no more than >> what Tim suggested) and had planned to investigate further (when time >> permits...) >> >
[julia-users] Julia on beaglebone
Is anyone able to build/use Julia on a beaglebone black? There are some comments about building Julia on raspberry pi 2 at https://github.com › README.arm.md , but, I could not find anything related with beaglebone black.
Re: [julia-users] keyword: "using"
The most comprehensive description is in the Modules section of the manual: http://docs.julialang.org/en/release-0.4/manual/modules/ On Sat, Jan 23, 2016 at 11:41 AM, PattiMichelle Sheaffer < pattimichelle...@gmail.com> wrote: > Heh - just trying to quickly determine the syntax of the keyword "using" - > but the word itself has so many hits, it's useless to search "using" (with, > say, "Julia" and "keyword") on the internet. >
Re: [julia-users] CurveFit Pakage: non-linear fitting code
One link: http://stackoverflow.com/questions/34840875/julia-using-curvefit-package-non-linear On Jan 23, 2016 10:13 AM,wrote: > I wish someone would publish a nonlinear fitting code using package > CurveFit > using this data, how we can use CurveFit? > > x = [0.0 0.2 0.4 1.0 1.6 1.8 2.0 2.6 2.8 3.0 3.8 4.8 5.0 5.2 6.0 6.2 7.4 > 7.6 7.8 8.6 8.8 9.0 9.2 9.4 10.0 10.6 10.8 11.2 11.6 11.8 12.2 12.4]; > > y = [-0.183 -0.131 0.027 0.3 0.579 0.853 0.935 1.133 1.269 1.102 1.092 > 1.143 0.811 0.91 0.417 0.46 -0.516 -0.334 -0.504 -0.946 -0.916 -0.975 > -1.099 -1.113 -1.297 -1.234 -0.954 -1.122 -0.609 -0.593 -0.403 -0.51]; >
Re: [julia-users] How to convert Int64 to Date
The easiest way right now is to do Date(Dates.UTD(735685)) It's a bit awkward, and I think we should have a better default option. Perhaps we should define `convert(::Type{Date}, x::Int64)` defined for this. On Sat, Jan 23, 2016 at 9:36 AM, Min-Woong Sohnwrote: > I want to convert an Int64 value 735685 to Date type (2016-1-22). > convert(Date,735685) does not work. Does anyone know how to do this? > >
Re: [julia-users] How to convert Int64 to Date
Jacob, I agree -- in both directions: convert(::Type(Date), x::Int64) and convert(::Type(Int64), x::Date). Jeffrey On Saturday, January 23, 2016 at 12:20:53 PM UTC-5, Jacob Quinn wrote: > > The easiest way right now is to do > > Date(Dates.UTD(735685)) > > It's a bit awkward, and I think we should have a better default option. > Perhaps we should define `convert(::Type{Date}, x::Int64)` defined for this. > > On Sat, Jan 23, 2016 at 9:36 AM, Min-Woong Sohn> wrote: > >> I want to convert an Int64 value 735685 to Date type (2016-1-22). >> convert(Date,735685) does not work. Does anyone know how to do this? >> >> >
Re: [julia-users] How to convert Int64 to Date
I've created a pull request to clarify the usage here and add documentation. https://github.com/JuliaLang/julia/pull/14775 -Jacob On Sat, Jan 23, 2016 at 9:36 AM, Min-Woong Sohnwrote: > I want to convert an Int64 value 735685 to Date type (2016-1-22). > convert(Date,735685) does not work. Does anyone know how to do this? > >
Re: [julia-users] randperm run time is slow
Hi Dan, It would also be good if you deleted that post (or edited it and removed the code), for the same reason Viral mentioned: if someone reads the post and then creates a pull request for changing the Julia implementation, it could be argued that that implementation was derived from GPL code, which makes it GPL. A clean-room implementation (such as creating the patch from a higher level description of the code) is okay. (Viral, it would probably be good for you to remove the code from your post as well. I did so in this post below.) Cheers, Kevin On Saturday, January 23, 2016 at 6:30:07 AM UTC-8, Viral Shah wrote: > > Unfortunately, this makes the implementation GPL. If you can describe the > algorithm in an issue on github, someone can do a cleanroom implementation. > > -viral > > On Saturday, January 23, 2016 at 3:17:19 PM UTC+5:30, Dan wrote: >> >> Another way to go about it, is to look at R's implementation of a random >> permutation and recreate it in Julia, hoping for similar performance. >> Having done so, the resulting Julia code is: >> >> >> A size 1,000,000 permutation was generated x2 faster with this method. >> But, this method uses uniform floating random numbers, which might not be >> uniform on integers for large enough numbers. In general, it should be >> possible to optimize a more correct implementation. But if R envy is a >> driver, R performance is recovered with a pure Julia implementation (the R >> implementation is in C). >> >> On Saturday, January 23, 2016 at 7:26:49 AM UTC+2, Rafael Fourquet wrote: >>> >>> > Let's capture this as a Julia performance issue on github, >>> > if we can't figure out an easy way to speed this up right away. >>> >>> I think I remember having identified a potentially sub-optimal >>> implementation of this function few weeks back (perhaps no more than >>> what Tim suggested) and had planned to investigate further (when time >>> permits...) >>> >>
Re: [julia-users] randperm run time is slow
The problem I think came essentially from the repeated creation of RangeGenerator objects, cf. https://github.com/JuliaLang/julia/pull/14772.
[julia-users] Capturing output of interactive julia
Are there any recommendations for capturing the output of an interactive julia session? I was hoping that the following would work. $ julia | tee temp.txt ERROR: MethodError: `convert` has no method matching convert(::Type{Base.TTY}, ::Base.PipeEndpoint) This may have arisen from a call to the constructor Base.TTY(...), since type constructors fall back to convert methods. Closest candidates are: Base.TTY(::Any) call{T}(::Type{T}, ::Any) convert{T}(::Type{T}, !Matched::T) ... in call at Terminals.jl:116 in _start at ./client.jl:388 I might fall back to running julia within an Emacs shell-buffer, but I would prefer to keep the REPL functionality.
[julia-users] keyword: "using"
Heh - just trying to quickly determine the syntax of the keyword "using" - but the word itself has so many hits, it's useless to search "using" (with, say, "Julia" and "keyword") on the internet.
[julia-users] I wish someone would publish a non-linear fitting code
I wish someone would publish a non-linear fitting code using this data, how we can use CurveFit? x = [0.0 0.2 0.4 1.0 1.6 1.8 2.0 2.6 2.8 3.0 3.8 4.8 5.0 5.2 6.0 6.2 7.4 7.6 7.8 8.6 8.8 9.0 9.2 9.4 10.0 10.6 10.8 11.2 11.6 11.8 12.2 12.4]; y = [-0.183 -0.131 0.027 0.3 0.579 0.853 0.935 1.133 1.269 1.102 1.092 1.143 0.811 0.91 0.417 0.46 -0.516 -0.334 -0.504 -0.946 -0.916 -0.975 -1.099 -1.113 -1.297 -1.234 -0.954 -1.122 -0.609 -0.593 -0.403 -0.51];
Re: [julia-users] newbie
Hi Patricia, First, welcome to julia! I can't speak for the developers of Wavelets.jl, but they might welcome a contribution of nonseparable wavelets. You could submit an issue to that package to ask. If they don't respond, or would rather not have them, you could create your own package. Relevant documentation (it's a lot of text, but once you walk through it once or twice it's pretty simple): http://docs.julialang.org/en/stable/manual/packages/#package-development Best, --Tim On Friday, January 22, 2016 07:38:38 PM PattiMichelle Sheaffer wrote: > I've been using IDL, matlab, and octave for a while (mostly IDL) but Juila > looks really interesting. I have been interested in wavelets (one of the > reasons for matlab) and think that if Julia wavelet package got > non-separable wavelets (e.g., quincunx based) it would really stand out in > that department. For image analysis, separability (directionality x/y) and > its impact on images is a problem everyone just sort of lives with. Not > everyone is familiar with nonseparable wavelets. I don't find them in most > of the standard intro texts. Thoughts? > > Thanks for letting me join, > Patricia
Re: [julia-users] Running multiple scripts in parallel Julia sessions
Any reason not to run them all as separate processes? On Fri, Jan 22, 2016 at 11:08 PM, Ritchie Leewrote: > Let's say I have 10 julia scripts, scripts = ["script1.jl", "script2.jl", > , "script10.jl"] and I would like to run them in parallel in separate > Julia sessions, but 4 at a time (since I only have 4 cores on my machine). > Is there any way to do this programmatically? > > I tried doing this: > > addprocs(4) > pmap(include, scripts) > > or > > addprocs(4) > @parallel for s in scripts > include(s) > end > > However, this seems to reuse the same session, so all the global consts in > the script file are colliding. I would like to make sure that the > namespaces are completely separate. > > Thanks! >
[julia-users] Julia on beaglebone
If it is compatible with arm7 there is nigtly build on julialang.org/downloads for linux. If you want to build from source on machine it will take too long I think.
Re: [julia-users] Re: How to run a detached command and return execution to the parent script?
Great! I'm glad you got it sorted out. On Fri, Jan 22, 2016 at 6:24 PM, Adrian Salceanuwrote: > No no, It's perfectly fine, it was my fault. What I haven't realized is > that if I start the server async then my script will finish immediately, > which also terminated the server. It was my responsibility to keep the > whole app alive now. > > It works like a charm! > > > sâmbătă, 23 ianuarie 2016, 00:06:13 UTC+1, Stefan Karpinski a scris: >> >> The shell works with processes, Julia has tasks where are not the same >> thing... >> >> On Fri, Jan 22, 2016 at 5:49 PM, Adrian Salceanu >> wrote: >> >>> The problem seems to that HttpServer can not run @async - it exits >>> immediately. >>> >>> === >>> >>> using HttpServer >>> >>> http = HttpHandler() do req::Request, res::Response >>> Response( ismatch(r"^/hello/", req.resource) ? exit(2) : 404 ) >>> end >>> >>> server = Server( http ) >>> run( server, 8001 ) # <--- this works but blocks >>> @async run( server, 8001 ) # <--- this exits immediately >>> >>> === >>> >>> It's not necessarily a problem that HttpServer blocks. But what drives >>> me nuts is: if I run >>> $ julia app.jl & >>> in the shell, it works perfectly. The process is placed in the >>> background, the server happily listens to the assigned port, etc. >>> >>> Why can't I run the same command from within another julia process and >>> get the same effect? >>> >>> >>> vineri, 22 ianuarie 2016, 22:40:56 UTC+1, Stefan Karpinski a scris: @spawn runs a command on a (random) worker process. If you want to do "background" work in the current process, you can use @async: julia> t = @async (sleep(5); rand()) Task (runnable) @0x000112d746a0 julia> wait(t) 0.14543742643271207 On Fri, Jan 22, 2016 at 4:33 PM, Adrian Salceanu wrote: > Oh! The ruby analogy made me think about actually spawning the > detached command! Which produced the desired effect! > > julia> @spawn run(detach(`ping www.google.com`)) > > > > vineri, 22 ianuarie 2016, 22:29:27 UTC+1, Adrian Salceanu a scris: >> >> I guess what I'm looking for is the equivalent of Ruby's Process#spawn >> >> In REPL: >> >> >> pid = Process.spawn("ping www.google.com", :out => '/dev/null') >> 83210 >> >> <-- the process is running in the >> background and control has been returned to the REPL >> >> >> vineri, 22 ianuarie 2016, 22:06:01 UTC+1, Adrian Salceanu a scris: >>> >>> Hi, >>> >>> I'm hammering at a web app and I'm trying to setup functionality to >>> monitor the file system for changes and restart/reload the server >>> automatically so the changes are picked up (I'm using Mux which uses >>> HttpServer). >>> >>> The approach I have in mind is: >>> >>> 1. have a startup script which is run from the command line, >>> something like: >>> $ julia -L startup.jl >>> >>> 2. the startup script launches the web app, which starts the web >>> server. My intention was to run >>> $ julia -L app.jl >>> as a command inside startup.jl, detached, and have the startup.jl >>> script get back control, with app.jl running detached in the background. >>> >>> 3. once startup.jl gets back control, it begins monitoring the file >>> system and when changes are detected, kills the app and relaunches it. >>> >>> That was the theory. Now, I might be missing something but I can't >>> find a way to detach the command I'm running and get control back to the >>> startup script. And I tried a lot of things! >>> >>> === >>> >>> I'm providing simpler example using "ping", which also run >>> indefinitely, similar to the web server. >>> >>> julia> run(detach(`ping "www.google.com"`)) # the command is >>> detached and continues to run after the julia REPL is closed, but at >>> this >>> point the REPL does not get control, there's no cursor available in the >>> REPL >>> PING www.google.com (173.194.45.82): 56 data bytes >>> 64 bytes from 173.194.45.82: icmp_seq=0 ttl=54 time=30.138 ms >>> 64 bytes from 173.194.45.82: icmp_seq=1 ttl=54 time=30.417 ms >>> ... more output ... >>> 64 bytes from 173.194.45.82: icmp_seq=7 ttl=54 time=30.486 ms >>> 64 bytes from 173.194.45.82: icmp_seq=8 ttl=54 time=30.173 ms >>> ^CERROR: InterruptException: >>> < here I press Ctrl+C and only now the REPL >>> gets back the cursor, with the command still running in the background >>> >>> === >>> >>> Also, related to this, passing "&" into the command to detach does >>> not work as expected, the "&" is interpreted as argument of the command. >>> Not sure if this would help anyway to return control to the startup.jl >>> script?
[julia-users] Re: newbie
Welcome Patricia, As one who both has thoughts and is not familiar with nonseparable wavelets, any explanation or links for the non-specialist may help. Jeffrey Sarnoff On Friday, January 22, 2016 at 11:03:19 PM UTC-5, PattiMichelle Sheaffer wrote: > > I've been using IDL, matlab, and octave for a while (mostly IDL) but Juila > looks really interesting. I have been interested in wavelets (one of the > reasons for matlab) and think that if Julia wavelet package got > non-separable wavelets (e.g., quincunx based) it would really stand out in > that department. For image analysis, separability (directionality x/y) and > its impact on images is a problem everyone just sort of lives with. Not > everyone is familiar with nonseparable wavelets. I don't find them in most > of the standard intro texts. Thoughts? > > Thanks for letting me join, > Patricia >
Re: [julia-users] Capturing output of interactive julia
On Sat, Jan 23, 2016 at 12:29 PM, Josef Sachswrote: > Are there any recommendations for capturing the output > of an interactive julia session? I was hoping that the > following would work. http://man7.org/linux/man-pages/man1/script.1.html > > $ julia | tee temp.txt > ERROR: MethodError: `convert` has no method matching > convert(::Type{Base.TTY}, ::Base.PipeEndpoint) > This may have arisen from a call to the constructor Base.TTY(...), > since type constructors fall back to convert methods. > Closest candidates are: > Base.TTY(::Any) > call{T}(::Type{T}, ::Any) > convert{T}(::Type{T}, !Matched::T) > ... > in call at Terminals.jl:116 > in _start at ./client.jl:388 > > I might fall back to running julia within an Emacs shell-buffer, > but I would prefer to keep the REPL functionality.
[julia-users] Re: a good IDE for Julia ? (Julia Studio does not work with Julia v 0.3.0)
Eclipse isn't terribly user-friendly for noobs like me - has anyone been able to get liclipse to point to their Juila install? If so, can you share? Thanks!!
Re: [julia-users] Capturing output of interactive julia
This seems like a pretty reasonable feature to add to the REPL if you'll open an issue for it. On Sat, Jan 23, 2016 at 1:13 PM, Yichao Yuwrote: > On Sat, Jan 23, 2016 at 12:29 PM, Josef Sachs wrote: > > Are there any recommendations for capturing the output > > of an interactive julia session? I was hoping that the > > following would work. > > http://man7.org/linux/man-pages/man1/script.1.html > > > > > $ julia | tee temp.txt > > ERROR: MethodError: `convert` has no method matching > convert(::Type{Base.TTY}, ::Base.PipeEndpoint) > > This may have arisen from a call to the constructor Base.TTY(...), > > since type constructors fall back to convert methods. > > Closest candidates are: > > Base.TTY(::Any) > > call{T}(::Type{T}, ::Any) > > convert{T}(::Type{T}, !Matched::T) > > ... > > in call at Terminals.jl:116 > > in _start at ./client.jl:388 > > > > I might fall back to running julia within an Emacs shell-buffer, > > but I would prefer to keep the REPL functionality. >
[julia-users] CurveFit Pakage: non-linear fitting code
I wish someone would publish a nonlinear fitting code using package CurveFit using this data, how we can use CurveFit? x = [0.0 0.2 0.4 1.0 1.6 1.8 2.0 2.6 2.8 3.0 3.8 4.8 5.0 5.2 6.0 6.2 7.4 7.6 7.8 8.6 8.8 9.0 9.2 9.4 10.0 10.6 10.8 11.2 11.6 11.8 12.2 12.4]; y = [-0.183 -0.131 0.027 0.3 0.579 0.853 0.935 1.133 1.269 1.102 1.092 1.143 0.811 0.91 0.417 0.46 -0.516 -0.334 -0.504 -0.946 -0.916 -0.975 -1.099 -1.113 -1.297 -1.234 -0.954 -1.122 -0.609 -0.593 -0.403 -0.51];
[julia-users] How to convert Int64 to Date
I want to convert an Int64 value 735685 to Date type (2016-1-22). convert(Date,735685) does not work. Does anyone know how to do this?
Re: [julia-users] Re: a good IDE for Julia ? (Julia Studio does not work with Julia v 0.3.0)
Atom is a pretty good editor, and there is an ongoing work to rewrite Juno in it. See https://github.com/JunoLab/atom-ink for a screencast of the editor. -- Luthaf PattiMichelle Sheaffer a écrit: Eclipse isn't terribly user-friendly for noobs like me - has anyone been able to get liclipse to point to their Juila install? If so, can you share? Thanks!!
Re: [julia-users] Re: keyword: "using"
... and you can use "using" more than once, e.g. using A: fooA, barA using B: fooB, barB
Re: [julia-users] CurveFit Pakage: non-linear fitting code
hello tshort I published this post on the "stack". the solution presented has errors in the coefficients. Em sábado, 23 de janeiro de 2016 14:08:07 UTC-2, tshort escreveu: > > One link: > > > http://stackoverflow.com/questions/34840875/julia-using-curvefit-package-non-linear > On Jan 23, 2016 10:13 AM,wrote: > >> I wish someone would publish a nonlinear fitting code using package >> CurveFit >> using this data, how we can use CurveFit? >> >> x = [0.0 0.2 0.4 1.0 1.6 1.8 2.0 2.6 2.8 3.0 3.8 4.8 5.0 5.2 6.0 6.2 7.4 >> 7.6 7.8 8.6 8.8 9.0 9.2 9.4 10.0 10.6 10.8 11.2 11.6 11.8 12.2 12.4]; >> >> y = [-0.183 -0.131 0.027 0.3 0.579 0.853 0.935 1.133 1.269 1.102 1.092 >> 1.143 0.811 0.91 0.417 0.46 -0.516 -0.334 -0.504 -0.946 -0.916 -0.975 >> -1.099 -1.113 -1.297 -1.234 -0.954 -1.122 -0.609 -0.593 -0.403 -0.51]; >> >
[julia-users] Re: newbie
Hi everyone, and thanks for the replies. Most wavelet work has seemed to concentrate on the mathematical structures of the wavelets (in one dimension) themselves (for instance, orthogonal vs. continuous, and lifting vs. frames, etc.). I guess this comes from thought about how the Fourier transform applies to higher dimensions. Say, in an image, you transform along the x axis of an image, then the y axis. This is mathematically consistent with a Cartesian arrangement of the data in an image, but a Cartesian arrangement usually has nothing to do with the arrangement of the scene contrast elements contained in an image - the C. arrangement is just a human imposition of structure where it doesn't really exist. Blah, blah (sorry, I know I talk too much). The "separability" comes from the separability of the transform into the x and y (say) coordinates. Anyway, this result is artifacts - for instance, in a 2D Daub. wavelet transform of a smooth circle, the scene contrast elements at 45 degrees to the pixel coordinate system are "enhanced." The ridgelets and curvelets, as well as things like matching pursuit and entropy treeing are ways to sort of get around these - but they come from the coordinate grid so you sort of cannot get rid of them. Two fixes seem to be buried deep in the literature: (1) creating wavelets of the same dimension as the dataset (2D wavelets for images) - and these wavelets are not simple combinations of 1D wavelets; and (2) performing "tricks" with the underlying grid (at least, that's how I understand it) - the "quincunx" grid transforms rotate and decimate the grid so there's no preferred direction in, say, a 2D transform. I think these two may actually be different aspects of the same thing.
[julia-users] Re: Expression object for "unquote"
Ok, I tried to do that: import Base.show function show(e::Expr) if e.head == :macro e.head = :function print("macro") print(@sprintf("%s", stripmeta(e))[9:end]) e.head = :macro nothing elseif e.head == :$ print("\$(") for a in e.args show(a) end print(")") else show(e) end end I thought that show would be defined recursively on functions, but it seems that's not the case, since trying to print :(macro m(x) :(x) end) gives me $(Expr(:quote, :($(Expr(:$, :x). How would I get around this? On Monday, January 18, 2016 at 6:14:42 AM UTC-8, Ismael Venegas Castelló wrote: > That's because in the case of expressions, we are interested in the AST, > show representation is just an abstraction of that, there is also dump and > xdump: > > julia> ex = :(:($x)) > :($(Expr(:quote, :($(Expr(:$, :x)) > > julia> Meta.show_sexpr(ex); println() > (:quote, (:$, :x)) > > julia> dump(ex) > > Expr > head: Symbol quote > args: Array(Any,(1,)) > 1: Expr > head: Symbol $ > args: Array(Any,(1,)) > 1: Symbol x > typ: Any > typ: Any > > julia> ex.args[1].args[1] = :y > :y > > julia> ex > :($(Expr(:quote, :($(Expr(:$, :y)) > > julia> Meta.show_sexpr(ex); println() > (:quote, (:$, :y)) > > julia> dump(ex) > Expr > head: Symbol quote > args: Array(Any,(1,)) > 1: Expr > head: Symbol $ > args: Array(Any,(1,)) > 1: Symbol y > typ: Any > typ: Any > > You could overwrite those methods or write your own that prints them the > way you want to. > > El domingo, 17 de enero de 2016, 1:50:05 (UTC-6), vis...@stanford.edu > escribió: >> >> Hi! >> >> Was messing around with exceptions, and trying to see under the hood and >> construct macro expressions. >> >> Eg, Meta.show_sexpr(:(:(+ 1 2))) -> (:quote, (:call, :+, 1, 2)) >> >> but how do you build an unquote expression? >> >> Meta.show_sexpr(:(:($(x+5) + 1))) -> (:quote, (:call, :+, (:$, (:call, >> :+, :x, 5)), 1)) >> >> >> But Expr(:quote, Expr(:call, :+, Expr(:$, Expr(:call, :+, :x, 5)), 1)) >> -> :($(Expr(:quote, :($(Expr(:$, :(x + 5))) + 1 >> >> In other words, it's not processing into the appropriate expression, and >> there's some weird intermediate syntax going on. >> >> >> How does one build an unquote expression? I.e, an expression that would >> eval to unquoting a variable? >> >
[julia-users] Re: Expression object for "unquote"
Sorry, just to be clear: *julia> **show(:(macro m(x) :($x) end))* macro m(x) $(Expr(:quote, :($(Expr(:$, :x) end On Saturday, January 23, 2016 at 4:28:49 PM UTC-8, vis...@stanford.edu wrote: > > Ok, I tried to do that: > > import Base.show > function show(e::Expr) > if e.head == :macro > e.head = :function > print("macro") > print(@sprintf("%s", stripmeta(e))[9:end]) > e.head = :macro > nothing > elseif e.head == :$ > print("\$(") > for a in e.args > show(a) > end > print(")") > else > show(e) > end > end > > I thought that show would be defined recursively on functions, but it > seems that's not the case, since trying to print :(macro m(x) :(x) end) > gives me $(Expr(:quote, :($(Expr(:$, :x). > How would I get around this? > > On Monday, January 18, 2016 at 6:14:42 AM UTC-8, Ismael Venegas Castelló > wrote: > >> That's because in the case of expressions, we are interested in the AST, >> show representation is just an abstraction of that, there is also dump and >> xdump: >> >> julia> ex = :(:($x)) >> :($(Expr(:quote, :($(Expr(:$, :x)) >> >> julia> Meta.show_sexpr(ex); println() >> (:quote, (:$, :x)) >> >> julia> dump(ex) >> >> Expr >> head: Symbol quote >> args: Array(Any,(1,)) >> 1: Expr >> head: Symbol $ >> args: Array(Any,(1,)) >> 1: Symbol x >> typ: Any >> typ: Any >> >> julia> ex.args[1].args[1] = :y >> :y >> >> julia> ex >> :($(Expr(:quote, :($(Expr(:$, :y)) >> >> julia> Meta.show_sexpr(ex); println() >> (:quote, (:$, :y)) >> >> julia> dump(ex) >> Expr >> head: Symbol quote >> args: Array(Any,(1,)) >> 1: Expr >> head: Symbol $ >> args: Array(Any,(1,)) >> 1: Symbol y >> typ: Any >> typ: Any >> >> You could overwrite those methods or write your own that prints them the >> way you want to. >> >> El domingo, 17 de enero de 2016, 1:50:05 (UTC-6), vis...@stanford.edu >> escribió: >>> >>> Hi! >>> >>> Was messing around with exceptions, and trying to see under the hood and >>> construct macro expressions. >>> >>> Eg, Meta.show_sexpr(:(:(+ 1 2))) -> (:quote, (:call, :+, 1, 2)) >>> >>> but how do you build an unquote expression? >>> >>> Meta.show_sexpr(:(:($(x+5) + 1))) -> (:quote, (:call, :+, (:$, (:call, >>> :+, :x, 5)), 1)) >>> >>> >>> But Expr(:quote, Expr(:call, :+, Expr(:$, Expr(:call, :+, :x, 5)), 1)) >>> -> :($(Expr(:quote, :($(Expr(:$, :(x + 5))) + 1 >>> >>> In other words, it's not processing into the appropriate expression, and >>> there's some weird intermediate syntax going on. >>> >>> >>> How does one build an unquote expression? I.e, an expression that would >>> eval to unquoting a variable? >>> >>
[julia-users] Re: keyword: "using"
Thanks, Stefan - it looks like "using" can only target one module at a time, although it can import multiple parts of a single module by separating with commas.
Re: [julia-users] Re: keyword: "using"
You can write `using A, B` to use both A and B but then you can't list specific bindings. On Sat, Jan 23, 2016 at 3:41 PM, PattiMichellewrote: > Thanks, Stefan - it looks like "using" can only target one module at a > time, although it can import multiple parts of a single module by > separating with commas. >
Re: [julia-users] Running multiple scripts in parallel Julia sessions
Do you mean using @spawn, success, or just from the command prompt? The scripts are long-running experiments where I am also tracking things like CPU time. I would like them queued and run 4 at a time, i.e., if 1 finishes ahead of others, then the next one will start running on the free processor. Is there a way to schedule into separate processes? On Saturday, January 23, 2016 at 12:00:35 PM UTC-8, Stefan Karpinski wrote: > > Any reason not to run them all as separate processes? > > On Fri, Jan 22, 2016 at 11:08 PM, Ritchie Lee> wrote: > >> Let's say I have 10 julia scripts, scripts = ["script1.jl", "script2.jl", >> , "script10.jl"] and I would like to run them in parallel in separate >> Julia sessions, but 4 at a time (since I only have 4 cores on my machine). >> Is there any way to do this programmatically? >> >> I tried doing this: >> >> addprocs(4) >> pmap(include, scripts) >> >> or >> >> addprocs(4) >> @parallel for s in scripts >> include(s) >> end >> >> However, this seems to reuse the same session, so all the global consts >> in the script file are colliding. I would like to make sure that the >> namespaces are completely separate. >> >> Thanks! >> > >