[julia-users] Re: Get the red out!

2016-09-24 Thread Simon Danisch
How about something like this: function showtypetree(T, level=0) println("\t" ^ level, T) for t in subtypes(T) (t != Any) && showtypetree(t, level+1) end end This is still not type stable, since *_subtype *seems to use untyped sets: https://github.com/JuliaLang/julia/blob/m

[julia-users] [ANN] UnicodeFun

2016-09-28 Thread Simon Danisch
Good news everyone! I've written a small library that offers various transformations of text to special Unicode characters. The most prominent one is the latex-string to latex-unicode: "\\itA \\in \\bbR^{nxn}, \\bfv \\in \\bbR^n, \\lambda_i \\in \\bbR: \\itA\\bfv = \\lambda_i\\bfv"==> "𝐴 ∈ ℝⁿˣⁿ,

[julia-users] Re: [ANN] UnicodeFun

2016-09-28 Thread Simon Danisch
The best adhoc solution I could find looks like this: 1̲2̲ ̲/̲ ̲2̲0̲ 200 So not impossible... I'll see how we can integrate this Am Mittwoch, 28. September 2016 12:05:36 UTC+2 schrieb Simon Danisch: > > Good news everyone! > I've written a small library that offers various

[julia-users] Re: [ANN] UnicodeFun

2016-09-28 Thread Simon Danisch
a bit more involved with the line break. Am Mittwoch, 28. September 2016 12:05:36 UTC+2 schrieb Simon Danisch: > > Good news everyone! > I've written a small library that offers various transformations of text > to special Unicode characters. > The most prominent one is the

Re: [julia-users] Re: [ANN] UnicodeFun

2016-09-28 Thread Simon Danisch
ion) at > ./strings/io.jl:37 > in to_fraction(::String, ::String) at /home/pi/.julia/v0.5/ > UnicodeFun/src/sub_super_scripts.jl:172 > > julia> > > > Le 28/09/2016 à 13:40, Simon Danisch a Êcrit : > > I added the to_fraction function: > > to_fraction("ι²

Re: [julia-users] Re: [ANN] UnicodeFun

2016-09-28 Thread Simon Danisch
lic code > for SymEngine or SymPy in that unicode form, and have it convert to the > appropriate code. > > On Wednesday, September 28, 2016 at 6:43:48 AM UTC-7, Simon Danisch wrote: >> >> That's the short form which works with sub/superscript and will create >> somethi

[julia-users] Re: ANN: CUDAdrv.jl, and CUDA.jl deprecation

2016-09-30 Thread Simon Danisch
Great work! :) Well, I think GPUArrays should be the right place! If it is the right place depends on how much time and cooperation I get ;) The plan is to integrate all these 3rd party libraries. If you could help me with that, it would already be a great first step to establish that library :

[julia-users] Re: StaticArrays vs FixedSizeArrays

2016-10-07 Thread Simon Danisch
You might enjoy: GeometryTypes.jl Especially the Face type should be convenient: https://github.com/JuliaGeometry/GeometryTypes.jl/blob/master/src/faces.jl Its currently based on FixedSizeArrays, but I want to port it to StaticArrays whenever

[julia-users] Re: Julia types newbie question

2016-10-17 Thread Simon Danisch
I'm guessing that is done to prevent overflow. So you need to use your own implementation. Here are the promote rules defining this behavior: https://github.com/JuliaLang/julia/blob/master/base/reduce.jl#L32 So in theory you could also implement your own Int type, that has a different promote beh

[julia-users] Re: Julia types newbie question

