[julia-users] Error: expected Function, got Int64

2015-05-18 Thread James Byars
Hello all,

I am an education doctoral student who is a self-taught stats and 
programming person. My primary coding and stats experience is with R. I 
have started to attempt Julia and was using the Project Euler questions as 
a way to teach myself the language structure, types, and specifying 
functions. I have been really drawn to Julia because of all the great 
conversations about the language on the YouTube channel. There have been 
several great repositories that share coding examples for each of the 
problems (although Project Euler wants everybody to do it on their own) 
which have been tremendously helpful.

One of the proposed solutions for Problem #1 have this structure:
println(sum(3:3:999) + sum(5:5:999) - sum(15:15:999))

I am trying to make a function of this type of problem so I am not bounded 
by specifying each number every time. So I adapted the solution to the 
following format:

*function fib_sum_2(x,y,z)*
*sum(x:x:z) + sum(y:y:z) - sum(lcm(x,y):lcm(x,y):z)*
*end*

However, when I try to run the function (fib_sum_2(3,5,999)) I get the 
following error:

*type: fib_sum_2: in apply, expected Function, got Int64
while loading In[140], in expression starting on line 1

 in fib_sum_2 at In[137]:2*


I did attempt to google this problem, but still could not find a source that 
really explained the problem. I understand that this is a really newbie 
question and thank you to everyone for their patience and any assistance. If 
anybody can correct my error or provide resources that might help me with 
future Euler Project problems that would be great. I feel that I am missing 
something terribly easy with Julia, but thank you all for any help. Also, I am 
using IJulia for reference. If I have posted this question in error, can 
anybody direct me to the right forum?


With Regards,


James



[julia-users] Re: Installing HDF5

2015-05-18 Thread rk
Thanks. I managed to get it to work by using the terminal instead. For 
those running Juno and encountering similar problems I'd recommend building 
packages from the terminal.

On Saturday, May 16, 2015 at 11:16:54 PM UTC-5, Tony Kelman wrote:

 No, this isn't normal, but bugs happen. Blosc's binaries are hosted on an 
 MIT url that has caused issues with some proxies in the past, I believe. 
 You might also try reverting this commit 
 https://github.com/JuliaLang/BinDeps.jl/commit/94ac0fa54d4ee64f23f1815c1114c9d6d23ead05
  
 in your local copy of BinDeps, which you can find  the location of by 
 running `Pkg.dir(BinDeps)`


 On Saturday, May 16, 2015 at 7:58:43 PM UTC-7, rk wrote:

 Hi

 I am running Julia in Juno on a Windows 7 machine. I am trying to install 
 HDF5 and am noticing that the build time is quite long. In particular it 
 seems to be stuck on building Blosc (for many hours). I have tried removing 
 and re-installing the package. 
 I was just wondering if the long build time was normal for this package?

 Thank you very much for your help



[julia-users] installing nlopt.jl on unix with manually installed NLopt?

2015-05-18 Thread Florian Oswald
Hi all,

I'm working on a scienfitic unix cluster where the NLopt.jl provided 
build.jl fails. I paste the error output in the end. I installed NLopt 
manually into ~/local. How can I build NLopt.jl such that it takes my 
~/local/lib/libnlopt.a? I have done

push!(Sys.DL_LOAD_PATH, ${HOME}/local/lib)

thanks!






*[ ERROR: NLopt 
]*


*could not spawn 
setenv(`/home/eisuc151/.julia/v0.3/NLopt/deps/src/nlopt-2.4/configure 
--enable-shared --without-guile --without-python --without-octave 
--without-matlab --with-cxx 
--prefix=/home/eisuc151/.julia/v0.3/NLopt/deps/usr`,Union(UTF8String,ASCIIString)[PATH=/home/eisuc151/.julia/v0.3/NLopt/deps/usr/bin:/home/eisuc151/local/bin:/home/eisuc151/.autojump/bin:/home/eisuc151/local/bin:/local/software/rh53/hdf5/1.8.4/gcc/bin:/local/software/rh53/python/2.6.5/gcc/bin:/local/software/rh53/protobuf/2.4.1/gcc/bin:/local/software/rh53/samtools/0.1.16/bin:/local/software/rh53/gcc/4.8.1/bin:/usr/lib64/qt-3.3/bin:/local/software/rh53/acroread/8.1.6/Adobe/Reader8/bin:/local/software/maui/3.3.1/bin:/usr/lpp/mmfs//bin:/local/software/torque/default/sbin:/local/software/torque/default/bin:/usr/local/bin:/bin:/usr/bin,HDF5_INC_DIR=/local/software/rh53/hdf5/1.8.4/gcc/include,QTDIR=/usr/lib64/qt-3.3,LD_LIBRARY_PATH=/local/software/rh53/hdf5/1.8.4/gcc/lib:/local/software/rh53/mpc/0.9/gcc/lib:/local/software/rh53/gmp/5.0.2/gcc/lib:/local/software/rh53/mpfr/2.4.2/gcc/lib:/local/software/rh53/gcc/4.8.1/lib:/local/software/rh53/gcc/4.8.1/lib64:/local/software/torque/default/lib,MANPATH=/local/software/rh53/python/2.6.5/gcc/share/man:/local/software/rh53/protobuf/2.4.1/gcc/share/man:/local/software/rh53/samtools/0.1.16/man:/local/software/rh53/gcc/4.8.1/share/man:/local/software/torque/default/man:/usr/local/share/man:/usr/share/man/en:/usr/share/man:/local/Modules/3.2.6/man,MODULEPATH=/local/Modules/versions:/local/Modules/\$MODULE_VERSION/modulefiles:/local/Modules/modulefiles:,LIBPATH=/local/software/rh53/gcc/4.8.1/libexec/gcc/x86_64-unknown-linux-gnu/4.8.1,USER=eisuc151,KDEDIR=/usr,PBS_SERVER=blue30,blue31,SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass,LESSOPEN=|/usr/bin/lesspipe.sh
 
%s,MAUIHOMEDIR=/local/maui/3.3.1,SHELL=/bin/bash,QTLIB=/usr/lib64/qt-3.3/lib,SSH_CLIENT=152.78.130.89
 
44959 
22,SSH_TTY=/dev/pts/7,HOME=/home/eisuc151,TERM=xterm-256color,HOSTNAME=blue34,QTINC=/usr/lib64/qt-3.3/include,HISTSIZE=1000,LC_ALL=C,LC_CTYPE=en_GB.UTF-8,LANG=en_US.UTF-8,SHLVL=1,LOADEDMODULES=torque/current:gpfs:moab/6.1.9:acroread/8.1.6:gcc/4.8.1:samtools/0.1.16:protobuf/2.4.1:python/2.6.5/gcc:hdf5/1.8.4,LOGNAME=eisuc151,OLDPWD=/home/eisuc151/local,_LMFILES_=/local/Modules/modulefiles/torque/current:/local/Modules/modulefiles/gpfs:/local/Modules/modulefiles/moab/6.1.9:/local/Modules/3.2.6/modulefiles/acroread/8.1.6:/local/Modules/3.2.6/modulefiles/gcc/4.8.1:/local/Modules/3.2.6/modulefiles/samtools/0.1.16:/local/Modules/3.2.6/modulefiles/protobuf/2.4.1:/local/Modules/3.2.6/modulefiles/python/2.6.5/gcc:/local/Modules/3.2.6/modulefiles/hdf5/1.8.4,HDF5_LIB_DIR=/local/software/rh53/hdf5/1.8.4/gcc/lib,SHARKCLONEROOT=/usr/lpp/mmfs//src,_=/home/eisuc151/local/bin/julia,CVS_RSH=ssh,G_BROKEN_FILENAMES=1,MODULE_VERSION_STACK=3.2.6,GIT_SSL_NO_VERIFY=true,PWD=/home/eisuc151/local/lib,MODULESHOME=/local/Modules/3.2.6,PYTHONPATH=/home/eisuc151/local/lib/python2.6/site-packages/,BASH_FUNC_module()=()
 
{  eval `/local/Modules/\$MODULE_VERSION/bin/modulecmd bash 
\$*`\n},SSH_CONNECTION=152.78.130.89 44959 152.78.31.149 
22,AUTOJUMP_ERROR_PATH=/home/eisuc151/.local/share/autojump/errors.log,OPENBLAS_NUM_THREADS=8,CPPFLAGS=
 
-I/home/eisuc151/.julia/v0.3/NLopt/deps/usr/include,MAIL=/var/spool/mail/eisuc151,LDFLAGS=
 
-L/home/eisuc151/.julia/v0.3/NLopt/deps/usr/lib -Wl,-rpath 
-Wl,/home/eisuc151/.julia/v0.3/NLopt/deps/usr/lib,MODULE_VERSION=3.2.6,PKG_CONFIG_PATH=/home/eisuc151/.julia/v0.3/NLopt/deps/usr/lib/pkgconfig,INPUTRC=/etc/inputrc,KDE_NO_IPV6=1,LS_COLORS=di=1;34:fi=0:ln=31:pi=5:so=5:bd=5:cd=5:or=31:mi=0:ex=35:*.sh=31:*.r=32:*.R=32:*.out=35]):
 
no such file or directory (ENOENT)*

*while loading /home/eisuc151/.julia/v0.3/NLopt/deps/build.jl, in 
expression starting on line 54*


[julia-users] Using Julia program as computation backend

2015-05-18 Thread Roman Kravchik
I am building a web app for DSP tasks. It consists of SPA frontend, REST 
API Server, RabbitMQ and computation server.
And I want to use Julia lang for develop computation back-end.
Has anybody had some experience in integration Julia programs with AMQP 
message brokers?

P.S. I've read this topic 
https://groups.google.com/forum/#!topic/julia-users/umHiBwVLQ4g.


Re: [julia-users] Using Julia program as computation backend

2015-05-18 Thread Kevin Squire
That's true.

