[julia-users] Re: Differences between == and indexing/keys?

2014-10-20 Thread Joshua Job
So would something like hash(x::ProblemInstance,h::Uint64=uint(0)) = 3*hash(x.h)+2*hash(x.J)+hash(x. properties)+h be a reasonable thing to do? If the h,J,and properties fields are the same, this yields the same hash, but I'm not sure if we might run into problems with hashes potentially overlapp

Re: [julia-users] Re: type cannot be constructed

2014-10-20 Thread Sal Mangano
oops On Monday, October 20, 2014 11:36:32 PM UTC-4, Stefan Karpinski wrote: > > julia> int32('A') > 65 > > > On Mon, Oct 20, 2014 at 10:59 PM, Sal Mangano > wrote: > >> Here is one: >> >> *julia> **convert(Int32,'A')* >> >> *65* >> >> >> *julia> **Int32('A')* >> >> *ERROR: type cannot be construc

Re: [julia-users] Re: type cannot be constructed

2014-10-20 Thread Stefan Karpinski
julia> int32('A') 65 On Mon, Oct 20, 2014 at 10:59 PM, Sal Mangano wrote: > Here is one: > > *julia> **convert(Int32,'A')* > > *65* > > > *julia> **Int32('A')* > > *ERROR: type cannot be constructed* > > On Monday, October 20, 2014 11:50:01 AM UTC-4, Ben Arthur wrote: >> >> are there any circum

[julia-users] Re: type cannot be constructed

2014-10-20 Thread Sal Mangano
Here is one: *julia> **convert(Int32,'A')* *65* *julia> **Int32('A')* *ERROR: type cannot be constructed* On Monday, October 20, 2014 11:50:01 AM UTC-4, Ben Arthur wrote: > > are there any circumstances where int32(x) should fail and > convert(Int32,x) succeed? i have a strange case of this

[julia-users] .net programming, windows API and Pycall?

2014-10-20 Thread MrWirelessKeyboard
Are there any facilities to program with .net or access the windows api? Perhaps some sort of LLVM to .net? If not, would it be conceivably possible to do pycall->pywin32->write a short script-> compile into a exe?

Re: [julia-users] IJulia Error

2014-10-20 Thread Ted Fujimoto
If anyone is still listening, I recently faced a similar problem likely caused by trying to install IHaskell (big mistake). And, yes, Pkg.build("IJulia") seemed to do the trick. On Friday, April 11, 2014 10:12:57 AM UTC-4, Isaiah wrote: > > Could you check to see if this is corrected automatical

[julia-users] Differences between == and indexing/keys?

2014-10-20 Thread Steven G. Johnson
Defining == is not enough. You have to define a hash(x) method, otherwise it will default to hashing based on the memory address (which changes between runs).

[julia-users] Differences between == and indexing/keys?

2014-10-20 Thread Joshua Job
Hello all, I have defined a structure type ProblemInstance with 3 fields (h,J, and a dictionary called properties), and which to store a dictionary that actually uses these structures as the key. I've defined == for these objects as follows: ==(a::ProblemInstance,b::ProblemInstance)=(a.h==b.h)

[julia-users] Julia running on Koding IDE ...