2016-10-21 Thread Simon Danisch
There is a speed difference, which you can see beautifully like this: function _sum{T}(::Type{T}, A) r = zero(T) @inbounds for i in eachindex(A) r += T(A[i]) end r end @code_llvm _sum(Int, rand(Int64, 10^6)) -> uses <4,Int64> vectors @code_llvm _sum(Int, rand(Int32, 10^6)

[julia-users] Re: ANN: Highlights.jl

2016-11-03 Thread Simon Danisch
That's a great library, very pleasant to use! Thanks! Am Mittwoch, 2. November 2016 21:14:06 UTC+1 schrieb Michael Hatherly: > > I’m pleased to announce the initial 0.1 release of Highlights.jl > — a Julia package for > highlighting source code simila

[julia-users] Re: How to tell if Val{T} is using a fast route

2016-11-16 Thread Simon Danisch
... And really should be, if you want to use code typed: # module scope ff(x::Type{Val{1}}) = 1 const y = 1 function test() # local scope x = 1 a = ff(Val{x}) c = ff(Val{y}) d = ff(Val{1}) end @code_warntype test() Best, Simon Am Mittwoch, 16. November 2016 16:06:31 UTC

[julia-users] [ANN] GLVisualize

2016-11-21 Thread Simon Danisch
I finally tagged a new version of GLVisualize with a lot of new goodies and overall improved stability. For more information please see my blog post: GLVisualize - a modern graphics platform for julia [Lets d

[julia-users] Re: should I use types

2015-01-14 Thread Simon Danisch
You could in addition use ImmutableArrays: immutable Packet{T} ID::{T} position::Vector3{T} direction::Vector3{T} energy::{T} time::{T} end Which makes Packet a bitstype, with efficient memory layout. If you need to mutate these, there are actually ways, whe

[julia-users] Re: should I use types

2015-01-16 Thread Simon Danisch
@Erik Schnetter Would you suggest: type Packet{T} ID:::Vector{T} position::Vector{Vector3{T}} direction::Vector{Vector3{T}} energy::Vector{T} time:::Vector{T} end instead of Vector{Packet} ? Is this, because Packet is to big for the registers, but Vector3 al

[julia-users] Facebook Open Sources Torch (Deep Learning Library)

2015-01-16 Thread Simon Danisch
Thought this could be interesting to some: http://torch.ch/ Would have been cool if they had used Julia instead of LUAjit =) And OpenCL, instead of going for the Vendor lock -.- Nevertheless, it's an interesting library! Best, Simon

[julia-users] Re: Facebook Open Sources Torch (Deep Learning Library)

2015-01-16 Thread Simon Danisch
Yes, that's a good link! And they say they're the fastest around, so I guess it's worth looking at their code and get some inspirations from it ;) Am Freitag, 16. Januar 2015 19:27:56 UTC+1 schrieb Simon Danisch: > > Thought this could be interesting to some: > http://tor

[julia-users] Re: Creating a type to store parameters in, and constructors with keyword arguments

2015-01-17 Thread Simon Danisch
There are plans, to integrate this as an default constructor: https://github.com/JuliaLang/julia/issues/5333 Best is to write the constructor yourself, to have the correct defaults ;) By the way, your type is not designed very well, as you're using abstract field types. Better would be: type Para

[julia-users] Re: Creating a type to store parameters in, and constructors with keyword arguments

2015-01-18 Thread Simon Danisch
This seems to be more useful(depending on your use cases): function Parameters( eta = 3, sigma = 1, rho = 5, xi = 2, agrid = linrange(1,10,10), beta = 4 ) @CallDefaultConstructor Parameters end Like this, you can replace parts of the defaults

[julia-users] Re: simple IO question

2015-01-19 Thread Simon Danisch
Well that's definitely overcomplicated: I'd suggest something like this: f=open(fname) col1 = Float64[] col2 = Float64[] for line in eachline(f) if !startswith(line, "#") num1, num2 = map(float64, split(line)) push!(col1, num1) push!(col2, num2) end end close(f) I think startswith is not availa

[julia-users] Re: simple IO question

2015-01-19 Thread Simon Danisch
By the way, your first construct is implemented by* lines = readlines(open("file"))* Am Montag, 19. Januar 2015 07:59:54 UTC+1 schrieb tugul...@gmail.com: > > trying to learn some basics of IO in julia. All I want for now is to read > tabular part of following file in two separate arrays: > > #

[julia-users] Re: Plotting-package-independent API

2015-01-22 Thread Simon Danisch
Well, I'm planning to introduce some functionality similar to show, building upon a rich type system. What I have in mind is something like this: show(::Matrix{Z}; parameters...) => Surface show(::Matrix{Red}; parameters...) => Red channel show(::Matrix{RGB}; parameters...) => Image show

[julia-users] Re: Plotting-package-independent API

2015-01-22 Thread Simon Danisch
The reference does seem to fit here, as a general plotting language seems to be awfully complicated. By the way, I totally forgot to mention, that I want to turn GLPlot more into a meta package, offering different plotting interfaces, since I'm generalizing more and more of the render code and

[julia-users] Re: What Julia package would you use for animations?

2015-02-06 Thread Simon Danisch
If it's in 3D you can open an issue at https://github.com/SimonDanisch/GLPlot.jl. GLPlot can render particles with arbitrary meshes. Most things should be in place for this, but probably not usable right away ;) Am Freitag, 6. Februar 2015 18:47:41 UTC+1 schrieb Phil Tomson: > > Say I want to d

[julia-users] Re: request for feature: modify field in immutable object in a container

2015-02-09 Thread Simon Danisch
You can actually modify immutables in an array directly. I actually implemented this in GLAbstraction for my own usage. I'm implementing FixedSizeArrays.jl at the moment, which will include this feature (In the feature list I call it "setinde

[julia-users] Re: request for feature: modify field in immutable object in a container

2015-02-09 Thread Simon Danisch
Here is some code: https://gist.github.com/SimonDanisch/805fee6b676107e378ae#file-setindex-jl Am Sonntag, 8. Februar 2015 21:35:20 UTC+1 schrieb vav...@uwaterloo.ca: > > I would like to request the following language feature: a function or > macro to modify a field of an immutable inside a contai

Re: [julia-users] Re: request for feature: modify field in immutable object in a container

2015-02-09 Thread Simon Danisch
2015-02-09 15:15 GMT+01:00 Mauro : > So, this actually modifies an immutable, right? This doesn't seem > right, aren't they supposed to be immutable? > > On Mon, 2015-02-09 at 14:29, Simon Danisch wrote: > > You can actually modify immutables in an array d

[julia-users] Re: request for feature: modify field in immutable object in a container

2015-02-09 Thread Simon Danisch
But arrays of* type* are still not densely packed, right? I tried it with the newest master and it doesn't look like it. Am Sonntag, 8. Februar 2015 21:35:20 UTC+1 schrieb vav...@uwaterloo.ca: > > I would like to request the following language feature: a function or > macro to modify a field of

[julia-users] Re: request for feature: modify field in immutable object in a container

2015-02-09 Thread Simon Danisch
While we're at it... Why does this work: reinterpret(Float32, Int32(0)) @assert isbits(ImmutableType1) && isbits(ImmutableType2) && (sizeof(ImmutableType1) == sizeof(ImmutableType2)) reinterpret(ImmutableType1, Array(ImmutableType2, 42)) but this does not: reinterpret(ImmutableType1, Immutable

[julia-users] Local scope for function storage

2015-02-11 Thread Simon Danisch
Hi, I was trying to find out, what the best way is to have some local, constant storage for a function, which is only accessible from inside the function So something like this: begin const local a = [] test() = dosomething(a) end I was quite surprised, that you can't do this efficiently. Or at

[julia-users] Re: Display Help in JUNO

2015-02-11 Thread Simon Danisch
>From http://michaelhatherly.github.io/Lexicon.jl/manual/#viewing-documentation : Lexicon hooks into the REPL's ? mode (help-mode) once using Lexicon has been called from the REPL. Other environments, such as editors, are not currently supported. Am Mittwoch, 11. Februar 2015 17:08:24 UTC+1 sch

[julia-users] Re: Input parameters for a simulation: Extract variables from a dictionary?

2015-02-11 Thread Simon Danisch
How about simply iterating over the dict? for (key, value) in dict set(simulation, key, value) end Note, that you can actually access a type like this: type T a::Int end x = T(1) x.(:a) = 10 #<- :a is a symbol, which can be created like this symbol("string") x.(:a) is equivalent to getfield

[julia-users] Re: Local scope for function storage

2015-02-11 Thread Simon Danisch
n use case. My code using this is absolutely not performance critical ;) @Mauro I am aware of the scope, and I agree with you. I didn't open an issue, as I wanted to discuss this first. Am Mittwoch, 11. Februar 2015 17:20:02 UTC+1 schrieb Simon Danisch: > > Hi, > I was trying to

[julia-users] Re: Local scope for function storage

2015-02-12 Thread Simon Danisch
l, either because initializing x is very expensive, or because you're gathering some resource. Am Mittwoch, 11. Februar 2015 17:20:02 UTC+1 schrieb Simon Danisch: > > Hi, > I was trying to find out, what the best way is to have some local, > constant storage for a function, which

[julia-users] JuliaGPU, JuliaGeometry, JuliaGL

2015-02-17 Thread Simon Danisch
Hi all, I've tried to vitalize some of the Julia groups that I'm part of. Groups: JuliaGPU , JuliaGeometry , JuliaGL The biggest change is, that I've added some gitter batches, to easily start chatting

[julia-users] Re: [`call`/`convert` functions] I don't understand this `MethodError` (v0.4.0-dev+3353 / Win 64 bits).

2015-02-17 Thread Simon Danisch
Well, this is one of the ugly things and actually not new: Bar{Float64}(1, 8) should do the trick. The other doesn't work, because you can't construct Bar with more than two values. This happens because you did overwrite the default constructor, allowing to construct bar only with x and y. T can

[julia-users] Re: isa should be user friendlier

2015-02-17 Thread Simon Danisch
*eltype([1f0]) <: Float32* should do the trick... Am Dienstag, 17. Februar 2015 17:03:12 UTC+1 schrieb J Luis: > > julia> isa(1.0f0, Float32) > true > > julia> isa([1.0f0], Float32) > false > > julia> isa([1.0f0], Array{Float32}) > true > > It means that to know the data type one must first test i

[julia-users] Re: Convert Array{Float64,1} to Type{Float64}

2015-02-17 Thread Simon Danisch
julia> v*v' 1x1 Array{Int64,2}: 14 This is an array, while w[1] is a Float64. So you need to do something like first(v*v') or (v*v')[1] Am Dienstag, 17. Februar 2015 21:04:04 UTC+1 schrieb Christian Dengler: > > Hello, > > I recently discovered Julia, and tried to convert some of my code. I ran

Re: [julia-users] working with immutable arrays

2015-02-18 Thread Simon Danisch
I hope to cover this issue in ImmutableArrays. Biggest problem will be, that it only works for 0.4 so far...and i still haven't found the time to finish this completely :(

[julia-users] Re: JuliaGPU, JuliaGeometry, JuliaGL

2015-02-18 Thread Simon Danisch
Its a little icon, which will lead you to the corresponding gitter chat room. its placed in the readme of the meta repositories.

[julia-users] Re: Why does my Julia code run so slow?

2015-02-23 Thread Simon Danisch
How does it compare to c by now?

[julia-users] Re: Bokeh.jl update released: call for feedback

2015-02-23 Thread Simon Danisch
I'll be really happy, if everything worked without javascript and html, to be honest. Yeah it's great to use it and gives you quick, awesome looking results, but it's the lazy way out in my view. It's great that you can use Julia in a web browser, but it gets pretty restrictive, as soon as you w

[julia-users] Re: Bokeh.jl update released: call for feedback

2015-02-23 Thread Simon Danisch
*"To qualify what I mean by "easier", I guess I mean: "Easier in most cases for most developers", c and c++ are all very well, but the popularity and ease of development of JavaScript can't be argued with."* That's exactly why I hope that Julia will replace javascript, also for graphics. Like t

Re: [julia-users] Re: Bokeh.jl update released: call for feedback

2015-02-23 Thread Simon Danisch
lly agreeing. > > I'm as keen as anyone for JavaScript to be a stop gap before something > better, just that right now it's the best stop gap. > > > -- > > Samuel Colvin > s...@muelcolvin.com, > 07801160713 > > On 23 February 2015 at 22:41, Simon Danisc

[julia-users] Re: linking Julia with C to improve performances

2015-02-24 Thread Simon Danisch
@Bill Hart small note on your example: you don't return anything, which is why LLVM's code elimination jumps in and removes your whole function body, which results in a very fast "addition" :P Even if you return c, LLVM is smart enough to just precalculate the value resulting in doit() = 30 as t

Re: [julia-users] Bokeh.jl update released: call for feedback

2015-02-24 Thread Simon Danisch
Well, sticking to the Cairo API is not an option, quite frankly. I want to create something completely interactive at high speeds. I want to see, if I can actually compile parts of my event tree completely to the GPU and directly manipulate the points of, e.g. a rendered path, in GPU memory. Which

[julia-users] Re: using repeat() function, and then using size()

2015-02-25 Thread Simon Danisch
Are you on windows? This is most probably an old but unfixed bug, which is only about the display of tuples in the REPL. https://github.com/JuliaLang/julia/issues/7434 Am Mittwoch, 25. Februar 2015 09:59:18 UTC+1 schrieb Ranjan Anantharaman: > > Hey, I'm trying to translate some MATLAB code into

Re: [julia-users] Bokeh.jl update released: call for feedback

2015-02-25 Thread Simon Danisch
2015-02-25 11:57 GMT+01:00 Andreas Lobinger : > Hello colleague, > > On Tuesday, February 24, 2015 at 4:37:04 PM UTC+1, Simon Danisch wrote: >> >> Well, sticking to the Cairo API is not an option, quite frankly. >> I want to create something completely interactive at high sp

[julia-users] Whats the deal with concatenation in 0.4!?

2015-02-25 Thread Simon Danisch
Hi there, I thought default concatenation was deprecated, to make it easier to create arrays of arrays... But it became rather impossible and confusing in the horizontal case, from what I see. Is there really not a single method left from the few ways in 0.35 of creating a horizontal vector of v

[julia-users] Re: Julia users Berlin

2015-02-25 Thread Simon Danisch
I'd join, if the date is allowing it =) But, I'm not from Berlin, so I'd need to plan this! Am Mittwoch, 25. Februar 2015 14:35:13 UTC+1 schrieb David Higgins: > > Hi all, > > I'm based at the Technical University in Berlin and I've more or less > completed the transition to using Julia for all

[julia-users] Re: Whats the deal with concatenation in 0.4!?

2015-02-25 Thread Simon Danisch
ith optional typing, ensuring that you don't end up with Any[] I do think, that this is very clear and consistent and doesn't leave anything in doubt! Am Mittwoch, 25. Februar 2015 19:00:01 UTC+1 schrieb Simon Danisch: > > Hi there, > I thought default concatenation was depre

Re: [julia-users] Re: Whats the deal with concatenation in 0.4!?

2015-02-25 Thread Simon Danisch
and [a;b;c] and [a b c] for concatenation is pretty good. I > no longer feel that there's any need for a new bracket like [| |]. The > thing that clicked for me is that [a;] isn't really concatenation at all > anyway. > > On Wed, Feb 25, 2015 at 4:58 PM, Simon Danisch wro

Re: [julia-users] Re: Whats the deal with concatenation in 0.4!?

2015-02-25 Thread Simon Danisch
ork, bug or not isn't known to me. 2015-02-25 23:18 GMT+01:00 Simon Danisch : > Well, the issue raised here was, how do you realize non concatening [a b > c]? This seems impossible now, even though that there are quite a few use > cases for it... > > 2015-02-25 23:13 GMT+01:00 Stefa

Re: [julia-users] Re: Whats the deal with concatenation in 0.4!?

2015-02-25 Thread Simon Danisch
ec1, vec2, vec3] will absolutely work. I think the issue > you saw with it was specific to ImmutableArrays. I don't know why they > have that behavior. > > On Wed, Feb 25, 2015 at 5:21 PM, Simon Danisch wrote: > > I mean, my whole busyness is about constructing matrices of Vec

