Re: [julia-users] Re: Dispatching on type that is unknown at code write-time but known at run time.

2015-03-14 Thread Kristoffer Carlsson
That looks very promising. Instead of type checking every time an element is accessed it is enough to just check once what type of Vector it is and then we know what element we have in the core loop. Since there is only a few type of elements the cost of this check will be negligble. I will

Re: [julia-users] Re: Best practices for migrating 0.3 code to 0.4? (specifically constructors)

2015-03-14 Thread Ian Watson
I am seeing what looks like a similar problem trying to use PyPlot in version 0.4. When I issue 'using PyPlot', I get ERROR: LoadError: LoadError: LoadError: MethodError: `convert` has no method matching convert(::Type{Ptr{UInt8}}, ::ASCIIString) This may have arisen from a call to the

[julia-users] re ERRoR `convert` has no method matching convert(::Type{Int64...}, ::Int64) in pmap in Julia 0.3.6

2015-03-14 Thread Maxwell
Hello folks, This is a re-post from my previous post earlier in the week. My code was referring t a non-existent file. I am attaching the code I am using since I have no idea what part of the code is producing errors in Julia 0.3.6. I am trying to run a little bootstrap in Julia using pmap

Re: [julia-users] Re: Dispatching on type that is unknown at code write-time but known at run time.

2015-03-14 Thread Mauro
type LinTrig : FElement v1::Int end Here you should probably use `immutable`, that way it will be stored as efficiently as ints. type LinQuad : FElement v1::Int v2::Int end type Node c::Float64 end type FEMesh node::Vector{Node} elements::Vector{FElement}

Re: [julia-users] Re: Dispatching on type that is unknown at code write-time but known at run time.

2015-03-14 Thread Kristoffer Carlsson
Left some nonsense at the top of my reply, sorry.

[julia-users] fixed-point questions

2015-03-14 Thread Christian Peel
I've been toying around with implementing a fixed-point type in Julia. This has been mentioned before (http://bit.ly/1DlF2S0) I guess that it is on one or more person's to-do list; does anyone have a fixed-point type they can share? I made a toy type at this gist:

Re: [julia-users] fixed-point questions

2015-03-14 Thread Christian Peel
Thanks! I feel sheepish for not seeing that earlier. Looking at the package, I am curious to know why Fixed32 does not have a dynamic storage type as UFixed does? I guess it would be possible to add code so that Fixed32{2}(1)+Fixed32{4}(1) would work; is that right? Also, I guess that Fixed32

Re: [julia-users] Re: search for files along path

2015-03-14 Thread Jameson Nash
Perhaps related, I've have a Glob package for finding files and matching paths against their shell-style pattern: https://github.com/vtjnash/Glob.jl/ On Sat, Mar 14, 2015 at 4:02 PM Simon Danisch sdani...@gmail.com wrote: I've this piece of code flying around: function

[julia-users] Re: In-place operations: what happens when I call x[:] += 1?

2015-03-14 Thread John
Expand and show_sexpr are handy! Looks like you were right, Tamas. On Saturday, March 14, 2015 at 12:33:56 PM UTC, John wrote: I was surprised today that the following function doesn't modify an input array function f(x) x += 1 end However, now I understand that x += 1 is just

Re: [julia-users] Tolerance for the checks in cholfact too small?

2015-03-14 Thread Andreas Noack
Good to to hear that. I've filed an issue to figure out how to make this more consistent https://github.com/JuliaLang/julia/issues/10520 2015-03-14 21:06 GMT-04:00 Kristoffer Carlsson kcarlsso...@gmail.com: On Sunday, March 15, 2015 at 1:02:11 AM UTC+1, Andreas Noack wrote: You can get

[julia-users] Re: Dispatching on type that is unknown at code write-time but known at run time.

2015-03-14 Thread Sisyphuss
Hello Kristoffer, I don't quite understand what you are doing. But by judging from the title of your post, I'd like to share with you my opinion, and I hope it would be helpful. The (multiple) dispatch used by Julia is a dynamic one, that is, the dispatch is preformed at run time instead of

Re: [julia-users] Tolerance for the checks in cholfact too small?

2015-03-14 Thread Andreas Noack
You can get around this by specifying that the matrix is symmetric. This can be done with cholfact(Symmetric(A, :L)) which then bypasses the test for symmetry and cholfact only looks at the lower triangle. However, the error you got is not consistent with the way cholfact works for dense

[julia-users] Re: Informal Call for a Julia π - day challenge

