Re: [julia-users] Is there a direct way to get binary representation of a float?

2015-10-18 Thread Gunnar Farnebäck
It might help if you explain something about what you want to do with the binary representation. For example, julia> f(x::Float64) = reinterpret(Float64, reinterpret(UInt64, x) & 0x7fff) f (generic function with 1 method) generates very simple LLVM code julia> code_llvm(f, (Float6

[julia-users] Re: ANN: A potential new Discourse-based Julia forum

2015-10-18 Thread Jonathan Malmaud
Turns out I forgot to revert the special settings I used during the julia-users import; should be good now. On Sunday, October 18, 2015 at 1:28:08 PM UTC-5, Seth wrote: > > "You're replying too quickly. Please wait 277 hours before trying again." > > one comment every 11 days, or is this a bug? (

[julia-users] Re: Performance compared to Matlab

2015-10-18 Thread Glen O
How many cores does your computer have? Recent versions of Matlab automatically parallelise calculations like the coswt calculations, I believe, whereas Julia requires explicit request for parallel computations. A quick profiling in Julia reveals that it's actually the coswt matrix construction

Re: [julia-users] Is there a direct way to get binary representation of a float?

2015-10-18 Thread Uliano Guerrini
> Il giorno 18 ott 2015, alle ore 23:28, ele...@gmail.com ha scritto: > > > You can't unbox an already unboxed object. > > Cheers > Lex I see, however my question is if there is a way to perform the conversion shown (or the like) without any (or minimal) run time penalty that is the reason w

Re: [julia-users] Re: Julia and Object-Oriented Programming

2015-10-18 Thread Stefan Karpinski
It's a highly debatable claim that single dispatch class-based OO leads to better or more maintainable software designs. I grew up on these kinds of languages – Object Pascal, C++, Ruby, Java. Despite the ongoing rhetoric that this paradigm solves all sorts of program design problems, that's just n

Re: [julia-users] Re: ANN: A potential new Discourse-based Julia forum

2015-10-18 Thread Jonathan Malmaud
Hmm, if not a bug, it seems at least like way over-aggressive moderation defaults. I'll look into lifting those. Sent from my iPad > On Oct 18, 2015, at 1:28 PM, Seth wrote: > > "You're replying too quickly. Please wait 277 hours before trying again." > > one comment every 11 days, or is thi

[julia-users] Re: Julia and Object-Oriented Programming

2015-10-18 Thread Abe Schneider
On Sunday, October 18, 2015 at 9:44:21 PM UTC-4, vav...@uwaterloo.ca wrote: > > Going a bit on a tangent, I claim that object-oriented programming, at > least as embodied in C++, is not really suitable for scientific computing > and in fact has led certain codes to go astray. > C++ is purposef

[julia-users] Re: Julia and Object-Oriented Programming

2015-10-18 Thread Abe Schneider
> > > But I agree with Tobias and Simon - there is very little reason to try to > make Julia more object-oriented. All the power you get from OO is still > there, but you might need to think a little differently to harness it. If > you have a concrete problem, along the lines of “this is how I’

[julia-users] Re: Help on performance issues

2015-10-18 Thread Daniel Jones
Hi Patrick, The biggest difference here is how `res` and `allres` are updated. In python version you say 'res+[pos[0]]' which creates a new list with the value appended, but in the Julia version you use `union(copy(res),pos[1])`. The union function will hash all the values in res and pos[1] to

[julia-users] Re: Julia and Object-Oriented Programming

2015-10-18 Thread Abe Schneider
I'm not sure everyone would agree that Julia is "fully" object oriented. Usually definitions of OOP include management of the data and not just the interface. Specifically, there is no way to (currently) describe an inheritance of variables. While I personally would like Julia to have that feat

[julia-users] Help on performance issues

2015-10-18 Thread Patrick Useldinger
Hi everybody, I am currently benchmarking languages to write a kakuro solver in. I am not really familiar with Julia but ported the small algorithm I had written in Lisp and PyPy to Julia nevertheless. Unfortunately Julia's performance is really bad and I'm reaching out to the community to find

[julia-users] Re: Julia and Object-Oriented Programming

2015-10-18 Thread vavasis
Going a bit on a tangent, I claim that object-oriented programming, at least as embodied in C++, is not really suitable for scientific computing and in fact has led certain codes to go astray. To give a simple example, suppose you are told to write a 'matrix' class in C++ that contains all the

[julia-users] Re: Are (+), (*) the only ops that can use n-ary definitions?

2015-10-18 Thread Páll Haraldsson
On Monday, October 19, 2015 at 1:00:33 AM UTC, Páll Haraldsson wrote: > > On Tuesday, September 1, 2015 at 1:08:38 PM UTC, Jeffrey Sarnoff wrote: >> >> import Base:(+),(*),(-) >> >> julia> 2+3+4 >> 9 >> julia> (+){T<:Integer}(a::T,b::T,c::T) = ((a+b)+c)+1 >> julia> 2+3+4 >> 10 >> >> julia> 2-3-4 >>

[julia-users] Re: Are (+), (*) the only ops that can use n-ary definitions?

2015-10-18 Thread Páll Haraldsson
On Tuesday, September 1, 2015 at 1:08:38 PM UTC, Jeffrey Sarnoff wrote: > > import Base:(+),(*),(-) > > julia> 2+3+4 > 9 > julia> (+){T<:Integer}(a::T,b::T,c::T) = ((a+b)+c)+1 > julia> 2+3+4 > 10 > > julia> 2-3-4 > -5 > julia> (+){T<:Integer}(a::T,b::T,c::T) = ((a-b)-c)-1 > julia> 2-3-4 > -5 > > Ar

[julia-users] Re: Julia and Object-Oriented Programming

2015-10-18 Thread Páll Haraldsson
On Sunday, October 18, 2015 at 1:15:50 PM UTC, Simon Danisch wrote: > > Besides the current flaws, > As already argued ("fully OOP", just not in the traditional way/syntax), not a flaw, just different ("composition-over-inheritance"). Don't you agree with "no flaw"? You seem, by what you continu

[julia-users] Re: Is there a direct way to get binary representation of a float?

2015-10-18 Thread elextr
On Sunday, October 18, 2015 at 3:42:57 PM UTC+10, Uliano Guerrini wrote: > > Thanks to the pointers given I dug a little bit under the hood ad found > the promising unbox intrinsic function. It would exactly be what I was > looking for but it seems to work only one way: > > *julia> **using Base

[julia-users] Re: IJulia notebook porting from one kernel to another

2015-10-18 Thread Cedric St-Jean
> Still, do you know if, in order to run a notebook written with kernel 0.3.10, it is mandatory to keep that kernel? Yes, I see what you mean, it's a good question. I'll remember to keep 0.3.10 around... I don't know the answer, but I bet that you could edit the .ipynb file in a text/JSON edit

[julia-users] Re: IJulia notebook porting from one kernel to another

2015-10-18 Thread Ferran Mazzanti
...but that's *exactly* the problem: with my old notebooks, for which I do not have the (old) kernel installed anymore, IJulia refuses to open it properly complaining that I can not find the right kernel, and opens it in *kind of* text mode. So no, I wish i could do that, but it is not working.

Re: [julia-users] Re: ANN: NullableArrays.jl package

2015-10-18 Thread Milan Bouchet-Valat
Le dimanche 18 octobre 2015 à 16:20 -0400, Sebastian Good a écrit : > I’ve considered whether it makes sense to have, say, a > NullableBits{T,V} where T is the bits type, e.g. Int64 or Float32, > and V is the special value which is considered null. Then you would > use a similar set of functions as

[julia-users] Re: IJulia notebook porting from one kernel to another

2015-10-18 Thread David P. Sanders
In the Kernel menu, you can change the kernel to whichever kernel you would like to use. Then save the notebook, and the next time you open it, it will automatically open with the new kernel. (Note that this assumes you are using IPython / Jupyter at least version 3. If you are not, you should

Re: [julia-users] Re: ANN: NullableArrays.jl package

2015-10-18 Thread Sebastian Good
I’ve considered whether it makes sense to have, say, a NullableBits{T,V} where T is the bits type, e.g. Int64 or Float32, and V is the special value which is considered null. Then you would use a similar set of functions as defined in NullableArray to make operations on these numbers be polluted

[julia-users] Re: ANN: NullableArrays.jl package

2015-10-18 Thread Matt Bauman
On Sunday, October 18, 2015 at 3:54:13 PM UTC-4, David Gold wrote: > > @Sebastian: If I understand you correctly, then it should at least be > possible. If T is your datatype that behaves as such and x is the value of > type T that designates missingness, then it seems you could > straightforwar

[julia-users] Re: Does Julia really solve the two-language problem?

2015-10-18 Thread Art Kuo
> Having the type of a variable be determined by the variable name is > craziness. Which is why you always run with implicit none. > It had its reason back in its day. For math it is/was typical to choose counter-like integers for things like a series, with variables like i, j, k, l, m, or n

[julia-users] Re: Julia and Object-Oriented Programming

2015-10-18 Thread Tomas Lycken
I’ve never seen a problem that foo.bar(x,y) can solve, but bar(foo, x, y) can’t. There *are* things, however, that are pretty easy to do in OO languages that can’t be done in Julia; one such thing is adding/changing behavior through inheritance. That’s pretty easy to work around, though - ins

[julia-users] Re: ANN: NullableArrays.jl package

2015-10-18 Thread David Gold
NullableArray{T, N} and Array{Nullable{T, N}} essentially follow the struct-of-arrays vs. array-of-struct distinction. All of the values of a NullableArray and all of the information about missingness/presence of values are each stored in separate Array objects, which allows for certain optimiz

[julia-users] Re: ANN: NullableArrays.jl package

2015-10-18 Thread David Gold
@Sebastian: If I understand you correctly, then it should at least be possible. If T is your datatype that behaves as such and x is the value of type T that designates missingness, then it seems you could straightforwardly write your own method to convert an Array{T} to a NullableArray{T} that

[julia-users] Re: Does Julia really solve the two-language problem?

2015-10-18 Thread Páll Haraldsson
On Sunday, October 18, 2015 at 12:51:21 PM UTC, Sisyphuss wrote: > > The two-language problem refers to prototyping with one slow dynamic > language and rewrite it with a fast static language for the final product. > Yes, but there is one other two (or more..) language "thing" (I wouldn't call i

[julia-users] Re: IJulia notebook porting from one kernel to another

2015-10-18 Thread Ferran Mazzanti
Thank you very much for the reply :) Still, do you know if, in order to run a notebook written with kernel 0.3.10, it is mandatory to keep that kernel? I ask because if so, one has to store all kernels used, at least to be able to load the notebook the first time after upgrading Julia to a new ke

[julia-users] Re: IJulia notebook porting from one kernel to another

2015-10-18 Thread Cedric St-Jean
Hi Ferran, I upgraded to Jupyter notebooks before doing the switch to 0.4, and I haven't had any issue, except that Shift+Tab no longer works... On Sunday, October 18, 2015 at 8:09:08 AM UTC-4, Ferran Mazzanti wrote: > > > a) Are IJulia notebooks keeping track of the kernel version they use? >

[julia-users] Re: Julia and Object-Oriented Programming

2015-10-18 Thread Tobias Knopp
Julia is fully object oriented. The core of OO is not to write a dot between an object and an associated function but that one has virtual functions. Multiple dispatch provides just that. Cheers Tobi Am Sonntag, 18. Oktober 2015 15:15:50 UTC+2 schrieb Simon Danisch: > > This design has at leas

[julia-users] Re: ANN: A potential new Discourse-based Julia forum

2015-10-18 Thread Seth
"You're replying too quickly. Please wait 277 hours before trying again." one comment every 11 days, or is this a bug? (I'd post it there, but) On Tuesday, October 13, 2015 at 5:50:21 PM UTC-7, Jonathan Malmaud wrote: > > Also just realized there's extensive support for oneboxing (smart inl

[julia-users] Re: GraphPlot.jl

2015-10-18 Thread Seth
This is very cool! Just FYI for others: we have native LightGraphs integration for GraphPlot now - it joins GraphLayout and TikzGraphs as supported rendering packages. On Friday, October 16, 2015 at 5:57:25 AM UTC-7, Jihui Han wrote: > > https://github.com/afternone/GraphPlot.jl > > >

Re: [julia-users] Re: using chol command in Julia v.0.4.0

2015-10-18 Thread Christoph Ortner
I agree - that would be much nicer. Christoph

Re: [julia-users] Re: using chol command in Julia v.0.4.0

2015-10-18 Thread Milan Bouchet-Valat
Le dimanche 18 octobre 2015 à 07:34 -0700, Christoph Ortner a écrit : > There is a discussion on this here: > > https://github.com/JuliaLang/julia/pull/10963 > > (but I am still not getting the point) The problem is that people will use the simpler function without wondering and get bad performa

[julia-users] Re: using chol command in Julia v.0.4.0

2015-10-18 Thread Christoph Ortner
There is a discussion on this here: https://github.com/JuliaLang/julia/pull/10963 (but I am still not getting the point)

[julia-users] Re: using chol command in Julia v.0.4.0

2015-10-18 Thread Christoph Ortner
Ok I just found a pull request that does just that. https://github.com/JuliaLang/julia/pull/10963 sorry for the rant. Christoph

[julia-users] Re: using chol command in Julia v.0.4.0

2015-10-18 Thread Christoph Ortner
On Sunday, 18 October 2015 14:33:30 UTC+1, Kristoffer Carlsson wrote: > > The reason for dispatching is to make the chol function type stable. > > https://github.com/JuliaLang/julia/pull/10862 > That was clear from the usage of Val, but I am still not really getting it. >From the discussions in

[julia-users] Re: Does Julia really solve the two-language problem?

2015-10-18 Thread Kristoffer Carlsson
Having the type of a variable be determined by the variable name is craziness. Which is why you always run with implicit none. On Sunday, October 18, 2015 at 4:02:02 PM UTC+2, LarryD wrote: > > How does this compare to the "old standard?" > > 1. Fortran requires every variable to have a defined

Re: [julia-users] Re: Does Julia really solve the two-language problem?

2015-10-18 Thread Stefan Karpinski
Fortran is an awesome language, but clearly there's demand for something easier. Keep in mind that every single popular technical computing environment is dynamically typed. On Sun, Oct 18, 2015 at 7:32 PM, LarryD wrote: > How does this compare to the "old standard?" > > 1. Fortran requires eve

[julia-users] Re: Does Julia really solve the two-language problem?

2015-10-18 Thread LarryD
How does this compare to the "old standard?" 1. Fortran requires every variable to have a defined type, but automatically defaults to floating or integer type based on the first letter of the variable name. Or, you can pre-define your own sets of first-letter defaults with the Implicit command

Re: [julia-users] Re: Does Julia really solve the two-language problem?

2015-10-18 Thread Stefan Karpinski
There are different styles and levels of writing code in every language. There's highly abstract C++ and there's low-level pointer-chasing C++ that's basically C. Even in C there's the void*-style of programming which is effectively dynamically typed without the safety. Given this fact, I'm not sur

[julia-users] Re: Performance compared to Matlab

2015-10-18 Thread Kristoffer Carlsson
Worth saying is that Julia is not faster than Matlab if most of your time is spent on doing cosinus on a large array, which this is doing. On Sunday, October 18, 2015 at 3:41:54 PM UTC+2, Daniel Carrera wrote: > > Hello, > > Other people have already given advice on how to speed up the code. I ju

[julia-users] Re: Does Julia really solve the two-language problem?

2015-10-18 Thread Kristoffer Carlsson
> > > If Julia uses one code style to do prototyping, and then uses a completely > different style to write final product, then it can't be called the same > language. At best, Julia turns the 2-language problem to a 1.5-language > problem. > > What is it with Julia that requires you to write

[julia-users] Re: Performance compared to Matlab

2015-10-18 Thread Daniel Carrera
Hello, Other people have already given advice on how to speed up the code. I just want to comment that Julia really is faster than Matlab, but the way that you make code faster in Julia is almost the opposite of how you do it in Matlab. Specifically, in Matlab the advice is that if you want the

Re: [julia-users] Does Julia really solve the two-language problem?

2015-10-18 Thread Christof Stocker
I agree with you in that most of the code I start out with usually contains some dirty hacks that I later refactor. But that is just my personal approach to programming -> get something running quickly and iterate on it That being said, based on my personal experience with Julia (which is abo

[julia-users] Re: using chol command in Julia v.0.4.0

2015-10-18 Thread Kristoffer Carlsson
The reason for dispatching is to make the chol function type stable. https://github.com/JuliaLang/julia/pull/10862 On Sunday, October 18, 2015 at 9:17:42 AM UTC+2, Christoph Ortner wrote: > > > I also like (and use) dispatch on values, using the Val{:symbol} > construction, but when I can I alwa

[julia-users] Re: Does Julia really solve the two-language problem?

2015-10-18 Thread Christoph Ortner
Just speaking from my own experience in scientific computing (PDEs and molecular simulation): A+\Delta=B. with \Delta small is *not* necessary for Julia to "solve the two-language problem". In fact, I tend to write three iterations: (i) a crappy piece of code that solves the core problem but is

[julia-users] Re: Julia and Object-Oriented Programming

2015-10-18 Thread Simon Danisch
This design has at least 3 issues, since you can't have instances of a module. In general: I personally would value the discussion of why Julia needs more OOP constructs much more, If one can show that there are terrible flaws in Julia's model which are swiftly solvable with OOP. My guess is, th

[julia-users] Re: Julia and Object-Oriented Programming

2015-10-18 Thread Abe Schneider
I would say that the module is closest to a c++ namespace, which itself can be thought of as a static class. Note, however, that in both cases you can't really have separate instances. Because of the desire to separate dispatch from type information, Julia doesn't really follow the OOP paradigm

[julia-users] Re: Performance compared to Matlab

2015-10-18 Thread Andras Niedermayer
The type instability looks like a bug in Julia to me, filed issue: https://github.com/JuliaLang/julia/issues/13665 On Sunday, October 18, 2015 at 2:54:04 PM UTC+2, Andras Niedermayer wrote: > > There is a type instability (see here >

[julia-users] Re: CCALL to intel MKL on MAC ?

2015-10-18 Thread Lionel du Peloux
Kristoffer, Thank you so much for helping. I don't really know what's happening. I've run the intel script (mklvars.sh) to set up my environment variables correctly (good to know the tip !). I still get the same error message in my Juno IDE (mac os) : Intel MKL FATAL ERROR: Cannot load libmkl_

[julia-users] Re: Performance compared to Matlab

2015-10-18 Thread Andras Niedermayer
There is a type instability (see here ) that slows down your code. @code_warntype Jakes_Flat( 926, 1e-6, 5, 0, 1, 0 ) shows that variable h has type Any. I managed to track down the type instabi

[julia-users] Does Julia really solve the two-language problem?

2015-10-18 Thread Sisyphuss
The two-language problem refers to prototyping with one slow dynamic language and rewrite it with a fast static language for the final product. If Julia really solves the two-language problem, it should meet the following criteria: Let A be the code written during prototyping, B be the code writ

[julia-users] Re: Performance compared to Matlab

2015-10-18 Thread Jason Merrill
Two quick pieces of advice: Try @code_warntype Jakes_Flat( 926, 1e-6, 5, 0, 1, 0 ) For some reason, the type of the variable "h" is not being inferred tightly (i.e. it has type any). If you can sort things out so that h is typed more concretely, I suspect you'll be able to match matlab's p

[julia-users] Julia and Object-Oriented Programming

2015-10-18 Thread Sisyphuss
When I'm learning Julia, I am always thinking what is the correct way to do OOP in this language. It seems to me that what I learned in C++ does not apply in Julia. It took me long to realize that the equivalent of Class of C++ in Julia is not Type, but Module. Module is the basic function unit

[julia-users] Re: using chol command in Julia v.0.4.0

2015-10-18 Thread jamesmnason
Thanks to Kristoffer. I agree with Christoph. Best, Jim On Sunday, October 18, 2015 at 3:17:42 AM UTC-4, Christoph Ortner wrote: > > > I also like (and use) dispatch on values, using the Val{:symbol} > construction, but when I can I always hide it from the "user" even (when > important for pe

[julia-users] IJulia notebook porting from one kernel to another

2015-10-18 Thread Ferran Mazzanti
Hi folks, this is an IJulia related question: I have updated to Julia 0.4.0 and now *some* of my old IJulia notebooks do not load properly anymore -when I try to load them, IJulia complains stating that t can not find the proper Julia kernel for it. And then it loads the file, but converts it t

[julia-users] Re: Julia on Mac OS X Yosemite

2015-10-18 Thread Vishnu Raj
Solution at this link worked for me : https://github.com/one-more-minute/Julia-LT/issues/203

[julia-users] Performance compared to Matlab

2015-10-18 Thread Vishnu Raj
Although Julia homepage shows using Julia over Matlab gains more in performance, my experience is quite opposite. I was trying to simulate channel evolution using Jakes Model for wireless communication system. Matlab code is: function [ h, tf ] = Jakes_Flat( fd, Ts, Ns, t0, E0, phi_N ) %JAKES_FL

[julia-users] Re: using chol command in Julia v.0.4.0

2015-10-18 Thread Christoph Ortner
I also like (and use) dispatch on values, using the Val{:symbol} construction, but when I can I always hide it from the "user" even (when important for performance). Personally, I think chol(A, Val{:L}) is ugly and also confusing for novices. I am wondering: Why is it necessary to use disp