Re: [julia-users] Re: Whats the deal with concatenation in 0.4!?

2015-02-25 Thread Simon Danisch
01:00 Josh Langsfeld : > Assuming transposing works, you could do [[a,a,a]' ; [a,a,a]'] which isn't > entirely horrible > > On Wednesday, February 25, 2015 at 5:50:04 PM UTC-5, Simon Danisch wrote: >> >> Okay... So how do I realize: >> a = vec3(...) >&g

Re: [julia-users] Re: Whats the deal with concatenation in 0.4!?

2015-02-25 Thread Simon Danisch
sorry for my redundant argumentation, I just can't help myself ;) 2015-02-26 0:46 GMT+01:00 Simon Danisch : > Yeah it's not I suppose... > But it sort of mixes concatenating syntax with construction syntax and > gives you completely different syntax for basically the same process. &

Re: [julia-users] Re: Whats the deal with concatenation in 0.4!?

2015-02-25 Thread Simon Danisch
> On Wed, Feb 25, 2015 at 6:46 PM, Simon Danisch wrote: > >> So what do I expect from your case? >> [[a,a,a]' ; [a,a,a]'] >> b = [a,a,a]' => some array, which looks comparable to Case 2 >> [b ; b] -> independent of b's shape, this sh

Re: [julia-users] Re: Whats the deal with concatenation in 0.4!?