On Monday, May 18, 2015, Roman Kravchik ro...@kravchik.ru wrote:

 Thanks for the link.
 But it seems to be like CGI-style operation - eval julia expression and
 i'm not sure it's a perspective direction.

 понедельник, 18 мая 2015 г., 17:46:16 UTC+3 пользователь Kevin Squire
 написал:

 Hi Roman,

 Not a direct answer to your question, but you might check out node-julia
 (https://www.npmjs.com/package/node-julia), if you're open to including
 node in the soup of web components.

 Cheers,
Kevin

 On Monday, May 18, 2015, Roman Kravchik ro...@kravchik.ru wrote:

 I am building a web app for DSP tasks. It consists of SPA frontend, REST
 API Server, RabbitMQ and computation server.
 And I want to use Julia lang for develop computation back-end.
 Has anybody had some experience in integration Julia programs with AMQP
 message brokers?

 P.S. I've read this topic
 https://groups.google.com/forum/#!topic/julia-users/umHiBwVLQ4g.




Re: [julia-users] Julia Summer of Code

2015-05-18 Thread Sisyphuss
You can be a tutor I guess.

On Saturday, May 16, 2015 at 2:32:22 PM UTC+2, Scott Jones wrote:

 These are particular interesting to me (if I were a student, or not 
 already more than full-time working using Julia), I'd jump on one of these 
 two:

 https://github.com/JuliaLang/julialang.github.com/blob/master/gsoc/2015/index.md#project-simple-persistent-distributed-storage

 https://github.com/JuliaLang/julialang.github.com/blob/master/gsoc/2015/index.md#project-fast-bignums-in-julia

 The second also ties in with my interest in have fast decimal numbers in 
 Julia, both fixed size (32,64,128), and arbitrary like bignums.



[julia-users] Re: sqrt(abs2(x)) Vs abs(x)

2015-05-18 Thread Kristoffer Carlsson
When you benchmark stuff like this it is good to make a benchmark with as 
little noise in it as possible. Here is a version which removes slicing, 
bounds checking, allocations etc:

function timeit()
A = rand(1024, 1024)
B = similar(A)
a = @elapsed for i = 1:size(A, 1), j = 1:size(A, 2)
@inbounds B[i,j] = sqrt(abs2(A[i,j]))
end

b = @elapsed for i = 1:size(A, 1), j = 1:size(A, 2)
@inbounds B[i,j] = abs(A[i,j])
end

return a,b
end

as = Float64[]
bs = Float64[]

for i in 1:20
a, b = timeit()
push!(as, a)
push!(bs, b)
println(i)
end

This gives me the results:

julia mean(as)
0.04173319045

julia mean(bs)
0.0417097596

which seems pretty much equal to me

On Monday, May 18, 2015 at 4:51:48 PM UTC+2, antony schutz wrote:

 Hello, 

 I just discover abs2() function :v 

 And I have to say that i'm really surprised that: 
 sqrt(abs2( x ))  is quicker than  abs( x ) 

 For a Matrix of size 512*512 and then a vector of size 512 
 1 realizations, the mean results are (on a macbook): 

 abs(x[:,:])

 0.0073665214096

 sqrt(abs2(x[:,:]))

 0.004686118031895

 abs(x[:])

 1.222129120001e-5

 sqrt(abs2(x[:]))

 1.15177585e-5


 Regards





Re: [julia-users] known, working, recent examples for Clang.jl?

2015-05-18 Thread Isaiah Norton

 Just a side question: If i run wrap_c on one of the larger system
 libraries (e.g. X11.h)  and get an error; is it more likely it uses a
 rather esoteric cpp features (and therefore isn't covered in the current
 wrap_c) OR is it more likely that i miss some compiler flags?


Hard to say, depends on the error... Probably 60/40 chance it is a compiler
flag issue. I'm guessing that X11 (like most system libraries) has a pretty
gnarly set of ifdefs. At some point it is almost unavoidable to require
integrating compiler-adjacent tools like this into the proper build system
like SWIG does.

I use linux too, so I can have a look if you want to file an issue and link
to your wrapper script.

Matching compiler options is going to be a tricky issue for distribution of
some Cxx.jl based wrappers as well, and I don't know what the answer is. I
suspect we may end up with a build-the-world approach for the big Julia
Environment distribution that is envisioned. This is basically the
solution that Kitware and various other groups have adopted to the problem
of first class everywhere cross-platform applications, after many years
of experience.

On Mon, May 18, 2015 at 8:21 AM, Andreas Lobinger lobing...@gmail.com
wrote:

 On Sunday, May 17, 2015 at 7:06:34 PM UTC+2, Isaiah wrote:


 (please file issues...)


 Just a side question: If i run wrap_c on one of the larger system
 libraries (e.g. X11.h)  and get an error; is it more likely it uses a
 rather esoteric cpp features (and therefore isn't covered in the current
 wrap_c) OR is it more likely that i miss some compiler flags?



[julia-users] Error: expected Function, got Int64

2015-05-18 Thread Daniel Høegh
Have you tried to restart the REPL, because I see no problems in running:
function fib_sum_2(x,y,z)
sum(x:x:z) + sum(y:y:z) - sum(lcm(x,y):lcm(x,y):z)
end
julia fib_sum_2(3,5,999)
233168


[julia-users] Re: Error: expected Function, got Int64

2015-05-18 Thread Kristoffer Carlsson
This works for me, both in Julia 0.3 and 0.4

julia function fib_sum_2(x,y,z)
   sum(x:x:z) + sum(y:y:z) - sum(lcm(x,y):lcm(x,y):z)
   end
fib_sum_2 (generic function with 1 method)


julia fib_sum_2(3,5,999)
233168

What happens if you restart Julia and try again?





On Monday, May 18, 2015 at 4:34:11 PM UTC+2, James Byars wrote:

 Hello all,

 I am an education doctoral student who is a self-taught stats and 
 programming person. My primary coding and stats experience is with R. I 
 have started to attempt Julia and was using the Project Euler questions as 
 a way to teach myself the language structure, types, and specifying 
 functions. I have been really drawn to Julia because of all the great 
 conversations about the language on the YouTube channel. There have been 
 several great repositories that share coding examples for each of the 
 problems (although Project Euler wants everybody to do it on their own) 
 which have been tremendously helpful.

 One of the proposed solutions for Problem #1 have this structure:
 println(sum(3:3:999) + sum(5:5:999) - sum(15:15:999))

 I am trying to make a function of this type of problem so I am not bounded 
 by specifying each number every time. So I adapted the solution to the 
 following format:

 *function fib_sum_2(x,y,z)*
 *sum(x:x:z) + sum(y:y:z) - sum(lcm(x,y):lcm(x,y):z)*
 *end*

 However, when I try to run the function (fib_sum_2(3,5,999)) I get the 
 following error:

 *type: fib_sum_2: in apply, expected Function, got Int64
 while loading In[140], in expression starting on line 1

  in fib_sum_2 at In[137]:2*


 I did attempt to google this problem, but still could not find a source that 
 really explained the problem. I understand that this is a really newbie 
 question and thank you to everyone for their patience and any assistance. If 
 anybody can correct my error or provide resources that might help me with 
 future Euler Project problems that would be great. I feel that I am missing 
 something terribly easy with Julia, but thank you all for any help. Also, I 
 am using IJulia for reference. If I have posted this question in error, can 
 anybody direct me to the right forum?


 With Regards,


 James



[julia-users] Re: Error: expected Function, got Int64

2015-05-18 Thread James Byars
Thank you. I said this in the post below, but is this an issue with Julia 
going forward? The need to restart.

On Monday, May 18, 2015 at 10:50:28 AM UTC-4, Kristoffer Carlsson wrote:

 This works for me, both in Julia 0.3 and 0.4

 julia function fib_sum_2(x,y,z)
sum(x:x:z) + sum(y:y:z) - sum(lcm(x,y):lcm(x,y):z)
end
 fib_sum_2 (generic function with 1 method)


 julia fib_sum_2(3,5,999)
 233168

 What happens if you restart Julia and try again?





 On Monday, May 18, 2015 at 4:34:11 PM UTC+2, James Byars wrote:

 Hello all,

 I am an education doctoral student who is a self-taught stats and 
 programming person. My primary coding and stats experience is with R. I 
 have started to attempt Julia and was using the Project Euler questions as 
 a way to teach myself the language structure, types, and specifying 
 functions. I have been really drawn to Julia because of all the great 
 conversations about the language on the YouTube channel. There have been 
 several great repositories that share coding examples for each of the 
 problems (although Project Euler wants everybody to do it on their own) 
 which have been tremendously helpful.

 One of the proposed solutions for Problem #1 have this structure:
 println(sum(3:3:999) + sum(5:5:999) - sum(15:15:999))

 I am trying to make a function of this type of problem so I am not 
 bounded by specifying each number every time. So I adapted the solution to 
 the following format:

 *function fib_sum_2(x,y,z)*
 *sum(x:x:z) + sum(y:y:z) - sum(lcm(x,y):lcm(x,y):z)*
 *end*

 However, when I try to run the function (fib_sum_2(3,5,999)) I get the 
 following error:

 *type: fib_sum_2: in apply, expected Function, got Int64
 while loading In[140], in expression starting on line 1

  in fib_sum_2 at In[137]:2*


 I did attempt to google this problem, but still could not find a source that 
 really explained the problem. I understand that this is a really newbie 
 question and thank you to everyone for their patience and any assistance. If 
 anybody can correct my error or provide resources that might help me with 
 future Euler Project problems that would be great. I feel that I am missing 
 something terribly easy with Julia, but thank you all for any help. Also, I 
 am using IJulia for reference. If I have posted this question in error, can 
 anybody direct me to the right forum?


 With Regards,


 James



[julia-users] Re: 4D interpolation from scattered points

2015-05-18 Thread Florian Oswald
Hi there,
xdata (or any other grid) does not need to be on a grid, that's just the 
way the example is written. but no extrapolation, that's right.

On Thursday, 14 May 2015 01:05:55 UTC+1, Yakir Gagnon wrote:

 Thanks a ton people!!!

 ExtremelyRandomizedTrees.jl: Might be really good, but errored a lot on 
 version 4.
 ApproXD.jl: Very cool, I'll come back to that later, but for now: What 
 Lininterp cannot do: Multidimensional extrapolation which I need (and 
 accept is prone to silliness). Plus, according to the examples, the known 
 xdata needs to be on a grid. My x,y,z are not equally spaced that way, they 
 are scattered.
 compute the distances: I started with that, and in light of these results 
 I might fall back to doing just that. 
 Polyharmonic Splines: does exactly what I want, but not faster than just 
 distances (but probably a lot more accurate). 
 CHull.jl: might be awesome for this, but I didn't quickly see how I can 
 use it to interpolate and extrapolate.

 I feel like I owe you guys some background: I have some color-map 
 functions that take a value, let's call it X (for some 0X1 and for some 
 -pi/2Xpi/2) and return an RGB. I need to use these to convert images that 
 have colors that are similar (but not always identical) to the RGB values 
 from these color-maps back to the value (X) that would have resulted in 
 said RGB (so it's like the inverse of those color-map functions). After 
 much trial and error, I think that since the images I want to convert this 
 way are all 8-bit, the fastest way would be to construct a lookup table for 
 all 2^(8*3) possible RGB combinations. This table (Dict) will take any RGB 
 value from those images I need to convert and return X. This makes sense 
 because I have only 4 such color-map functions, and potentially endless 
 amounts of images to convert (currently a couple of tera). 
 So I think I'll use simple distances, run that once, save those lookup 
 tables and use them again and again on new images. 




 On Thursday, May 14, 2015 at 4:19:18 AM UTC+10, Luke Stagner wrote:

 You can use Polyharmonic Splines 
 http://nbviewer.ipython.org/gist/lstagner/04a05b120e0be7de9915


 On Wednesday, May 13, 2015 at 5:33:08 AM UTC-7, Yakir Gagnon wrote:

 I have a bunch (~1000) of x,y,z and a corresponding value, V. One unique 
 V for each x,y,z. I want to interpolate and extrapolate wildly (so I 
 really don't care about how accurate or correct it is). The x,y,z I have 
 are not regularly spaced or anything. They're scattered across some range 
 (they all share similar ranges), and I want to know what value (i.e. new V) 
 I should be getting at new and regularly spaced x,y,z. I think 
 Matlab's griddata would do what I want.
 I tired following the lower-level functionality from Grid.jl, 
 Interpolations.jl, and Dierckx.jl, but couldn't figure out how to get this 
 to work. 
 I think I need to fit some curve to my scattered points and then use 
 that to find the values at the new xyz (at least that's how I think 
 griddata works)... Any good simple ideas out there?



Re: [julia-users] Using Julia program as computation backend

2015-05-18 Thread Kevin Squire
Hi Roman,

Not a direct answer to your question, but you might check out node-julia (
https://www.npmjs.com/package/node-julia), if you're open to including node
in the soup of web components.

Cheers,
   Kevin

On Monday, May 18, 2015, Roman Kravchik ro...@kravchik.ru wrote:

 I am building a web app for DSP tasks. It consists of SPA frontend, REST
 API Server, RabbitMQ and computation server.
 And I want to use Julia lang for develop computation back-end.
 Has anybody had some experience in integration Julia programs with AMQP
 message brokers?

 P.S. I've read this topic
 https://groups.google.com/forum/#!topic/julia-users/umHiBwVLQ4g.



[julia-users] sqrt(abs2(x)) Vs abs(x)

2015-05-18 Thread antony schutz
Hello, 

I just discover abs2() function :v 

And I have to say that i'm really surprised that: 
sqrt(abs2( x ))  is quicker than  abs( x ) 

For a Matrix of size 512*512 and then a vector of size 512 
1 realizations, the mean results are (on a macbook): 

abs(x[:,:])

0.0073665214096

sqrt(abs2(x[:,:]))

0.004686118031895

abs(x[:])

1.222129120001e-5

sqrt(abs2(x[:]))

1.15177585e-5


Regards





Re: [julia-users] Using Julia program as computation backend

2015-05-18 Thread Roman Kravchik
Thanks for the link.
But it seems to be like CGI-style operation - eval julia expression and i'm 
not sure it's a perspective direction.

понедельник, 18 мая 2015 г., 17:46:16 UTC+3 пользователь Kevin Squire 
написал:

 Hi Roman,

 Not a direct answer to your question, but you might check out node-julia (
 https://www.npmjs.com/package/node-julia), if you're open to including 
 node in the soup of web components. 

 Cheers,
Kevin 

 On Monday, May 18, 2015, Roman Kravchik ro...@kravchik.ru javascript: 
 wrote:

 I am building a web app for DSP tasks. It consists of SPA frontend, REST 
 API Server, RabbitMQ and computation server.
 And I want to use Julia lang for develop computation back-end.
 Has anybody had some experience in integration Julia programs with AMQP 
 message brokers?

 P.S. I've read this topic 
 https://groups.google.com/forum/#!topic/julia-users/umHiBwVLQ4g.



Re: [julia-users] Is it possible to imread indexed images?

2015-05-18 Thread Yakir Gagnon
Cool, thanks again Tim!


Yakir Gagnon
The Queensland Brain Institute (Building #79)
The University of Queensland
Brisbane QLD 4072
Australia

cell +61 (0)424 393 332
work +61 (0)733 654 089

On Fri, May 15, 2015 at 12:05 AM, Tim Holy tim.h...@gmail.com wrote:

 I'm not sure myself how hard this would be to add.
 http://www.imagemagick.org/api/magick-image.php#MagickExportImagePixels
 does not obviously provide a mechanism to retrieve the index. But I haven't
 looked extensively.

 In the longer-term, there will be multiple readers supported, so the
 answer to
 your question will likely depend on the reader.

 --Tim

 On Wednesday, May 13, 2015 11:18:10 PM Yakir Gagnon wrote:
  In Images.jl, is it possible to read an indexed image so that the Type of
  the image is ImageCmap and one of its fields is the colormap?
 
  I tried this:
  (in shell)
  convert rose: +dither -colors 256 -type palette rose_palette.gif
  convert rose_palette.gif -format %r info:
  PseudoClass sRGB *= this means it's an indexed image (with a palette)*
 
  and in Julia:
  julia using Images
  julia isdirect(imread(rose_palette.gif))
  true *= which means that it's not indexed...*
 
  Thanks in advance (probably) Tim!




Re: [julia-users] known, working, recent examples for Clang.jl?

2015-05-18 Thread Andreas Lobinger
On Sunday, May 17, 2015 at 7:06:34 PM UTC+2, Isaiah wrote:


 (please file issues...)


Just a side question: If i run wrap_c on one of the larger system libraries 
(e.g. X11.h)  and get an error; is it more likely it uses a rather esoteric 
cpp features (and therefore isn't covered in the current wrap_c) OR is it 
more likely that i miss some compiler flags?


Re: [julia-users] Example of imread from an imagemagick stream

2015-05-18 Thread Yakir Gagnon
I’m now using open instead of readandwrite…
​


Yakir Gagnon
The Queensland Brain Institute (Building #79)
The University of Queensland
Brisbane QLD 4072
Australia

cell +61 (0)424 393 332
work +61 (0)733 654 089

On Fri, May 15, 2015 at 10:27 AM, Yakir Gagnon 12.ya...@gmail.com wrote:

 Thanks!
 OK, I finally found the commit you were talking about (commit
 7ba0d6093c093acfc5c1d71fa3cad1ff33bccdfc). I managed to find an example for
 the stuff I wanted:

 cmd = `convert $filename -depth $bitdepth $colorspace:-`
 stream, _ = readsfrom(cmd)
 nchannels = length(colorspace)
 data = read(stream, T, nchannels, sz...)

 But I couldn't find this mysterious readsfrom. I suspect it's something
 to do with OSX (I'm on linux). I blindly switched it with readandwrite on
 a complete whim. And it works!!!

 I'll be happy to know if this is sub-optimal.


 On Friday, May 15, 2015 at 12:08:01 AM UTC+10, Tim Holy wrote:

 If you dig through the commit history of Images.jl, at some point you'll
 find
 the commit that switched from using Cmd to the C api for interacting with
 ImageMagick. That should have quite a few examples.

 --Tim

 On Thursday, May 14, 2015 05:25:19 AM Yakir Gagnon wrote:
  Can someone please post a simple example of reading an image stream
 from
  imagemagick?
 
  So something like this (though this doesn't work):
 
  cmd = `convert img.png do some imagemagick things that I wish I could
 do
  with Images.jl but are only possible with imagemagick -compress none
 ppm:-`
  I = imread(readall(cmd),Images.PPMBinary)
 
  I'm trying to avoid writing the image imagemagick created to disk and
 read
  it straight into julia. The readall(cmd) part works awesome, it spews
 all
  the image bits to the stdout. But I can't get imread to pick it up as
 an
  image.
 
  Thanks in advance!




Re: [julia-users] Re: how to create a command with an unquoted backslash in it?

2015-05-18 Thread Yakir Gagnon
Right, yea, it was all a mistake I made and I thought the parenthesis were
the culprits... Thanks anyway!!!


Yakir Gagnon
The Queensland Brain Institute (Building #79)
The University of Queensland
Brisbane QLD 4072
Australia

cell +61 (0)424 393 332
work +61 (0)733 654 089

On Sun, May 17, 2015 at 8:48 AM, andrew cooke and...@acooke.org wrote:

 just playing around, it seems to me like julia is escaping with slashes.
 i don't have imagmagick installed, but with echo it woks as expected:

 julia run(`echo \(`)
 (

 julia run(`echo \\(`)
 \(

 julia ^D
 andrew@netbook:~ echo (
 bash: syntax error near unexpected token `newline'
 andrew@netbook:~ echo \(
 (
 andrew@netbook:~ echo \\(
 bash: syntax error near unexpected token `('
 andrew@netbook:~ echo \\\(
 \(

 the two julia commands give results equivalent to `\(` and `\\\(` in bash.




 On Friday, 15 May 2015 00:41:24 UTC-3, Yakir Gagnon wrote:



 I'm trying to run an external imagemagick command. As such, it needs to
 include some escaped parenthesis. In shell it would look like this:

 convert img.png \( -clone 0 -crop 450x+450+0 -dither None -remap
 colormap1.png \) \( -clone 0 -crop 450x+951+0 -dither None -remap
 colormap2.png \) -delete 0 z%d.png

 But when I build something like this in julia:

 cmd = `convert $fname ( -clone 0 -crop wx+$(w+1)+0 -dither None -remap
 colormap1.png ) ( -clone 0 -crop 450x+$(sz[1]-w+1)+0 -dither None -remap
 colormap2.png ) -delete 0 z%d.png`

 the parenthesis don't get escaped (as they should be).

 This is not the first time I've gone crazy over this issue. Any ideas?




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

2015-05-18 Thread Dahua Lin
The package has been moved to under JuliaSparse:

https://github.com/JuliaSparse/SparseVectors.jl

Best,
Dahua


On Sunday, May 17, 2015 at 10:24:57 PM UTC+8, Dahua Lin wrote:

 Dear all,

 I am pleased to announce a new package SparseVectors: 
 https://github.com/lindahua/SparseVectors.jl

 Sparse data has become increasingly common in machine learning and related 
 areas. For example, in document analysis, each document is often 
 represented as a sparse vector, which each entry represents the number of 
 occurrences of a certain word. However, the support of sparse vectors 
 remains quite limited in Julia base.

 This package provides two types SparseVector and SparseVectorView and a 
 series of methods to work with sparse vectors. Specifically, this package 
 provides the following functionalities:

- Construction of sparse vectors
- Get a view of a column in a sparse matrix (of CSC format), or a view 
of a range of columns.
- Specialized arithmetic functions on sparse vectors, e.g. +, -, *, 
etc.
- Specialized reduction functions on sparse vectors, e.g. sum, 
vecnorm, etc.

 It is also worth noting that there's been some discussion (see 
 https://github.com/JuliaLang/julia/pull/8718) of adding SparseVector to 
 the Julia Base. Hopefully, this can be added in 0.4. Even this happens, the 
 package remains useful, as it also works with Julia 0.3 (which won't have 
 SparseVector support).

 Best,
 Dahua




Re: [julia-users] Preferred way to structure a module

2015-05-18 Thread Mauro
 For my own modules, I've tended to follow the example of the Distributions 
 and Distances package, where each distribution (or distance) is its own 
 type, and then there is a small number of generic functions (eg evaluate) 
 that use multiple dispatch to return the appropriate value depending on the 
 input type.

If I recall correctly, recent discussions on this list suggest that many
(but not all) see this as the most julian pattern.  I think it may have
been discussed within one of those recent super-long threads.

 But I've seen source code in other packages that indicates a different
 strategy. For example, the Optim package appears (and please correct
 me if I'm wrong - I'm definitely not an expert) to have a different
 Symbol for each optimisation algorithm, and then uses if elseif
 statements to ensure the right optimisation procedure is called.

(Not having looked at the code) I would, instead of `:alg_a` use
`AlgTyp{:a}` and dispatch on it, i.e. the method described above.

 A second strategy would be the SmoothingKernels package which appears
 to have a different function name for each kernel.

This might be fine too.  However, to write generic code one has to
resort to higher order functions which are not so performant at the
moment.

 So my question: Is there a preferred julian way of doing things, or is it 
 a case of whatever seems to be the best fit on a case-by-case basis?

 Cheers,

 Colin



[julia-users] Re: how do we convert an array{Float64,1} in a Float64?

2015-05-18 Thread Sisyphuss
Side note: A[] == A[1]


On Saturday, May 16, 2015 at 9:19:48 PM UTC+2, paul analyst wrote:

 Use []

 julia A=rand(1)
 1-element Array{Float64,1}:
  0.33519

 julia A[]
 0.3351896128863725

 julia


 W dniu piątek, 15 maja 2015 23:18:32 UTC+2 użytkownik Lytu napisał:

 Someone know how to convert an array{Float64,1} in a Float64?
 Thank you



Re: [julia-users] Re: Error: expected Function, got Int64

2015-05-18 Thread Isaiah Norton
(or use `workspace()`)

On Mon, May 18, 2015 at 11:56 AM, Jameson Nash vtjn...@gmail.com wrote:

 at some point you probably entered something like:
 sum = 5

 from that point on, sum refers to 5, rather than the Base.sum function.

 you could restore it by typing
 sum = Base.sum

 or just restart


 On Mon, May 18, 2015 at 11:37 AM James Byars jimmyby...@gmail.com wrote:

 Thank you. I said this in the post below, but is this an issue with Julia
 going forward? The need to restart.


 On Monday, May 18, 2015 at 10:50:28 AM UTC-4, Kristoffer Carlsson wrote:

 This works for me, both in Julia 0.3 and 0.4

 julia function fib_sum_2(x,y,z)
sum(x:x:z) + sum(y:y:z) - sum(lcm(x,y):lcm(x,y):z)
end
 fib_sum_2 (generic function with 1 method)


 julia fib_sum_2(3,5,999)
 233168

 What happens if you restart Julia and try again?





 On Monday, May 18, 2015 at 4:34:11 PM UTC+2, James Byars wrote:

 Hello all,

 I am an education doctoral student who is a self-taught stats and
 programming person. My primary coding and stats experience is with R. I
 have started to attempt Julia and was using the Project Euler questions as
 a way to teach myself the language structure, types, and specifying
 functions. I have been really drawn to Julia because of all the great
 conversations about the language on the YouTube channel. There have been
 several great repositories that share coding examples for each of the
 problems (although Project Euler wants everybody to do it on their own)
 which have been tremendously helpful.

 One of the proposed solutions for Problem #1 have this structure:
 println(sum(3:3:999) + sum(5:5:999) - sum(15:15:999))

 I am trying to make a function of this type of problem so I am not
 bounded by specifying each number every time. So I adapted the solution to
 the following format:

 *function fib_sum_2(x,y,z)*
 *sum(x:x:z) + sum(y:y:z) - sum(lcm(x,y):lcm(x,y):z)*
 *end*

 However, when I try to run the function (fib_sum_2(3,5,999)) I get the
 following error:

 *type: fib_sum_2: in apply, expected Function, got Int64
 while loading In[140], in expression starting on line 1

  in fib_sum_2 at In[137]:2*


 I did attempt to google this problem, but still could not find a source 
 that really explained the problem. I understand that this is a really 
 newbie question and thank you to everyone for their patience and any 
 assistance. If anybody can correct my error or provide resources that 
 might help me with future Euler Project problems that would be great. I 
 feel that I am missing something terribly easy with Julia, but thank you 
 all for any help. Also, I am using IJulia for reference. If I have posted 
 this question in error, can anybody direct me to the right forum?


 With Regards,


 James




Re: [julia-users] Re: Error: expected Function, got Int64

2015-05-18 Thread Tim Holy
You probably did this:

julia x = rand(3)
3-element Array{Float64,1}:
 0.203537 
 0.0976039
 0.425243 

julia sum = 5   # you just borked sum
5

julia sum(x)
ERROR: type: apply: expected Function, got Int64

But notice sum is still there:

julia Base.sum(x)
0.7263840892398132

julia sum = Base.sum
sum (generic function with 13 methods)

julia sum(x)
0.7263840892398132


The ability to treat a function as a variable is very powerful: you can pass 
functions as arguments to other functions.

--Tim

On Monday, May 18, 2015 08:37:54 AM James Byars wrote:
 Thank you. I said this in the post below, but is this an issue with Julia
 going forward? The need to restart.
 
 On Monday, May 18, 2015 at 10:50:28 AM UTC-4, Kristoffer Carlsson wrote:
  This works for me, both in Julia 0.3 and 0.4
  
  julia function fib_sum_2(x,y,z)
  
 sum(x:x:z) + sum(y:y:z) - sum(lcm(x,y):lcm(x,y):z)
 
 end
  
  fib_sum_2 (generic function with 1 method)
  
  
  julia fib_sum_2(3,5,999)
  233168
  
  What happens if you restart Julia and try again?
  
  On Monday, May 18, 2015 at 4:34:11 PM UTC+2, James Byars wrote:
  Hello all,
  
  I am an education doctoral student who is a self-taught stats and
  programming person. My primary coding and stats experience is with R. I
  have started to attempt Julia and was using the Project Euler questions
  as
  a way to teach myself the language structure, types, and specifying
  functions. I have been really drawn to Julia because of all the great
  conversations about the language on the YouTube channel. There have been
  several great repositories that share coding examples for each of the
  problems (although Project Euler wants everybody to do it on their own)
  which have been tremendously helpful.
  
  One of the proposed solutions for Problem #1 have this structure:
  println(sum(3:3:999) + sum(5:5:999) - sum(15:15:999))
  
  I am trying to make a function of this type of problem so I am not
  bounded by specifying each number every time. So I adapted the solution
  to
  the following format:
  
  *function fib_sum_2(x,y,z)*
  *sum(x:x:z) + sum(y:y:z) - sum(lcm(x,y):lcm(x,y):z)*
  *end*
  
  However, when I try to run the function (fib_sum_2(3,5,999)) I get the
  following error:
  
  *type: fib_sum_2: in apply, expected Function, got Int64
  while loading In[140], in expression starting on line 1
  
   in fib_sum_2 at In[137]:2*
  
  I did attempt to google this problem, but still could not find a source
  that really explained the problem. I understand that this is a really
  newbie question and thank you to everyone for their patience and any
  assistance. If anybody can correct my error or provide resources that
  might help me with future Euler Project problems that would be great. I
  feel that I am missing something terribly easy with Julia, but thank you
  all for any help. Also, I am using IJulia for reference. If I have
  posted this question in error, can anybody direct me to the right forum?
  
  
  With Regards,
  
  
  James



Re: [julia-users] Re: Error: expected Function, got Int64

2015-05-18 Thread Jameson Nash
at some point you probably entered something like:
sum = 5

from that point on, sum refers to 5, rather than the Base.sum function.

you could restore it by typing
sum = Base.sum

or just restart


On Mon, May 18, 2015 at 11:37 AM James Byars jimmyby...@gmail.com wrote:

 Thank you. I said this in the post below, but is this an issue with Julia
 going forward? The need to restart.


 On Monday, May 18, 2015 at 10:50:28 AM UTC-4, Kristoffer Carlsson wrote:

 This works for me, both in Julia 0.3 and 0.4

 julia function fib_sum_2(x,y,z)
sum(x:x:z) + sum(y:y:z) - sum(lcm(x,y):lcm(x,y):z)
end
 fib_sum_2 (generic function with 1 method)


 julia fib_sum_2(3,5,999)
 233168

 What happens if you restart Julia and try again?





 On Monday, May 18, 2015 at 4:34:11 PM UTC+2, James Byars wrote:

 Hello all,

 I am an education doctoral student who is a self-taught stats and
 programming person. My primary coding and stats experience is with R. I
 have started to attempt Julia and was using the Project Euler questions as
 a way to teach myself the language structure, types, and specifying
 functions. I have been really drawn to Julia because of all the great
 conversations about the language on the YouTube channel. There have been
 several great repositories that share coding examples for each of the
 problems (although Project Euler wants everybody to do it on their own)
 which have been tremendously helpful.

 One of the proposed solutions for Problem #1 have this structure:
 println(sum(3:3:999) + sum(5:5:999) - sum(15:15:999))

 I am trying to make a function of this type of problem so I am not
 bounded by specifying each number every time. So I adapted the solution to
 the following format:

 *function fib_sum_2(x,y,z)*
 *sum(x:x:z) + sum(y:y:z) - sum(lcm(x,y):lcm(x,y):z)*
 *end*

 However, when I try to run the function (fib_sum_2(3,5,999)) I get the
 following error:

 *type: fib_sum_2: in apply, expected Function, got Int64
 while loading In[140], in expression starting on line 1

  in fib_sum_2 at In[137]:2*


 I did attempt to google this problem, but still could not find a source 
 that really explained the problem. I understand that this is a really 
 newbie question and thank you to everyone for their patience and any 
 assistance. If anybody can correct my error or provide resources that might 
 help me with future Euler Project problems that would be great. I feel that 
 I am missing something terribly easy with Julia, but thank you all for any 
 help. Also, I am using IJulia for reference. If I have posted this question 
 in error, can anybody direct me to the right forum?


 With Regards,


 James




Re: [julia-users] Re: how to replace , to . in Array{Any,2}:

2015-05-18 Thread Paul Analyst

Big thx, but after this code x is no changed
Paul

W dniu 2015-05-17 o 20:23, wild...@gmail.com pisze:

map(e-replace(string(e), ',', '.'), x)

On Saturday, May 16, 2015 at 2:40:05 PM UTC-4, paul analyst wrote:

I have file with decimal separator lika ,
x=readdlm(x.txt,'\t')

julia x=x[2:end,:]
6390x772 Array{Any,2}:

some kolumns looks :
julia x[:,69]
6390-element Array{Any,1}:
 0.0
  0,33
  0,72
  1,09
  0,95
  3,57
  2,27
  2,42



julia replace(x[:,69],',','.')
ERROR: `replace` has no method matching replace(::Array{Any,1},
::Char, ::Char)

julia replace(string(x[:,69],',','.'))
ERROR: `replace` has no method matching replace(::ASCIIString)


how to replace , to . ?

I can repalce all , to .

Paul






[julia-users] Error running dump() on a JLD (HDF5) file containing a DataFrame

2015-05-18 Thread Josef Sachs
Am I doing something wrong?  I get the same error in 0.3.8.
I notice that there is a method with signature
read(::HDF5.HDF5Dataset, ::Type{Array{HDF5.HDF5Compound,N}})
but not
read(::HDF5.HDF5Dataset, ::Type{HDF5.HDF5Compound})

   _
   _   _ _(_)_ |  A fresh approach to technical computing
  (_) | (_) (_)|  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type help() for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.4.0-dev+4825 (2015-05-14 00:12 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit ff35d98 (4 days old master)
|__/   |  x86_64-w64-mingw32

julia using DataFrames

julia df = DataFrame(A = 1:4, B = [M, F, F, M])
4x2 DataFrames.DataFrame
| Row | A | B   |
|-|---|-|
| 1   | 1 | M |
| 2   | 2 | F |
| 3   | 3 | F |
| 4   | 4 | M |

julia using HDF5, JLD

julia file = jldopen(df.jld, w)
Julia data file version 0.1.0: df.jld

julia file[df] = df
4x2 DataFrames.DataFrame
| Row | A | B   |
|-|---|-|
| 1   | 1 | M |
| 2   | 2 | F |
| 3   | 3 | F |
| 4   | 4 | M |

julia close(file)

julia file = jldopen(df.jld, r)
Julia data file version 0.1.0: df.jld

julia dump(file)
JLD.JldFile
  plain: HDF5.HDF5File len 4
_refs: HDF5.HDF5Group len 16
  0001: HDF5Dataset (2,) : 
[HDF5.HDF5ReferenceObj(0x15d8),HDF5.HDF5ReferenceObj(0x2e70)]
  0002: HDF5Dataset () : ERROR: MethodError: `read` has no method 
matching read(::HDF5.HDF5Dataset, ::Type{HDF5.HDF5Compound})
Closest candidates are:
  read{T}(::IO, ::Type{T}, ::Int64, ::Int64...)
  read{T}(::IO, ::Type{T}, ::Integer, ::Integer...)
  read{T}(::Base.AsyncStream, ::Type{T}, ::Tuple{Vararg{Int64}})
  ...
 in dump at C:\Users\s2sajs\.julia\v0.4\HDF5\src\plain.jl:995
 in dump at C:\Users\s2sajs\.julia\v0.4\HDF5\src\plain.jl:1008 (repeats 2 times)

 in xdump at show.jl:762
 in dump at show.jl:882
 in anonymous at show.jl:888
 in with_output_limit at show.jl:1220
 in dump at show.jl:888


Re: [julia-users] Re: how do we convert an array{Float64,1} in a Float64?

2015-05-18 Thread Paul Analyst

But very important !
Paul
W dniu 2015-05-18 o 17:45, Sisyphuss pisze:

Side note: A[] == A[1]


On Saturday, May 16, 2015 at 9:19:48 PM UTC+2, paul analyst wrote:

Use []

julia A=rand(1)
1-element Array{Float64,1}:
 0.33519

julia A[]
0.3351896128863725

julia


W dniu piątek, 15 maja 2015 23:18:32 UTC+2 użytkownik Lytu napisał:

Someone know how to convert an array{Float64,1} in a Float64?
Thank you





[julia-users] Re: sqrt(abs2(x)) Vs abs(x)

2015-05-18 Thread Steven G. Johnson


On Monday, May 18, 2015 at 10:51:48 AM UTC-4, antony schutz wrote:

 Hello, 

 I just discover abs2() function :v 

 And I have to say that i'm really surprised that: 
 sqrt(abs2( x ))  is quicker than  abs( x ) 


Note that the abs(x) function is more robust because it avoids spurious 
overflow when x is large.

For example, if x=1e300, then abs(x) correctly returns x, but abs2(x) is 
Inf (infinity, i.e. it overflowed the largest representable 
double-precision floating-point number), so sqrt(abs2(x)) = sqrt(Inf) = Inf.

For benchmarking, I used:

   function foo!(Y,X,n)
  for i = 1:length(X), j = 1:n
 @inbounds Y[i] = abs(X[i])
  end
  return Y
   end

   function bar!(Y,X,n)
  for i = 1:length(X), j=1:n
 @inbounds Y[i] = sqrt(abs2(X[i]))
  end
  return Y
   end

For real data, I got:

X = rand(10^3); Y = similar(X);
foo!(Y, X, 1); bar!(Y, X, 1); # call once to eliminate JIT cost
@time foo!(Y, X, 1);
@time bar!(Y, X, 1);

elapsed time: 0.003777997 seconds (80 bytes allocated)
elapsed time: 0.041755933 seconds (80 bytes allocated)

i.e. abs was much faster.  For complex data, X = rand(Complex128, 10^3), Y 
= Array(Float64, 10^3), I got:

elapsed time: 0.09278846 seconds (80 bytes allocated)
elapsed time: 0.041389585 seconds (80 bytes allocated)

so in this case sqrt(abs2) was faster (though less robust): the abs 
function is costly because it requires both a branch and a rescaling 
(division) in addition to the square root and mul/adds.  See also the 
hypot(x,y) function.



[julia-users] Tips on parallel performance?

2015-05-18 Thread Jason Morton
Working with a 16 core / 32 thread machine with 32GB ram that presents to 
ubuntu as 32 cores.  I'm trying to understand how to get the best 
performance for embarrassingly parallel tasks.  I want to take a bunch of 
svds in parallel as an example.  The scaling seems to be perfect (6.6 
seconds regardless of number of svds) until about 7 or 8 simultaneous svds, 
at which point it starts to creep up, scaling roughly linearly although 
with high variance, up to 22 seconds for 16 and 47 seconds for 31.

I can confirm that the number of processors being used seems to equals the 
number getting pmapped over by watching htop, so I don't think openblas 
multithreading is the issue.  Memory usage stays low.  Any guess on what is 
going on?  I'm using the generic linux binary julia-79599ada44.  I don't 
think there should be any sending of the matrices but perhaps that is the 
issue.

Probably I am missing something obvious.

 with nprocs = 16 
@time pmap(x-[svd(rand(1000,1000))[2][1] for i in 1:10],[i for i in 1:16])
elapsed time: 22.350466328 seconds (12292776 bytes allocated)
@time map(x-[svd(rand(1000,1000))[2][1] for i in 1:10],[i for i in 1:16])
elapsed time: 91.135322511 seconds (10269056672 bytes allocated, 2.57% gc 
time)

 with nprocs = 31 
#perfect scaling until here (at 6x speedup)
 @time pmap(x-[svd(rand(1000,1000))[2][1] for i in 1:10],[i for i in 1:6])
elapsed time: 6.720786336 seconds (159168 bytes allocated)
@time map(x-[svd(rand(1000,1000))[2][1] for i in 1:10],[i for i in 1:6])
elapsed time: 34.146665292 seconds (3847940044 bytes allocated, 2.46% gc 
time)

#4.5x speedup
@time pmap(x-[svd(rand(1000,1000))[2][1] for i in 1:10],[i for i in 1:16])
elapsed time: 19.819358972 seconds (391056 bytes allocated)
 @time map(x-[svd(rand(1000,1000))[2][1] for i in 1:10],[i for i in 1:16])
elapsed time: 90.688842475 seconds (10260844684 bytes allocated, 2.36% gc 
time)
 
#3.69x speedup
@time pmap(x-[svd(rand(1000,1000))[2][1] for i in 1:10],[i for i in 
1:nprocs()])
elapsed time: 47.411315342 seconds (738616 bytes allocated)
@time map(x-[svd(rand(1000,1000))[2][1] for i in 1:10],[i for i in 
1:nprocs()])
elapsed time: 175.308752879 seconds (19880206220 bytes allocated, 2.34% gc 
time)






[julia-users] Re: Microsoft and Julia (getting to 1.0)

2015-05-18 Thread Tony Kelman
Aside from semver.org, I'm going to guess not yet. But I'm also not privy 
to any private discussions that may have happened within Julia Computing. 
(Hopefully we can avoid there needing to be too many of those related to 
the language itself)


On Monday, May 18, 2015 at 1:41:17 PM UTC-7, Michael Francis wrote:

 Out of interest is there a definition of 1.0 ? 

 On Sunday, May 17, 2015 at 12:29:19 AM UTC-4, Tony Kelman wrote:

 Julia might get Microsoft's attention at some point. You could go vote 
 for 
 http://feedback.azure.com/forums/257792-machine-learning/suggestions/7668225-julia-support-in-azureml-studio,
  
 for one thing.

 The recently-released VS Code editor also looks very nice, and as soon as 
 it supports plugins it would be very worthwhile to look at making a Julia 
 plugin for it.

 I've also recently been in touch with someone from the Microsoft MPI 
 team, it might end up being tractable to get some libraries and Julia 
 packages that use MPI for parallelism to work on Windows too. We'll have to 
 see.

 Regarding getting to Julia 1.0 faster, we also very badly need more 
 influence within the LLVM community. Keno has a large number of patches 
 open to make LLVM and MCJIT work better for Julia, but they're not getting 
 reviewed by enough people. Having Julia Computing get enough resources to 
 hire, say, the top few dozen contributors full-time would absolutely help 
 things advance faster, but I don't think it should be rushed either.


 On Saturday, May 16, 2015 at 6:07:05 PM UTC-7, Eric Forgy wrote:

 Very cool reading: https://github.com/JuliaLang/julia/pull/11196

 I occasionally write code, but to call myself a developer would be an 
 insult to you guys who are doing awesome things :)

 If Julia apps are ever going to target enterprises in a serious manner, 
 there absolutely must be solid support for Windows. I'll keep my eyes open 
 for ways to help out.

 On Saturday, May 16, 2015 at 8:32:31 PM UTC+8, Steven G. Johnson wrote:

 If you are a Windows developer, it would be great to have your help in 
 getting/keeping Julia running smoothly on Windows; only a few of the most 
 active developers use Windows regularly right now.   Probably the biggest 
 improvement will be the transition to libgit (issue #11196), as the 
 package 
 system on Windows is deathly slow at the moment.



Re: [julia-users] Re: Microsoft and Julia (getting to 1.0)

2015-05-18 Thread Isaiah Norton
The milestone flags are useful references (nothing really set in stone at
this point though, AFAIK).

https://github.com/JuliaLang/julia/issues?q=is%3Aopen+is%3Aissue+milestone%3A0.5
https://github.com/JuliaLang/julia/issues?q=is%3Aopen+is%3Aissue+milestone%3A1.0


On Mon, May 18, 2015 at 6:19 PM, Tony Kelman t...@kelman.net wrote:

 Aside from semver.org, I'm going to guess not yet. But I'm also not privy
 to any private discussions that may have happened within Julia Computing.
 (Hopefully we can avoid there needing to be too many of those related to
 the language itself)


 On Monday, May 18, 2015 at 1:41:17 PM UTC-7, Michael Francis wrote:

 Out of interest is there a definition of 1.0 ?

 On Sunday, May 17, 2015 at 12:29:19 AM UTC-4, Tony Kelman wrote:

 Julia might get Microsoft's attention at some point. You could go vote
 for
 http://feedback.azure.com/forums/257792-machine-learning/suggestions/7668225-julia-support-in-azureml-studio,
 for one thing.

 The recently-released VS Code editor also looks very nice, and as soon
 as it supports plugins it would be very worthwhile to look at making a
 Julia plugin for it.

 I've also recently been in touch with someone from the Microsoft MPI
 team, it might end up being tractable to get some libraries and Julia
 packages that use MPI for parallelism to work on Windows too. We'll have to
 see.

 Regarding getting to Julia 1.0 faster, we also very badly need more
 influence within the LLVM community. Keno has a large number of patches
 open to make LLVM and MCJIT work better for Julia, but they're not getting
 reviewed by enough people. Having Julia Computing get enough resources to
 hire, say, the top few dozen contributors full-time would absolutely help
 things advance faster, but I don't think it should be rushed either.


 On Saturday, May 16, 2015 at 6:07:05 PM UTC-7, Eric Forgy wrote:

 Very cool reading: https://github.com/JuliaLang/julia/pull/11196

 I occasionally write code, but to call myself a developer would be an
 insult to you guys who are doing awesome things :)

 If Julia apps are ever going to target enterprises in a serious manner,
 there absolutely must be solid support for Windows. I'll keep my eyes open
 for ways to help out.

 On Saturday, May 16, 2015 at 8:32:31 PM UTC+8, Steven G. Johnson wrote:

 If you are a Windows developer, it would be great to have your help in
 getting/keeping Julia running smoothly on Windows; only a few of the most
 active developers use Windows regularly right now.   Probably the biggest
 improvement will be the transition to libgit (issue #11196), as the 
 package
 system on Windows is deathly slow at the moment.




Re: [julia-users] Best way in Julia to build a set of unique values?

2015-05-18 Thread Jacob Quinn
You could also take a look at JudyDicts.jl, which wrap the corresponding C
library. Supposedly, it's one of the most highly optimized Dict
implementations anywhere. I think the Julia package may need an update,
however.

https://github.com/tanmaykm/JudyDicts.jl

-Jacob

On Mon, May 18, 2015 at 4:07 PM, Steven G. Johnson stevenj@gmail.com
wrote:

 Scott, this looks pretty much exactly like what Tim's example does: you
 have a dictionary (aka associative array, aka mapping, depending on your
 terminology) mapping keys to a counter.

 Dicts are reasonably fast in Julia, although they could certainly be
 further optimized (like almost anything).


Re: [julia-users] Best way in Julia to build a set of unique values?

2015-05-18 Thread Yichao Yu
On Mon, May 18, 2015 at 5:24 PM, Scott Jones scott.paul.jo...@gmail.com wrote:
 I suppose I could use a set simply to determine if it was present or not,
 and then push! to another array if not present... just didn't seem as
 efficient as what I'm used to...

Why does it have to be an array? And what data structure do you use in
other languages?


 On Monday, May 18, 2015 at 4:53:02 PM UTC-4, Jameson wrote:

 use a Set?
 http://docs.julialang.org/en/latest/stdlib/collections/?highlight=set

 On Mon, May 18, 2015 at 4:46 PM Scott Jones scott.pa...@gmail.com wrote:

 I would like to be able to do the following in Julia:
 Take a UInt64 (or UInt128, for that matter), and add it to an array, if
 it is not already present, returning the index.
 (This would be trivial in the language I used to work on, and I think it
 probably is in Julia as well, but I haven't found the right data structure
 yet...)
 What would be the best performing way of handling that?
 What if, instead of an UInt64 or UInt128, I had an array of bytes (like
 128 or 256)?  What would be the best way for that?

 Thanks, Scott


Re: [julia-users] Best way in Julia to build a set of unique values?

2015-05-18 Thread Steven G. Johnson
Scott, this looks pretty much exactly like what Tim's example does: you have a 
dictionary (aka associative array, aka mapping, depending on your terminology) 
mapping keys to a counter. 

Dicts are reasonably fast in Julia, although they could certainly be further 
optimized (like almost anything). 

Re: [julia-users] Best way in Julia to build a set of unique values?

2015-05-18 Thread Jameson Nash
use a Set?
http://docs.julialang.org/en/latest/stdlib/collections/?highlight=set

On Mon, May 18, 2015 at 4:46 PM Scott Jones scott.paul.jo...@gmail.com
wrote:

 I would like to be able to do the following in Julia:
 Take a UInt64 (or UInt128, for that matter), and add it to an array, if it
 is not already present, returning the index.
 (This would be trivial in the language I used to work on, and I think it
 probably is in Julia as well, but I haven't found the right data structure
 yet...)
 What would be the best performing way of handling that?
 What if, instead of an UInt64 or UInt128, I had an array of bytes (like
 128 or 256)?  What would be the best way for that?

 Thanks, Scott



Re: [julia-users] Best way in Julia to build a set of unique values?

2015-05-18 Thread Scott Jones
How well do Dict’s perform currently in Julia?  I hope pretty well!  Thanks, 
that’s more what I needed…

-Scott
 On May 18, 2015, at 5:34 PM, Tim Holy tim.h...@gmail.com wrote:
 
 If you really want to get the index back, perhaps better might be a dict:
 
 counter = 0
 d = Dict{KeyType,Int}()
 for item in list
idx = get(d, item, counter+1)
if idx  counter
counter += 1
end
# Do whatever you plan to do with idx
 end
 
 --Tim
 
 On Monday, May 18, 2015 02:24:25 PM Scott Jones wrote:
 I suppose I could use a set simply to determine if it was present or not,
 and then push! to another array if not present... just didn't seem as
 efficient as what I'm used to...
 
 On Monday, May 18, 2015 at 4:53:02 PM UTC-4, Jameson wrote:
 use a Set?
 http://docs.julialang.org/en/latest/stdlib/collections/?highlight=set
 
 On Mon, May 18, 2015 at 4:46 PM Scott Jones scott.pa...@gmail.com
 
 javascript: wrote:
 I would like to be able to do the following in Julia:
 Take a UInt64 (or UInt128, for that matter), and add it to an array, if
 it is not already present, returning the index.
 (This would be trivial in the language I used to work on, and I think it
 probably is in Julia as well, but I haven't found the right data
 structure
 yet...)
 What would be the best performing way of handling that?
 What if, instead of an UInt64 or UInt128, I had an array of bytes (like
 128 or 256)?  What would be the best way for that?
 
 Thanks, Scott
 



Re: [julia-users] Best way in Julia to build a set of unique values?

2015-05-18 Thread Tim Holy
As long as the dict is concretely typed, it should be pretty good. (I can't 
comment about string keys, but you probably could! I think Symbols are more 
performant than strings for indexing.)

Also, small correction: I should have used get! instead of get. You want to 
set that new value in the Dict.

--Tim

On Monday, May 18, 2015 05:37:00 PM Scott Jones wrote:
 How well do Dict’s perform currently in Julia?  I hope pretty well!  Thanks,
 that’s more what I needed…
 
 -Scott
 
  On May 18, 2015, at 5:34 PM, Tim Holy tim.h...@gmail.com wrote:
  
  If you really want to get the index back, perhaps better might be a dict:
  
  counter = 0
  d = Dict{KeyType,Int}()
  for item in list
  
 idx = get(d, item, counter+1)
 if idx  counter
 
 counter += 1
 
 end
 # Do whatever you plan to do with idx
  
  end
  
  --Tim
  
  On Monday, May 18, 2015 02:24:25 PM Scott Jones wrote:
  I suppose I could use a set simply to determine if it was present or not,
  and then push! to another array if not present... just didn't seem as
  efficient as what I'm used to...
  
  On Monday, May 18, 2015 at 4:53:02 PM UTC-4, Jameson wrote:
  use a Set?
  http://docs.julialang.org/en/latest/stdlib/collections/?highlight=set
  
  On Mon, May 18, 2015 at 4:46 PM Scott Jones scott.pa...@gmail.com
  
  javascript: wrote:
  I would like to be able to do the following in Julia:
  Take a UInt64 (or UInt128, for that matter), and add it to an array, if
  it is not already present, returning the index.
  (This would be trivial in the language I used to work on, and I think
  it
  probably is in Julia as well, but I haven't found the right data
  structure
  yet...)
  What would be the best performing way of handling that?
  What if, instead of an UInt64 or UInt128, I had an array of bytes (like
  128 or 256)?  What would be the best way for that?
  
  Thanks, Scott



Re: [julia-users] Best way in Julia to build a set of unique values?

2015-05-18 Thread Scott Jones
I suppose I could use a set simply to determine if it was present or not, 
and then push! to another array if not present... just didn't seem as 
efficient as what I'm used to...

On Monday, May 18, 2015 at 4:53:02 PM UTC-4, Jameson wrote:

 use a Set? 
 http://docs.julialang.org/en/latest/stdlib/collections/?highlight=set

 On Mon, May 18, 2015 at 4:46 PM Scott Jones scott.pa...@gmail.com 
 javascript: wrote:

 I would like to be able to do the following in Julia:
 Take a UInt64 (or UInt128, for that matter), and add it to an array, if 
 it is not already present, returning the index.
 (This would be trivial in the language I used to work on, and I think it 
 probably is in Julia as well, but I haven't found the right data structure 
 yet...)
 What would be the best performing way of handling that?
 What if, instead of an UInt64 or UInt128, I had an array of bytes (like 
 128 or 256)?  What would be the best way for that?

 Thanks, Scott



[julia-users] Best way in Julia to build a set of unique values?

2015-05-18 Thread Scott Jones
I would like to be able to do the following in Julia:
Take a UInt64 (or UInt128, for that matter), and add it to an array, if it 
is not already present, returning the index.
(This would be trivial in the language I used to work on, and I think it 
probably is in Julia as well, but I haven't found the right data structure 
yet...)
What would be the best performing way of handling that?
What if, instead of an UInt64 or UInt128, I had an array of bytes (like 128 
or 256)?  What would be the best way for that?

Thanks, Scott


Re: [julia-users] Best way in Julia to build a set of unique values?

2015-05-18 Thread Scott Jones


On Monday, May 18, 2015 at 5:31:18 PM UTC-4, Yichao Yu wrote:

 On Mon, May 18, 2015 at 5:24 PM, Scott Jones scott.pa...@gmail.com 
 javascript: wrote: 
  I suppose I could use a set simply to determine if it was present or 
 not, 
  and then push! to another array if not present... just didn't seem as 
  efficient as what I'm used to... 

 Why does it have to be an array? And what data structure do you use in 
 other languages? 


In COS (CachéObjectScript... i.e. 21st century Mumps), I would have written 
something like:

If '$data(arr(key),index) { // If the array already has the key, it is set 
into the variable index, otherwise:
Set arr(key) = $Increment(index) // atomically increment index, and set 
the key to that value in the array
}
// Do whatever I want with the index (usually I also set up a reverse 
mapping, i.e.:
Set index(index) = key

The nice thing in COS, all I have to do to make that persistent, and shared 
across a system (or also distributed to other systems), is add a ^ before 
the arrays or values...
`^arr(key)` and `$increment(^index)` and `^index(^index)`.
Very very fast too...


  
  On Monday, May 18, 2015 at 4:53:02 PM UTC-4, Jameson wrote: 
  
  use a Set? 
  http://docs.julialang.org/en/latest/stdlib/collections/?highlight=set 
  
  On Mon, May 18, 2015 at 4:46 PM Scott Jones scott.pa...@gmail.com 
 wrote: 
  
  I would like to be able to do the following in Julia: 
  Take a UInt64 (or UInt128, for that matter), and add it to an array, 
 if 
  it is not already present, returning the index. 
  (This would be trivial in the language I used to work on, and I think 
 it 
  probably is in Julia as well, but I haven't found the right data 
 structure 
  yet...) 
  What would be the best performing way of handling that? 
  What if, instead of an UInt64 or UInt128, I had an array of bytes 
 (like 
  128 or 256)?  What would be the best way for that? 
  
  Thanks, Scott 



Re: [julia-users] SharedArray definition and assignation of values. Is this behavior a bug?

2015-05-18 Thread Jacob Quinn
I'm actually just about to do another round of windows testing on #11280,
so I'll test this out as well. Thanks for the report!

-Jacob

On Mon, May 18, 2015 at 6:27 PM, Sebastian Souyris 
sebastian.souy...@gmail.com wrote:

 It seems that there is a bug when you define several SharedArray in one
 call (for example using include(file.jl)). Or maybe I'm missing
 something about how to use SharedArray. I'm using Windows 7. Let me explain
 with an example:

 This code has no problem. It assign correctly the values of SharedArrays a
 and b:

 ##
 julia a = SharedArray(Float64, (2));
 julia b = SharedArray(Float64, (2));
 julia for i in 1:2
 a[i] = i
 end
 julia for i in 1:2
 b[i] = i+2
 end
 julia a
 2-element SharedArray{Float64,1}:
  1.0
  2.0
 julia b
 2-element SharedArray{Float64,1}:
  3.0
  4.0
 ##

 But the following code has a problem.  It assign incorrectly the same
 value to a and b:

 ##
 julia a = SharedArray(Float64, (2));b = SharedArray(Float64, (2));

 julia for i in 1:2
 a[i] = i
 end

 julia for i in 1:2
 b[i] = i+2
 end

 julia a
 2-element SharedArray{Float64,1}:
  3.0
  4.0

 julia b
 2-element SharedArray{Float64,1}:
  3.0
  4.0
 ##

 If you define multiple SharedArray in one call, the values of all the
 SharedArrays of that call are equal to the values of the last SharedArray that
 was defined and has assigned values.

 Is this behavior expected? Or is it a bug?


 Thanks!




[julia-users] Re: GSoC 2015 with JuliaQuantum

2015-05-18 Thread Viral Shah
This is amazing! Do keep us posted on how things go.

-viral

On Tuesday, May 19, 2015 at 4:42:39 AM UTC+5:30, Amit Jamadagni wrote:

 Hello everyone,
I am most happy to inform that my project titled JuliaQuantum : 
 Framework for Solvers 
 https://www.google-melange.com/gsoc/project/details/google/gsoc2015/amitjamadagni/5700735861784576
  has 
 been selected for GSoC 2015 
 https://www.google-melange.com/gsoc/homepage/google/gsoc2015 under 
 NumFOCUS umbrella. I will be working on creating a framework for solvers 
 used in Quantum Mechanics under the mentor-ship of Alexander Croy and 
 support from the Julia Quantum team. The project will be using 
 implementations from QuBase.jl, ODE.jl, Expokit.jl and also will aim to 
 implement few enhancements in the packages in the course of development. 
 The updates of the project can be followed under the news 
 http://juliaquantum.github.io/news/index.html section on the 
 JuliaQuantum http://juliaquantum.github.io/ site. The end result of the 
 project will be to populate the package QuDynamics.jl 
 https://github.com/JuliaQuantum/QuDynamics.jl with features outlined in 
 the project proposal 
 https://github.com/numfocus/gsoc/blob/7917b4fc08ce73ac74f8a2b9dd7929d994fc4282/2015/proposals/Amit.md.
  
 It would be great to hear from the community on the above mentioned ideas.

 Thanking you,
 Amit. 



[julia-users] Re: Microsoft and Julia (getting to 1.0)

2015-05-18 Thread Viral Shah
Support for Microsoft platforms is obviously important. Not just Azure, but 
even AWS keeps coming out with really cool stuff almost by the day. It is 
tempting to think that an army of engineers can shorten everything and get 
things done quicker (mythical man month?) - but I personally don't think 
that things will work out that way. There is no amount of money that can 
bring all the key contributors to Julia together - they are all doing 
dramatically different things. With $X million, one may be able to assemble 
a different team, but then the outcome will certainly be different.

Even with JuliaBox, we have built things just bit by bit as we need them, 
and that has turned out to be a more useful way to think about many of 
these things. It is not just about writing lots of wrappers, but thinking 
about the right abstractions, and that either comes from someone with deep 
experience and thinking, or by actually doing things and reflecting on how 
to do things better.

The question I would rather ask is - what do we want in Julia 1.0, and the 
surrounding ecosystem (IDEs, packages, cloud platforms, software stacks, 
etc.). Like I said, I will shortly clean up what I have written up and post 
it here. From there, we should as a community ask about how to best get 
there - whether it is about finding funds, finding people, finding space, 
or finding pizza - most likely a combination of all these.

-viral

On Saturday, May 16, 2015 at 7:42:30 AM UTC+5:30, Eric Forgy wrote:

 Hi,

 I have never been a huge fan of Microsoft, but I have to admit that with 
 Nadella at the helm, it does seem like an entirely new company doing some 
 pretty amazing and innovative things. Windows 10, Surface Pro 3 and Azure 
 are quickly making a lot of the things we're doing in my FinTech startup 
 obsolete already. I'm increasingly tempted to ride their wave and hitch my 
 startup to MS technologies. 

 Microsoft recently acquired Revolution Analytics 
 http://blogs.technet.com/b/machinelearning/archive/2015/04/06/microsoft-closes-acquisition-of-revolution-analytics.aspx
  
 and have integrated R into the Azure SQL suite, which is pretty awesome. 
 They have also done quite a lot with integrating Python.

 You can guess where I am going with this...

 I can imagine Julia would have to get to 1.0 before Microsoft would 
 consider incorporating Julia directly into their products. 

 I've asked before 
 http://blogs.technet.com/b/machinelearning/archive/2015/04/06/microsoft-closes-acquisition-of-revolution-analytics.aspx,
  
 and Keno estimated back in January that 1.0 is 2 years away. In light of 
 the recent discussions around Julia Computing, can you think of ways this 
 could be accelerated or is it just something that takes that much time? For 
 example, if significant funds were raised and the core team could build a 
 small army of senior full-time developers, could this get done quicker?

 If we allow ourselves to dream, how much funds would be required and what 
 is the shortest path to 1.0?

 With US$X million, we could produce Julia 1.0 in Y months.

 What is the most optimistic X and Y (allowing ourselves to dream)?

 Best regards,
 Eric



Re: [julia-users] Preferred way to structure a module

2015-05-18 Thread colintbowers
Just wanted to say thanks for responding, and if you do encounter that 
thread again in your travels, I'd be very grateful if you could post a link 
(but please don't waste time searching for it on my behalf).

Cheers,

Colin

On Monday, 18 May 2015 18:22:06 UTC+10, Mauro wrote:

  For my own modules, I've tended to follow the example of the 
 Distributions 
  and Distances package, where each distribution (or distance) is its own 
  type, and then there is a small number of generic functions (eg 
 evaluate) 
  that use multiple dispatch to return the appropriate value depending on 
 the 
  input type. 

 If I recall correctly, recent discussions on this list suggest that many 
 (but not all) see this as the most julian pattern.  I think it may have 
 been discussed within one of those recent super-long threads. 

  But I've seen source code in other packages that indicates a different 
  strategy. For example, the Optim package appears (and please correct 
  me if I'm wrong - I'm definitely not an expert) to have a different 
  Symbol for each optimisation algorithm, and then uses if elseif 
  statements to ensure the right optimisation procedure is called. 

 (Not having looked at the code) I would, instead of `:alg_a` use 
 `AlgTyp{:a}` and dispatch on it, i.e. the method described above. 

  A second strategy would be the SmoothingKernels package which appears 
  to have a different function name for each kernel. 

 This might be fine too.  However, to write generic code one has to 
 resort to higher order functions which are not so performant at the 
 moment. 

  So my question: Is there a preferred julian way of doing things, or is 
 it 
  a case of whatever seems to be the best fit on a case-by-case basis? 
  
  Cheers, 
  
  Colin 



Re: [julia-users] SharedArray definition and assignation of values. Is this behavior a bug?

2015-05-18 Thread Jacob Quinn
I'm not able to reproduce the above behavior with my latest changes to
#11280, so that's a good sign!

If you're feeling ambitious/able, feel free to give that PR a spin to see
if it fixes it for you as well.

-Jacob

On Mon, May 18, 2015 at 8:55 PM, Jacob Quinn quinn.jac...@gmail.com wrote:

 I'm actually just about to do another round of windows testing on #11280,
 so I'll test this out as well. Thanks for the report!

 -Jacob

 On Mon, May 18, 2015 at 6:27 PM, Sebastian Souyris 
 sebastian.souy...@gmail.com wrote:

 It seems that there is a bug when you define several SharedArray in one
 call (for example using include(file.jl)). Or maybe I'm missing
 something about how to use SharedArray. I'm using Windows 7. Let me explain
 with an example:

 This code has no problem. It assign correctly the values of SharedArrays
 a and b:

 ##
 julia a = SharedArray(Float64, (2));
 julia b = SharedArray(Float64, (2));
 julia for i in 1:2
 a[i] = i
 end
 julia for i in 1:2
 b[i] = i+2
 end
 julia a
 2-element SharedArray{Float64,1}:
  1.0
  2.0
 julia b
 2-element SharedArray{Float64,1}:
  3.0
  4.0
 ##

 But the following code has a problem.  It assign incorrectly the same
 value to a and b:

 ##
 julia a = SharedArray(Float64, (2));b = SharedArray(Float64, (2));

 julia for i in 1:2
 a[i] = i
 end

 julia for i in 1:2
 b[i] = i+2
 end

 julia a
 2-element SharedArray{Float64,1}:
  3.0
  4.0

 julia b
 2-element SharedArray{Float64,1}:
  3.0
  4.0
 ##

 If you define multiple SharedArray in one call, the values of all the
 SharedArrays of that call are equal to the values of the last
 SharedArray that was defined and has assigned values.

 Is this behavior expected? Or is it a bug?


 Thanks!





[julia-users] Newbie question; convert a hex string to base64

2015-05-18 Thread Martin Becze
Hello I'm just starting with julia and im stuck on converting a hex string 
to base64 encoded string. How would you do this with julia?

Thanks,
-Martin


Re: [julia-users] SharedArray definition and assignation of values. Is this behavior a bug?

2015-05-18 Thread Jameson Nash
this definitely looks like a bug. can you post an issue? it might be good
to see if https://github.com/JuliaLang/julia/pull/11280 fixes it as well.

On Mon, May 18, 2015 at 10:44 PM Sebastian Souyris 
sebastian.souy...@gmail.com wrote:

 It seems that there is a bug when you define several SharedArray in one
 call (for example using include(file.jl)). Or maybe I'm missing
 something about how to use SharedArray. I'm using Windows 7. Let me explain
 with an example:

 This code has no problem. It assign correctly the values of SharedArrays a
 and b:

 ##
 julia a = SharedArray(Float64, (2));
 julia b = SharedArray(Float64, (2));
 julia for i in 1:2
 a[i] = i
 end
 julia for i in 1:2
 b[i] = i+2
 end
 julia a
 2-element SharedArray{Float64,1}:
  1.0
  2.0
 julia b
 2-element SharedArray{Float64,1}:
  3.0
  4.0
 ##

 But the following code has a problem.  It assign incorrectly the same
 value to a and b:

 ##
 julia a = SharedArray(Float64, (2));b = SharedArray(Float64, (2));

 julia for i in 1:2
 a[i] = i
 end

 julia for i in 1:2
 b[i] = i+2
 end

 julia a
 2-element SharedArray{Float64,1}:
  3.0
  4.0

 julia b
 2-element SharedArray{Float64,1}:
  3.0
  4.0
 ##

 If you define multiple SharedArray in one call, the values of all the
 SharedArrays of that call are equal to the values of the last SharedArray that
 was defined and has assigned values.

 Is this behavior expected? Or is it a bug?


 Thanks!




Re: [julia-users] Re: Microsoft and Julia (getting to 1.0)

2015-05-18 Thread Viral Shah
On Julia 1.0 and related tools, I recently put something together for a 
grant proposal, basically summarizing various issues on github and 
discussions we have been having. I need to do some cleanup, but will share 
something here in a few days. We can then iterate on it and publish it as a 
roadmap on julialang.org.

-viral

On Tuesday, May 19, 2015 at 3:57:17 AM UTC+5:30, Isaiah wrote:

 The milestone flags are useful references (nothing really set in stone at 
 this point though, AFAIK).


 https://github.com/JuliaLang/julia/issues?q=is%3Aopen+is%3Aissue+milestone%3A0.5

 https://github.com/JuliaLang/julia/issues?q=is%3Aopen+is%3Aissue+milestone%3A1.0


 On Mon, May 18, 2015 at 6:19 PM, Tony Kelman t...@kelman.net wrote:

 Aside from semver.org, I'm going to guess not yet. But I'm also not 
 privy to any private discussions that may have happened within Julia 
 Computing. (Hopefully we can avoid there needing to be too many of those 
 related to the language itself)


 On Monday, May 18, 2015 at 1:41:17 PM UTC-7, Michael Francis wrote:

 Out of interest is there a definition of 1.0 ? 

 On Sunday, May 17, 2015 at 12:29:19 AM UTC-4, Tony Kelman wrote:

 Julia might get Microsoft's attention at some point. You could go vote 
 for 
 http://feedback.azure.com/forums/257792-machine-learning/suggestions/7668225-julia-support-in-azureml-studio,
  
 for one thing.

 The recently-released VS Code editor also looks very nice, and as soon 
 as it supports plugins it would be very worthwhile to look at making a 
 Julia plugin for it.

 I've also recently been in touch with someone from the Microsoft MPI 
 team, it might end up being tractable to get some libraries and Julia 
 packages that use MPI for parallelism to work on Windows too. We'll have 
 to 
 see.

 Regarding getting to Julia 1.0 faster, we also very badly need more 
 influence within the LLVM community. Keno has a large number of patches 
 open to make LLVM and MCJIT work better for Julia, but they're not getting 
 reviewed by enough people. Having Julia Computing get enough resources to 
 hire, say, the top few dozen contributors full-time would absolutely help 
 things advance faster, but I don't think it should be rushed either.


 On Saturday, May 16, 2015 at 6:07:05 PM UTC-7, Eric Forgy wrote:

 Very cool reading: https://github.com/JuliaLang/julia/pull/11196

 I occasionally write code, but to call myself a developer would be 
 an insult to you guys who are doing awesome things :)

 If Julia apps are ever going to target enterprises in a serious 
 manner, there absolutely must be solid support for Windows. I'll keep my 
 eyes open for ways to help out.

 On Saturday, May 16, 2015 at 8:32:31 PM UTC+8, Steven G. Johnson wrote:

 If you are a Windows developer, it would be great to have your help 
 in getting/keeping Julia running smoothly on Windows; only a few of the 
 most active developers use Windows regularly right now.   Probably the 
 biggest improvement will be the transition to libgit (issue #11196), as 
 the 
 package system on Windows is deathly slow at the moment.




[julia-users] Re: Best way in Julia to build a set of unique values?

2015-05-18 Thread Scott Jones
Thanks everybody, Dicts are working fine now, for my tests with UInt64 and 
UInt128s as keys... (I haven't benchmarked it against my old stuff, I'll 
have to do that at some point ;-) )
What I'm doing right now isn't really performance critical (I, of course, 
am obsessively interested in any performance topic!), I am testing building 
different data structures for handling
the tasks that utf8proc is used for right now... that won't take 1.5MB, and 
will be much faster... (in the database world, a lot of what I'm doing is 
changing it from a row store to a column store...).
I don't know how much time in compiling Julia is spent on seeing if a 
character is a start identifier character or a plain identifier 
character... but this should speed those checks up quite a bit.
BTW: Jacob  Steven, you are both very evil, pointing me at another need 
performance thing to get obsessed about!  Now I'll start thinking about 
Judy as well as Julia... (Judy is LGPL, which is OK
for making a wrapper, but I don't think that would allow me to rewrite it 
in Julia, would it?)



Re: [julia-users] Best way in Julia to build a set of unique values?

2015-05-18 Thread Steven G. Johnson


On Monday, May 18, 2015 at 6:26:06 PM UTC-4, Jacob Quinn wrote:

 You could also take a look at JudyDicts.jl, which wrap the corresponding C 
 library. Supposedly, it's one of the most highly optimized Dict 
 implementations anywhere. I think the Julia package may need an update, 
 however.

 https://github.com/tanmaykm/JudyDicts.jl


The benchmark numbers on that page make the Julia Dict look pretty darn 
good. 


Re: [julia-users] Re: how to replace , to . in Array{Any,2}:

2015-05-18 Thread elextr
Strings are immutable, so replace can't change the existing string, so it 
returns a new string, so map returns a new array which you have to assign 
back to x

Cheers
Lex


On Tuesday, May 19, 2015 at 2:10:18 AM UTC+10, paul analyst wrote:

  Big thx, but after this code x is no changed
 Paul

 W dniu 2015-05-17 o 20:23, wil...@gmail.com javascript: pisze:
  
 map(e-replace(string(e), ',', '.'), x)

 On Saturday, May 16, 2015 at 2:40:05 PM UTC-4, paul analyst wrote: 

 I have file with decimal separator lika ,
 x=readdlm(x.txt,'\t')

 julia x=x[2:end,:]
 6390x772 Array{Any,2}:

 some kolumns looks :
 julia x[:,69]
 6390-element Array{Any,1}:
  0.0
   0,33
   0,72
   1,09
   0,95
   3,57
   2,27
   2,42



 julia replace(x[:,69],',','.')
 ERROR: `replace` has no method matching replace(::Array{Any,1}, ::Char, 
 ::Char)

 julia replace(string(x[:,69],',','.'))
 ERROR: `replace` has no method matching replace(::ASCIIString)


 how to replace , to . ?

 I can repalce all , to . 

 Paul


   
  

Re: [julia-users] (autoconf | cmake) USE_SYSTEM_LLVM=1 Cxx.jl

2015-05-18 Thread Isaiah Norton

 1) I would like to compile LLVM with cmake as I'm used to... which flags I
 shoud use ?


see `deps/llvm-svn/build_Release/config.log` for the flags we pass in, and
try to mirror at least some of those.

2) Maybe there is some trick : llvm-config --cxxflags can give flags
 different from the llvm compilation flags


I don't follow...

 3) Is there, in general, a one-to-one correspondance between cmake flags
 and configure flags ? and particularly for llvm ?


It depends on the flags. CMake does a lot of platform detection so some
flags may not be necessary.

3) at the end, can we adapt the build of Cxx.jl for an external LLVM ?
 because Pkg.clone(...) and the Pkg.build(...) require the internal llvm.


Provided you have also built LLDB and Clang with compatible flags, I don't
see any reason why not. I believe the Cxx.jl build script just uses
llvm-config, but you might need to teach it where to find some things, if
it makes any hard-coded assumptions.

4) bonus question : is it avoidable , the fact that sagemath comes with his
 own python, youcompleteme (vim plugin) comes with it's own llvm/clang,
 cling (cern interpreter) comes with it's own llvm/clang


No idea about Sage/Python, but with respect to Linux and LLVM, part of the
issue is that some distributions are militant about bumping LLVM versions
without realizing how much the LLVM API changes from version to version.
(another issue is that getting patches in to LLVM can sometimes be
slow/difficult, so groups like Cling maintain their own fork, as we
unfortunately may have to do)

Relatedly, see: https://github.com/JuliaLang/julia/pull/9422 (although IIRC
it is not driving the LLVM CMake build directly yet)


[julia-users] Re: Microsoft and Julia (getting to 1.0)

2015-05-18 Thread Michael Francis
Out of interest is there a definition of 1.0 ? 

On Sunday, May 17, 2015 at 12:29:19 AM UTC-4, Tony Kelman wrote:

 Julia might get Microsoft's attention at some point. You could go vote for 
 http://feedback.azure.com/forums/257792-machine-learning/suggestions/7668225-julia-support-in-azureml-studio,
  
 for one thing.

 The recently-released VS Code editor also looks very nice, and as soon as 
 it supports plugins it would be very worthwhile to look at making a Julia 
 plugin for it.

 I've also recently been in touch with someone from the Microsoft MPI team, 
 it might end up being tractable to get some libraries and Julia packages 
 that use MPI for parallelism to work on Windows too. We'll have to see.

 Regarding getting to Julia 1.0 faster, we also very badly need more 
 influence within the LLVM community. Keno has a large number of patches 
 open to make LLVM and MCJIT work better for Julia, but they're not getting 
 reviewed by enough people. Having Julia Computing get enough resources to 
 hire, say, the top few dozen contributors full-time would absolutely help 
 things advance faster, but I don't think it should be rushed either.


 On Saturday, May 16, 2015 at 6:07:05 PM UTC-7, Eric Forgy wrote:

 Very cool reading: https://github.com/JuliaLang/julia/pull/11196

 I occasionally write code, but to call myself a developer would be an 
 insult to you guys who are doing awesome things :)

 If Julia apps are ever going to target enterprises in a serious manner, 
 there absolutely must be solid support for Windows. I'll keep my eyes open 
 for ways to help out.

 On Saturday, May 16, 2015 at 8:32:31 PM UTC+8, Steven G. Johnson wrote:

 If you are a Windows developer, it would be great to have your help in 
 getting/keeping Julia running smoothly on Windows; only a few of the most 
 active developers use Windows regularly right now.   Probably the biggest 
 improvement will be the transition to libgit (issue #11196), as the package 
 system on Windows is deathly slow at the moment.



Re: [julia-users] Best way in Julia to build a set of unique values?

2015-05-18 Thread Tim Holy
If you really want to get the index back, perhaps better might be a dict:

counter = 0
d = Dict{KeyType,Int}()
for item in list
idx = get(d, item, counter+1)
if idx  counter
counter += 1
end
# Do whatever you plan to do with idx
end

--Tim

On Monday, May 18, 2015 02:24:25 PM Scott Jones wrote:
 I suppose I could use a set simply to determine if it was present or not,
 and then push! to another array if not present... just didn't seem as
 efficient as what I'm used to...
 
 On Monday, May 18, 2015 at 4:53:02 PM UTC-4, Jameson wrote:
  use a Set?
  http://docs.julialang.org/en/latest/stdlib/collections/?highlight=set
  
  On Mon, May 18, 2015 at 4:46 PM Scott Jones scott.pa...@gmail.com
  
  javascript: wrote:
  I would like to be able to do the following in Julia:
  Take a UInt64 (or UInt128, for that matter), and add it to an array, if
  it is not already present, returning the index.
  (This would be trivial in the language I used to work on, and I think it
  probably is in Julia as well, but I haven't found the right data
  structure
  yet...)
  What would be the best performing way of handling that?
  What if, instead of an UInt64 or UInt128, I had an array of bytes (like
  128 or 256)?  What would be the best way for that?
  
  Thanks, Scott



Re: [julia-users] Best way in Julia to build a set of unique values?

2015-05-18 Thread Scott Jones
Oops... that should have been:
If '$data(arr(key),index) { // If the array already has the key, it is set 
into the variable index, otherwise:
Set index = $Increment(arr) // atomically increment index, and set the 
key to that value in the array
Set arr(key) = index
Set index(index) = key  // Set up reverse index
}
// Do whatever I want with the index


[julia-users] GSoC 2015 with JuliaQuantum

2015-05-18 Thread Amit Jamadagni
Hello everyone,
   I am most happy to inform that my project titled JuliaQuantum : 
Framework for Solvers 
https://www.google-melange.com/gsoc/project/details/google/gsoc2015/amitjamadagni/5700735861784576
 has 
been selected for GSoC 2015 
https://www.google-melange.com/gsoc/homepage/google/gsoc2015 under 
NumFOCUS umbrella. I will be working on creating a framework for solvers 
used in Quantum Mechanics under the mentor-ship of Alexander Croy and 
support from the Julia Quantum team. The project will be using 
implementations from QuBase.jl, ODE.jl, Expokit.jl and also will aim to 
implement few enhancements in the packages in the course of development. 
The updates of the project can be followed under the news 
http://juliaquantum.github.io/news/index.html section on the JuliaQuantum 
http://juliaquantum.github.io/ site. The end result of the project will 
be to populate the package QuDynamics.jl 
https://github.com/JuliaQuantum/QuDynamics.jl with features outlined in 
the project proposal 
https://github.com/numfocus/gsoc/blob/7917b4fc08ce73ac74f8a2b9dd7929d994fc4282/2015/proposals/Amit.md.
 
It would be great to hear from the community on the above mentioned ideas.

Thanking you,
Amit. 


[julia-users] Preferred way to structure a module

2015-05-18 Thread colintbowers
Hi all,

I'm just writing with a broad question about how to structure a module in 
Julia.

For my own modules, I've tended to follow the example of the Distributions 
and Distances package, where each distribution (or distance) is its own 
type, and then there is a small number of generic functions (eg evaluate) 
that use multiple dispatch to return the appropriate value depending on the 
input type. But I've seen source code in other packages that indicates a 
different strategy. For example, the Optim package appears (and please 
correct me if I'm wrong - I'm definitely not an expert) to have a different 
Symbol for each optimisation algorithm, and then uses if elseif statements 
to ensure the right optimisation procedure is called. A second strategy 
would be the SmoothingKernels package which appears to have a different 
function name for each kernel.

So my question: Is there a preferred julian way of doing things, or is it 
a case of whatever seems to be the best fit on a case-by-case basis?

Cheers,

Colin



[julia-users] Re: Zurich Julia users Meetup needs a new organizer

2015-05-18 Thread Mauro
I just stepped up as the new organizer of Zurich Julia Users Group.  

I plan to hold the next meeting around first or second week of July to give 
a summary of what went on at JuliaCon.  If you're near Zurich and not yet a 
member of the meetup, please join at: 
http://www.meetup.com/Zurich-Julia-User-Group/

Let's keep the rest of the conversation on the meetup list. Mauro

On Monday, May 11, 2015 at 3:02:04 PM UTC+2, Charles Santana wrote:

 Dear all,

 Sorry if this message is not in the scope of the list. 

 The former organizer of Zurich Julia Users Group in Meetup left the 
 function more or less one month ago and until now nobody in the Meetup 
 community accepted to take the organization of the group. I was wondering 
 if there is anybody in this list that is from Zürich and would like to 
 accept this challenge :)

 Without an Organizer, Zurich Julia Users Group will be disabled on May 
 19, 2015.

 More information about the group can be found here: 
 http://www.meetup.com/Zurich-Julia-User-Group/

 Best,

 Charles
 -- 
 Um axé! :)

 --
 Charles Novaes de Santana, PhD
 http://www.imedea.uib-csic.es/~charles