2015-03-14 Thread David P. Sanders
El sábado, 7 de marzo de 2015, 11:59:47 (UTC-6), Alan Edelman escribió: With about a week left, I'd love to find out how many digits of π we can get only from Julia. Perhaps we can coordinate a worldwide distributed computation this week. In a different direction, it seems not to be

Re: [julia-users] fixed-point questions

2015-03-14 Thread Tim Holy
If you mean a fixed point number, you might want to check out FixedPointNumbers.jl. --Tim On Saturday, March 14, 2015 06:28:00 PM Christian Peel wrote: I've been toying around with implementing a fixed-point type in Julia. This has been mentioned before (http://bit.ly/1DlF2S0) I guess that it

[julia-users] Tolerance for the checks in cholfact too small?

2015-03-14 Thread Kristoffer Carlsson
From my Finite Element code I generate a global stiffness matrix K. However, I can not use the cholesky factorization on it because of ERROR: ArgumentError: sparse matrix is not symmetric/Hermitian in cholfact at sparse/cholmod.jl:916 in cholfact at sparse/cholmod.jl:991 However, I am pretty

[julia-users] Re: Dispatching on type that is unknown at code write-time but known at run time.

2015-03-14 Thread Kristoffer Carlsson
Ok, I will give a minimum working example. Consider this: abstract FElement type LinTrig : FElement v1::Int end type LinQuad : FElement v1::Int v2::Int end type Node c::Float64 end type FEMesh node::Vector{Node} elements::Vector{FElement} end function

[julia-users] Re: In-place operations: what happens when I call x[:] += 1?

2015-03-14 Thread Sisyphuss
`x[:]` works, because the values of `x` can be changed. Nevertheless, `x` itself (its address) cannot be changed. When you do `x=x+1` in the callee, it will bind `x` to a new local variable, which has different address from the previous `x`. The same lethargy applies to `x[1] += 1`. On

Re: [julia-users] Re: Dispatching on type that is unknown at code write-time but known at run time.

2015-03-14 Thread Kristoffer Carlsson
On Saturday, March 14, 2015 at 11:06:06 PM UTC+1, Mauro wrote: type LinTrig : FElement v1::Int end Here you should probably use `immutable`, that way it will be stored as efficiently as ints. I actually do use immutable, I just forgot to write it in the example. type

Re: [julia-users] Re: Dispatching on type that is unknown at code write-time but known at run time.