2015-02-25 Thread Simon Danisch
Oh wait, i should get some sleep... eltype of b is obviosly Vector3, which is what you said :D 2015-02-26 1:56 GMT+01:00 Simon Danisch : > Just to make sure that we're on the same page: you say that your > suggestion actually doesn't work to construct a Matrix{Vector3}? >

[julia-users] Re: Functions in degrees

2015-03-01 Thread Simon Danisch
Seems like another case for this discussion: https://github.com/JuliaLang/julia/issues/9821 Am Dienstag, 4. Februar 2014 17:57:16 UTC+1 schrieb Hans W Borchers: > > I was astonished to see the following functions in the Julia Standard > Library, > functions that accept (or return) degrees instead

[julia-users] Re: julia interpolation of own type with string()

2015-03-01 Thread Simon Danisch
You need to overwrite show: Base.show(io::IO, ::Thomas) = println(io, "Hey, Thomas here!") Am Sonntag, 1. März 2015 14:03:23 UTC+1 schrieb Thomas Magnusson: > > I'm quite new to Julia and I'm looking into porting some Python code to > Julia. This code uses __repr__() overloading to display custo

[julia-users] Re: how to remove the quotation marks ?

2015-03-01 Thread Simon Danisch
If I'm not mistaken, that's how an array of strings gets displayed: julia>["tets", "test"] "test" "test" So no need for removing them! Am Sonntag, 1. März 2015 19:51:40 UTC+1 schrieb paul analyst: > > Przetłumacz wiadomość na język polski > how to remove the quotation marks ?, like below.. >

