[julia-users] Re: FE solver in Julia fast and faster
Nice. I'd say this is also not bad for the commercial solver :) On Saturday, January 10, 2015 at 10:42:24 AM UTC+8, Petr Krysl wrote: Hello all, Big thanks to Tim Holy and Andreas Noack. The FE solver implemented in Julia as described previously ( https://groups.google.com/forum/?fromgroups=#!searchin/julia-users/Krysl/julia-users/dgNqrJBZx5U/oGeXMZFjToMJ) has been further optimized with their helpful hints and pointers. The comparison problem now runs in around 9.6 seconds, compared to 16 seconds solve phase achieved with the commercial FEA software . Not bad, Julia! Petr
[julia-users] Solving Sparse System with Tikhonov regularization
Hi, I have learned from another mailing list thread that I con solve the normal equation X'X b = X'y with the sparse matrix X by Z = X' b = cholfact(Z)\Zy However, I need to solve (X'X + lambda I) b = X'y i.e. the regularized normal equation. Does someone know a direct method for this? IIUC cholfact cannot be used for this. Alternatively it would be interesting if someone has code (or knows algorithms) for computing the SVD of a sparse matrix. Thanks Tobi
Re: [julia-users] How to define help text for a module function so that it displays in REPL
Docile.jl works great. With Lexicon (or base Julia 0.4dev), you get nice REPL help. Mkdocs (http://mkdocs.org) works great for taking Markdown from Docile output along with other Markdown files to make online documentation. Mkdocs is super easy and works great with Github Pages. It also works with readthedocs (but I haven't tried that). Here is an example of package documentation developed with Docile and Mkdocs (still a work in progress): https://tshort.github.io/Sims.jl/ On Fri, Jan 9, 2015 at 3:41 AM, Ján Dolinský jan.dolin...@2bridgz.com wrote: Hi, I would like to know how to write a help (comment) text e.g. for a module function so that once module is loaded it is displayed if in REPL help mode. E.g. for sum function help?sum displays brief help text for sum Thanks, Jan
Re: [julia-users] Solving Sparse System with Tikhonov regularization
Thanks Chris your answer is spot on. I totally forgot about that stacking method which is also very useful to show that the 1st and 2nd normal equation are equivalent if one applies Tikhonov regularization. I am already using iterative solvers for my problem. Interestingly the Kaczmarz method provides extremely good results for my matrix. Since it is challenging to choose lambda and the number of iterations in practice I want to look if a direct solver would work better. To you points: 1) If \ does not support sparse matrices this will be too slow (I am inherently assuming that the cholesky decomposition is also sparse...) 2) Can you point me to Julia code where a sparse QR is implemented? I know the argument about avoiding the normal equations quite well but in practice this does not always matter (e.g. if the matrix is an operator that you do not want to arrange explicitly) 3) Do you have a pointer to LSQR Julia code? Step 0) is already done. I get speedups of factor 100 and and this is quite crucial as the solver should be used in an online reconstruction framework. Cheers, Tobi Am Samstag, 10. Januar 2015 14:21:07 UTC+1 schrieb Chris Foster: Hi Tobi, I think cholfact(X'X + lambda I)\(X'y) should work: X'X is positive (semi-)definite, lambda*I is positive definite for lambda0, and the sum of any two positive definite matrices is also positive definite. Alternatively, if you're worried about the numerical conditioning of X'X, you can note that the regularized least squares minimization problem minimize ||Xb - y||^2 + λ||b||^2 is really just ordinary least squares with a larger system matrix: minimize ||Ab - z||^2 where A is the block matrix [X] [λI] and z is the vector made up blockwise as [y] [0] Now it just looks like ordinary least squares with a larger set of equations, so you can solve it with whatever sparse direct or iterative solver you can get your hands on. I like this way of writing regularization conditions - it makes it clear that you're just adjoining extra linear equations to the least squares system, which makes the task of translating it into numerical code easier. My advice is to try the following in order: 1) Try the builtin backdivide first (b = A\z). Looking at the source, I'm afraid julia may not yet have support for sparse direct least squares but I could be wrong. Maybe someone has built a package for this. Certainly matlab does well here by calling SuiteSparseQR with a preordering permutation to reduce fill in (possibly something like symamd(X'X) but I couldn't get it to tell me.). 2) Try a sparse direct solver, such as SuiteSparseQR with one of the preordering permutations. You need only R from the decomposition A = QR, from which it's then quite easy to solve the least squares problem as b = R\(R'\(A'z)). As far as I understand, this is significantly better conditioned than using the normal equations directly, since it avoids forming X'X. 3) If your problem is hitting memory limits, try an iterative solver like the LSQR method. In my meager experience this involves quite a bit more fiddling since you have to choose convergence thresholds, etc. It can also be quite a bit slower than a direct solver if you want high precision! Oh, I forgot step zero 0) Make sure it really has to be solved as a sparse problem. If the full matrix fits in memory, it's always worth trying to solve it directly just to see what happens ;-) (A direct full solution is also a good comparison point to determine whether any fancy sparse stuff is giving you the right answer.) By the way, if you want to know lots about solving least squares problems, the book Numerical Methods for Least Squares Problems by Ake Björck is just amazing. Cheers, ~Chris On Sat, Jan 10, 2015 at 7:27 PM, Tobias Knopp tobias...@googlemail.com javascript: wrote: Hi, I have learned from another mailing list thread that I con solve the normal equation X'X b = X'y with the sparse matrix X by Z = X' b = cholfact(Z)\Zy However, I need to solve (X'X + lambda I) b = X'y i.e. the regularized normal equation. Does someone know a direct method for this? IIUC cholfact cannot be used for this. Alternatively it would be interesting if someone has code (or knows algorithms) for computing the SVD of a sparse matrix. Thanks Tobi
[julia-users] Types that behave like functions: can I define f(x) using something like getindex
I'm working on a type that will have a function-like behavior, so I'd like to write f(x) to evaluate the function f at x. I could define getindex(f::MyType,x::Number) so f[x] would behave as desired, but it would be aesthetically pleasing to be able to type f(x) in this case. Is there a way to have something like a function_call I could define to make this happen? Or perhaps this already exists in Julia and I just can't find it.
Re: [julia-users] Types that behave like functions: can I define f(x) using something like getindex
You can override the `call` function to do just this, but the behaviour is new to 0.4. On 10 January 2015 at 14:04, Ed Scheinerman edward.scheiner...@gmail.com wrote: I'm working on a type that will have a function-like behavior, so I'd like to write f(x) to evaluate the function f at x. I could define getindex(f::MyType,x::Number) so f[x] would behave as desired, but it would be aesthetically pleasing to be able to type f(x) in this case. Is there a way to have something like a function_call I could define to make this happen? Or perhaps this already exists in Julia and I just can't find it.
Re: [julia-users] How to define help text for a module function so that it displays in REPL
I'm experimenting with using Docile/Lexicon. Somehow i understood how to add documentation. But is there somewhere also something like a style guide, what to document?
Re: [julia-users] How to define help text for a module function so that it displays in REPL
Hi, I had a look at your package: very nice indeed! It is not clear to me where the actual documentation is though. I followed some links to source code and there was no documentation in there… Petr On Saturday, January 10, 2015 at 8:35:24 AM UTC-8, tshort wrote: Docile.jl works great. With Lexicon (or base Julia 0.4dev), you get nice REPL help. Mkdocs (http://mkdocs.org) works great for taking Markdown from Docile output along with other Markdown files to make online documentation. Mkdocs is super easy and works great with Github Pages. It also works with readthedocs (but I haven't tried that). Here is an example of package documentation developed with Docile and Mkdocs (still a work in progress): https://tshort.github.io/Sims.jl/ On Fri, Jan 9, 2015 at 3:41 AM, Ján Dolinský jan.do...@2bridgz.com javascript: wrote: Hi, I would like to know how to write a help (comment) text e.g. for a module function so that once module is loaded it is displayed if in REPL help mode. E.g. for sum function help?sum displays brief help text for sum Thanks, Jan
Re: [julia-users] Re: Sort performance depends on Array type in a strange way
To make it fast, you probably want type Pair{X,Y} x::X y::Y end and use a concretely-typed array of Pair{X,Y}. --Tim On Friday, January 09, 2015 04:23:39 PM Páll Haraldsson wrote: I'm not sure why it matters if I added Numbers: type Pair : Number x y end I got a little lower time and 0 bytes allocated: julia @time sort_Pair() elapsed time: 0.006614108 seconds (488 bytes allocated) elapsed time: 0.041584405 seconds (31991872 bytes allocated) elapsed time: 1.732269097 seconds (0 bytes allocated) Array{Pair,1} elapsed time: 1.951577918 seconds (35993216 bytes allocated, 8.71% gc time) Hi, This is my first answer here, I'm not an expert on Julia.. Seems tuple is slow. It's more general, On my machine this beats Python: function sort_Pair() gc(); @time temp = rand(500_000) gc(); @time temp2 = [Pair(temp[i],i) for i=1:length(temp)] gc(); @time sort!(temp2); println(typeof(temp2)) end julia @time sort_pair() elapsed time: 0.006823427 seconds (488 bytes allocated) elapsed time: 0.035921609 seconds (31991872 bytes allocated) elapsed time: 1.975542283 seconds (448 bytes allocated) Array{Pair,1} elapsed time: 2.20708157 seconds (40892612 bytes allocated, 7.46% gc time) compared to (or 2.7 sec total in Python): julia @time sort_any() elapsed time: 0.006287604 seconds (488 bytes allocated) elapsed time: 0.047933539 seconds (35991872 bytes allocated) elapsed time: 5.989875809 seconds (191154832 bytes allocated) Array{Any,1} elapsed time: 6.247331383 seconds (231803748 bytes allocated, 2.76% gc time) I used: type Pair x y end import Base.isless function isless(a, b) if a.x b.x true elseif a.x == b.x a.y b.y true else false end end You can maybe think of a tuple as a type, but I'm not sure where to look for code for it nor looked into the profiler (use @profile, not @time). A tuple can of course be a 2-tupel (pair), 3-tuple, etc. And I could change the function for each case, just not sure how I would make my own type that would handle n-tuples.. Julia does that and maybe just has to be optimized. Maybe in 0.4 it is.. Types in Julia are supposed to be abstraction-free, but included tuples seem to have a 231803748/40892612 = 5.6 times overhead compared to my Pair judging by the memory allocations. On Friday, January 9, 2015 at 10:06:30 AM UTC, Andras Niedermayer wrote: The performance of the sort algorithm varies largely with the element type of an Array, in an unexpected (at least for me) way. Sorting time is ordered like this: Vector{(Any,Any)} Vector{Any} Vector{(Float64,Int64}). Is this a bug or is this behavior intended? Here's the code: --- julia function sort_floatint_tuple() temp = rand(500_000) temp2 = (Float64,Int64)[(temp[i],i) for i=1:length(temp)] sort!(temp2) end sort_floatint_tuple (generic function with 1 method) julia gc(); @time sort_floatint_tuple(); elapsed time: 5.371570706 seconds (2187115768 bytes allocated, 44.77% gc time) julia gc(); @time sort_floatint_tuple(); elapsed time: 7.522759215 seconds (2184593304 bytes allocated, 57.48% gc time) julia function sort_any_tuple() temp = rand(500_000) temp2 = (Any,Any)[(temp[i],i) for i=1:length(temp)] sort!(temp2) end sort_any_tuple (generic function with 1 method) julia gc(); @time sort_any_tuple(); elapsed time: 2.705974449 seconds (526135400 bytes allocated, 23.32% gc time) julia gc(); @time sort_any_tuple(); elapsed time: 3.215082563 seconds (523241560 bytes allocated, 37.72% gc time) julia function sort_any() temp = rand(500_000) temp2 = Any[(temp[i],i) for i=1:length(temp)] sort!(temp2) end sort_any (generic function with 1 method) julia gc(); @time sort_any(); elapsed time: 3.591829528 seconds (231327824 bytes allocated, 6.01% gc time) julia gc(); @time sort_any(); elapsed time: 3.932805966 seconds (231203560 bytes allocated, 12.54% gc time) --- Python is much faster here: --- %timeit temp=np.random.rand(50); temp2=zip(temp,range(len(temp))); temp2.sort() 1 loops, best of 3: 1.33 s per loop --- PS: Type inference gives Vector{(Float64,Int64)} if I write the for comprehension in a function and Vector{(Any,Any)} if I run it outside of a function. PPS: After looking at this in detail, I found out that sortperm would have been a better option for this. But it is still surprising to me that losing type information ((Any,Any) instead of (Float64,Int64)) speeds up the code.
Re: [julia-users] Solving Sparse System with Tikhonov regularization
Hi Tobi, I think cholfact(X'X + lambda I)\(X'y) should work: X'X is positive (semi-)definite, lambda*I is positive definite for lambda0, and the sum of any two positive definite matrices is also positive definite. Alternatively, if you're worried about the numerical conditioning of X'X, you can note that the regularized least squares minimization problem minimize ||Xb - y||^2 + λ||b||^2 is really just ordinary least squares with a larger system matrix: minimize ||Ab - z||^2 where A is the block matrix [X] [λI] and z is the vector made up blockwise as [y] [0] Now it just looks like ordinary least squares with a larger set of equations, so you can solve it with whatever sparse direct or iterative solver you can get your hands on. I like this way of writing regularization conditions - it makes it clear that you're just adjoining extra linear equations to the least squares system, which makes the task of translating it into numerical code easier. My advice is to try the following in order: 1) Try the builtin backdivide first (b = A\z). Looking at the source, I'm afraid julia may not yet have support for sparse direct least squares but I could be wrong. Maybe someone has built a package for this. Certainly matlab does well here by calling SuiteSparseQR with a preordering permutation to reduce fill in (possibly something like symamd(X'X) but I couldn't get it to tell me.). 2) Try a sparse direct solver, such as SuiteSparseQR with one of the preordering permutations. You need only R from the decomposition A = QR, from which it's then quite easy to solve the least squares problem as b = R\(R'\(A'z)). As far as I understand, this is significantly better conditioned than using the normal equations directly, since it avoids forming X'X. 3) If your problem is hitting memory limits, try an iterative solver like the LSQR method. In my meager experience this involves quite a bit more fiddling since you have to choose convergence thresholds, etc. It can also be quite a bit slower than a direct solver if you want high precision! Oh, I forgot step zero 0) Make sure it really has to be solved as a sparse problem. If the full matrix fits in memory, it's always worth trying to solve it directly just to see what happens ;-) (A direct full solution is also a good comparison point to determine whether any fancy sparse stuff is giving you the right answer.) By the way, if you want to know lots about solving least squares problems, the book Numerical Methods for Least Squares Problems by Ake Björck is just amazing. Cheers, ~Chris On Sat, Jan 10, 2015 at 7:27 PM, Tobias Knopp tobias.kn...@googlemail.com wrote: Hi, I have learned from another mailing list thread that I con solve the normal equation X'X b = X'y with the sparse matrix X by Z = X' b = cholfact(Z)\Zy However, I need to solve (X'X + lambda I) b = X'y i.e. the regularized normal equation. Does someone know a direct method for this? IIUC cholfact cannot be used for this. Alternatively it would be interesting if someone has code (or knows algorithms) for computing the SVD of a sparse matrix. Thanks Tobi
Re: [julia-users] Types that behave like functions: can I define f(x) using something like getindex
Great. I'll wait for a stable 0.4. Thanks for the speedy reply. On Saturday, January 10, 2015 at 8:06:45 AM UTC-6, Mike Innes wrote: You can override the `call` function to do just this, but the behaviour is new to 0.4. On 10 January 2015 at 14:04, Ed Scheinerman edward.sc...@gmail.com javascript: wrote: I'm working on a type that will have a function-like behavior, so I'd like to write f(x) to evaluate the function f at x. I could define getindex(f::MyType,x::Number) so f[x] would behave as desired, but it would be aesthetically pleasing to be able to type f(x) in this case. Is there a way to have something like a function_call I could define to make this happen? Or perhaps this already exists in Julia and I just can't find it.
[julia-users] Complex infinity
Is there a way to have a single complex infinity? This may come at the cost of computational efficiency I suppose, but I can think of situations where all of the following give the same result: julia (1+1im)/0 Inf + Inf*im julia 1im/0 NaN + Inf*im julia 1/0 + im Inf + 1.0im It would be nice (sometimes) if these were all the same ComplexInf, say. Perhaps there's an extended complex numbers module for this sort of work?
Re: [julia-users] Re: I cannot reach GitHub because of a firewall at work, how do I install Gadfly?
So you have a firewall that is blocking http?Do they force you to use an http proxy? See http://stackoverflow.com/questions/128035/how-do-i-pull-from-a-git-repository-through-an-http-proxy on setting up git to use your http proxy (e.g. copy the settings from your web browser). On Friday, January 9, 2015 at 5:47:39 PM UTC-5, John Hall wrote: Tried before. Doesn't work. On Fri, Jan 9, 2015 at 5:23 PM, Steven G. Johnson steve...@gmail.com javascript: wrote: On Friday, January 9, 2015 at 4:56:29 PM UTC-5, John Hall wrote: I've seen both the git manual and the https/git workaround before. Neither seem to work. If you do git clone manually from the command line with an https or http URL, does it work? It would be good to diagnose the specific problem.
Re: [julia-users] How to define help text for a module function so that it displays in REPL
Sorry, it's hidden in a branch (again, a work in progress): * https://github.com/tshort/Sims.jl/tree/mkdocs Here is the documentation directory with the static markdown files and the markdown files generated from Docile: * https://github.com/tshort/Sims.jl/tree/mkdocs/docs Compare the input and output for one of the source files: * https://github.com/tshort/Sims.jl/blob/mkdocs/examples/lib/electrical.jl: * https://tshort.github.io/Sims.jl/examples/lib/#electrical On Sat, Jan 10, 2015 at 12:06 PM, Petr Krysl krysl.p...@gmail.com wrote: Hi, I had a look at your package: very nice indeed! It is not clear to me where the actual documentation is though. I followed some links to source code and there was no documentation in there… Petr On Saturday, January 10, 2015 at 8:35:24 AM UTC-8, tshort wrote: Docile.jl works great. With Lexicon (or base Julia 0.4dev), you get nice REPL help. Mkdocs (http://mkdocs.org) works great for taking Markdown from Docile output along with other Markdown files to make online documentation. Mkdocs is super easy and works great with Github Pages. It also works with readthedocs (but I haven't tried that). Here is an example of package documentation developed with Docile and Mkdocs (still a work in progress): https://tshort.github.io/Sims.jl/ On Fri, Jan 9, 2015 at 3:41 AM, Ján Dolinský jan.do...@2bridgz.com wrote: Hi, I would like to know how to write a help (comment) text e.g. for a module function so that once module is loaded it is displayed if in REPL help mode. E.g. for sum function help?sum displays brief help text for sum Thanks, Jan
Re: [julia-users] Re: I cannot reach GitHub because of a firewall at work, how do I install Gadfly?
The commands I listed above where I try to git config --global http.proxy are the same thing as the answers to the stackoverflow question (I had actually referred to it before posting). The IE settings my company provides don't seem to be enough (and IT support is essentially unhelpful). On Sat, Jan 10, 2015 at 10:00 AM, Steven G. Johnson stevenj@gmail.com wrote: So you have a firewall that is blocking http?Do they force you to use an http proxy? See http://stackoverflow.com/questions/128035/how-do-i-pull-from-a-git-repository-through-an-http-proxy on setting up git to use your http proxy (e.g. copy the settings from your web browser). On Friday, January 9, 2015 at 5:47:39 PM UTC-5, John Hall wrote: Tried before. Doesn't work. On Fri, Jan 9, 2015 at 5:23 PM, Steven G. Johnson steve...@gmail.com wrote: On Friday, January 9, 2015 at 4:56:29 PM UTC-5, John Hall wrote: I've seen both the git manual and the https/git workaround before. Neither seem to work. If you do git clone manually from the command line with an https or http URL, does it work? It would be good to diagnose the specific problem.
[julia-users] Re: FE solver in Julia fast and faster
Also documentation will be immesely helpful for mortals like me. I would like to use this for optics problems On Saturday, 10 January 2015 13:40:34 UTC-5, Zahirul ALAM wrote: Very good. is the url https://github.com/PetrKryslUCSD/jfineale_for_trying_out still valid for the new optimized version? may be you will release this as a package? On Friday, 9 January 2015 21:42:24 UTC-5, Petr Krysl wrote: Hello all, Big thanks to Tim Holy and Andreas Noack. The FE solver implemented in Julia as described previously ( https://groups.google.com/forum/?fromgroups=#!searchin/julia-users/Krysl/julia-users/dgNqrJBZx5U/oGeXMZFjToMJ) has been further optimized with their helpful hints and pointers. The comparison problem now runs in around 9.6 seconds, compared to 16 seconds solve phase achieved with the commercial FEA software . Not bad, Julia! Petr
[julia-users] Re: FE solver in Julia fast and faster
Jeff, Not sure this is answering your question: both the commercial software and the Julia solver were run on the same machine (i7 with 16 GB of memory running Windows 7). On an equivalent Linux laptop the Julia solver is even faster. Comsol is not available on that laptop. P On Saturday, January 10, 2015 at 12:35:18 PM UTC-8, Jeff Waller wrote: Hmm, not knowing a lot about this, just the keyword I have the question. Is it possible to make it 3x faster yet and/or what hardware is that benchmark obtained from?
Re: [julia-users] Complex infinity
Julia's support for complex arithmetic is written purely in Julia, so I don't see how my suggestion to implement a new type is necessarily slower than hard-coding in special values indicating complex infinity. The code branches that one would need would simply be put in different places. Are there LLVM intrinsics and/or hardware support for complex arithmetic? The story would be different if there are (and I don't think we use them currently). The normalization of all complex infinities is essentially provided by the C9X proposal's cproj function (which uses Inf + 0.0im as the representation of ComplexInf). However, the C9X proposal acknowledges that there are use cases for both topologies and thus avoids recommending one or the other. To quote: Two topologies are commonly used in complex mathematics: the complex plane with its continuum of infinities and the Riemann sphere with its single infinity. The complex plane is better suited for transcendental functions, the Riemann sphere for algebraic functions. The complex types with their multiplicity of infinities provide a useful (though imperfect) model for the complex plane. The cproj function helps model the Riemann sphere by mapping all infinities to one, and should be used just before any operation, especially comparisons, that might give spurious results for any of the other infinities. In this proposal, the complex plane is clearly the more fundamental space. The Riemann sphere cannot be worked with directly; one can only work with the shadow of the Riemann sphere projected back onto the complex plane, one particular projection of which is provided by cproj. In contrast, it would be very Julian to represent the working topology with types rather than explicitly forcing users to choose between the ordinary complex plane and the Riemann sphere. The Riemann sphere would be a first-class working algebra instead of being accessible indirectly via cproj. The type model is also more composable, should there ever be a need to intermix the two topologies. The situation for zeros is less dire since they compare equal with ==, whereas the various representations of complex infinity do not. Thanks, Jiahao Chen Staff Research Scientist MIT Computer Science and Artificial Intelligence Laboratory
[julia-users] Re: FE solver in Julia fast and faster
Very good. is the url https://github.com/PetrKryslUCSD/jfineale_for_trying_out still valid for the new optimized version? may be you will release this as a package? On Friday, 9 January 2015 21:42:24 UTC-5, Petr Krysl wrote: Hello all, Big thanks to Tim Holy and Andreas Noack. The FE solver implemented in Julia as described previously ( https://groups.google.com/forum/?fromgroups=#!searchin/julia-users/Krysl/julia-users/dgNqrJBZx5U/oGeXMZFjToMJ) has been further optimized with their helpful hints and pointers. The comparison problem now runs in around 9.6 seconds, compared to 16 seconds solve phase achieved with the commercial FEA software . Not bad, Julia! Petr
Re: [julia-users] How to define help text for a module function so that it displays in REPL
Also, the links to source code don't work (I think) because I'm working on a branch. They should work once I merge to master. The only issue I found with Mkdocs was with syntax highlighting. Just a bit of googling, though. I had to use the codehighlight extension that uses Pygments. I also needed to add a css file. See the mkdocs.yml file. On Sat, Jan 10, 2015 at 12:42 PM, Tom Short tshort.rli...@gmail.com wrote: Sorry, it's hidden in a branch (again, a work in progress): * https://github.com/tshort/Sims.jl/tree/mkdocs Here is the documentation directory with the static markdown files and the markdown files generated from Docile: * https://github.com/tshort/Sims.jl/tree/mkdocs/docs Compare the input and output for one of the source files: * https://github.com/tshort/Sims.jl/blob/mkdocs/examples/lib/electrical.jl : * https://tshort.github.io/Sims.jl/examples/lib/#electrical On Sat, Jan 10, 2015 at 12:06 PM, Petr Krysl krysl.p...@gmail.com wrote: Hi, I had a look at your package: very nice indeed! It is not clear to me where the actual documentation is though. I followed some links to source code and there was no documentation in there… Petr On Saturday, January 10, 2015 at 8:35:24 AM UTC-8, tshort wrote: Docile.jl works great. With Lexicon (or base Julia 0.4dev), you get nice REPL help. Mkdocs (http://mkdocs.org) works great for taking Markdown from Docile output along with other Markdown files to make online documentation. Mkdocs is super easy and works great with Github Pages. It also works with readthedocs (but I haven't tried that). Here is an example of package documentation developed with Docile and Mkdocs (still a work in progress): https://tshort.github.io/Sims.jl/ On Fri, Jan 9, 2015 at 3:41 AM, Ján Dolinský jan.do...@2bridgz.com wrote: Hi, I would like to know how to write a help (comment) text e.g. for a module function so that once module is loaded it is displayed if in REPL help mode. E.g. for sum function help?sum displays brief help text for sum Thanks, Jan
[julia-users] Re: Adding Compose circles/lines/polygons to Gadfly plots?
Kaj, Guide.annotation was recently added. I haven't tagged a new version since its inclusion, so you need to either checkout master (with Pkg.checkout(Gadfly)) or wait until I tag 0.3.11. On Friday, January 9, 2015 at 4:42:38 PM UTC-8, Kaj Wiik wrote: Julia 0.3.5 Gadfly 0.3.10 julia plot(sin, 0, 2pi, Guide.annotation(compose(context(), circle([pi/2, 3*pi/2], [1.0, -1.0], [2mm]), fill(nothing), stroke(orange ERROR: annotation not defined ?? Kaj On Friday, January 9, 2015 at 6:28:03 AM UTC+2, Sheehan Olver wrote: I came across this which answers my question: http://gadflyjl.org/guide_annotation.html On Wednesday, December 10, 2014 at 8:05:02 AM UTC+11, Sheehan Olver wrote: I want to add, say, a triangle or circle to a Gadfly plot. The following works compose(render(plot(x=1:10,y=1:10)),circle(0.5,0.5,0.1)) But I want the circle to use the same coordinate system as the plot. Any advice?
[julia-users] Re: FE solver in Julia fast and faster
The optimized toolkit JFinEALE is now available on github: https://github.com/PetrKryslUCSD/JFinEALE Petr
Re: [julia-users] Complex infinity
Instead of defining a new type, it should be faster to normalize complex numbers after every operation. The current, IEEE-based complex numbers not only have various representations of infinity, but also for zero, since they distinguish between +0.0 and -0.0. Thus, the normalization would map all of the four complex zeros to zero (e.g. +0.0+0.0im), and would also choose a single normalized representation of infinity (maybe inf+inf*im, where inf=1.0/0.0). I would probably be necessary to redefine most complex number arithmetic to take these special cases into account. If you do this for complex numbers, then you may also want to do it for real numbers, just for good measure. Currently, there is +0.0 and -0.0 (and +inf and -inf), and a real number corresponding to an extended complex number should probably not distinguish between these either. -erik On Jan 10, 2015, at 14:37 , Jiahao Chen jia...@mit.edu wrote: You might be interested in Issue #5234, where I tried to catalogue issues arising from nonfinite floating-point computations in the ordinary complex plane (without closure on the Riemann sphere). Being able to switch between complex and extended complex (closed at ComplexInf) would be interesting. I vaguely recall discussing complex infinity with Mike Innes at some point, but I don't recall if we got anywhere. One solution is to wrap ordinary complex numbers in a new type representing finite extended complex numbers, and create yet another new type representing complex infinity. Define each function over the exted For each function, and redefine each function you want to use by either wrapping a finite answer in the new type, or otherwise checking if the answer is infinite and returning another new type instead which represents complex infinity. abstract ExtendedComplex{T:Real} immutable ComplexInf{T:Real} : ExtendedComplex{T} end immutable FiniteExtendedComplex{T:Real} : ExtendedComplex{T} z :: Complex{T} end function ExtendedComplex{T:Real}(r::T, i::T) if isfinite(r) isfinite(i)) return ExtendedComplex(Complex(r, i)) else return ComplexInf{T}() end end import Base./ function /{T}(z:: ComplexInf{T}, w:: FiniteExtendedComplex{T}) return z end function /{T}(z:: FiniteExtendedComplex{T}, w:: ComplexInf{T}) return zero(z) end function /{T}(z:: FiniteExtendedComplex{T}, w:: FiniteExtendedComplex{T}) a = z.z/w.z return isfinite(a) ? ExtendedComplex(a) : ComplexInf{T} end With these definitions you can compute as follows: julia FiniteExtendedComplex(2.0, 0.5)/FiniteExtendedComplex(0.5, 2.0) FiniteExtendedComplex{Float64}(0.47058823529411764 - 0.8823529411764706im) julia FiniteExtendedComplex(2.0, 0.3)/FiniteExtendedComplex(0.0, 0.0) ComplexInf{Float64}() julia ComplexInf{Float64}()/FiniteExtendedComplex(0.0, 0.0) ComplexInf{Float64}() julia ComplexInf{Float64}()/ComplexInf{Float64}() #Don't know how to do ∞/∞ ERROR: `/` has no method matching /(::ComplexInf{Float64}, ::ComplexInf{Float64}) Thanks, Jiahao Chen Staff Research Scientist MIT Computer Science and Artificial Intelligence Laboratory On Sat, Jan 10, 2015 at 8:55 AM, Ed Scheinerman edward.scheiner...@gmail.com wrote: Is there a way to have a single complex infinity? This may come at the cost of computational efficiency I suppose, but I can think of situations where all of the following give the same result: julia (1+1im)/0 Inf + Inf*im julia 1im/0 NaN + Inf*im julia 1/0 + im Inf + 1.0im It would be nice (sometimes) if these were all the same ComplexInf, say. Perhaps there's an extended complex numbers module for this sort of work? -- Erik Schnetter schnet...@gmail.com http://www.perimeterinstitute.ca/personal/eschnetter/ My email is as private as my paper mail. I therefore support encrypting and signing email messages. Get my PGP key from http://pgp.mit.edu/. signature.asc Description: Message signed with OpenPGP using GPGMail
[julia-users] Re: FE solver in Julia fast and faster
Simon, The commercial solver was Comsol 4.4. I suppose it is implemented in C or C++. Some of the user interface is probably in Java. I will certainly consider your suggestion about the types. Frankly, I didn't know better how to provide both type stability and flexibility. Hopefully I will learn as I go. If you have a concrete way of managing that in mind, do let me know (or implement it ;). Petr On Saturday, January 10, 2015 at 12:24:06 PM UTC-8, Simon Danisch wrote: Wow =) Do you have more details about the commercial solver? Is it implemented in C/C++? If yes, this might become my favorite example to show off Julia's strengths! Commercial C/C++ software looses against non commercial high level code makes up a pretty good story =) One thing I notice while scanning through your code: You're extensively using your own type(alias). I guess you have your reasons for that, but it made it a little harder for me to read your code and reminds me a lot of C/C++. Like this, if I want to use another array type instead of your defined type, I'd need to go into your JFFoundationModule and change your code. If it would be programmed against the abstract interfaces of FloatingPoint/AbstractArray/etc..., together with type stable functions, your library would be more flexible to use, as the types would simply be defined by the input types. I don't know if you're just used to C/C++ style programming, or if your case is a little more complicated than I imagine. Anyway, thanks for this great package! :) Am Samstag, 10. Januar 2015 03:42:24 UTC+1 schrieb Petr Krysl: Hello all, Big thanks to Tim Holy and Andreas Noack. The FE solver implemented in Julia as described previously ( https://groups.google.com/forum/?fromgroups=#!searchin/julia-users/Krysl/julia-users/dgNqrJBZx5U/oGeXMZFjToMJ) has been further optimized with their helpful hints and pointers. The comparison problem now runs in around 9.6 seconds, compared to 16 seconds solve phase achieved with the commercial FEA software . Not bad, Julia! Petr
[julia-users] Speed of Julia when a function is passed as an argument, and a different, but much faster coding.
Dear all, I was comparing the speed of Julia versus other languages (like Python or Fortran). As a test case I decided to check the speed when a function is passed to another one (for an example in a Ode solver). This is just a test case for situations that can arise, I know that there are very good ode solvers in Julia. I have found that the following code is quite slow, as slow as Python. function eusolverfun(fun::Function, n::Int64, tend::Float64, x0::Float64, y0 ::Float64, a::Float64, b::Float64, c::Float64, d::Float64) x, y = x0, y0 dt = tend/n for i=1:n dx, dy = fun(x, y, a, b, c, d)::(Float64,Float64) x = x + dx*dt y = y + dy*dt end return x, y end function predpreyeq(x::Float64, y::Float64, a::Float64, b::Float64, c::Float64, d::Float64) dx = x*(a-b*y) dy = -y*(c-d*x) return dx, dy end function fullcalc(n) tend = 5.0 a, b, c, d = 1.5, 1.0, 3.0, 1.0 x0, y0 = 1.0, 1.0 x, y = eusolverfun(predpreyeq, 20, tend, x0, y0, a, b, c, d) @time x, y = eusolverfun(predpreyeq, n, tend, x0, y0, a, b, c, d) end fullcalc(int(1e7)) I much faster version, as fast as Fortran actually, is the following: module genode export Ode, eusolver abstract Ode function eusolver(ode::Ode, n, tend, x0, y0) x, y = x0, y0 dt = tend/n for i=1:n dx, dy = eqfun(ode, x, y) x = x + dx*dt y = y + dy*dt end return x, y end eqfun(ode::Ode, x, y) = (x,y) end using genode import genode.eqfun immutable MyOde : Ode a::Float64 b::Float64 c::Float64 d::Float64 end function eqfun(ode::MyOde, x, y) dx = x*(ode.a-ode.b*y) dy = -y*(ode.c-ode.d*x) return dx, dy end n = int(1E9) w = MyOde(1.5, 1.0, 3.0, 1.0) x, y = eusolver(w, 10, 5.0, 1.0, 1.0) @time x, y = eusolver(w, n, 5.0, 1.0, 1.0) On my windows machine the first program for n=1e7 gives: elapsed time: 2.603235344 seconds (161792 bytes allocated, 40.55% gc time) While the second one gives (n=1e9): elapsed time: 6.615803974 seconds (208 bytes allocated) Is there a way to code first version in order to be as fast as the second? While the second version could be quite handy for passing parameters to the Ode, one still needs to declare a placeholder function (*eqfun(ode::Ode, ...)* in module genode) and import it in order to allow the overloading of the function to take place. Thanks.
[julia-users] Re: Adding Compose circles/lines/polygons to Gadfly plots?
Daniel, Thanks, works now perfectly, I had to restart julia after checkout to get it working. In fact this was my suspicion but did not know how to get the master. This is indeed a very friendly community, many thanks! Kaj On Saturday, January 10, 2015 at 9:01:03 PM UTC+2, Daniel Jones wrote: Kaj, Guide.annotation was recently added. I haven't tagged a new version since its inclusion, so you need to either checkout master (with Pkg.checkout(Gadfly)) or wait until I tag 0.3.11. On Friday, January 9, 2015 at 4:42:38 PM UTC-8, Kaj Wiik wrote: Julia 0.3.5 Gadfly 0.3.10 julia plot(sin, 0, 2pi, Guide.annotation(compose(context(), circle([pi/2, 3*pi/2], [1.0, -1.0], [2mm]), fill(nothing), stroke(orange ERROR: annotation not defined ?? Kaj On Friday, January 9, 2015 at 6:28:03 AM UTC+2, Sheehan Olver wrote: I came across this which answers my question: http://gadflyjl.org/guide_annotation.html On Wednesday, December 10, 2014 at 8:05:02 AM UTC+11, Sheehan Olver wrote: I want to add, say, a triangle or circle to a Gadfly plot. The following works compose(render(plot(x=1:10,y=1:10)),circle(0.5,0.5,0.1)) But I want the circle to use the same coordinate system as the plot. Any advice?
Re: [julia-users] Complex infinity
Whoops, that version didn't work. Try this version instead: abstract ExtendedComplex{T:Real} immutable ComplexInf{T:Real} : ExtendedComplex{T} end immutable FiniteExtendedComplex{T:Real} : ExtendedComplex{T} z :: Complex{T} end function FiniteExtendedComplex{T:Real}(r::T, i::T) if isfinite(r) isfinite(i) return FiniteExtendedComplex(Complex(r, i)) else return ComplexInf{T}() end end import Base./ function /{T}(z:: ComplexInf{T}, w:: FiniteExtendedComplex{T}) return z end function /{T}(z:: FiniteExtendedComplex{T}, w:: ComplexInf{T}) return zero(z) end function /{T}(z:: FiniteExtendedComplex{T}, w:: FiniteExtendedComplex{T}) a = z.z/w.z return isfinite(a) ? FiniteExtendedComplex(a) : ComplexInf{T}() end
Re: [julia-users] Complex infinity
You might be interested in Issue #5234 https://github.com/JuliaLang/julia/issues/5234, where I tried to catalogue issues arising from nonfinite floating-point computations in the ordinary complex plane (without closure on the Riemann sphere). Being able to switch between complex and extended complex (closed at ComplexInf) would be interesting. I vaguely recall discussing complex infinity with Mike Innes at some point, but I don't recall if we got anywhere. One solution is to wrap ordinary complex numbers in a new type representing finite extended complex numbers, and create yet another new type representing complex infinity. Define each function over the exted For each function, and redefine each function you want to use by either wrapping a finite answer in the new type, or otherwise checking if the answer is infinite and returning another new type instead which represents complex infinity. abstract ExtendedComplex{T:Real} immutable ComplexInf{T:Real} : ExtendedComplex{T} end immutable FiniteExtendedComplex{T:Real} : ExtendedComplex{T} z :: Complex{T} end function ExtendedComplex{T:Real}(r::T, i::T) if isfinite(r) isfinite(i)) return ExtendedComplex(Complex(r, i)) else return ComplexInf{T}() end end import Base./ function /{T}(z:: ComplexInf{T}, w:: FiniteExtendedComplex{T}) return z end function /{T}(z:: FiniteExtendedComplex{T}, w:: ComplexInf{T}) return zero(z) end function /{T}(z:: FiniteExtendedComplex{T}, w:: FiniteExtendedComplex{T}) a = z.z/w.z return isfinite(a) ? ExtendedComplex(a) : ComplexInf{T} end With these definitions you can compute as follows: julia FiniteExtendedComplex(2.0, 0.5)/FiniteExtendedComplex(0.5, 2.0) FiniteExtendedComplex{Float64}(0.47058823529411764 - 0.8823529411764706im) julia FiniteExtendedComplex(2.0, 0.3)/FiniteExtendedComplex(0.0, 0.0) ComplexInf{Float64}() julia ComplexInf{Float64}()/FiniteExtendedComplex(0.0, 0.0) ComplexInf{Float64}() julia ComplexInf{Float64}()/ComplexInf{Float64}() #Don't know how to do ∞/∞ ERROR: `/` has no method matching /(::ComplexInf{Float64}, ::ComplexInf{Float64}) Thanks, Jiahao Chen Staff Research Scientist MIT Computer Science and Artificial Intelligence Laboratory On Sat, Jan 10, 2015 at 8:55 AM, Ed Scheinerman edward.scheiner...@gmail.com wrote: Is there a way to have a single complex infinity? This may come at the cost of computational efficiency I suppose, but I can think of situations where all of the following give the same result: julia (1+1im)/0 Inf + Inf*im julia 1im/0 NaN + Inf*im julia 1/0 + im Inf + 1.0im It would be nice (sometimes) if these were all the same ComplexInf, say. Perhaps there's an extended complex numbers module for this sort of work?
[julia-users] Re: FE solver in Julia fast and faster
Hmm, not knowing a lot about this, just the keyword I have the question. Is it possible to make it 3x faster yet and/or what hardware is that benchmark obtained from?
Re: [julia-users] Complex infinity
What I was imagining was a new type, called e.g. ExtendedComplex (or RiemannComplex) that substitutes for the current Complex type. I didn't know about cproj, but I was imagining something equivalent to RiemannComplex calls cproj after every complex number operation. If a function can return two different types, this is called type instability. It requires the compiler (at least currently, but I know of no plans to change this) to return values in heap-allocated data structures instead of in registers. This is very expensive. See e.g. http://julia.readthedocs.org/en/latest/manual/performance-tips/ for a discussion on type instability. Without this problem, using a separate type to denote infinity would indeed not only be a very elegant but also efficient solution. -erik On Jan 10, 2015, at 17:44 , Jiahao Chen jia...@mit.edu wrote: Julia's support for complex arithmetic is written purely in Julia, so I don't see how my suggestion to implement a new type is necessarily slower than hard-coding in special values indicating complex infinity. The code branches that one would need would simply be put in different places. Are there LLVM intrinsics and/or hardware support for complex arithmetic? The story would be different if there are (and I don't think we use them currently). The normalization of all complex infinities is essentially provided by the C9X proposal's cproj function (which uses Inf + 0.0im as the representation of ComplexInf). However, the C9X proposal acknowledges that there are use cases for both topologies and thus avoids recommending one or the other. To quote: Two topologies are commonly used in complex mathematics: the complex plane with its continuum of infinities and the Riemann sphere with its single infinity. The complex plane is better suited for transcendental functions, the Riemann sphere for algebraic functions. The complex types with their multiplicity of infinities provide a useful (though imperfect) model for the complex plane. The cproj function helps model the Riemann sphere by mapping all infinities to one, and should be used just before any operation, especially comparisons, that might give spurious results for any of the other infinities. In this proposal, the complex plane is clearly the more fundamental space. The Riemann sphere cannot be worked with directly; one can only work with the shadow of the Riemann sphere projected back onto the complex plane, one particular projection of which is provided by cproj. In contrast, it would be very Julian to represent the working topology with types rather than explicitly forcing users to choose between the ordinary complex plane and the Riemann sphere. The Riemann sphere would be a first-class working algebra instead of being accessible indirectly via cproj. The type model is also more composable, should there ever be a need to intermix the two topologies. The situation for zeros is less dire since they compare equal with ==, whereas the various representations of complex infinity do not. Thanks, Jiahao Chen Staff Research Scientist MIT Computer Science and Artificial Intelligence Laboratory -- Erik Schnetter schnet...@gmail.com http://www.perimeterinstitute.ca/personal/eschnetter/ My email is as private as my paper mail. I therefore support encrypting and signing email messages. Get my PGP key from http://pgp.mit.edu/. signature.asc Description: Message signed with OpenPGP using GPGMail
Re: [julia-users] Re: Julia v0.3.5
Is there anything preventing julialang/julia/NEWS.md from splitting out changes by build number (i.e. 0.3.4 and 0.3.5 have separate subsections)? I assume most (all?) the changes are being logged anyway. On Saturday, 10 January 2015 10:29:12 UTC+11, Elliot Saba wrote: Amazing when we can copy numbers from one computer to another properly, isn't it? -E On Fri, Jan 9, 2015 at 3:27 PM, ele...@gmail.com javascript: wrote: Now matches the tagged commit 'n all. Thanks Lex On Saturday, January 10, 2015 at 9:19:35 AM UTC+10, Elliot Saba wrote: We noticed that as well https://github.com/JuliaLang/julia/commit/a05f87b79ad62beb033817fdfdefa270c9557aaf. An `apt-get update apt-get upgrade` should fix it. -E On Fri, Jan 9, 2015 at 3:15 PM, cdm cdmcle...@gmail.com wrote: yeah ... that parenthetical has been static since at least version 0.3.3 curious ... On Friday, January 9, 2015 at 3:06:29 PM UTC-8, ele...@gmail.com wrote: Thank you all the people who bring these updates. One question, the versioninfo() for theJulia release on the Ubuntu PPA says: Version 0.3.5 Commit 21d5433* (2014-10-21 20:18 UTC) The commit and date/time hasn't changed. Cheers Lex On Saturday, January 10, 2015 at 5:11:13 AM UTC+10, Elliot Saba wrote: Hello all! The latest bugfix release of the 0.3.x Julia line has been released. Binaries are available from the usual place http://julialang.org/downloads/, and as is typical with such things, please report all issues to either the issue tracker https://github.com/JuliaLang/julia/issues, or email this list. As this is a bugfix release, there are not too many new big-item features to announce, but if you are interested in the bugs fixed since 0.3.4, this commit log https://github.com/JuliaLang/julia/compare/v0.3.4...v0.3.5 should give you an idea of the effort put in by our team of backporters. This is a recommended upgrade for anyone using any of the previous 0.3.x releases, and should act as a drop-in replacement for any of the 0.3.x line. We would like to get feedback if someone has a correctly working program that doesn't work after this upgrade. Happy Hacking, -E
Re: [julia-users] Re: Julia v0.3.5
Only a tiny fraction of the commits end up being described in NEWS.md, as you might guess from the fact that there are over 20,000 commits to julia and only 300 bulleted items in NEWS.md (many of which are links). We do try to make sure the big-ticket items end up in NEWS.md. Unfortunately, there are several challenges to implementing your suggestion. The commits are first made to master for release with 0.4; those may come with additions to NEWS.md in the 0.4 section, or the NEWS entry may come much later (e.g., as we prepare 0.4 for release). Commits get backported to 0.3 at varying times, and may not grab NEWS commits if those came separately. Given the organic nature of this process, it's understandable that no one goes to the effort to manually edit NEWS.md for point releases. Of course, if someone wants to step up and take that job on, that would be great. Best, --Tim On Saturday, January 10, 2015 05:24:38 PM i.costi...@me.com wrote: Is there anything preventing julialang/julia/NEWS.md from splitting out changes by build number (i.e. 0.3.4 and 0.3.5 have separate subsections)? I assume most (all?) the changes are being logged anyway. On Saturday, 10 January 2015 10:29:12 UTC+11, Elliot Saba wrote: Amazing when we can copy numbers from one computer to another properly, isn't it? -E On Fri, Jan 9, 2015 at 3:27 PM, ele...@gmail.com javascript: wrote: Now matches the tagged commit 'n all. Thanks Lex On Saturday, January 10, 2015 at 9:19:35 AM UTC+10, Elliot Saba wrote: We noticed that as well https://github.com/JuliaLang/julia/commit/a05f87b79ad62beb033817fdfdefa 270c9557aaf. An `apt-get update apt-get upgrade` should fix it. -E On Fri, Jan 9, 2015 at 3:15 PM, cdm cdmcle...@gmail.com wrote: yeah ... that parenthetical has been static since at least version 0.3.3 curious ... On Friday, January 9, 2015 at 3:06:29 PM UTC-8, ele...@gmail.com wrote: Thank you all the people who bring these updates. One question, the versioninfo() for theJulia release on the Ubuntu PPA says: Version 0.3.5 Commit 21d5433* (2014-10-21 20:18 UTC) The commit and date/time hasn't changed. Cheers Lex On Saturday, January 10, 2015 at 5:11:13 AM UTC+10, Elliot Saba wrote: Hello all! The latest bugfix release of the 0.3.x Julia line has been released. Binaries are available from the usual place http://julialang.org/downloads/, and as is typical with such things, please report all issues to either the issue tracker https://github.com/JuliaLang/julia/issues, or email this list. As this is a bugfix release, there are not too many new big-item features to announce, but if you are interested in the bugs fixed since 0.3.4, this commit log https://github.com/JuliaLang/julia/compare/v0.3.4...v0.3.5 should give you an idea of the effort put in by our team of backporters. This is a recommended upgrade for anyone using any of the previous 0.3.x releases, and should act as a drop-in replacement for any of the 0.3.x line. We would like to get feedback if someone has a correctly working program that doesn't work after this upgrade. Happy Hacking, -E
[julia-users] Re: FE solver in Julia fast and faster
Correction: The repository has been now updated to look like a true Julia package. It can be cloned and there's even a rudimentary test. https://github.com/PetrKryslUCSD/JFinEALE.jl P On Saturday, January 10, 2015 at 11:57:48 AM UTC-8, Petr Krysl wrote: The optimized toolkit JFinEALE is now available on github: https://github.com/PetrKryslUCSD/JFinEALE Petr
Re: [julia-users] Complex infinity
This may lead to problems with nans. For example, 1.0/(0.0, 0.0) is (inf, nan), and 1.0/(inf,nan) is (0.0, nan); multiply by (1, im) yields (nan, nan), and all information is lost. With a proper treatment, this would be (0.0, 0.0) instead. -erik On Jan 10, 2015, at 18:07 , Jiahao Chen jia...@mit.edu wrote: Another possibility that occurs to me is to redefine the == equality comparison. Currently this is defined as ==(z::Complex, w::Complex) = (real(z) == real(w)) (imag(z) == imag(w)) but for some purposes it may be sufficient to redefine this as ==(z::Complex, w::Complex) = if isinf(z) isinf(w) return true else return (real(z) == real(w)) (imag(z) == imag(w)) end to model the topology of the Riemann sphere. With this redefinition: julia Complex(Inf, 0.0) == Complex(Inf, NaN) true julia Complex(Inf, 0.0) == Complex(Inf, 2.0) true -- Erik Schnetter schnet...@gmail.com http://www.perimeterinstitute.ca/personal/eschnetter/ My email is as private as my paper mail. I therefore support encrypting and signing email messages. Get my PGP key from http://pgp.mit.edu/. signature.asc Description: Message signed with OpenPGP using GPGMail
Re: [julia-users] Complex infinity
On Sat, Jan 10, 2015 at 6:12 PM, Erik Schnetter schnet...@gmail.com wrote: This may lead to problems with nans. For example, 1.0/(0.0, 0.0) is (inf, nan), and 1.0/(inf,nan) is (0.0, nan); multiply by (1, im) yields (nan, nan), and all information is lost. With a proper treatment, this would be (0.0, 0.0) instead. We already have this problem. julia 1.0/Complex(0.0, 0.0) NaN + NaN*im (essentially #9531) I agree that (Inf, NaN) should be treated as a representation of complex infinity. (Ref: #5234)
Re: [julia-users] Re: I cannot reach GitHub because of a firewall at work, how do I install Gadfly?
There are very few *nix based applications that observe the Windows internet settings. R, most notably, allows you use the internet2 Windows interface http://cran.r-project.org/bin/windows/base/rw-FAQ.html#The-Internet-download-functions-fail_002e. But this isn't observed by packages that use curl (e.g. devtools). In any case, best to setup a local proxy and the environment variables described below (not easy is it?) On Sunday, 11 January 2015 12:16:42 UTC+11, i.cos...@me.com wrote: If your workplace uses a proxy script to automagicallly http://msdn.microsoft.com/en-us/library/dn321447.aspx assign you to particular proxy servers, then you probably need to start an instance of a local proxy server (e.g. CNTLM). While I haven't tried this myself, this means that all you need to do is tell git (probably, maybe also Julia?) that it needs to send data packets through `localhost:3128` (that is CNTLM's default proxy server's address/port combo). I think you could do this with an environment variable used by git (something like HTTPS_PROXY = localhost / HTTP_PROXY = localhost) On Sunday, 11 January 2015 04:49:03 UTC+11, John Hall wrote: The commands I listed above where I try to git config --global http.proxy are the same thing as the answers to the stackoverflow question (I had actually referred to it before posting). The IE settings my company provides don't seem to be enough (and IT support is essentially unhelpful). On Sat, Jan 10, 2015 at 10:00 AM, Steven G. Johnson steve...@gmail.com wrote: So you have a firewall that is blocking http?Do they force you to use an http proxy? See http://stackoverflow.com/questions/128035/how-do-i-pull-from-a-git-repository-through-an-http-proxy on setting up git to use your http proxy (e.g. copy the settings from your web browser). On Friday, January 9, 2015 at 5:47:39 PM UTC-5, John Hall wrote: Tried before. Doesn't work. On Fri, Jan 9, 2015 at 5:23 PM, Steven G. Johnson steve...@gmail.com wrote: On Friday, January 9, 2015 at 4:56:29 PM UTC-5, John Hall wrote: I've seen both the git manual and the https/git workaround before. Neither seem to work. If you do git clone manually from the command line with an https or http URL, does it work? It would be good to diagnose the specific problem.
Re: [julia-users] Re: I cannot reach GitHub because of a firewall at work, how do I install Gadfly?
If your workplace uses a proxy script to automagicallly http://msdn.microsoft.com/en-us/library/dn321447.aspx assign you to particular proxy servers, then you probably need to start an instance of a local proxy server (e.g. CNTLM). While I haven't tried this myself, this means that all you need to do is tell git (probably, maybe also Julia?) that it needs to send data packets through `localhost:3128` (that is CNTLM's default proxy server's address/port combo). I think you could do this with an environment variable used by git (something like HTTPS_PROXY = localhost / HTTP_PROXY = localhost) On Sunday, 11 January 2015 04:49:03 UTC+11, John Hall wrote: The commands I listed above where I try to git config --global http.proxy are the same thing as the answers to the stackoverflow question (I had actually referred to it before posting). The IE settings my company provides don't seem to be enough (and IT support is essentially unhelpful). On Sat, Jan 10, 2015 at 10:00 AM, Steven G. Johnson steve...@gmail.com javascript: wrote: So you have a firewall that is blocking http?Do they force you to use an http proxy? See http://stackoverflow.com/questions/128035/how-do-i-pull-from-a-git-repository-through-an-http-proxy on setting up git to use your http proxy (e.g. copy the settings from your web browser). On Friday, January 9, 2015 at 5:47:39 PM UTC-5, John Hall wrote: Tried before. Doesn't work. On Fri, Jan 9, 2015 at 5:23 PM, Steven G. Johnson steve...@gmail.com wrote: On Friday, January 9, 2015 at 4:56:29 PM UTC-5, John Hall wrote: I've seen both the git manual and the https/git workaround before. Neither seem to work. If you do git clone manually from the command line with an https or http URL, does it work? It would be good to diagnose the specific problem.
Re: [julia-users] Package structure
Petr, Would you like me to prepare a simple pull request tomorrow? Regards, Rob Sent from my iPhone On Jan 10, 2015, at 6:22 PM, Petr Krysl krysl.p...@gmail.com wrote: Hello everybody, I wonder if I could get some advice on how to structure a package? I could see how the SRC and TEST folders had a place in the package structure, but so far I could not discern a systematic way for access to examples that use the package. In particular, when I create a package (clone()),, and the package has an EXAMPLES folder, none of the stuff in that folder is actually visible at the REPL... How should this be handled? Thanks, P
Re: [julia-users] Complex infinity
Ah, I see your concern about the singleton ComplexInf type. This sounds just like the very same design issue behind NA in DataArrays and Nullables in 0.4.
Re: [julia-users] Complex infinity
Another possibility that occurs to me is to redefine the == equality comparison. Currently this is defined as ==(z::Complex, w::Complex) = (real(z) == real(w)) (imag(z) == imag(w)) but for some purposes it may be sufficient to redefine this as ==(z::Complex, w::Complex) = if isinf(z) isinf(w) return true else return (real(z) == real(w)) (imag(z) == imag(w)) end to model the topology of the Riemann sphere. With this redefinition: julia Complex(Inf, 0.0) == Complex(Inf, NaN) true julia Complex(Inf, 0.0) == Complex(Inf, 2.0) true
Re: [julia-users] Complex infinity
On Jan 10, 2015, at 18:15 , Jiahao Chen jia...@mit.edu wrote: Ah, I see your concern about the singleton ComplexInf type. This sounds just like the very same design issue behind NA in DataArrays and Nullables in 0.4. Yes, it is. But no matter how efficient this will be -- this approach will always require at least one additional bit of storage to describe the type, whereas a representation purely in terms of two reals won't. This will always be slower. -erik -- Erik Schnetter schnet...@gmail.com http://www.perimeterinstitute.ca/personal/eschnetter/ My email is as private as my paper mail. I therefore support encrypting and signing email messages. Get my PGP key from http://pgp.mit.edu/. signature.asc Description: Message signed with OpenPGP using GPGMail
Re: [julia-users] Complex infinity
On Jan 10, 2015, at 18:22 , Jiahao Chen jia...@mit.edu wrote: On Sat, Jan 10, 2015 at 6:12 PM, Erik Schnetter schnet...@gmail.com wrote: This may lead to problems with nans. For example, 1.0/(0.0, 0.0) is (inf, nan), and 1.0/(inf,nan) is (0.0, nan); multiply by (1, im) yields (nan, nan), and all information is lost. With a proper treatment, this would be (0.0, 0.0) instead. We already have this problem. julia 1.0/Complex(0.0, 0.0) NaN + NaN*im (essentially #9531) I agree that (Inf, NaN) should be treated as a representation of complex infinity. (Ref: #5234) This will either require normalizing the result of complex operations, or normalizing the input. -erik -- Erik Schnetter schnet...@gmail.com http://www.perimeterinstitute.ca/personal/eschnetter/ My email is as private as my paper mail. I therefore support encrypting and signing email messages. Get my PGP key from http://pgp.mit.edu/. signature.asc Description: Message signed with OpenPGP using GPGMail
[julia-users] Package structure
Hello everybody, I wonder if I could get some advice on how to structure a package? I could see how the SRC and TEST folders had a place in the package structure, but so far I could not discern a systematic way for access to examples that use the package. In particular, when I create a package (clone()),, and the package has an EXAMPLES folder, none of the stuff in that folder is actually visible at the REPL... How should this be handled? Thanks, P