Re: [julia-users] Re: workflow recommendation/tutorial

2015-01-26 Thread Tamas Papp
Thanks to everyone for the replies. So do I understand the following correctly: if I separate my functions and runtime code (eg MyModule and MyModuleRun), and then want to redefine a single function in the first, then I have to reload the whole module again? Julia seemed so ideal for exploratory

[julia-users] Re: Help grokking a certain unsupported or misplaced expression

2015-01-26 Thread Patrick O'Leary
Using JuliaParser.jl as a reference, it loks like is in the class unary_and_binary_ops, as well as syntactic_binary_ops. The | operator is not in either of these classes. At least one reason for the difference in lowering to the AST is that is also an addressof-like operator in the context

Re: [julia-users] Re: workflow recommendation/tutorial

2015-01-26 Thread Tamas Papp
So the only the global name space is for tinkering (iterative, interactive development), and modules are for more-or-less stable code --- is this correct? Is this an inherent feature of the architecture of Julia, or can one expect this to change as issues (especially #265) are resolved? Best,

[julia-users] Freeing XMLElement from LightXML.jl? (Mem leak problem)

2015-01-26 Thread Robert Feldt
Hi, Does anyone now how to free up the memory in a XMLElement object in LightXML.jl? LightXML.jl has a free(xdoc::XMLDocument) but no corresponding free(xelem::XMLElement). There are functions related to free in clib.jl in the package but no docs that I can find on how to use it. I tried to

Re: [julia-users] Re: workflow recommendation/tutorial

2015-01-26 Thread Tim Holy
You can redefine a function like this: function MyModule.myfunction(args...) stuff end Two caveats: - myfunction has to already exist in MyModule for this to work---you can't add new names to an already-closed module. - Anything that has already been compiled and uses myfunction won't

[julia-users] eigenvalues of sparse matrix

2015-01-26 Thread Andrei Berceanu
Is there any Julia function for computing the eigenvalues of a large, sparse, hermitian matrix M? I have tried eig(M) and eigvals(M) and got the no method error. //A

[julia-users] module reflection introspection

2015-01-26 Thread Tamas Papp
Suppose I have a trivial module module Foo x = 1 end so names(Foo) now includes a Symbol that is === to symbol(x). I have two questions: 1. How can I intern symbols into a module programatically, possibly from outside the module? symbol(Foo.y) does not work (using 3.5). 2. Similarly, how can I

Re: [julia-users] eigenvalues of sparse matrix

2015-01-26 Thread Andreas Noack
You can use eigs. Usually, you only ask for a few of the values, but in theory, you could get all of them, but it could take some time to compute them. 2015-01-26 9:40 GMT-05:00 Andrei Berceanu andreiberce...@gmail.com: Is there any Julia function for computing the eigenvalues of a large,

Re: [julia-users] Freeing XMLElement from LightXML.jl? (Mem leak problem)

2015-01-26 Thread Isaiah Norton
The underlying XMLNode needs to be freed using xmlFreeNode from libxml2: http://xmlsoft.org/html/libxml-tree.html#xmlFreeNode I don't think this is wrapped yet, but it should be straightforward to add -- ideally, called via a finalizer so that the objects are freed automatically when Julia

Re: [julia-users] Re: gpu computing tutorial

2015-01-26 Thread Tim Holy
Not exactly what you're asking for, but code in the test/ folder is also often a frequent source of inspiration, since it shows how to use the code. --Tim On Sunday, January 25, 2015 11:32:20 PM tuguldu...@gmail.com wrote: yes, I saw those. What I am looking for is source code that implemented

Re: [julia-users] Re: Strange performance behavior

2015-01-26 Thread Yuuki Soho
1. That's my matlab code, I was hoping to be able to write it with loops in Julia, because sometimes these vectorize operations can become a real headache, but it's maybe hopeless to try to beat these highly optimized libraries. function alpha =

[julia-users] emacs shell not working with julia in docker container

2015-01-26 Thread Christian Groll
I did set up Julia in a docker container. When I run it from the shell everything works just fine. However, when I start the shell inside of emacs, I can run the docker container and start Julia, but it somehow messes with the output:

Re: [julia-users] eigenvalues of sparse matrix

2015-01-26 Thread Andrei Berceanu
Besides, the help of eigs says using Lanczos or Arnoldi iterations for real symmetric or general nonsymmetric matrices respectively. Mine is hermitian, i.e. complex and symmetric. On Monday, January 26, 2015 at 4:02:16 PM UTC+1, Andrei Berceanu wrote: That seems to return a lot of things

Re: [julia-users] Freeing XMLElement from LightXML.jl? (Mem leak problem)

2015-01-26 Thread Robert Feldt
Actually this diff better shows the proposed changes: https://github.com/robertfeldt/LightXML.jl/commit/238fbb5c41629e254088dfe7553a53c72bd5dffa Will test and see if it helps. /Robert Den måndag 26 januari 2015 kl. 17:36:47 UTC+1 skrev Robert Feldt: Ok, great. I'm not used to explicit mem

Re: [julia-users] Call overloading and @code_... macros

2015-01-26 Thread Jameson Nash
Maybe llvm has now turned on code relocation on MachO? If so, I just need to flip a switch in the code to fix this. On Mon, Jan 26, 2015 at 3:30 AM Luthaf lut...@luthaf.fr wrote: I am using the latest master, on OS X 10.9, with LLVM svn julia versioninfo() Julia Version 0.4.0-dev+2914 Commit

Re: [julia-users] Re: Strange performance behavior

2015-01-26 Thread Yuuki Soho
Omg, I forgot to remove it! I should proof-read my code more carefully before posting... Julia is now 5x faster than matlab.

Re: [julia-users] Re: workflow recommendation/tutorial

2015-01-26 Thread Tamas Papp
Where is the API for this functionality exposed, so that eg ESS could make use of it? For example, how would one eval or define new functions into a module in the REPL? Best, Tamas On Mon, Jan 26 2015, Mike Innes mike.j.in...@gmail.com wrote: It's not an inherent feature of Julia, no, just a

Re: [julia-users] Re: Strange performance behavior

2015-01-26 Thread Stefan Karpinski
On Mon, Jan 26, 2015 at 10:44 AM, Yuuki Soho yu...@vivaldi.net wrote: Julia is now 5x faster than matlab. Win.

Re: [julia-users] eigenvalues of sparse matrix

2015-01-26 Thread Andreas Noack
Yes. There is some extra output including convergence information and the Ritz vectors. It should probably be explained in the manual, but the first argument is the values. You can avoid the vectors with ritzvec=false, so something like eigs(A, ritzvec = false)[1] should give you the largest (in

Re: [julia-users] eigenvalues of sparse matrix

2015-01-26 Thread Andrei Berceanu
Indeed it seems to work with complex matrices as well. What would be very useful for me is the ability to get eigenvalues within a certain interval, emin to emax. I dont see this in the capabilities of eigs. //A On Monday, January 26, 2015 at 4:21:58 PM UTC+1, Andreas Noack wrote: Yes. There

Re: [julia-users] eigenvalues of sparse matrix

2015-01-26 Thread Andrei Berceanu
That seems to return a lot of things besides the eigenvalues. On Monday, January 26, 2015 at 3:43:01 PM UTC+1, Andreas Noack wrote: You can use eigs. Usually, you only ask for a few of the values, but in theory, you could get all of them, but it could take some time to compute them.

Re: [julia-users] Freeing XMLElement from LightXML.jl? (Mem leak problem)

2015-01-26 Thread Robert Feldt
Ok, great. I'm not used to explicit mem management from Julia so appreciate feedback on proposed solution: function free(xelem::XMLElement) ccall(xmlFreeNode, Void, (Ptr{Void},), xelem.node.ptr) xelem.node.ptr = nullptr end since XMLElement type has a node::XMLNode attribute and the XMLNode

Re: [julia-users] Re: workflow recommendation/tutorial

2015-01-26 Thread Mike Innes
It's not an inherent feature of Julia, no, just a tooling thing. Juno, for example, will allow you to eval directly into modules just fine, including defining new functions, replacing them, evalling `include`s, and replacing the module wholesale in order to get around type redefinition issues and

[julia-users] Re: workflow recommendation/tutorial

2015-01-26 Thread David van Leeuwen
Hi, Everyone seems to agree on the same workflow, so I'll just mention my workflow as an alternative. Pros: - don't need any Julia REPL restarts - don't need to prepend module name in (interactive) code. - variables, data structures etc all are retained during development. Cons: - in

Re: [julia-users] Re: workflow recommendation/tutorial

2015-01-26 Thread Mike Innes
Jewel.jl handles all the code analysis/eval related stuff. I don't know ESS that well but it shouldn't be hard to make use of it if someone wants to. In a nutshell it's basically as simple as calling `eval(Base, :(foo() = 1))`, but there's a few other things to think about like making sure Julia

Re: [julia-users] module reflection introspection

2015-01-26 Thread Jameson Nash
`quote ... end` (or `:(...)` for shorthand) can be used to create expression objects that are equivalent when eval'd to executing the expression directly. from there, you can explore the resulting Expr tree with dump() and Meta.show_sexpr() to observe the correct expression tree. you can convert

Re: [julia-users] module reflection introspection

2015-01-26 Thread Tamas Papp
OK, but I still don't know how to unintern a symbol. This is not mentioned in the manual. On Mon, Jan 26 2015, Jameson Nash vtjn...@gmail.com wrote: `quote ... end` (or `:(...)` for shorthand) can be used to create expression objects that are equivalent when eval'd to executing the expression

Re: [julia-users] Enums in Julia

2015-01-26 Thread Mauro
There is a FAQ entry on this which suggests not to use types each of elements of the enum (if I recall correctly). I recently did a enum like this: export nonstiff, mildlystiff, stiff abstract Enum immutable Stiff : Enum val::Int function Stiff(i::Integer) @assert 0=i=2

Re: [julia-users] Re: ANN: Symbolic computation with Julia

2015-01-26 Thread lapeyre . math122a
On Monday, January 26, 2015 at 7:20:54 PM UTC+1, Francesco Bonazzi wrote: A Mathematica parser could be used as an optional addition, such as what Mathics is to SymPy. Anyways, there are various options for Julia: - use Expr and operate on them, this is similar to how Maxima works.

[julia-users] Re: poly2mask in Julia?

2015-01-26 Thread Andrei Zh
@Andreas: do you refer to this thread: https://groups.google.com/forum/#!topic/julia-users/Kwy2Zh-i4ks Yes, it's an option. I was looking for something specifically designed for this purpose, but seems like Scikit Image and some others keep exactly the approach you've described [1], so I

Re: [julia-users] Re: Question about list of list; equivalent to Python's key paramater?

2015-01-26 Thread Mauro
This should work: help? sort Base.sort(A, dim, [alg=algorithm,] [by=transform,] [lt=comparison,] [rev=false]) Sort a multidimensional array A along the given dimension. julia sort(Vector{Int}[[1,2], [1,2,3]], lt=(x,y)-(length(x)length(y)) ) 2-element Array{Array{Int64,1},1}: [1,2,3] [1,2]

Re: [julia-users] Enums in Julia

2015-01-26 Thread Stefan Karpinski
We definitely need a standard solution to this in Base Julia. We may have enough example use cases at this point to know what it needs to look like. Relevant issue: https://github.com/JuliaLang/julia/issues/3080 On Mon, Jan 26, 2015 at 3:11 PM, Mauro mauro...@runbox.com wrote: There is a FAQ

Re: [julia-users] eigenvalues of sparse matrix

2015-01-26 Thread Andrei Berceanu
The matrix is 1681x1681 with 8240 non-zero entries (i.e. 0.29% non-zero). I'm not sure how this relates to your second comment though :) On Monday, January 26, 2015 at 5:48:37 PM UTC+1, Andreas Noack wrote: How large is the matrix and what is the sparsity? You might be able to get closer to

[julia-users] Re: ANN: Symbolic computation with Julia

2015-01-26 Thread lapeyre . math122a
Hello Jim, Thanks for the long response. I looked at the papers; I think they are worth studying. I found that I can progress most quickly modeling on Mathematica. The design is fairly simple and consistent. Of course the documentation is vague in some places, but so far, it is not a problem.

[julia-users] Enums in Julia

2015-01-26 Thread Reid Atcheson
Hey all. I have frequently been in the position of wanting enumerations in Julia. I have finally settled on the implementation linked below which lets me refer to flags in a named way and only specify their underlying numbering once. Is this the best way, or are there better ways I haven't

[julia-users] Question about list of list; equivalent to Python's key paramater?

2015-01-26 Thread Wai Yip Tung
I'm trying to construct a list of list and do some operation on it. In Python I would do In [7]: ll = [[1,2],[1,2,3],[7]] Say I want to sort them by the length of the list, many function accepts a `key` parameter. In this case I want the `key` to be `len`. In [8]: max(ll, key=len) Out[8]: [1,

[julia-users] Re: Question about list of list; equivalent to Python's key paramater?

2015-01-26 Thread Joshua Adelman
On Monday, January 26, 2015 at 12:09:40 PM UTC-5, Joshua Adelman wrote: On Monday, January 26, 2015 at 12:02:10 PM UTC-5, Wai Yip Tung wrote: I'm trying to construct a list of list and do some operation on it. In Python I would do In [7]: ll = [[1,2],[1,2,3],[7]] Say I want to sort

[julia-users] Re: ANN: Symbolic computation with Julia

2015-01-26 Thread Francesco Bonazzi
On Monday, January 26, 2015 at 6:11:33 PM UTC+1, lapeyre@gmail.com wrote: Another resource is Richard Fateman's mma4max http://www.cs.berkeley.edu/~fateman/lisp/mma4max/, which I see has updates since I last built it. It aims more or less to implement mma in common lisp. In fact

Re: [julia-users] Re: ANN: Symbolic computation with Julia

2015-01-26 Thread lapeyre . math122a
(My posts are not appearing where I want. Hope this one does!) On Monday, January 26, 2015 at 6:57:48 PM UTC+1, James Crist wrote: Maybe the parser could be useful if rewritten in Julia: Side tracking a bit, but one of the reasons I use SymPy instead of something like Maxima is that it

[julia-users] Re: Question about list of list; equivalent to Python's key paramater?

2015-01-26 Thread Joshua Adelman
On Monday, January 26, 2015 at 12:02:10 PM UTC-5, Wai Yip Tung wrote: I'm trying to construct a list of list and do some operation on it. In Python I would do In [7]: ll = [[1,2],[1,2,3],[7]] Say I want to sort them by the length of the list, many function accepts a `key` parameter. In

[julia-users] serialization of an object with circular references

2015-01-26 Thread Levi Boyles
Hi, I'm running Julia 0.3.5 and I have some tree structures with nodes pointing to both parents and children. I want to serialize/deserialize these to/from file storage, but the serialize function gives a long string of errors (longer than the length of my shell output buffer), so I'm

[julia-users] Re: Creating an array of arrays

2015-01-26 Thread Ivar Nesje
This behaviour is intended and as I understand it a relic from Matlab (where you can't have arrays of arrays). It is the basis for a convenient array construction from a range (eg, [1:5] gives [1,2,3,4,5] instead of an array with a Range object), so there are more to it than you might think.

[julia-users] Re: Help grokking a certain unsupported or misplaced expression

2015-01-26 Thread Ivar Nesje
You need to use ()([true,true], [true,false],[false,true]) I think this is because is used as a special character in ccall. I have seen this raised a few times, but I don't know what to search for to find the previous discussions. Regards Ivar mandag 26. januar 2015 15.33.06 UTC+1 skrev

[julia-users] Re: Help grokking a certain unsupported or misplaced expression

2015-01-26 Thread Matt Bauman
If I understand correctly, this may improve soon: https://github.com/JuliaLang/julia/pull/9913#issuecomment-71341494 On Monday, January 26, 2015 at 12:53:33 PM UTC-5, Ivar Nesje wrote: You need to use ()([true,true], [true,false],[false,true]) I think this is because is used as a

Re: [julia-users] Freeing XMLElement from LightXML.jl? (Mem leak problem)

2015-01-26 Thread Robert Feldt
I fixed the typo (should be finalizer and not finalize) and also had to import xmlFreeNode from the c lib but when I run I get: julia(56167,0x7fff7924c300) malloc: *** error for object 0x7f9a33b159c0: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug so

[julia-users] Caching of code generated by macros

2015-01-26 Thread Jan Niklas Hasse
Hi! I've just tried the Match.jl package and it works just as expected. But now my program needs 10 extra seconds to start, even if the code using the @match macro is untouched. Is there anyway to cache the generated code? If I understand the docs correctly this only works if I move the code

[julia-users] Re: ANN: Symbolic computation with Julia

2015-01-26 Thread Francesco Bonazzi
On Monday, January 26, 2015 at 6:11:33 PM UTC+1, lapeyre@gmail.com wrote: I found that I can progress most quickly modeling on Mathematica. The design is fairly simple and consistent. Of course the documentation is vague in some places, but so far, it is not a problem. Of course, even

Re: [julia-users] Re: ANN: Symbolic computation with Julia

2015-01-26 Thread James Crist
Maybe the parser could be useful if rewritten in Julia: Side tracking a bit, but one of the reasons I use SymPy instead of something like Maxima is that it meshes seamlessly into the language infrastructure. By writing a parser and creating another system means that it can't use julia's

[julia-users] Looking for suggsetions to speed up function calls that have @cpp ccall()

2015-01-26 Thread Roy Wang
Hey everyone, I'm trying to use @cpp ccall() to call myfunc() in a custom shared library I wrote in C++, and I noticed there is some overhead if I put the @cpp ccall inside a function. The relevant portion of my Julia code: # mypath is a constant string type that specifies the path of my

Re: [julia-users] Looking for suggsetions to speed up function calls that have @cpp ccall()

2015-01-26 Thread Stefan Karpinski
That would certainly explain it – the @cpp version probably needs to do a fair amount of LLVM code generation, whereas `ccall` is built into the language. On Mon, Jan 26, 2015 at 4:59 PM, Ivar Nesje iva...@gmail.com wrote: Did you time your function twice? The first time you call a function it

Re: [julia-users] Enums in Julia

2015-01-26 Thread Reid Atcheson
Ok now that you have put it there, the comments in the documentation make more sense to me. It looks like both yours and mine are essentially equivalent, but yours is simpler. I was aiming for the following behavior with my implementation: - different enum types won't typecheck (can't do if

[julia-users] Writing Type-Stable Code in Julia - type stable version not that fast in 0.4

2015-01-26 Thread Kuba Roth
Hi there, Recently I run into this very interesting post: http://www.johnmyleswhite.com/notebook/2013/12/06/writing-type-stable-code-in-julia/ Surprisingly, when tested both examples against the latest 0.4 build - the speed difference of the type-stable version is only 2-3 times faster then

[julia-users] I cannot fine the code for Garch in mean

2015-01-26 Thread Jung Soo Park
Is there any way I can have the code for Garch in Mean or GarchM please Thank you..

[julia-users] SAVE THE DATE: JuliaCon 2015, June 24 - 28

2015-01-26 Thread Jiahao Chen
On behalf of the organizing committee, it is my pleasure to announce that JuliaCon 2015 will be held at the MIT Stata Center during the dates of Wednesday, June 24 through Sunday, June 28. More details forthcoming. We look forward to seeing you in Cambridge, Massachusetts six months from now,

Re: [julia-users] Writing Type-Stable Code in Julia - type stable version not that fast in 0.4

2015-01-26 Thread Mauro
This is a performance regression, also for 0.3.5. My timings for 0.3.5: julia @time [sumofsins1(100_000) for i in 1:100]; elapsed time: 0.446675737 seconds (320109932 bytes allocated, 21.32% gc time) julia @time [sumofsins2(100_000) for i in 1:100]; elapsed time: 0.115537618 seconds (896 bytes

Re: [julia-users] Freeing XMLElement from LightXML.jl? (Mem leak problem)

2015-01-26 Thread Isaiah Norton
I'm not sure where the malloc error is coming from, exactly, but you need to call finalizer, not finalize. Also it should be run on the XMLNode rather than the XMLElement. The following example might help (at least, it doesn't crash!) julia n = new_textnode(s) s julia finalizer(n, z::XMLNode -

[julia-users] Re: emacs shell not working with julia in docker container

2015-01-26 Thread Christian Groll
Perfect, it works. Thanks a lot! I now run a shell in emacs, run a docker container in the shell, and julia in the container, and I connect to it with M-x ess-remote. However, I also guess that using emacs tramp should be a better approach, as the ESS manual says: The recommended way to

Re: [julia-users] simple I/O question

2015-01-26 Thread Kyle Barbary
This is the other thread: https://groups.google.com/forum/#!searchin/julia-users/simple$20IO/julia-users/MRjELN0Zzlk/TM57aTp9w6wJ On Mon, Jan 26, 2015 at 9:39 PM, alex codoreanu alex.codore...@gmail.com wrote: Hi Kyle, I have the same issue but I can't find the solution you found in a

[julia-users] Re: poly2mask in Julia?

2015-01-26 Thread Andreas Lobinger
Hello colleagues, i think you could do (if i get the upper description correctly) just setup a grid of points and feed it through something like inpolygon - might be not the optimized case, but should work. There have been questions about that here (i know, because i posted code) before. But

Re: [julia-users] Call overloading and @code_... macros

2015-01-26 Thread Luthaf
I am using the latest master, on OS X 10.9, with LLVM svn julia versioninfo() Julia Version 0.4.0-dev+2914 Commit 4c3e03b (2015-01-26 06:17 UTC) Platform Info: System: Darwin (x86_64-apple-darwin13.4.0) CPU: Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz WORD_SIZE: 64 BLAS: libopenblas

Re: [julia-users] Re: Strange performance behavior

2015-01-26 Thread Yuuki Soho
Coming back to my original problem, I did a simplified version of it, which is about 10x slower than a vectorized matlab version. Have I missed anything here ? A = ones(50,40,40); B = ones(50,100)/2; C = ones(40,100)/3; D = ones(40,100)/4; E = ones(100,100)/5; idx = int([100:-1:1]);

[julia-users] Re: Looking for suggsetions to speed up function calls that have @cpp ccall()

2015-01-26 Thread Roy Wang
Thanks guys, I think that was it. On Monday, 26 January 2015 16:59:54 UTC-5, Ivar Nesje wrote: Did you time your function twice? The first time you call a function it needs to be compiled, and for very small tests, that process will dominate.

[julia-users] Re: emacs shell not working with julia in docker container

2015-01-26 Thread Kirill Ignatiev
On Monday, 26 January 2015 08:26:24 UTC-5, Christian Groll wrote: I did set up Julia in a docker container. When I run it from the shell everything works just fine. However, when I start the shell inside of emacs, I can run the docker container and start Julia, but it somehow messes with

Re: [julia-users] eigenvalues of sparse matrix

2015-01-26 Thread Andreas Noack
That is not a large matrix. I'd densify it and use eigvals(Hermitian, vl, vu) on it, where vl and vu are the bounds on the eigenvalues. E.g. julia A = complex(randn(1681,1681), randn(1681, 1681));A = A + A'; julia eigvals(Hermitian(A), 5.0, 10.0) 31-element Array{Float64,1}: 5.26302

[julia-users] Looking for suggsetions to speed up function calls that have @cpp ccall()

2015-01-26 Thread Ivar Nesje
Did you time your function twice? The first time you call a function it needs to be compiled, and for very small tests, that process will dominate.