[julia-users] Re: beginning deep learning with 500 lines of Julia

2015-03-03 Thread Simon Danisch
I'm a little out of sync with machine learning but this looks really awesome =) I do hope as well, that we move forward with a unified array interface in JuliaGPU! Am Samstag, 28. Februar 2015 16:19:18 UTC+1 schrieb Deniz Yuret: > > KUnet.jl (beginning d

[julia-users] Re: General question about composite types

2015-03-03 Thread Simon Danisch
To summarize the advantages of type+immutable: - convenience of a nice accessors (e.g a.x) - less overhead (The timings were run in a loop and mb and time were added up) * 0.003644110999725s 2mb -> a = [1,2,3,4] # this is actually a lot better, than the last time i benchmarked this :) * 0.0010

[julia-users] Re: 3D interactive plots in IJulia

2015-03-03 Thread Simon Danisch
Well there is GLPlot.jl , but it might not be what you're looking for... Also it's on a feature freeze right now. I'm restructuring the architecture, before I add more advanced features. Am Dienstag, 3. März 2015 16:38:32 UTC+1 schrieb Andrei Berceanu: >

[julia-users] Re: 3D interactive plots in IJulia

2015-03-04 Thread Simon Danisch
@Steven Sagaert Well, what you say definitely holds true, if your goals are to have nice scientific visualizations as quickly available as possible. My goals are somewhat different. I want to go more into the direction of visual debugging and interactive programming, while keeping everything in