2014-10-20 Thread cdm
if anyone has tracked any of the developments of Koding, a cloud DevelopmentEnvironment hosted on Amazon EC2 (http://blog.koding.com/2014/10/new-release/) { https://prod.koding.com/ } and then gone on to wonder if you could get Julia running in that remote Ubuntu 14.04 environ

[julia-users] Re: NLopt and Julia Inf

2014-10-20 Thread Steven G. Johnson
On Monday, October 20, 2014 2:40:52 PM UTC-4, Gustavo Camilo wrote: > > I'm wondering if anyone has experience with how NLopt and Julia interface. > Basically I've made my objective function return *Inf* if for the current > parameter choices the value of the objective Does Not Exist or can't b

Re: [julia-users] ESS: library ref

2014-10-20 Thread Ista Zahn
Same thing here. I suggest asking on the ess mailing list at https://stat.ethz.ch/mailman/listinfo/ess-help Best, Ista On Mon, Oct 20, 2014 at 1:19 PM, Andrew Dabrowski wrote: > In the ESS wiki page for Julia (https://github.com/emacs-ess/ESS/wiki/Julia) > it says: > >> To look up for a topic [s

[julia-users] NLopt and Julia Inf

2014-10-20 Thread Gustavo Camilo
Hi all, I'm wondering if anyone has experience with how NLopt and Julia interface. Basically I've made my objective function return *Inf* if for the current parameter choices the value of the objective Does Not Exist or can't be computed, can Julia's NLopt implementation handle this properly? I

[julia-users] ESS: library ref

2014-10-20 Thread Andrew Dabrowski
In the ESS wiki page for Julia (https://github.com/emacs-ess/ESS/wiki/Julia) it says: To look up for a topic [sic] in julia standard library reference: C-c C-d > C-r. > But when I try that I get "Sorry, not implemented for dialect Julia". An I doing something wrong or has that feature simpl

Re: [julia-users] BigInt randrange 25x slower than in python

2014-10-20 Thread alexander maznev
Yes, I should have checked that first, I didn't realize readbytes was that slow. Comparing python's os.urandom with f.read() - os.urandom() is about 80x faster when reading short byte lengths (<4096) (but at 4096+ bytes os.urandom() and f.read() have the same runtimes). Nevertheless python f.r

Re: [julia-users] Variable "forgotten" after a for loop?

2014-10-20 Thread Felipe Jiménez
Thank you too, Isaiah. After I've made it work (pre-declaring the variable) I will see if I can make it faster.

Re: [julia-users] Variable "forgotten" after a for loop?

2014-10-20 Thread Felipe Jiménez
Thank you, Jacob, I've seen it now.

Re: [julia-users] Surprising machine code for bitstype

2014-10-20 Thread Ivar Nesje
Yes, I waited until 0.3.1 was released before backporting this. I did that because I was afraid that I might swap a performance problem for a bug right before tagging a new release. kl. 18:19:13 UTC+2 mandag 20. oktober 2014 skrev Stefan Karpinski følgende: > > I'm confused – this does appear to

Re: [julia-users] Surprising machine code for bitstype

2014-10-20 Thread Stefan Karpinski
Seems like the right call. On Mon, Oct 20, 2014 at 12:26 PM, Ivar Nesje wrote: > Yes, I waited until 0.3.1 was released before backporting this. I did that > because I was afraid that I might swap a performance problem for a bug > right before tagging a new release. > > kl. 18:19:13 UTC+2 mandag

Re: [julia-users] Surprising machine code for bitstype

2014-10-20 Thread Stefan Karpinski
I'm confused – this does appear to have been backported. Was it backported after 0.3.1 was released? If so, using 0.3.2 should fix it. On Mon, Oct 20, 2014 at 11:54 AM, Simon Byrne wrote: > This seems to be fixed in the 0.4 branch. I think this is the same issue > as this: > > https://github.com

Re: [julia-users] Surprising machine code for bitstype

2014-10-20 Thread Simon Byrne
This seems to be fixed in the 0.4 branch. I think this is the same issue as this: https://github.com/JuliaLang/julia/issues/8088 the fix for which apparently just missed the 0.3.1 backport. -simon > >>

Re: [julia-users] Surprising machine code for bitstype

2014-10-20 Thread Sebastian Good
https://github.com/JuliaLang/julia/issues/8742 Let me know if it needs any changes. FWIW I'm on Julia 0.3.1, OS X. Cheers! *Sebastian Good* On Mon, Oct 20, 2014 at 11:43 AM, Jameson Nash wrote: > Can you open an issue? It looks like it's still emitting a gc-frame, even > though it isn't usi

[julia-users] type cannot be constructed

2014-10-20 Thread Ben Arthur
are there any circumstances where int32(x) should fail and convert(Int32,x) succeed? i have a strange case of this buried inside an @eval inside a module and am wondering whether it's something peculiar to my situation or worth creating a minimal test case and filing a bug report. windows7, j

Re: [julia-users] Surprising machine code for bitstype

2014-10-20 Thread Jameson Nash
Can you open an issue? It looks like it's still emitting a gc-frame, even though it isn't using it. On Monday, October 20, 2014, Sebastian Good < sebast...@palladiumconsulting.com> wrote: > Your'e right! Sloppy case-minimizing-and-pasting; my apologies. I forgot > to define the conversion. Try th

Re: [julia-users] Surprising machine code for bitstype

2014-10-20 Thread Sebastian Good
Your'e right! Sloppy case-minimizing-and-pasting; my apologies. I forgot to define the conversion. Try this julia> import Base.convert julia> bitstype 8 Foo julia> convert(::Type{Foo}, x::Uint8) = reinterpret(Foo, x) convert (generic function with 443 methods) julia> @code_llvm convert(Uint8, 0

Re: [julia-users] Surprising machine code for bitstype

2014-10-20 Thread Stefan Karpinski
julia> bitstype 8 Foo julia> convert(Foo, 100) ERROR: `convert` has no method matching convert(::Type{Foo}, ::Int64) in convert at base.jl:9 How fast do you want to raise an error? ;-) On Mon, Oct 20, 2014 at 11:18 AM, Sebastian Good < sebast...@palladiumconsulting.com> wrote: > When I've run

[julia-users] Surprising machine code for bitstype

2014-10-20 Thread Sebastian Good
When I've run benchmarks with custom bitstypes, they seem to run very quickly. But I wouldn't have guessed it from the machine code I can preview at the REPL. Can anyone explain what I'm seeing here? (I'm dumping @code_llvm as it's more instructive; the @code_native is very large). Converting a

Re: [julia-users] Variable "forgotten" after a for loop?

2014-10-20 Thread Jacob Quinn
This is normal/expected behavior. Check out the manual chapter on the scope of variables: http://docs.julialang.org/en/latest/manual/variables-and-scoping/. In particular, there are certain "blocks" of code that introduce a scope and once that scope is done, all variables that were introduced with

Re: [julia-users] Variable "forgotten" after a for loop?

2014-10-20 Thread Isaiah Norton
Yes: the variable does not live past the scope where it is defined. If you want the value outside the loop, you should pre-declare the variable. Also, you should take a close look at two parts of the manual (at least): the performance section, and the "major differences from other languages" secti

[julia-users] Variable "forgotten" after a for loop?

2014-10-20 Thread Felipe Jiménez
This is my first question here. I'm starting with Julia, so sorry if this is too simple. I am used to programming mostly in Matlab, so the following behavior has surprised me. I use the variable jjmin inside a for loop (not a function). After the loop finishes, its value is "forgotten"! Is thi

Re: [julia-users] file modification time?

2014-10-20 Thread Tony Fong
Thanks! On Monday, October 20, 2014 8:15:01 PM UTC+7, Tim Holy wrote: > > mtime > > --Tim > > On Monday, October 20, 2014 05:17:13 AM Tony Fong wrote: > > Is there a way to get the modification time of a file (path given)? > > > > Right now I'm using this round-about way: > > > > using Date

Re: [julia-users] file modification time?

2014-10-20 Thread Tim Holy
mtime --Tim On Monday, October 20, 2014 05:17:13 AM Tony Fong wrote: > Is there a way to get the modification time of a file (path given)? > > Right now I'm using this round-about way: > > using Dates > refreshtimestr = readall( `stat -f "%m" $f`) > refreshtime = unix2datetime( int( chomp( refr

[julia-users] file modification time?

2014-10-20 Thread Tony Fong
Is there a way to get the modification time of a file (path given)? Right now I'm using this round-about way: using Dates refreshtimestr = readall( `stat -f "%m" $f`) refreshtime = unix2datetime( int( chomp( refreshtimestr ) ) ) I'm not sure how portable this is (it works okay on a mac).

Re: [julia-users] Re: is for iteration very expensive?

2014-10-20 Thread Mauro
> Just checked the sparse matrix section of the Julia manual. My question > is whether what you explained only applies to actually declared sparse > matrix? Yes. (This is probably what most people think when hearing "sparse matrix": a matrix stored in some sparse matrix format.) > In my cas