Re: [julia-users] Re: haskey for Set

2015-11-12 Thread Freddy Chua
that works, thank you. Freddy Chua On Thu, Nov 12, 2015 at 3:06 PM, Seth <catch...@bromberger.com> wrote: > in(el, S) or el in S. > > > On Thursday, November 12, 2015 at 2:36:28 PM UTC-8, Freddy Chua wrote: >> >> haskey does not work for Set ? It only works for

[julia-users] haskey for Set

2015-11-12 Thread Freddy Chua
haskey does not work for Set ? It only works for Dict. Should it be that way? How do I test whether an element is in a Set?

[julia-users] Measure Execution Time of Remote Process

2015-02-20 Thread Freddy Chua
If I execute the following, @sync begin @spawnat remote_process_id_1 f() @spawnat remote_process_id_2 f() end How do I measure how much time each individual process takes? @elapsed is only for an aggregated value.

[julia-users] compile errors on osx 10.9.5 for v0.3.2

2014-11-18 Thread Freddy Chua
error during bootstrap: LoadError(at sysimg.jl line 230: LoadError(at linalg.jl line 216: LoadError(at linalg/umfpack.jl line 78: ErrorException(error compiling anonymous: could not load module libumfpack: dlopen(libumfpack.dylib, 1): Library not loaded:

[julia-users] Sorted Dictionary

2014-07-31 Thread Freddy Chua
Is there a dictionary or associative container or Tree Map that is sorted on the keys?

[julia-users] Re: Sorted Dictionary

2014-07-31 Thread Freddy Chua
It's not OrderedDict, if that's what you are thinking of. On Thursday, July 31, 2014 1:55:35 PM UTC-7, Ivar Nesje wrote: https://github.com/JuliaLang/DataStructures.jl

[julia-users] How to get text from PyObject matplotlib.text.Text object

2014-07-31 Thread Freddy Chua
I am using PyPlot to visualise my results. Then I used locs, labels = xticks() to get the x-axis labels but labels[1] is a PyObject matplotlib.text.Text object instead of a Julia String. How do I get the string out? I need to reformat the string.. -Freddy

How to interpret the execution log of a Hadoop job

2014-06-29 Thread Freddy Chua
I am wondering is there a documented specification of what each line of the output log represents. Freddy Chua

[julia-users] Compilation error help??

2014-06-24 Thread Freddy Chua
../kernel/x86_64/dgemm_kernel_4x4_haswell.S:2548: Error: no such instruction: `vpermpd $ 0xb1,%ymm3,%ymm3' make[4]: *** [dtrmm_kernel_RN_HASWELL.o] Error 1 make[3]: *** [libs] Error 1 *** Clean the OpenBLAS build with 'make -C deps clean-openblas'. Rebuild with 'make OPENBLAS_USE_THREAD=0

Re: [julia-users] Unable to compile Julia after Homebrew removed gfortran

2014-05-29 Thread Freddy Chua
Does not work, the compiler revert back to using clang On Thursday, May 29, 2014 1:57:25 PM UTC+8, Kevin Squire wrote: USEGCC = 1 USECLANG = 0 On Wed, May 28, 2014 at 10:34 PM, Freddy Chua fred...@gmail.comjavascript: wrote: I am trying to benchmark GNU cc vs Clang cc. But how

[julia-users] Unable to compile Julia after Homebrew removed gfortran

2014-05-28 Thread Freddy Chua
I am on OSX Mavericks. OSX does not come with the GCC compilers. Instead it uses the Clang CC compilers which does not included gfortran, I have been using gfortran from Homebrew. Recently, Homebrew removed gfortran as a formula. But gfortran is now included in the homebrew gcc formula. After

Re: [julia-users] Unable to compile Julia after Homebrew removed gfortran

2014-05-28 Thread Freddy Chua
: SuiteSparse, Openblas, LAPACK, and ARPACK to rebuild them (anyone have an idea of where to put this as an FAQ?) On Wed, May 28, 2014 at 10:27 PM, Freddy Chua fred...@gmail.comjavascript: wrote: I am on OSX Mavericks. OSX does not come with the GCC compilers. Instead it uses the Clang CC

[julia-users] Convert Array{Array{Float64}, 1} to Array{Float64, 2}

2014-05-25 Thread Freddy Chua
For example a = Array(Array, 0) push!(a, [1, 2]) push!(a, [3, 4]) Gives me an array of array. Can I get a matrix easily in this way?

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

2014-05-25 Thread Freddy Chua
I mean, is there a function that allows me to take in a and return a matrix? b = convert_to_matrix(a) b[:, 2] = [2,4] On Monday, May 26, 2014 1:36:47 AM UTC+8, Freddy Chua wrote: For example a = Array(Array, 0) push!(a, [1, 2]) push!(a, [3, 4]) Gives me an array of array. Can I get

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

2014-05-25 Thread Freddy Chua
-element Array{Array{T,N},1}: [1,2] julia push!(a, [3, 4]) 2-element Array{Array{T,N},1}: [1,2] [3,4] julia b = hcat(a...) 2x2 Array{Int64,2}: 1 3 2 4 julia b[:, 2] 2-element Array{Int64,1}: 3 4 On Sunday, May 25, 2014 10:42:38 AM UTC-7, Freddy Chua wrote: I mean

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

2014-05-25 Thread Freddy Chua
UTC-7, Freddy Chua wrote: hang on, what does the ... in hcat(a...) means On Monday, May 26, 2014 1:47:21 AM UTC+8, Ethan Anderes wrote: Right, hcat(a…) does that (up to a transpose since julia stores things in column major order ). julia a = Array(Array, 0) 0-element Array{Array{T,N},1

[julia-users] Re: How does pass-by-sharing work exactly?

2014-05-01 Thread Freddy Chua
b = b .+ 5 creates a new instance of an array, so the original array pointed to by b is not changed at all. On Thursday, May 1, 2014 7:39:14 PM UTC+8, Kaj Wiik wrote: As a new user I was surprised that even if you change the value of function arguments (inside the function) the changes

Re: [julia-users] How does pass-by-sharing work exactly?

2014-05-01 Thread Freddy Chua
the original instance, is looping the only way? On Thursday, May 1, 2014 3:12:51 PM UTC+3, Freddy Chua wrote: b = b .+ 5 creates a new instance of an array, so the original array pointed to by b is not changed at all. On Thursday, May 1, 2014 7:39:14 PM UTC+8, Kaj Wiik wrote: As a new user I

Re: [julia-users] Re: Help me optimize Stochastic Gradient Descent of Least Squares Error

2014-04-27 Thread Freddy Chua
java and scala. Freddy Chua On Sun, Apr 27, 2014 at 2:07 PM, Elliot Saba staticfl...@gmail.com wrote: Hey there Freddy. The first thing you can do to speed up your code is to throw it inside of a function. Simply replacing your first line (which is begin) with function domytest() speeds up

[julia-users] Re: Help me optimize Stochastic Gradient Descent of Least Squares Error

2014-04-27 Thread Freddy Chua
I just hope that Julia can be faster than Java someday... On Sunday, April 27, 2014 2:03:28 PM UTC+8, Freddy Chua wrote: This code takes 60+ secs to execute on my machine. The Java equivalent takes only 0.2 secs!!! Please tell me how to optimise the following code.begin begin N = 1

Re: [julia-users] Re: Help me optimize Stochastic Gradient Descent of Least Squares Error

2014-04-27 Thread Freddy Chua
Here's the Java code. import java.util.Random; public class LeastSquaresError { public static void main(String [] args) { int N = 10; int K = 100; double rate = 1e-2; int ITERATIONS = 100; double [] y = new double[N]; double [] x = new double[N*K]; double []

[julia-users] Re: Help me optimize Stochastic Gradient Descent of Least Squares Error

2014-04-27 Thread Freddy Chua
Stochastic Gradient Descent is one of the most important optimisation algorithm in Machine Learning. So having it perform better than Java is important to have more widespread adoption. On Sunday, April 27, 2014 2:03:28 PM UTC+8, Freddy Chua wrote: This code takes 60+ secs to execute on my

Re: [julia-users] Re: Help me optimize Stochastic Gradient Descent of Least Squares Error

2014-04-27 Thread Freddy Chua
codehttps://gist.github.com/staticfloat/11339342with all the modifications made. -E On Sat, Apr 26, 2014 at 11:55 PM, Freddy Chua fred...@gmail.comjavascript: wrote: Stochastic Gradient Descent is one of the most important optimisation algorithm in Machine Learning. So having it perform

Re: [julia-users] Re: Help me optimize Stochastic Gradient Descent of Least Squares Error

2014-04-27 Thread Freddy Chua
it. you may also get a considerable boost by using @simd in your for loops (together with @inbounds) Let us know how it goes ;) cheers. El domingo, 27 de abril de 2014 09:39:03 UTC+2, Freddy Chua escribió: Alright, thanks! All these is looking very positive for Julia. On Sunday, April 27, 2014

Re: [julia-users] Re: Help me optimize Stochastic Gradient Descent of Least Squares Error

2014-04-27 Thread Freddy Chua
yep, x never changes... On Monday, April 28, 2014 12:25:14 AM UTC+8, Jason Merrill wrote: On Sunday, April 27, 2014 12:04:26 AM UTC-7, Elliot Saba wrote: Since we have made sure that our for loops have the right boundaries, we can assure the compiler that we're not going to step out of the

[julia-users] Re: Help me optimize Stochastic Gradient Descent of Least Squares Error

2014-04-26 Thread Freddy Chua
begin N = 1 K = 100 rate = 1e-2 ITERATIONS = 100 # generate y y = rand(N) # generate x x = rand(K, N) # generate w w = zeros(Float64, K) tic() for i=1:ITERATIONS for n=1:N y_hat = 0.0 x_n = x[:,n] for k=1:K y_hat += w[k] * x_n[k] end for k=1:K w[k] += rate * (y[n] - y_hat) * x_n[k] end

[julia-users] Re: Surprising range behavior

2014-04-23 Thread Freddy Chua
I think it's correct because the next value in the range would exceed PI. If you try 0:pi/101:pi, you would get 3.14 again. On Thursday, April 24, 2014 5:59:10 AM UTC+8, Peter Simon wrote: The first three results below are what I expected. The fourth result surprised me: julia

Re: [julia-users] How to get memory address of variable?

2014-04-20 Thread Freddy Chua
to the same object. --Tim On Saturday, April 19, 2014 10:37:45 PM Freddy Chua wrote: I am trying to see if I could fix some file serialization problems. Suppose I have a composite type type Foo a::Int64 end foo = Foo(10) How do I get the memory address or location

[julia-users] How to get memory address of variable?

2014-04-19 Thread Freddy Chua
I am trying to see if I could fix some file serialization problems. Suppose I have a composite type type Foo a::Int64 end foo = Foo(10) How do I get the memory address or location of foo?

[julia-users] I noticed there is no do while loop

2014-04-07 Thread Freddy Chua
as stated in question..

[julia-users] Pretty sure Dict (dictionary) is slow

2014-04-01 Thread Freddy Chua
I am using Dict to store my values. Since it is hash table, I thought that the performance would remain fairly constant even as the dictionary grows bigger. But this is not what I am experience at the moment. When the size of my Dict grows, the cost of retrieval increases as well. Can someone

[julia-users] Re: Pretty sure Dict (dictionary) is slow

2014-04-01 Thread Freddy Chua
Just to add, the key is an object rather than the usual ASCIIString or Int64 On Tuesday, April 1, 2014 6:34:08 PM UTC+8, Freddy Chua wrote: I am using Dict to store my values. Since it is hash table, I thought that the performance would remain fairly constant even as the dictionary grows

Re: [julia-users] Any method to save the variables in workspace to file?

2014-04-01 Thread Freddy Chua
Looks pretty good! On Tuesday, April 1, 2014 8:51:44 PM UTC+8, Isaiah wrote: One option is the JLD feature of HDF5 package: https://github.com/timholy/HDF5.jl On Tue, Apr 1, 2014 at 8:41 AM, Freddy Chua fred...@gmail.comjavascript: wrote: in matlab, there's save and load in java

Re: [julia-users] Re: Pretty sure Dict (dictionary) is slow

2014-04-01 Thread Freddy Chua
ObjectIdDict does not allow pre-defined types.. wouldn't that affect the performance too? On Tuesday, April 1, 2014 8:55:45 PM UTC+8, Isaiah wrote: You could try ObjectIdDict, which is specialized for this use case. On Tue, Apr 1, 2014 at 6:51 AM, Freddy Chua fred

Re: [julia-users] Re: Pretty sure Dict (dictionary) is slow

2014-04-01 Thread Freddy Chua
someone give some tips on memory management? On Tuesday, April 1, 2014 10:26:43 PM UTC+8, Iain Dunning wrote: Can you give _any_ sample code to demonstrate this behaviour? On Tuesday, April 1, 2014 9:00:20 AM UTC-4, Freddy Chua wrote: ObjectIdDict does not allow pre-defined types.. wouldn't

Re: [julia-users] Re: Pretty sure Dict (dictionary) is slow

2014-04-01 Thread Freddy Chua
type List_Node bus_stop::Bus_Stop bus_stops::Dict{Int64, Bus_Stop} next::List_Node prev::List_Node num_next::Int64 num_prev::Int64 distance_to_next::Float64 distance_to_prev::Float64 function List_Node(bus_stop::Bus_Stop) list_node = new() list_node.bus_stop = bus_stop list_node.bus_stops =

Re: [julia-users] Re: Pretty sure Dict (dictionary) is slow

2014-04-01 Thread Freddy Chua
A possible flaw I have is the circular dependency in the data structures between Bus_Stop and Edge.

Re: [julia-users] Re: Pretty sure Dict (dictionary) is slow

2014-04-01 Thread Freddy Chua
seem to create a List, Nodes or insert them into a Dict – it just walks over a preexisting linked list. On Tue, Apr 1, 2014 at 10:59 AM, Freddy Chua fred...@gmail.comjavascript: wrote: A possible flaw I have is the circular dependency in the data structures between Bus_Stop and Edge.

Re: [julia-users] Re: Pretty sure Dict (dictionary) is slow

2014-04-01 Thread Freddy Chua
guessed disabling GC manually is not the intention of the compiler designers.. On Tuesday, April 1, 2014 11:12:07 PM UTC+8, Freddy Chua wrote: I found this, https://groups.google.com/forum/#!searchin/julia-users/garbage/julia-users/6_XvoLBzN60/EHCrT46tIQYJ Might try to turn off GC and see whether

Re: [julia-users] Re: Pretty sure Dict (dictionary) is slow

2014-04-01 Thread Freddy Chua
invocation... On Tuesday, April 1, 2014 11:28:44 PM UTC+8, Freddy Chua wrote: Alright, I am pretty certain that macro nogc(ex) quote try gc_disable() local val = $(esc(ex)) finally gc_enable() end val end end Does the trick... My program does

Re: [julia-users] Re: Pretty sure Dict (dictionary) is slow

2014-04-01 Thread Freddy Chua
Strange, although my for loop does not create any additional memory, the memory usage increases to 60GB after turning off GC... On Tuesday, April 1, 2014 11:44:06 PM UTC+8, Freddy Chua wrote: Alright, these are my timings are disabling gc before disabling gc each for loop takes 911.240040

Re: [julia-users] Re: Pretty sure Dict (dictionary) is slow

2014-04-01 Thread Freddy Chua
There's a function here where the loop takes place.. https://github.com/JuliaLang/julia/issues/6357#issuecomment-3996 I don't really allocate anything in the loop.. Freddy Chua On Wed, Apr 2, 2014 at 12:24 AM, Stefan Karpinski ste...@karpinski.orgwrote: You still haven't shown any code

Re: [julia-users] Re: Pretty sure Dict (dictionary) is slow

2014-04-01 Thread Freddy Chua
abstract EdgeAbstract type Bus_Stop id::Int64 edges::Dict{Bus_Stop, EdgeAbstract} end type Edge : EdgeAbstract src::Bus_Stop tar::Bus_Stop speed::Float64 distance::Float64 end I have isolated the problem. It is this circular dependency that is currently not supported in Julia that causes the

Re: [julia-users] Any method to save the variables in workspace to file?

2014-04-01 Thread Freddy Chua
://github.com/timholy/HDF5.jl On Tue, Apr 1, 2014 at 8:41 AM, Freddy Chua fred...@gmail.com wrote: in matlab, there's save and load in java, there's object serialization So does julia have this feature?

Re: [julia-users] Where to download the benchmark program source codes

2014-03-31 Thread Freddy Chua
/5260 On Sun, Mar 30, 2014 at 9:55 AM, Freddy Chua fred...@gmail.comjavascript: wrote: Hi, I wonder where can I download the source code of these benchmarks, I want to try it on my own... I also wonder why no tests were done with Java.. Fortran JuliaPythonR MatlabOctaveMathe-matica

[julia-users] Optimize code for memory usage or speed?

2014-03-30 Thread Freddy Chua
Hi, I have a question. Suppose the data I have are only small integer values in the range of 1-10. Should I use Int64 or Int8. Using Int64 would be consistent with my system word size and would likely be faster. But using Int8 would definitely save more memory. So, which should I use?

[julia-users] Where to download the benchmark program source codes

2014-03-30 Thread Freddy Chua
Hi, I wonder where can I download the source code of these benchmarks, I want to try it on my own... I also wonder why no tests were done with Java.. FortranJuliaPythonRMatlabOctaveMathe-maticaJavaScriptGogcc 4.8.10.22.7.3 3.0.2R2012a3.6.48.0V8

[julia-users] Re: Optimize code for memory usage or speed?

2014-03-30 Thread Freddy Chua
I did some tests, turns out that in terms of speed, Uint8 is equivalent to Int64. Uint32 is twice as slow. On Sunday, March 30, 2014 2:27:17 PM UTC+8, Freddy Chua wrote: Hi, I have a question. Suppose the data I have are only small integer values in the range of 1-10. Should I use Int64

Re: [julia-users] Where to download the benchmark program source codes

2014-03-30 Thread Freddy Chua
at 9:55 AM, Freddy Chua fred...@gmail.comjavascript: wrote: Hi, I wonder where can I download the source code of these benchmarks, I want to try it on my own... I also wonder why no tests were done with Java.. Fortran JuliaPythonR MatlabOctaveMathe-matica JavaScriptGo gcc 4.8.10.2 2.7.3

Re: [julia-users] Where to download the benchmark program source codes

2014-03-30 Thread Freddy Chua
no tests were done with Java.. There is an open PR for Java, which you could check out and try: https://github.com/JuliaLang/julia/pull/5260 On Sun, Mar 30, 2014 at 9:55 AM, Freddy Chua fred...@gmail.comjavascript: wrote: Hi, I wonder where can I download the source code of these benchmarks

[julia-users] Circular Dependency in Composite Types

2014-03-27 Thread Freddy Chua
Hi I believe this question have not been asked as I could not find anything related to circular So I have two composite types type A foo::B end type B bar::A end The execution of this script results in a undefined error. How do I resolve this?

[julia-users] Re: New Docs?

2014-03-13 Thread Freddy Chua
I like it too... On Thursday, March 13, 2014 8:49:44 AM UTC+8, andrew cooke wrote: did the docs just change style? nice!

[julia-users] How to see the list of defined variables?

2014-03-10 Thread Freddy Chua
In matlab, I can type who to see the defined variables in the workspace. What do I type in Julia?

[julia-users] Re: How to see the list of defined variables?

2014-03-10 Thread Freddy Chua
Cool thanks! On Monday, March 10, 2014 3:21:28 PM UTC+8, Andrea Pagnani wrote: whos() and not whose() sorry On Monday, March 10, 2014 8:12:39 AM UTC+1, Freddy Chua wrote: In matlab, I can type who to see the defined variables in the workspace. What do I type in Julia?

[julia-users] Julia does not show the exact line of the error

2014-03-09 Thread Freddy Chua
I noticed that when I have a while loop and the bug occurs somewhere within the while look, the Julia interpreter does not show the exact location of where the error occurred. I do think that this is definitely a missing feature, and hope the developers of Julia implement this feature soon.

[julia-users] how to undefine variable in composite types

2014-03-08 Thread Freddy Chua
Suppose I have a Type type Foo a b end f = Foo(1,2) f.a = 1 f.b = 2 how do I test whether f.a is defined I do this isdefined(f, 1) but isdefined(f, 'a') does not work another question how do i undefine f.a such that isdefined(f,1) now returns false

Re: [julia-users] how to undefine variable in composite types

2014-03-08 Thread Freddy Chua
Thanks... i think that's a missing feature On Sunday, March 9, 2014 2:18:11 AM UTC+8, Stefan Karpinski wrote: 1. isdefined(f, :a) 2. you can't. On Sat, Mar 8, 2014 at 12:55 PM, Freddy Chua fred...@gmail.comjavascript: wrote: Suppose I have a Type type Foo a b end f = Foo

[julia-users] Is it possible to create function in composite types

2014-03-08 Thread Freddy Chua
Is it possible to create function in composite types with access to the composite type variables?