[julia-users] Re: How to satisfy this deprecation warning?

2015-03-04 Thread Simon Danisch
How about: Ptr{Uint8}[0,0]? For more complicated arrays: Ptr{Uint8}[ 0 for i=1:10, j=1:2] Am Mittwoch, 4. März 2015 17:11:49 UTC+1 schrieb J Luis: > > > julia> zeros(Ptr{Uint8},2) > WARNING: zero{T}(::Type{Ptr{T}}) is deprecated, use Ptr{T}(0) instead. > in zero at deprecated.jl:29 > in zeros at

[julia-users] Re: convert composite type to a vector

2015-03-05 Thread Simon Danisch
easiest would probably be: [foo.(i) for i=1:length(names(Foo))] Am Donnerstag, 5. März 2015 10:51:36 UTC+1 schrieb Tamas Papp: > > If I have a composite type > > type Foo > a > b > c > end > > I can initialize it with a vector like this: > > x = Foo([1,2,3]...) > > But how can I get

[julia-users] Re: convert composite type to a vector

2015-03-05 Thread Simon Danisch
> > Just be careful that foo does not go out of scope while you use the result > of "typevec!" this basically makes typevec! unsafe right? So, it probably should be prefixed like this. Am Donnerstag, 5. März 2015 10:51:36 UTC+1 schrieb Tamas Papp: > > If I have a composite type > > type Foo

[julia-users] Re: Confused about parametrization type

2015-03-05 Thread Simon Danisch
I think it's a good idea to have things parametric and type stable. So I'd vote for T <: FloatingPoint. Like this, the type you call a function with can be propagated down to all other functions and no conversions are needed. As you said, this gets difficult as some people have Float64 hard coded

[julia-users] Re: Confused about parametrization type

2015-03-06 Thread Simon Danisch
Mybe you're looking for this pattern: type Foo{T <: String} a::T b::T end Foo(a::String, b::String) = Foo(promote(a,b)...) If you don't know promote, here's an excerpt from help() julia> help(promote) Base.promote(xs...) Convert all arguments to their common promotion type (if any

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

2015-03-08 Thread Simon Danisch
Any chance, that you'll write up your findings in a blog post or whatnot!? Am Samstag, 7. März 2015 18:59:47 UTC+1 schrieb Alan Edelman: > > 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 comp

[julia-users] Re: How to generate composite types with a macro?

2015-03-09 Thread Simon Danisch
Hi, I'm working on FixedSizeArrays, which does pretty much what you have tried here. Simplified version from constructors.jl : macro gentype(N, typename) fields = [:($(symbol("I_$i"))::T) for i=1:N] quot

[julia-users] Re: How to interpolate a variable as a macro argument?

2015-03-11 Thread Simon Danisch
This is most likely not the right place to use eval! You need to define your problem better. What you describe here doesn't need a macro whatsoever. Macros are for manipulating the syntax tree, which is why the arguments are not the values, but expressions. What a macro is intended to do is more

[julia-users] Re: Saving timing results from @time

2015-03-11 Thread Simon Danisch
I'm working a little bit on a benchmarking suite. It's not available yet, but here is a piece of code which gives you some more functionality than @elapsed: https://gist.github.com/SimonDanisch/4b8f236e35cd07a58efc#file-benchmark-jl Best, Simon Am Mittwoch, 11. März 2015 17:05:07 UTC+1 schrieb

[julia-users] Re: Saving timing results from @time