2015-03-14 Thread Jameson Nash
Maybe I can create a macro macro’s can only modify syntax. they don’t have access to any type information. i don’t see how that will help you. -- if i understand your comments correctly, i think you could structure your algorithm as so (where i’ve called the primary

Re: [julia-users] Some simple use cases for multi-threading

2015-03-14 Thread John
On Saturday, March 14, 2015 at 5:26:25 PM UTC, Erik Schnetter wrote: As long as linear algebra is handled by BLAS, using multi-threading in Julia isn't really necessary. If the matrices are large enough to warrant multithreading, then using a multi-threaded BLAS is usually more

[julia-users] Re: Dispatching on type that is unknown at code write-time but known at run time.

2015-03-14 Thread Kristoffer Carlsson
Adding to my last reply. If my mesh looked like type FEMesh node::Vector{Node} elements_1::Vector{LinTrig} elements_2::Vector{LinQuad} end than it would also be OK because I could first call the function with elements_1, and then elements_2 and both times the compiler would know

Re: [julia-users] Re: Dispatching on type that is unknown at code write-time but known at run time.

2015-03-14 Thread Kristoffer Carlsson
And I agree it is type unstable, that's the crux. I need to rewrite my Mesh Maybe I can create a macro On Saturday, March 14, 2015 at 11:06:06 PM UTC+1, Mauro wrote: type LinTrig : FElement v1::Int end Here you should probably use `immutable`, that way it will be stored as

Re: [julia-users] Tolerance for the checks in cholfact too small?

2015-03-14 Thread Kristoffer Carlsson
On Sunday, March 15, 2015 at 1:02:11 AM UTC+1, Andreas Noack wrote: You can get around this by specifying that the matrix is symmetric. This can be done with cholfact(Symmetric(A, :L)) Thank you, just what I was looking for. which then bypasses the test for symmetry and cholfact only

[julia-users] Re: Some simple use cases for multi-threading

2015-03-14 Thread Steven Sagaert
How about a multithreaded (+ coroutine as it is now) HttpServer? On Friday, March 13, 2015 at 4:52:37 AM UTC+1, Viral Shah wrote: I am looking to put together a set of use cases for our multi-threading capabilities - mainly to push forward as well as a showcase. I am thinking of starting

Re: [julia-users] fixed-point questions

2015-03-14 Thread Tim Holy
On Saturday, March 14, 2015 07:27:48 PM Christian Peel wrote: Looking at the package, I am curious to know why Fixed32 does not have a dynamic storage type as UFixed does? They were written by different people, presumably for different purposes. I guess it would be possible to add code so

[julia-users] Re: print and write for VTK export

2015-03-14 Thread Tobias Knopp
not familiar with the vtk format but are you sure the the x,y,z coordinates lay not directly after each other? Could try: write(fid, vcat(x[:]', y[:]', z[:]') ) Am Samstag, 14. März 2015 18:54:59 UTC+1 schrieb Christian Dengler: Ty for your answers. I'm not familiar with vtk export on python,

[julia-users] Re: search for files along path

2015-03-14 Thread Simon Danisch
I've this piece of code flying around: function searchfile(file_name::String, root_folder::String) file_name == return files_folders = readdir(root_folder) folders = filter(x-isdir(joinpath(root_folder, x)), files_folders) files =

[julia-users] Dispatching on type that is unknown at code write-time but known at run time.

2015-03-14 Thread Kristoffer Carlsson
Hello, I am writing some code for Finite Elements in Julia. As usual, I have a mesh with elements and nodes. However, I do not want to restrict myself to only using one type of element per mesh and therefore I have a hierarchy of element types along the lines of: abstract FElement type

[julia-users] Using run time information for

2015-03-14 Thread Kristoffer Carlsson
Hello, I am writing some code for Finite Elements in Julia. As usual, I have a mesh with elements and nodes. However, I do not want to restrict myself to only using one type of element per mesh and therefore I have a hierarchy of element types along the lines of: abstract FElement type

Re: [julia-users] Re: Dispatching on type that is unknown at code write-time but known at run time.

2015-03-14 Thread Sisyphuss
I agree with @Mauro on the definition of `FEMesh`. When @Kristo writes `elements::Vector{FElement}` you implied that `elements` can be an heterogeneous vector, which contains `LinTrid` and `LinQuad` at the same time. So the compiler has to test each component of the vector, which makes the

[julia-users] Re: Performance - what am I doing wrong?

2015-03-14 Thread elextr
Read http://docs.julialang.org/en/latest/manual/performance-tips/?highlight=performance#performance-tips in particular the first one avoiding global variables. I get up to 40 times the performance by putting your code in a function. Cheers Lex On Sunday, March 15, 2015 at 2:10:29 PM UTC+10,

Re: [julia-users] Re: Informal Call for a Julia π - day challenge

2015-03-14 Thread Shashi Gowda
Late to the party but here's a simple monte carlo simulation visualized using Reactive, Interact, Compose randpoint() = (rand(), rand()) isin(x, y) = 0.25 (x-0.5)^2 + (y-0.5)^2 Compose.set_default_graphic_size(8inch, 8inch) @manipulate for switch=false, t=fpswhen(switch, 10),

[julia-users] Performance - what am I doing wrong?

2015-03-14 Thread Dallas Morisette
I am very new to Julia. I'm working on adding some features to a fairly simple Fortran simulation, and decided to try writing it in Python to make it easier to explore variations. After a lot of optimization work I got it within about 8x slower than the Fortran code. I had read about Julia and

Re: [julia-users] Plotting table of numbers in Gadfly?

2015-03-14 Thread Sheehan Olver
I would like something like the following to work: A=rand(1000,4) plot(A) # this would plot 4 curves each with 1000 data points and auto-labelled as 1:1000 plot(A,Geom.histogram) # this would plot 4 histograms with 1000

[julia-users] isnull woes

2015-03-14 Thread Toivo Henningsson
Do we consider nullness of java objects and nullables to be similar enough that they should actually be checked with the same predicate? I guess the two concepts do have a lot of things in common, though methods written to work with nullables might not be prepared to accept java objects.

[julia-users] Is it possible to generate runnable LLVM IR from Julia

2015-03-14 Thread Zexuan Luo
Hi, everyone. I am wonder how to convert Julia code into runnable LLVM IR(the *.ll file). There is a call named `code_llvm` can compile Julia function into LLVM IR. But its result contains something like `%jl_value_t*` hidden the object type, and makes it not a pure LLVM IR. Is there a way to

[julia-users] In-place operations: what happens when I call x[:] += 1?

2015-03-14 Thread John
I was surprised today that the following function doesn't modify an input array function f(x) x += 1 end However, now I understand that x += 1 is just syntactic sugar for x = x + 1. The reasoning from https://github.com/JuliaLang/julia/issues/7052 makes sense. OTOH, x[:] += 1 does modify the

[julia-users] Re: print and write for VTK export

2015-03-14 Thread Tobias Knopp
The nrrd format seems to be similar (text header and binary data). You can have a look at the implementation in Images.jl. See https://github.com/timholy/Images.jl/blob/master/src/ioformats/nrrd.jl#L356 for the part where the data is written. Note that the data function is only required here,

Re: [julia-users] isnull woes

2015-03-14 Thread Stefan Karpinski
Avik, I think it would be worth opening an issue on either julia or Compat.jl about this. On Sat, Mar 14, 2015 at 7:14 AM, Toivo Henningsson toivo@gmail.com wrote: Do we consider nullness of java objects and nullables to be similar enough that they should actually be checked with the same

[julia-users] Re: Julia on OpenBSD

2015-03-14 Thread Antoine Jardin
Hi, I have thought about it I'm currently running linux on my day to day laptop workstation but i used to run openbsd. I'll try to find the time to run a test build. llvm is v3.5 in OpenBSD 5.6 ggc is 4.9 gmake is 4.0 gfortran is 4.2 git is 1.9 perl is in base wget is in ports m4 is 1.4.17

[julia-users] Re: Some simple use cases for multi-threading

2015-03-14 Thread John
My main use cases involve operations that I want to parallelize over the last dimension of an array. In C/C++ I'd use #pragma parallel for or a thread pool. E.g., say I have a function f that operates in-place, like function f(x,y) for i=1:length(x) y[i] = exp(x[i]) end end It

Re: [julia-users] In-place operations: what happens when I call x[:] += 1?

2015-03-14 Thread Tamas Papp
My mental model is that x[:] += 1 is turned into x[:] = x[:] + 1 which is equivalent to x[:] = x + 1 which then is turned into a setindex! call. See http://docs.julialang.org/en/release-0.3/manual/arrays/#assignment I don't know if the last step is accessible to the user (for

[julia-users] print and write for VTK export

2015-03-14 Thread Christian Dengler
Hello, I'm trying to save my data as .vtk files, and ran into a problem with the print and write function. Resumee of what would solve my problems: - Using print(filestream, data), but omitting the square brackets, and - using print(filestream, vector), and actually writes the vector, one

[julia-users] Confused by embedding document

2015-03-14 Thread Zexuan Luo
I am confused on the the doc of [embedding](https://github.com/JuliaLang/julia/blob/master/doc/manual/embedding.rst)... For instance, when Julia is installed to $JULIA_DIR, one can compile the above test program test.c with gcc using: `gcc -o test -I$JULIA_DIR/include/julia

Re: [julia-users] In-place operations: what happens when I call x[:] += 1?

2015-03-14 Thread Tamas Papp
Thanks. Is the (top(endof)) syntax something that is exposed to the user? Did not work for me: julia colon(1,(top(endof))([1:4;])) ERROR: UndefVarError: top not defined Would be nice when I need to construct the range generated by a lone : in a macro. Best, Tamas On Sat, Mar 14 2015, Matt

Re: [julia-users] Some simple use cases for multi-threading

2015-03-14 Thread Erik Schnetter
As long as linear algebra is handled by BLAS, using multi-threading in Julia isn't really necessary. If the matrices are large enough to warrant multithreading, then using a multi-threaded BLAS is usually more efficient... -erik On Mar 13, 2015, at 16:54 , Tobias Knopp

Re: [julia-users] Some simple use cases for multi-threading

2015-03-14 Thread Erik Schnetter
On Mar 12, 2015, at 23:52 , Viral Shah vi...@mayin.org wrote: I am looking to put together a set of use cases for our multi-threading capabilities - mainly to push forward as well as a showcase. I am thinking of starting with stuff in the microbenchmarks and the shootout implementations

Re: [julia-users] In-place operations: what happens when I call x[:] += 1?

2015-03-14 Thread Jameson Nash
It can be helpful to look at the sexpr form: julia Meta.show_sexpr(expand(parse(“x[:] += 1”))) (:body, (:(=), GenSym(0), (:call, :colon, 1, (:call, :(top(endof)), :x))), (:(=), GenSym(1), (:call, :+, (:call, :getindex, :x, GenSym(0)), 1)), (:call, :setindex!, :x, GenSym(1), GenSym(0)), (:return,

Re: [julia-users] Re: Time type

2015-03-14 Thread Stefan Karpinski
There are no leap seconds in universal time. There are leap seconds in UTC which bridges terrestrial time (SI seconds) with universal time (day = 1 earth rotation; second = 1/86400 of an earth rotation) by using SI seconds as the basic unit but introducing leap seconds here and there to ensure

Re: [julia-users] Is it possible to generate runnable LLVM IR from Julia

2015-03-14 Thread Isaiah Norton
I think the only way to do this right now is to dump the whole image so you get all the necessary prior definitions. See this comment for the command line: https://github.com/JuliaLang/julia/issues/9430#issuecomment-67758882 (related to Emscripten, which doesn't work yet, but may work with

Re: [julia-users] Confused by embedding document

2015-03-14 Thread Milan Bouchet-Valat
Le samedi 14 mars 2015 à 07:11 -0700, Zexuan Luo a écrit : I am confused on the the doc of [embedding](https://github.com/JuliaLang/julia/blob/master/doc/manual/embedding.rst)... For instance, when Julia is installed to $JULIA_DIR, one can compile the above test program test.c with gcc

[julia-users] Re: CALL FOR PARTICIPATION: JuliaCon 2015, June 24-28, MIT

2015-03-14 Thread Philip Tellis
I have added JuliaCon to Lanyrd here: http://lanyrd.com/2015/juliacon/ Jiahao and the other organizers should feel free to claim the event and make updates

Re: [julia-users] Is it possible to generate runnable LLVM IR from Julia

2015-03-14 Thread Isaiah Norton
(also: please ask a question in only one place because the same people answer here and on StackOverflow) On Sat, Mar 14, 2015 at 10:32 AM, Isaiah Norton isaiah.nor...@gmail.com wrote: I think the only way to do this right now is to dump the whole image so you get all the necessary prior

[julia-users] SIAM CSE meetup?

2015-03-14 Thread Jiahao Chen
I presume that there are other Julia users attending the SIAM CSE conference in Salt Lake City this weekend. Would anyone be interested in meeting up?

Re: [julia-users] Confused by embedding document

2015-03-14 Thread Zexuan Luo
It is my glory to send a pull request. Please wait... 2015-03-14 22:43 GMT+08:00 Milan Bouchet-Valat nalimi...@club.fr: Le samedi 14 mars 2015 à 07:11 -0700, Zexuan Luo a écrit : I am confused on the the doc of [embedding](

[julia-users] Re: print and write for VTK export

2015-03-14 Thread Kristoffer Carlsson
One method that I have used to export VTK from Julia is simply using the VTK-library from python and calling it with PyCall. Something like this: https://gist.github.com/KristofferC/9a989a2c0518bb70009c On Saturday, March 14, 2015 at 1:41:04 PM UTC+1, Christian Dengler wrote: Hello, I'm

Re: [julia-users] In-place operations: what happens when I call x[:] += 1?

2015-03-14 Thread Matt Bauman
On Saturday, March 14, 2015 at 9:15:32 AM UTC-4, Tamas Papp wrote: I don't know if the last step is accessible to the user (for metaprogramming), would be interesting to learn about that. Here you go: julia expand(parse(x[:] += 1)) :(begin GenSym(0) = colon(1,(top(endof))(x))

Re: [julia-users] Some simple use cases for multi-threading

2015-03-14 Thread Jameson Nash
in that case, one usage might be that it's necessary for porting a competitive BLAS into julia. On Sat, Mar 14, 2015 at 1:26 PM Erik Schnetter schnet...@gmail.com wrote: As long as linear algebra is handled by BLAS, using multi-threading in Julia isn't really necessary. If the matrices are

[julia-users] Re: print and write for VTK export

2015-03-14 Thread Christian Dengler
Ty for your answers. I'm not familiar with vtk export on python, and i'm confident that finding my mistake will be easier than trying to understand what you did there with pycall. As for the nrrd code, it seems to be doing exactly what i did. I found one mistake i did previously though, telling

[julia-users] search for files along path

2015-03-14 Thread Andreas Lobinger
Hello colleagues, is there a simple method to search for data files (so not code) along a given path? data_path = ['/usr/local_data','/opt/all_data'] f = find_file(a.data,data_path); Wishing a happy day, Andreas