2015-03-11 Thread Simon Danisch
Yeah, especially if you can immediately plot the results and things like this. But don't get your hopes up to high, unless something unexpected happens, I won't have much time for this :( There is johnmyleswhite/Benchmark.jl , though. But it has a

[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 = filter(x->!isdir(joinpath(r

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

2015-03-15 Thread Simon Danisch
I actually just opened an issue over at Images.jl, to further modularize it, so that all the actual import functions are not part of it and live in their own package. This is nice, if you for example just need an jpg importer

[julia-users] Re: Simple dispatch question

2015-03-16 Thread Simon Danisch
It should be commonprefix{S <: AbstractString}(str_arr::Vector{S}) (Vector -> typealias Vector{T} Array{T, 1}) What you told julia with Vector{AbstractString} is that the function only takes Vectors with the element type of AbstractString. Though, ["asdasd", "adasd"] has the concrete element type

[julia-users] Re: Overloading Base functions or creating new ones?

2015-03-16 Thread Simon Danisch
I'm very much in favor of overloading, if the meaning doesn't deviate to much. Like this, you don't have to read any documentations, and the base functions become synonymous with a certain task. So if you want to add an element to some object, first thing you can try is to use push! and if that

[julia-users] Re: Julia users Berlin

2015-03-22 Thread Simon Danisch
I could schedule my Berlin visit for this time frame. When exactly would you be in Berlin? I could stay in Berlin up to Friday. Best, Simon Am Mittwoch, 25. Februar 2015 14:35:13 UTC+1 schrieb David Higgins: > > Hi all, > > I'm based at the Technical University in Berlin and I've more or less >

[julia-users] Re: About Speed (what am I doing wrong?)

2015-03-22 Thread Simon Danisch
With @simd and @inbounds you can halve the time (At least on my machine with Julia 0.4). Here is a very nice article that explains what blas actually does and what Julia doesn't do: http://nbviewer.ipython.org/url/math.mit.edu/~stevenj/18.335/Matrix-multiplication-experiments.ipynb Best, Simon A

[julia-users] Re: Julia users Berlin

2015-03-22 Thread Simon Danisch
Cool! I've just worked out the details and it seems that I can be available only the whole of Thursday (and earlier). If this fits we can try to organize something! Best, Simon Am Mittwoch, 25. Februar 2015 14:35:13 UTC+1 schrieb David Higgins: > > Hi all, > > I'm based at the Technical Universi

[julia-users] Re: Julia users Berlin

2015-03-23 Thread Simon Danisch
Awesome!! I'll definitely be there, as I already booked my tickets ;) Best, Simon Am Mittwoch, 25. Februar 2015 14:35:13 UTC+1 schrieb David Higgins: > > Hi all, > > I'm based at the Technical University in Berlin and I've more or less > completed the transition to using Julia for all of my rese

[julia-users] Re: zero-allocation reinterpretation of bytes

2015-03-23 Thread Simon Danisch
This should do the trick: immutable Test x::Float32 y::Int64 z::Int8 end unsafe_read_t(T::DataType, x::Vector{Uint8}, byte_offset::Integer) = unsafe_load(Ptr{T}(pointer(x, byte_offset)), 1) function read_t(T::DataType, x::Vector{Uint8}, byte_offset::Integer) @assert isbits(T) @assert byte_offset

[julia-users] Re: zero-allocation reinterpretation of bytes

2015-03-23 Thread Simon Danisch
Ah, Ptr{T}(...), is 0.4 syntax... 0.3.x would be convert(Ptr{T}, ptr) Am Montag, 23. März 2015 20:20:09 UTC+1 schrieb Sebastian Good: > > I'm trying to read some binary formatted data. In C, I would define an > appropriately padded struct and cast away. Is is possible to do something > similar i

Re: [julia-users] Julia users Berlin

2015-03-24 Thread Simon Danisch
My train leaves at 9pm (at least the train station is close), so I'd probably go there 1-2 hours early and see who drops by. Felix SchĂźler would come earlier as well ;) @David Higgins Do we need to call them to adjust this properly? On 24 Mar 2015 08:56, "Fabian Gans" wrote: > I will not be there

[julia-users] Re: zero-allocation reinterpretation of bytes

2015-03-24 Thread Simon Danisch
You should try llvmcall then... I tried to come up with a solution but I ran into this issue: #8740 Am Montag, 23. März 2015 20:20:09 UTC+1 schrieb Sebastian Good: > > I'm trying to read some binary formatted data. In C, I would define an > appropri

[julia-users] Re: zero-allocation reinterpretation of bytes

2015-03-24 Thread Simon Danisch
There is a high chance that I simply don't understand llvmcall well enough, though ;) Am Montag, 23. März 2015 20:20:09 UTC+1 schrieb Sebastian Good: > > I'm trying to read some binary formatted data. In C, I would define an > appropriately padded struct and cast away. Is is possible to do somet

[julia-users] Re: zero-allocation reinterpretation of bytes

2015-03-24 Thread Simon Danisch
Haha how silly of me! Don't know how I overlooked unsafe_load(ptr)... How odd, in the end I thought ::DataType and Type{T} doesn't emit different code... Guess it must have been obscured by something else. But yeah, makes sense that this specializes differently. Am Montag, 23. März 2015 20:20:09

[julia-users] Re: Product Function

2015-03-27 Thread Simon Danisch
I don't know excel that well, but are you looking for prod? prod([1,2,3,4]) == 24 Am Freitag, 27. März 2015 11:20:03 UTC+1 schrieb pip7...@gmail.com: > > Hi > Is there a product function like in excel for Julia? > Excel: {=PRODUCT(1+A2:L2)-1} > > Regards >

[julia-users] Re: best way to represent objects with common fields but different sets of moves

2015-03-27 Thread Simon Danisch
I'd vote for toivo's suggestion. So this could be a design: immutable Parser{Policy} common fields end #construction parser = Parser{:policy1}(...) #specialize the functions to a policy: validmove(::Parser{:policy1}) = ... validmove(::Parser{:policy2}) = ... #define functions for all parsers mov

[julia-users] Re: encode 4 x 1 byte into a one 4 bytes variable

2015-03-28 Thread Simon Danisch
I have a similar problem and I was wondering how to solve it best. Look at RGB24, which is probably pretty much the type you want. SimonDanisch/ColorTypes.jl/src/types.jl#L218 I copied that from Color.jl, and was wondering why it isn't defined as: immutable RGB24 r::Uint8 g::Uint8 b::Uint8 a::Uint8

[julia-users] [ANN] JuliaIO and FileIO

2015-04-04 Thread Simon Danisch
Hi there, FileIO has the aim to make it very easy to read any arbitrary file. I hastily copied together a proof of concept by taking code from Images.jl. JuliaIO is the umbrella group, which takes IO packages with no home. If someone wrote an IO package, but doesn't have time to implement the Fi

[julia-users] Re: [ANN] JuliaIO and FileIO

2015-04-04 Thread Simon Danisch
Oh brilliant, this is looks very similar :D I should follow Julia's issues more closely... Looking forward to your feedback! There are still quite some problems to figure out! Am Samstag, 4. April 2015 17:41:14 UTC+2 schrieb Simon Danisch: > > Hi there, > > FileIO has the ai

Re: [julia-users] [ANN] JuliaIO and FileIO

2015-04-04 Thread Simon Danisch
I might not understand you correctly. FileIO basically just includes all meta packages like ImageIO and MeshO, as it needs to know of all the possible IO libraries in order to read/write arbitrary files. The actual implementation of read(file::File{sometype}) happens in the low level IO packages li

[julia-users] Re: [ANN] JuliaIO and FileIO

2015-04-08 Thread Simon Danisch
he architecture and what a package creator must do to get integrated into FileIO. Best, Simon Am Samstag, 4. April 2015 17:41:14 UTC+2 schrieb Simon Danisch: > > Hi there, > > FileIO has the aim to make it very easy to read any arbitrary file. > I hastily copied together a proof

[julia-users] Re: [ANN] JuliaIO and FileIO

2015-04-08 Thread Simon Danisch
to switch out symbols in favor of types to better model hierarchies. Maybe this should come with a mime type overhaul, as they're closely related. Am Samstag, 4. April 2015 17:41:14 UTC+2 schrieb Simon Danisch: > > Hi there, > > FileIO has the aim to make it very easy to r

[julia-users] Re: Julia stuck at large floating point number array from source code

2015-04-14 Thread Simon Danisch
Same here...I have been observing this behaviour basically since the beginning of time. I always assumed that there is an issue for that and didn't bother looking it up, since I barely use the REPL... A quick google and github issue search tell me, there is no issue though! Am Dienstag, 14. Apr

[julia-users] Re: How should let this work?

2015-04-22 Thread Simon Danisch
Small additional note: If you think that this looks much worse (that was my reaction at least), rest assured... >From what I understand, this will change as soon as {...} gets available (Which is currently used for cell array creation). Am Mittwoch, 22. April 2015 08:44:36 UTC+2 schrieb Miao Yan

[julia-users] Re: Is there a plotting package that works for a current 0.4 build?

2015-04-24 Thread Simon Danisch
For gadfly I found out, that if you pull the master of most involved packages it works. I think it was Compose, Gadfly, Dataframes... Am Freitag, 24. April 2015 12:58:55 UTC+2 schrieb Tomas Lycken: > > I git pull-ed and built Julia this morning, and I can't get any of PyPlot, > Winston or Gadfl

  1   2   3   4   >