[julia-users] Re: JuliaCon 2015 videos

2015-08-14 Thread Johan Sigfrids
Nice! The quality is much better than last years videos. 

On Thursday, August 13, 2015 at 8:22:09 PM UTC+3, Viral Shah wrote:

 Folks, 

 I am happy to announce that the videos are almost all ready, and I will 
 start posting them in batches. I am starting with Jeff’s talk on our 
 Youtube channel: 

 https://www.youtube.com/user/JuliaLanguage 

 Direct link to the video: 

 https://www.youtube.com/watch?v=xUP3cSKb8sI 

 -viral 





Re: [julia-users] Re: big matrices in Julia

2015-08-14 Thread Charles Novaes de Santana
Hi John,

Thanks for writing and for your suggestion. Sorry if my email was not
clear.

I am working with global discrete maps at resolution varying from 0.5x0.5
to 2.5x2.5 degrees per grid point. Those maps are discrete and represent
the presence or absence of suitable habitat, so many of the points are
actually 0 (the authors of the maps considered some environmental
conditions to define if the sites were suitable or unsuitable habitats for
a given species).

I would like to know the distance between any pair of suitable habitats to
perform a task. My first and simplest try was to use a matrix to record the
distances between any pair of points, and to access this matrix whenever I
needed to use such a distance in my model. This approach woks fine with
lower resolution data, but I understand now that this idea is not that good
when I have so many sites.

I am thinking in different possibilities now. I see at least three (for
sure there are many more :)):

1) to use only the subset of suitable habitats to build the matrix of
distances (and then to use sparse matrix as suggested by Stefan)
2) to use a machine with more memory and try to run my models using the
matrices with all the sites
3) to try another language/library that might work better with such big
amount of data (like python, or R).

Thank you all for your feedbacks and your time!

Best,

Charles


On 14 August 2015 at 02:51, John Gibson johnfgib...@gmail.com wrote:

 What do you mean by distances between sites at different resolution
 maps? The word resolution suggests that the N x N size of the matrix
 results from the discretization of a continuous function into N data points
 and the computation of N^2 distances between those data points. If that's
 the case, there's almost certainly a more compact representation of the
 distance function than the N^2 matrix. For example, you can probably
 represent those N data points with an expansion over  m  N continuous
 expansion functions, and the distance function with an expansion over the m
 x m tensor product of those function.

 John


 On Thursday, August 13, 2015 at 6:26:55 AM UTC-4, Charles Santana wrote:

 Hi all,

 Do you recommend a way to work with bit matrices in Julia. By big I
 mean a 65600 x 65600 symmetric matrix (the upper triangular matrix is equal
 to the lower triangular one).

 I am studying the distances between sites at different resolution maps.
 For low resolution we have few sites, and for big resolution we have more
 sites (S).

 For few sites (small matrices) I was doing something like this:

 S = 100;#number of sites
 M = zeros(S,S);
 for i in 1:(S-1)
for j in (i+1):S
   M[i,j] = dist(i,j);#where dist(i,j) is the distance between sites i
 and j
end
 end

 However, for big matrices I get the following message:

 S=65600;
 M = zeros(S,S);
 ERROR: OutOfMemoryError()
  in call at essentials.jl:201
  in zeros at array.jl:233

 I am using Julia Version 0.4.0-dev+5920 in Ubuntu 14.04.

 Thanks for any tip!

 Best,

 Charles
 --
 Um axé! :)

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




-- 
Um axé! :)

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


[julia-users] Re: JuliaCon 2015 videos

2015-08-14 Thread Viral Shah
Here are the next batch of videos. There is a JuliaCon 2015 channel now:

https://www.youtube.com/playlist?list=PLP8iPy9hna6Sdx4soiGrSefrmOPdUWixM

This batch includes:

David Sanders: Validated numerics in Julia
Patrick Sanan: Using Julia on a Cray Supercomputer
Keno Fischer: Shaving the Yak
Spencer Lyon: Methods, Models, and Moments - Julian Economics with QuantEcon.jl
Randy Zwitch: Everyday Analytics and Visualization

-viral



 On 13-Aug-2015, at 10:51 pm, Viral Shah vi...@mayin.org wrote:
 
 Folks,
 
 I am happy to announce that the videos are almost all ready, and I will start 
 posting them in batches. I am starting with Jeff’s talk on our Youtube 
 channel:
 
 https://www.youtube.com/user/JuliaLanguage
 
 Direct link to the video:
 
 https://www.youtube.com/watch?v=xUP3cSKb8sI
 
 -viral
 
 
 



Re: [julia-users] Creating a bitmapped image with color bar

2015-08-14 Thread Maurizio Tomasi
Tim, does ImageCmap works with latest Julia? I cloned the latest Julia 
repository (0.4), added the Color, Images, and ImageView package and run 
this code (adapted from 
https://groups.google.com/forum/#!searchin/julia-users/%22ImageCmap%22/julia-users/T-i1JdwB4zk/f7FEsh4En4oJ
 
but using PBM format in order not to rely on ImageMagick) with no avail.

using Images, Color 

# build a sample image 
datafloat = reshape(linspace(0.5, 1.5, 6), 200, 300) 
# convert the raw 0.5:1.5 data to a integer type, so we can index 
dataint = iround(Uint8, 254*(datafloat - 0.5) + 1)  # ranges from 1 to 255 
# build our colormap 
b = RGB(0,0,1) 
w = RGB(1,1,1) 
r = RGB(1,0,0) 
cmaprgb = Array(RGB, 255) 
f = linspace(0,1,128) 
cmaprgb[1:128] = [(1-x)*b + x*w for x in f] 
cmaprgb[129:end] = [(1-x)*w + x*r for x in f[2:end]] 

img = ImageCmap(dataint, cmaprgb) 

imwrite(img,image.pbm)

The error is the following:

ERROR: MethodError: `mapinfo` has no method matching 
mapinfo(::Type{Images.ImageMagick}, 
::Images.ImageCmap{Color.RGB{T:Union{AbstractFloat,FixedPointNumbers.FixedPoint}},2,Array{UInt8,2}})
Closest candidates are:
  mapinfo(::Type{Color.RGB{FixedPointNumbers.UfixedBase{UInt8,8}}}, ::Any)
  
mapinfo(::Type{Color.AlphaColorValue{Color.RGB{FixedPointNumbers.UfixedBase{UInt8,8}},FixedPointNumbers.UfixedBase{UInt8,8}}},
 
::Any)
  
mapinfo{CT:Union{Color.AbstractAlphaColorValue{C:Color.ColorValue{T},T:Real},Color.ColorValue{T}}}(::Type{Color.RGB24},
 
::AbstractArray{CT:Union{Color.AbstractAlphaColorValue{C:Color.ColorValue{T},T:Real},Color.ColorValue{T}},N})
  ...
 in imwrite at /home/tomasi/.julia/v0.4/Images/src/io.jl:585
 in anonymous at /home/tomasi/.julia/v0.4/Images/src/io.jl:576
 in open at iostream.jl:114
 in imwrite at /home/tomasi/.julia/v0.4/Images/src/io.jl:573
 in imwrite at /home/tomasi/.julia/v0.4/Images/src/io.jl:186

Before submitting any bug report, I would like to be sure I'm not getting 
something totally wrong.
  Maurizio.

On Thursday, August 13, 2015 at 6:36:44 PM UTC+2, Tim Holy wrote:

 Images (on which ImageView is based) has an ImageCmap (= image colormap) 
 type. You could play with it and see how far you get. 

 Also, see the MapInfo section of 
 http://timholy.github.io/Images.jl/function_reference.html. It's a crazy- 
 powerful mechanism for on-the-fly changes in how data are mapped to screen 
 pixels. 

 --Tim 

 On Thursday, August 13, 2015 05:44:16 AM Maurizio Tomasi wrote: 
  Hi to everybody, 
  
I am the creator of Healpix.jl, a Julia 
  package (https://github.com/ziotom78/Healpix.jl) which implements 
  algorithms related to the Healpix sphere tessellation scheme 
  (http://healpix.jpl.nasa.gov/). The Healpix scheme subdivides a sphere 
 in 
  patches (pixels) of equal area, and it is widely used in cosmology. I am 
  writing to julia-user because I would like to implement visualization 
  functions too, but I haven't figured out what is the best way to 
 implement 
  them. 
  
  So far, I have used the Healpy (https://github.com/healpy/healpy) 
 library 
  as a reference for my implementation. Healpy wraps the original C++ 
 Healpix 
  library in a Python module. It uses Matplotlib to create plots of 
 spherical 
  projections. Internally, both the original C++ Healpix library and 
 Healpy 
  produce such plots by calculating a bitmapped representation of the 
  projection: they convert each (x,y) point in the image plane into a 
  normalized (u,v) coordinate, which is then spherically projected to a 
 point 
  on the sphere's surface. The value associated to the point on the sphere 
  determines the color of the point at (x,y). Here are a few examples of 
  typical Healpix maps: 
 http://healpix.jpl.nasa.gov/images/skymaps/ecl53s.gif 
  (Mollweide 
  projection), http://healpix.sourceforge.net/html/plot_orthpolrot.png 
  (Orthogonal projection). 
  
  The algorithm is really easy to implement in Julia, but I cannot decide 
 how 
  to actually do the following: 
  
  1. How to interactively show the map by e.g. opening a window, or by 
  displaying the image directly in a IJulia notebook? 
  2. The bitmap produced using this algorithm associates a scalar to each 
  pixel, but one usually wants to convert such scalar through a color map 
 in 
  order to have a RGB value to be actually drawable. (I am interested in 
  piecewise-linear maps). 
  3. When displaying the map, how to put a color bar under the map, like 
 in 
  the two links I provided above? 
  
  I have had a look at ImageView, and it look ok for point 1. However, it 
  seems to me that it is oriented towards real image files, because I 
  cannot find support for color maps and color bars. If it is really so, 
 is 
  there any other Julia package which would be relevant for my purposes? 
  
  Thanks a lot, 
Maurizio. 



Re: [julia-users] Re: big matrices in Julia

2015-08-14 Thread Mauro
Maybe you could use a ragged array, which would only store the half of
the matrix you need: https://bitbucket.org/maurow/ragged.jl

On Fri, 2015-08-14 at 01:03, Charles Novaes de Santana 
charles.sant...@gmail.com wrote:
 Dear all,

 Thank you very much for your help and suggestions! I have learned a lot
 from you. Indeed, I want to use this matrix and  not only to read and store
 the data.

 I should have written in my email that I was wondering if Julia had
 something similar to bigmemory and bigalgebra in R (
 https://sites.google.com/site/bigmemoryorg/home/bigalgebra). I know they
 make the allocation of huge amounts of data easier, but I didn't try to do
 it for my data yet (all my project is in Julia, so I want to try it until
 the infinite before using other languages).

 As it seems to be a problem related to my computational resources, my first
 shot will be to try to run it in Julia in a cluster with more memory. If it
 doesn't work I will take some time to think in a different way to solve my
 problem (in worst case I will need to avoid this high-resolution dataset
 for now).

 Thanks a lot!

 Charles

 On 14 August 2015 at 00:18, Marcio Sales marciole...@hotmail.com wrote:

 Charles,
 If your work ends with the matrix, then you could write a binary file on
 dink, and make your loop calculate and hold a bunch of values each time and
 save it to the binary file on disk periodically, until all values are
 saved. Try to make the loop hold as many values as possible, so you don't
 need to save as frequently, to improve performance.

 But If you then need to use this matrix for other operations, then you
 have a problem... unless you buy enough memory, or you can somehow do the
 operation in parts.
 Marcio


 Em quinta-feira, 13 de agosto de 2015 07:26:55 UTC-3, Charles Santana
 escreveu:

 Hi all,

 Do you recommend a way to work with bit matrices in Julia. By big I
 mean a 65600 x 65600 symmetric matrix (the upper triangular matrix is equal
 to the lower triangular one).

 I am studying the distances between sites at different resolution maps.
 For low resolution we have few sites, and for big resolution we have more
 sites (S).

 For few sites (small matrices) I was doing something like this:

 S = 100;#number of sites
 M = zeros(S,S);
 for i in 1:(S-1)
for j in (i+1):S
   M[i,j] = dist(i,j);#where dist(i,j) is the distance between sites i
 and j
end
 end

 However, for big matrices I get the following message:

 S=65600;
 M = zeros(S,S);
 ERROR: OutOfMemoryError()
  in call at essentials.jl:201
  in zeros at array.jl:233

 I am using Julia Version 0.4.0-dev+5920 in Ubuntu 14.04.

 Thanks for any tip!

 Best,

 Charles
 --
 Um axé! :)

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




 -- 
 Um axé! :)



[julia-users] Re: Creating a bitmapped image with color bar

2015-08-14 Thread Maurizio Tomasi
*@Tim Holy*: Many thanks for the reference, I completely missed ImageCmap. 
I'll give it a try.

*@Steven G. Johnson*: Yes, in my everyday work I am actually using my 
Healpix.jl library together with PyPlot. However, I am looking for a 
solution which does not require potential Healpix.jl users to install 
Python. (Part of my colleagues just use IDL under Windows, convincing them 
to install Julia would already be a tough effort!)

Maurizio.

On Thursday, August 13, 2015 at 4:38:58 PM UTC+2, Maurizio Tomasi wrote:

 Hi to everybody,

   I am the creator of Healpix.jl, a Julia package (
 https://github.com/ziotom78/Healpix.jl) which implements algorithms 
 related to the Healpix sphere tessellation scheme (
 http://healpix.jpl.nasa.gov/). The Healpix scheme subdivides a sphere in 
 patches (pixels) of equal area, and it is widely used in cosmology. I am 
 writing to julia-user because I would like to implement visualization 
 functions too, but I haven't figured out what is the best way to implement 
 them.

 So far, I have used the Healpy (https://github.com/healpy/healpy) library 
 as a reference for my implementation. Healpy wraps the original C++ Healpix 
 library in a Python module. It uses Matplotlib to create plots of spherical 
 projections. Internally, both the original C++ Healpix library and Healpy 
 produce such plots by calculating a bitmapped representation of the 
 projection: they convert each (x,y) point in the image plane into a 
 normalized (u,v) coordinate, which is then spherically projected to a point 
 on the sphere's surface. The value associated to the point on the sphere 
 determines the color of the point at (x,y). Here are a few examples of 
 typical Healpix maps: 
 http://healpix.jpl.nasa.gov/images/skymaps/ecl53s.gif (Mollweide 
 projection), http://healpix.sourceforge.net/html/plot_orthpolrot.png 
 (Orthogonal projection).

 The algorithm is really easy to implement in Julia, but I cannot decide 
 how to actually do the following:

 1. How to interactively show the map by e.g. opening a window, or by 
 displaying the image directly in a IJulia notebook?
 2. The bitmap produced using this algorithm associates a scalar to each 
 pixel, but one usually wants to convert such scalar through a color map in 
 order to have a RGB value to be actually drawable. (I am interested in 
 piecewise-linear maps).
 3. When displaying the map, how to put a color bar under the map, like in 
 the two links I provided above?

 I have had a look at ImageView, and it look ok for point 1. However, it 
 seems to me that it is oriented towards real image files, because I 
 cannot find support for color maps and color bars. If it is really so, is 
 there any other Julia package which would be relevant for my purposes?

 Thanks a lot,
   Maurizio.



Re: [julia-users] Re: Can Julia function be serialized and sent by network?

2015-08-14 Thread Jake Bolewski
Andrei Zh

I'm confused.  Have you actually tried?  

julia io = IOBuffer()
IOBuffer(data=UInt8[...], readable=true, writable=true, seekable=true, 
append=false, size=0, maxsize=Inf, ptr=1, mark=-1)

julia foo(x) =  x + 1
foo (generic function with 1 method)

julia serialize(io, foo)

julia seekstart(io)
IOBuffer(data=UInt8[...], readable=true, writable=true, seekable=true, 
append=false, size=9, maxsize=Inf, ptr=1, mark=-1)

julia baz = deserialize(io)
foo (generic function with 1 method)

julia baz(1)
2

The serialization code won't recursively serialize all the of the functions 
dependencies so you will have to send/serialize the code that defines the 
environment (types, constants, Packages, etc).

On Friday, August 14, 2015 at 6:23:23 AM UTC-4, Andrei Zh wrote:

 Yes, but once again, I'm not using Julia workers, but instead completely 
 independent Julia processes, running on different machines and ruled by 
 Spark, not by Julia's ClusterManager. I.e. workflow looks like this:

 1. Julia process 1 starts JVM and connects to Spark master node. 
 2. Julia process 1 sends serialized function to Spark master node. 
 3. Spark master node notifies Spark worker nodes (say, there are N of 
 them) about upcoming computations. 
 4. Each Spark worker node creates its own Julia process, independent from 
 Julia process 1. 
 5. Each Spark worker node receives serialized function and passes it to 
 its local Julia process. 

 So with N workers in Spark cluster, there's in total N+1 Julia processes, 
 and when function in question is created, Julia processes from 2 to N+1 
 don't even exist yet.


 On Friday, August 14, 2015 at 12:35:18 PM UTC+3, Tim Holy wrote:

 If you define the function with @everywhere, it will be defined on all 
 existing 
 workers. Likewise, `using MyPackage` loads the package on all workers. 

 --Tim 

 On Thursday, August 13, 2015 03:10:54 PM Andrei Zh wrote: 
  Ok, after going through serialization code, it's clear that default 
  implementation doesn't support serializing function code, but only its 
  name. For example, here's relevant section from 
  `deserialize(::SerializationState, ::Function)`: 
  mod = deserialize(s)::Module 
  name = deserialize(s)::Symbol 
  if !isdefined(mod,name) 
  return (args...)-error(function $name not defined on process 
  $(myid())) 
  end 
  
  
  
  This doesn't fit my needs (essentially, semantics of Spark), and I 
 guess 
  there's no existing solution for full function serialization. Thus I'm 
  going to write new solution for this. 
  
  So far the best idea I have is to get function's AST and recursively 
  serialize it, catching calls to the other non-Base function and any 
 bound 
  variables. But this looks quite complicated. Is there better / easier 
 way 
  to get portable function's representation? 
  
  On Monday, August 10, 2015 at 11:48:55 PM UTC+3, Andrei Zh wrote: 
   Yes, I incorrectly assumed `serialize` / `deserialize` use JLD 
 format. But 
   anyway, even when I saved the function into example.jls or even 
 plain 
   byte array (using IOBuffer and `takebuf_array`), nothing changed. Am 
 I 
   missing something obvious? 
   
   On Monday, August 10, 2015 at 11:40:03 PM UTC+3, Tim Holy wrote: 
   On Monday, August 10, 2015 01:13:15 PM Tony Kelman wrote: 
Should 
probably use some different extension for that, .jls or something, 
 to 
   
   avoid 
   
confusion. 
   
   Yes. That has been sufficiently confusing in the past, we even cover 
 this 
   here: 
   
   
 https://github.com/JuliaLang/JLD.jl#saving-and-loading-variables-in-julia 
   -data-format-jld 
   
   --Tim 
   
On Monday, August 10, 2015 at 12:45:35 PM UTC-7, Stefan Karpinski 
   
   wrote: 
 JLD doesn't support serializing functions but Julia itself does. 
 
 On Mon, Aug 10, 2015 at 3:43 PM, Andrei Zh faithle...@gmail.com 
 
 javascript: wrote: 
 I'm afraid it's not quite true, and I found simple way to show 
 it. 
   
   In the 
   
 next code snippet I define function `f` and serialize it to a 
 file: 
 
 julia f(x) = x + 1 
 f (generic function with 1 method) 
 
 julia f(5) 
 6 
 
 julia open(example.jld, w) do io serialize(io, f) end 
 
 
 Then I close Julia REPL and in a new session try to load and 
 use 
   
   this 
   
 function: 
 
 julia f2 = open(example.jld) do io deserialize(io) end 
 (anonymous function) 
 
 julia f2(5) 
 ERROR: function f not defined on process 1 
 
  in error at error.jl:21 
  in anonymous at serialize.jl:398 
 
 So deserialized function still refers to the old definition, 
 which 
   
   is not 
   
 available in this new session. 
 
 Is there any better way to serialize a function and run it on 
 an 
 unrelated Julia process? 
 
 On Monday, August 10, 2015 at 2:33:11 PM UTC+3, Jeff Waller 
 wrote: 
 My question is: does Julia's serialization produce completely 
 

[julia-users] Re: big matrices in Julia

2015-08-14 Thread John Gibson
Charles: 

Thanks for your response. I understand now that your application is 
ecological, but the mathematical nature and the discretization of your 
system is still unclear. You might consider a 'lazy' approach, in which you 
compute a distance when you need it, rather than computing them all and 
storing in a matrix. Or perhaps you should consult an applied mathematician 
at your university and get some help on how to represent your data set 
efficiently. I suspect there's a better way than just increasing the number 
of grid points.

John

On Thursday, August 13, 2015 at 6:26:55 AM UTC-4, Charles Santana wrote:

 Hi all,

 Do you recommend a way to work with bit matrices in Julia. By big I mean 
 a 65600 x 65600 symmetric matrix (the upper triangular matrix is equal to 
 the lower triangular one). 

 I am studying the distances between sites at different resolution maps. 
 For low resolution we have few sites, and for big resolution we have more 
 sites (S). 

 For few sites (small matrices) I was doing something like this:

 S = 100;#number of sites
 M = zeros(S,S);
 for i in 1:(S-1)
for j in (i+1):S
   M[i,j] = dist(i,j);#where dist(i,j) is the distance between sites i 
 and j
end
 end

 However, for big matrices I get the following message:

 S=65600;
 M = zeros(S,S);
 ERROR: OutOfMemoryError()
  in call at essentials.jl:201
  in zeros at array.jl:233

 I am using Julia Version 0.4.0-dev+5920 in Ubuntu 14.04.

 Thanks for any tip!

 Best,

 Charles
 -- 
 Um axé! :)

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



Re: [julia-users] big matrices in Julia

2015-08-14 Thread Stefan Karpinski
On Friday, August 14, 2015, Charles Novaes de Santana 
charles.sant...@gmail.com wrote:


 1) to use only the subset of suitable habitats to build the matrix of
 distances (and then to use sparse matrix as suggested by Stefan)


Distance matrices are not usually sparse – since the farthest apart pairs
of points have large distances and are the most common and least
interesting. However, you could store only distances for close points in a
sparse matrix and use zero to represent the distance between pairs of
points that are not close enough to be of interest. Either that or you
could store 1/d instead of d and then closer points have higher weights and
you can threshold 1/distance so that far apart points have zero entries.


 2) to use a machine with more memory and try to run my models using the
 matrices with all the sites


This is probably the easiest thing to do since your data set is not of a
truly unreasonable size, just largish. However, you may be much happier if
you can make your problem smaller than O(n^2).


 3) to try another language/library that might work better with such big
 amount of data (like python, or R).


This problem isn't going to be fundamentally different no matter what
language you use: you have more data than fits in memory. Spilling memory
to disk is going to be *much* slower than just recomputing distances –
orders of magnitude slower. As John suggested, is there any particular
reason you need to materialize all of these values in a matrix? What
computation are you going to perform over that matrix?


Re: [julia-users] Creating a bitmapped image with color bar

2015-08-14 Thread Tim Holy
Go ahead and submit the bug report. Also let me know what ImageView does with 
it. (I never use colormap images myself, so this is less well-tested.)

A pull-request fixing the problem would be even better, of course!

--Tim

On Friday, August 14, 2015 06:54:19 AM Maurizio Tomasi wrote:
 Tim, does ImageCmap works with latest Julia? I cloned the latest Julia
 repository (0.4), added the Color, Images, and ImageView package and run
 this code (adapted from
 https://groups.google.com/forum/#!searchin/julia-users/%22ImageCmap%22/julia
 -users/T-i1JdwB4zk/f7FEsh4En4oJ but using PBM format in order not to rely on
 ImageMagick) with no avail.
 
 using Images, Color
 
 # build a sample image
 datafloat = reshape(linspace(0.5, 1.5, 6), 200, 300)
 # convert the raw 0.5:1.5 data to a integer type, so we can index
 dataint = iround(Uint8, 254*(datafloat - 0.5) + 1)  # ranges from 1 to 255
 # build our colormap
 b = RGB(0,0,1)
 w = RGB(1,1,1)
 r = RGB(1,0,0)
 cmaprgb = Array(RGB, 255)
 f = linspace(0,1,128)
 cmaprgb[1:128] = [(1-x)*b + x*w for x in f]
 cmaprgb[129:end] = [(1-x)*w + x*r for x in f[2:end]]
 
 img = ImageCmap(dataint, cmaprgb)
 
 imwrite(img,image.pbm)
 
 The error is the following:
 
 ERROR: MethodError: `mapinfo` has no method matching
 mapinfo(::Type{Images.ImageMagick},
 
 ::Images.ImageCmap{Color.RGB{T:Union{AbstractFloat,FixedPointNumbers.FixedP
 ::oint}},2,Array{UInt8,2}})
 Closest candidates are:
   mapinfo(::Type{Color.RGB{FixedPointNumbers.UfixedBase{UInt8,8}}}, ::Any)
 
 mapinfo(::Type{Color.AlphaColorValue{Color.RGB{FixedPointNumbers.UfixedBase{
 UInt8,8}},FixedPointNumbers.UfixedBase{UInt8,8}}},
 ::Any)
 
 mapinfo{CT:Union{Color.AbstractAlphaColorValue{C:Color.ColorValue{T},T:Re
 al},Color.ColorValue{T}}}(::Type{Color.RGB24},
 ::AbstractArray{CT:Union{Color.AbstractAlphaColorValue{C:Color.ColorValue{
 ::T},T:Real},Color.ColorValue{T}},N})
   ...
  in imwrite at /home/tomasi/.julia/v0.4/Images/src/io.jl:585
  in anonymous at /home/tomasi/.julia/v0.4/Images/src/io.jl:576
  in open at iostream.jl:114
  in imwrite at /home/tomasi/.julia/v0.4/Images/src/io.jl:573
  in imwrite at /home/tomasi/.julia/v0.4/Images/src/io.jl:186
 
 Before submitting any bug report, I would like to be sure I'm not getting
 something totally wrong.
   Maurizio.
 
 On Thursday, August 13, 2015 at 6:36:44 PM UTC+2, Tim Holy wrote:
  Images (on which ImageView is based) has an ImageCmap (= image colormap)
  type. You could play with it and see how far you get.
  
  Also, see the MapInfo section of
  http://timholy.github.io/Images.jl/function_reference.html. It's a crazy-
  powerful mechanism for on-the-fly changes in how data are mapped to screen
  pixels.
  
  --Tim
  
  On Thursday, August 13, 2015 05:44:16 AM Maurizio Tomasi wrote:
   Hi to everybody,
   
 I am the creator of Healpix.jl, a Julia
   
   package (https://github.com/ziotom78/Healpix.jl) which implements
   algorithms related to the Healpix sphere tessellation scheme
   (http://healpix.jpl.nasa.gov/). The Healpix scheme subdivides a sphere
  
  in
  
   patches (pixels) of equal area, and it is widely used in cosmology. I am
   writing to julia-user because I would like to implement visualization
   functions too, but I haven't figured out what is the best way to
  
  implement
  
   them.
   
   So far, I have used the Healpy (https://github.com/healpy/healpy)
  
  library
  
   as a reference for my implementation. Healpy wraps the original C++
  
  Healpix
  
   library in a Python module. It uses Matplotlib to create plots of
  
  spherical
  
   projections. Internally, both the original C++ Healpix library and
  
  Healpy
  
   produce such plots by calculating a bitmapped representation of the
   projection: they convert each (x,y) point in the image plane into a
   normalized (u,v) coordinate, which is then spherically projected to a
  
  point
  
   on the sphere's surface. The value associated to the point on the sphere
   determines the color of the point at (x,y). Here are a few examples of
  
   typical Healpix maps:
  http://healpix.jpl.nasa.gov/images/skymaps/ecl53s.gif
  
   (Mollweide
   projection), http://healpix.sourceforge.net/html/plot_orthpolrot.png
   (Orthogonal projection).
   
   The algorithm is really easy to implement in Julia, but I cannot decide
  
  how
  
   to actually do the following:
   
   1. How to interactively show the map by e.g. opening a window, or by
   displaying the image directly in a IJulia notebook?
   2. The bitmap produced using this algorithm associates a scalar to each
   pixel, but one usually wants to convert such scalar through a color map
  
  in
  
   order to have a RGB value to be actually drawable. (I am interested in
   piecewise-linear maps).
   3. When displaying the map, how to put a color bar under the map, like
  
  in
  
   the two links I provided above?
   
   I have had a look at ImageView, and it look ok for point 1. However, it
   seems to me that it is oriented towards real 

Re: [julia-users] Creating a bitmapped image with color bar

2015-08-14 Thread Andreas Lobinger
Hello colleague,

i tend to agree, there is something wrong with Images.jl. I get
lobi@orange4:~/juliarepo$ ../julia04/julia 
   _
   _   _ _(_)_ |  A fresh approach to technical computing
  (_) | (_) (_)|  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type help() for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.4.0-dev+6526 (2015-08-07 14:14 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit dcc448b* (7 days old master)
|__/   |  x86_64-linux-gnu




with
Pkg.status()
WARNING: unknown Clang commit c4d18994, metadata may be ahead of package 
cache
13 required packages:
 - BinDeps   0.3.14
 - Clang 0.0.5+ 9b668ecf
 - Dates 0.4.4
 - Gadfly0.3.13
 - GraphViz  0.0.4  master
 - Graphs0.5.5
 - Gtk   0.8.2+ new_canvas
 - Images0.4.43
 - PyCall0.8.2
 - PyPlot1.5.3
 - Tk0.3.4+ f283145f
 - Vega  0.3.3
 - Winston   0.11.11




i get a different error, but still...

julia imwrite(img,image.pbm)
ERROR: MethodError: `imwrite` has no method matching imwrite(::Images.
ImageCmap{Color.RGB{T:Union{FixedPointNumbers.FixedPoint,AbstractFloat}},2,
Array{UInt8,2}}, ::IOStream, ::Type{Images.PBMBinary})
Closest candidates are:
  imwrite{T:Images.ImageFileType}(::Any, ::AbstractString, ::Type{T:Images
.ImageFileType})
  imwrite{T:Color.ColorValue{T}}(::AbstractArray{T:Color.ColorValue{T},N}, 
::IO, ::Type{Images.PPMBinary})
  imwrite{T:Color.ColorValue{T}}(::AbstractArray{T:Color.ColorValue{T},N}, 
::IO, ::Type{Images.PPMBinary}, ::Any)
  ...
 in anonymous at /home/lobi/.julia/v0.4/Images/src/io.jl:197
 in open at iostream.jl:114
 in imwrite at /home/lobi/.julia/v0.4/Images/src/io.jl:196
 in imwrite at /home/lobi/.julia/v0.4/Images/src/io.jl:186





Re: [julia-users] Re: Can Julia function be serialized and sent by network?

2015-08-14 Thread Andrei Zh

Hi Jake, 

your example works because you don't leave Julia session. `foo` is defined 
in this session, so the the pair of module name and function name is enough 
to get function object. If you save serialized function (or just retype it 
byte by byte) , it won't work. Here's an example: 

Session #1: 

julia io = IOBuffer()
IOBuffer(data=Uint8[...], readable=true, writable=true, seekable=true, 
append=false, size=0, maxsize=Inf, ptr=1, mark=-1)


julia foo(x) =  x + 1
foo (generic function with 1 method)


julia serialize(io, foo)


julia takebuf_array(io)
9-element Array{Uint8,1}:
 0x13
 0x02
 0x23
 0x2f
 0x02
 0x03
 0x66
 0x6f
 0x6f


julia



Session #2: 

julia data = Uint8[0x13, 0x02, 0x23, 0x2f, 0x02, 0x03, 0x66, 0x6f, 0x6f]
9-element Array{Uint8,1}:
 0x13
 0x02
 0x23
 0x2f
 0x02
 0x03
 0x66
 0x6f
 0x6f


julia io = IOBuffer(data)
IOBuffer(data=Uint8[...], readable=true, writable=false, seekable=true, 
append=false, size=9, maxsize=Inf, ptr=1, mark=-1)


julia bar = deserialize(io)
(anonymous function)


julia bar(1)
ERROR: function foo not defined on process 1
 in error at error.jl:21
 in anonymous at serialize.jl:398


julia

 






On Friday, August 14, 2015 at 5:49:55 PM UTC+3, Jake Bolewski wrote:

 Andrei Zh

 I'm confused.  Have you actually tried?  

 julia io = IOBuffer()
 IOBuffer(data=UInt8[...], readable=true, writable=true, seekable=true, 
 append=false, size=0, maxsize=Inf, ptr=1, mark=-1)

 julia foo(x) =  x + 1
 foo (generic function with 1 method)

 julia serialize(io, foo)

 julia seekstart(io)
 IOBuffer(data=UInt8[...], readable=true, writable=true, seekable=true, 
 append=false, size=9, maxsize=Inf, ptr=1, mark=-1)

 julia baz = deserialize(io)
 foo (generic function with 1 method)

 julia baz(1)
 2

 The serialization code won't recursively serialize all the of the 
 functions dependencies so you will have to send/serialize the code that 
 defines the environment (types, constants, Packages, etc).



[julia-users] Re: How has the behavior of include/require etc. changed in 0.4?

2015-08-14 Thread Spencer Lyon
We saw problems trying to  load on very recent master the other day.

I was able to fix it using the steps outlined here: 
https://github.com/QuantEcon/QuantEcon.jl/issues/64#issuecomment-130149602. 

Can you give that a try and report back?

On Friday, August 14, 2015 at 3:34:51 PM UTC-4, Nils Gudat wrote:

 I'm about to switch to 0.4, given that Stefan Karpinski mentioned in 
 another thread that it's close to being frozen. Upon running some of my 
 preexisting code today, I was confused by this:
 When using the excellent QuantEcon package, the Base.mean function (among 
 many others) gets extended, mostly by methods in Distributions, which is 
 required by QuantEcon. In 0.3.10, it looks like this:



 In 0.4 however, the following happens:



 This behavior changes when I use mean before using QuantEcon:



 Could anyone explain to me what is going wrong here and how to fix it?



Re: [julia-users] What's the best way to cache a function generated from a type instance?

2015-08-14 Thread Scott T
The issue was that I wasn't storing the Spline2D directly, but rather a 
function which wrapped log10 calls around the arguments. Pulling these out 
into my type's call method and directly storing the Spline inside it works 
perfectly. Thanks! I guess the lesson here is just store the data inside 
the type, don't try and make it like OO by putting a function inside too. 

Scott

On Friday, 14 August 2015 02:02:03 UTC+1, Scott T wrote:

 Thanks Kyle - looks like the error I was getting from JLD was unrelated, 
 as I just managed to save a Spline2D type with it. I'll try your approach. 
 Nice to hear that I can drop the collect calls as well.

 Scott


 On Friday, 14 August 2015 00:15:06 UTC+1, Kyle Barbary wrote:

 Hi Scott,

 Dierckx.Spline2D is simply a type that holds Vectors of spline 
 coefficients, so it should work with JLD like any other type (but I admit 
 that I’m not that familiar with JLD). I’d probably do something like this:

 using Dierckx

 type LogPTGridEOS
 logP::LinSpace{Float64}
 logT::LinSpace{Float64}
 densities::Matrix{Float64}
 spline::Spline2D

 # calculate the spline coefficients when you create a new instance
 LogPTGridEOS(logP, logT, densities) = new(logP, logT, densities, 
 Spline2D(logP, logT, densities))
 end

 grid = LogPTGridEOS(linspace(0.0, 1.0, 10), linspace(0.0, 1.0, 10), ones(10, 
 10))

 using JLD
 save(myfile.jld, grid, grid)

 Then your call method would simply be

 call(grid::LogPTGridEOS, p, t) = evaluate(grid.spline, log10(p), log10(t))

 Note that the latest version of Dierckx can accept LinSpace, Range or 
 any AbstractVector as inputs (internally collected into a Vector).

 — Kyle
 ​

 On Thu, Aug 13, 2015 at 3:41 PM, Scott T sgseab...@gmail.com wrote:

 That's a really nice solution, thanks.

 Scott


 On Thursday, 13 August 2015 22:19:35 UTC+1, Tim Holy wrote:

 There are several possible solutions, but one is to use the new custom 
 serialization facilities to discard/recreate the interp_func when you 
 save/load the object: 

 https://github.com/JuliaLang/JLD.jl/blob/master/doc/jld.md#custom-serialization
  

 --Tim 

 On Thursday, August 13, 2015 12:37:59 PM Scott T wrote: 
  Hi everyone, 
  
  I'm wondering what the most Julian way to handle the following 
 situation 
  is. I know it can't be complicated, but am not quite sure how to go 
 about 
  it. 
  
  I'm doing some simple interpolation using Dierckx.jl 
  https://github.com/kbarbary/Dierckx.jl, getting densities of 
 materials 
  from a pressure-temperature pair. 
  
  I have a type which holds pressure and temperature axes, and density 
 values 
  on the (logarithmic) grid that these define: 
  
  type LogPTGridEOS 
  logP::LinSpace{Float64} 
  logT::LinSpace{Float64} 
  densities::Matrix{Float64} 
  end 
  
  I want to be able to easily store and load instances of this type, 
 and am 
  using JLD.jl https://github.com/JuliaLang/JLD.jl for this. This 
 lets me 
  save and load from HDF5 .jld files, which preserve the type 
 information 
  (nice). 
  
  To interpolate on the grid, I first need to make an interpolating 
 function, 
  then evaluate it: 
  
  function call(eos::LogPTGridEOS, P, T) 
  interp_func = Dierckx.Spline2D(collect(eos.logP), 
 collect(eos.logT), eos 
  .densities)  # collect because Dierckx needs arrays 
  interpolated_density = Dierckx.evaluate(interp_func, log10(P), 
 log10(T)) 
  # remember this is a log-log grid 
  end 
  
  But the interpolating function made in that first line could just be 
 called 
  over and over again, avoiding any overhead from reconstructing it 
 (the slow 
  bit). How can I best cache this function for re-use? I considered 
 storing 
  it in the type itself by adding an interp_func field, but this 
 messes up 
  saving it via JLD since JLD can't save a pointer. Am I right in 
 thinking I 
  should make a wrapper type which holds the original type plus a 
 reference 
  to the interpolation function, or is there a nicer way to do this? 
  
  Cheers, 
  Scott 




[julia-users] nbagg support in ijulia?

2015-08-14 Thread smokingbear
Is nbagg backend supported by ijulia? If so, can anyone give me an 
example? I tried to change the backend to nbagg but it doesn't really 
show any interactive plot in notebooks.

ref.
https://github.com/stevengj/PyPlot.jl/issues/137
https://github.com/stevengj/PyCall.jl/issues/89

Thank you,


[julia-users] ANN: Major overhaul of ForwardDiff.jl

2015-08-14 Thread Jarrett Revels
Hi!

ForwardDiff.jl https://github.com/JuliaDiff/ForwardDiff.jl, a Julia 
package for performing automatic differentiation, has just been updated and 
is now much less buggy, much more performant, and much more comprehensively 
tested. 

An additional goal of the update was to provide a more friendly API, so 
hopefully the package is now easier to use for newcomers (documentation can 
be found in the master branch's README).

*To use the updated version of the package, check out it's most recent 
commit on the master branch*. The update is not yet tagged for release, as 
we want to give people a chance to work with the new API some before 
tagging a new version. Feel free to provide feedback in the form of an 
issue or pull request to the repository!

Note that this update only supports Julia v0.4.

Best,
Jarrett




Re: [julia-users] Segmentation fault during Julia compilation

2015-08-14 Thread Jameson Nash
It's a JIT copy of a julia function named new. The last time this error
popped up, it was due to an error in the free_page function logic to
compute whether it was safe to free the current page (since PPC using large
pages). One place to check then is to ensure the invalid pointer hadn't
accidentally being deleted by an madvise(DONTNEED) for an unrelated page
free operations.

Beyond that, I would suggest trying with the `MEMDEBUG` turned on in
options.h (which will also disable the `free_page` function).

Also, when you have gdb running, there are many more useful things to print
than just the backtrace. For starters, I would suggest looking at
`disassembly` and `info registers`. Also, go `up` on the stack trace and
look at `jl_(f-linfo)`, `jl_(jl_uncompress_ast(f-linfo, f-linfo-ast))`,
and `jl_(args[0])` / `jl_(args[1])`

On Fri, Aug 14, 2015 at 9:07 AM Mahesh Waidande 
mahesh.waidande1...@gmail.com wrote:

 Hi All,

 I am working on building/porting Julia on ppc64le architecture. I am using
 Ubuntu 14.10 on top of ppc64le hardware, while compiling Julia code(master
 branch) I am getting segmentation fault. I tried to debug segmentation
 fault with tools like gdb/vgdb , valgrind , electric-fence etc. but I not
 able to find a root cause of it. I need some help/pointers/suggestions on
 how I resolve it.

 Here are some details which will help you to diagnose a problem,

 1. Machine details :
 $ uname -a
 Linux pts00433-vm1 3.16.0-30-generic #40-Ubuntu SMP Mon Jan 12 22:07:11
 UTC 2015 ppc64le ppc64le ppc64le GNU/Linux
 $

 2. Snapshot of ‘make debug’ log
 make[1]: Leaving directory '/home/test/Mahesh/julia/julia/base'
 make[1]: Entering directory '/home/test/Mahesh/julia/julia'
  cd base  /home/test/Mahesh/julia/julia/usr/bin/julia-debug -C native
 --output-ji /home/test/Mahesh/julia/julia/usr/lib/julia/inference0.ji -f
 coreimg.jl

   Electric Fence 2.2 Copyright (C) 1987-1999 Bruce Perens 
 br...@perens.com
 Segmentation fault
 Makefile:175: recipe for target
 '/home/test/Mahesh/julia/julia/usr/lib/julia/inference0.ji' failed
 make[1]: *** [/home/test/Mahesh/julia/julia/usr/lib/julia/inference0.ji]
 Error 139
 make[1]: Leaving directory '/home/test/Mahesh/julia/julia'
 Makefile:64: recipe for target 'julia-inference' failed
 make: *** [julia-inference] Error 2

 3. gdb stack trace
 test@pts00433-vm1:~/Mahesh/julia/julia/base$ gdb --args
 /home/test/Mahesh/julia/julia/usr/bin/julia-debug -C native --output-ji
 /home/test/Mahesh/julia/julia/usr/lib/julia/inference0.ji -f coreimg.jl
 GNU gdb (Ubuntu 7.8-1ubuntu4) 7.8.0.20141001-cvs
 Copyright (C) 2014 Free Software Foundation, Inc.
 License GPLv3+: GNU GPL version 3 or later 
 http://gnu.org/licenses/gpl.html
 This is free software: you are free to change and redistribute it.
 There is NO WARRANTY, to the extent permitted by law.  Type show copying
 and show warranty for details.
 This GDB was configured as powerpc64le-linux-gnu.
 Type show configuration for configuration details.
 For bug reporting instructions, please see:
 http://www.gnu.org/software/gdb/bugs/.
 Find the GDB manual and other documentation resources online at:
 http://www.gnu.org/software/gdb/documentation/.
 For help, type help.
 Type apropos word to search for commands related to word...
 Reading symbols from
 /home/test/Mahesh/julia/julia/usr/bin/julia-debug...done.
 (gdb) b repl.c:532
 Breakpoint 1 at 0x10003a34: file repl.c, line 532.
 (gdb) r
 Starting program: /home/test/Mahesh/julia/julia/usr/bin/julia-debug -C
 native --output-ji
 /home/test/Mahesh/julia/julia/usr/lib/julia/inference0.ji -f coreimg.jl
 [Thread debugging using libthread_db enabled]
 Using host libthread_db library
 /lib/powerpc64le-linux-gnu/libthread_db.so.1.

   Electric Fence 2.2 Copyright (C) 1987-1999 Bruce Perens 
 br...@perens.com

 Breakpoint 1, main (argc=7, argv=0x3478) at repl.c:533
 533 {
 (gdb) c
 Continuing.

 Program received signal SIGSEGV, Segmentation fault.
 0x3fffb6970078 in julia.new_0 ()
 (gdb) where
 #0  0x3fffb6970078 in julia.new_0 ()
 #1  0x3fffb6b3b820 in jl_apply (f=0x3ffd9ac1de10, args=0x3fffde28,
 nargs=2) at julia.h:1263
 #2  0x3fffb6b4137c in jl_trampoline (F=0x3ffd9ac1de10,
 args=0x3fffde28, nargs=2) at builtins.c:979
 #3  0x3fffb6b2b084 in jl_apply (f=0x3ffd9ac1de10, args=0x3fffde28,
 nargs=2) at julia.h:1263
 #4  0x3fffb6b328d0 in jl_apply_generic (F=0x3ffd9ac1dd90,
 args=0x3fffde28, nargs=2) at gf.c:1675
 #5  0x3fffb6c2d9a0 in jl_apply (f=0x3ffd9ac1dd90, args=0x3fffde28,
 nargs=2) at julia.h:1263
 #6  0x3fffb6c2e014 in do_call (f=0x3ffd9ac1dd90, args=0x3ffd9ac215a8,
 nargs=2, eval0=0x0, locals=0x0, nl=0, ngensym=0)
 at interpreter.c:65
 #7  0x3fffb6c2eec4 in eval (e=0x3ffd9ac1ddd0, locals=0x0, nl=0,
 ngensym=0) at interpreter.c:212
 #8  0x3fffb6c2dc20 in jl_interpret_toplevel_expr (e=0x3ffd9ac1ddd0) at
 interpreter.c:27
 #9  0x3fffb6c55eac in jl_toplevel_eval_flex (e=0x3ffd9ac1ddb0, fast=1)
 at 

[julia-users] Re: Error 403 loading Images package

2015-08-14 Thread Daniel Fenn
More information: this isn't specific to the Images packages. 
Running Pkg.update() gives the same error.

Any ideas?

On Thursday, August 13, 2015 at 5:22:08 PM UTC-4, Daniel Fenn wrote:

 Hi,

 I just downloaded the Juno IDE to give Julia a try. I'm going through the 
 initial tutorial, and when I try to run the line : Pkg.add(Images) [line 
 87], I get the following output:

 INFO: Cloning cache of BinDeps from git://
 github.com/JuliaLang/BinDeps.jl.git
 fatal: unable to access 'https://github.com/JuliaLang/BinDeps.jl.git/': 
 The requested URL returned error: 403

 I was getting a different error earlier about self-signed certificates, so 
 I ran 

 git config --global http.sslVerify false

 Previous to that, I had to run this line to get anything to work at all:

 git config --global url.https://.insteadOf git://

 Not sure if either of those are related. I'm trying to run this on Windows 
 7, and it's on my work computer, so I'm sure there is a firewall.

 Does anyone have any ideas? I'd appreciate any help you could give me.

 Thanks,

 Daniel



[julia-users] Re: Possible to use filter! on a child dict within a parent dict, to remove the entire parent dict if condition in child is met?

2015-08-14 Thread Jeffrey Sarnoff
if you want to do this, yes:


julia a=Dict(A=1, B=2)
Dict{ASCIIString,Int64} with 2 entries:
  B = 2
  A = 1

julia around_a=Dict(A=3, B=a)
Dict{ASCIIString,Any} with 2 entries:
  B = Dict(B=2,A=1)
  A = 3

julia if (around_a[B][A] == 1) 
  delete!(around_a[B],A);
   end

julia around_a
Dict{ASCIIString,Any} with 2 entries:
  B = Dict(B=2)
  A = 3



On Friday, August 14, 2015 at 12:07:28 PM UTC-4, Ian Butterworth wrote:

 I have a dict containing both key+value pairs, and key+[array of dict] 
 pairs.

 Can I use filter! to remove the entire parent dict if condition in child 
 is met?

 i.e. 

 If measurements[uniqueentrykey][studyid] == bad study then remove 
 measurements[uniqueentrykey]

 Thanks



[julia-users] Re: Possible to use filter! on a child dict within a parent dict, to remove the entire parent dict if condition in child is met?

2015-08-14 Thread Ian Butterworth
Thanks. I was specifically asking about `filter!` but your code works well 
and it's only occupying 4 lines of code, so it should suffice.

Much appreciated

On Friday, 14 August 2015 12:18:29 UTC-4, Jeffrey Sarnoff wrote:

 if you want to do this, yes:


 julia a=Dict(A=1, B=2)
 Dict{ASCIIString,Int64} with 2 entries:
   B = 2
   A = 1

 julia around_a=Dict(A=3, B=a)
 Dict{ASCIIString,Any} with 2 entries:
   B = Dict(B=2,A=1)
   A = 3

 julia if (around_a[B][A] == 1) 
   delete!(around_a[B],A);
end

 julia around_a
 Dict{ASCIIString,Any} with 2 entries:
   B = Dict(B=2)
   A = 3



 On Friday, August 14, 2015 at 12:07:28 PM UTC-4, Ian Butterworth wrote:

 I have a dict containing both key+value pairs, and key+[array of dict] 
 pairs.

 Can I use filter! to remove the entire parent dict if condition in child 
 is met?

 i.e. 

 If measurements[uniqueentrykey][studyid] == bad study then remove 
 measurements[uniqueentrykey]

 Thanks



Re: [julia-users] Re: ArrayViews setindex! error

2015-08-14 Thread Stefan Karpinski
It should be pretty safe to start using 0.4 since we're about to enter a
feature freeze and release process. The main issue is that many packages
may not yet work on 0.4, so that part will be a bit rough.

On Fri, Aug 14, 2015 at 2:17 PM, Simon Kornblith si...@simonster.com
wrote:

 ArrayViews doesn't support indexing with ranges, vectors, etc. on Julia
 0.3, although this should work on Julia 0.4. (Also on 0.4, SubArrays
 created with sub/slice should be equally fast as ArrayViews, and both
 should be faster than on 0.3.) On 0.3 you need to write an explicit loop to
 set multiple indices with ArrayViews.

 Simon


 On Thursday, August 13, 2015 at 6:52:03 PM UTC-4, Yee Whye Teh wrote:

 Apologies, newbie to Julia here.

 I'm trying to use ArrayViews and ran into simple problem, where only the
 simplest setindex! usage (1 entry) works with a view, and anything
 involving more than one entry does not:

 *julia **x = ones(4)*

 *4-element Array{Float64,1}:*

 * 1.0*

 * 1.0*

 * 1.0*

 * 1.0*


 *julia **y=view(x,:)*

 *4-element ContiguousView{Float64,1,Array{Float64,1}}:*

 * 1.0*

 * 1.0*

 * 1.0*

 * 1.0*


 *julia **x[1:2]=5 # ok*

 *5*


 *julia **y[1]=5 # ok*

 *5*


 *julia **y[1:2]=6 # not ok*

 *ERROR: `setindex!` has no method matching
 setindex!(::ContiguousView{Float64,1,Array{Float64,1}}, ::Int64,
 ::UnitRange{Int64})*



 (I realize that there was a previous post related, but for complex
 setindex! use.  This one is very simple and I'd think should work?)

 cheers,
 -yw




[julia-users] Re: ArrayViews setindex! error

2015-08-14 Thread Simon Kornblith
ArrayViews doesn't support indexing with ranges, vectors, etc. on Julia 
0.3, although this should work on Julia 0.4. (Also on 0.4, SubArrays 
created with sub/slice should be equally fast as ArrayViews, and both 
should be faster than on 0.3.) On 0.3 you need to write an explicit loop to 
set multiple indices with ArrayViews.

Simon

On Thursday, August 13, 2015 at 6:52:03 PM UTC-4, Yee Whye Teh wrote:

 Apologies, newbie to Julia here.  

 I'm trying to use ArrayViews and ran into simple problem, where only the 
 simplest setindex! usage (1 entry) works with a view, and anything 
 involving more than one entry does not:

 *julia **x = ones(4)*

 *4-element Array{Float64,1}:*

 * 1.0*

 * 1.0*

 * 1.0*

 * 1.0*


 *julia **y=view(x,:)*

 *4-element ContiguousView{Float64,1,Array{Float64,1}}:*

 * 1.0*

 * 1.0*

 * 1.0*

 * 1.0*


 *julia **x[1:2]=5 # ok*

 *5*


 *julia **y[1]=5 # ok*

 *5*


 *julia **y[1:2]=6 # not ok*

 *ERROR: `setindex!` has no method matching 
 setindex!(::ContiguousView{Float64,1,Array{Float64,1}}, ::Int64, 
 ::UnitRange{Int64})*



 (I realize that there was a previous post related, but for complex 
 setindex! use.  This one is very simple and I'd think should work?)

 cheers,
 -yw



RE: [julia-users] Re: ANN: Major overhaul of ForwardDiff.jl

2015-08-14 Thread David Anthoff
Fantastic, thanks Jarrett!

 

Cheers,

David

 

From: julia-users@googlegroups.com [mailto:julia-users@googlegroups.com] On 
Behalf Of Miles Lubin
Sent: Friday, August 14, 2015 3:35 PM
To: julia-users julia-users@googlegroups.com
Cc: miles.lu...@gmail.com
Subject: [julia-users] Re: ANN: Major overhaul of ForwardDiff.jl

 

Thanks Jarrett!

 

This work is the product of a Julia Summer of Code project. Please kick the 
tires, we're planning letting the new code sit on master for a bit before 
tagging a new release. Users of Julia 0.3 will be stuck on the old API, since 
the code makes extensive use the generated function feature of Julia 0.4.

On Friday, August 14, 2015 at 2:20:09 PM UTC-6, Jarrett Revels wrote:

Hi!

 

ForwardDiff.jl https://github.com/JuliaDiff/ForwardDiff.jl , a Julia package 
for performing automatic differentiation, has just been updated and is now much 
less buggy, much more performant, and much more comprehensively tested. 

 

An additional goal of the update was to provide a more friendly API, so 
hopefully the package is now easier to use for newcomers (documentation can be 
found in the master branch's README).

 

To use the updated version of the package, check out it's most recent commit on 
the master branch. The update is not yet tagged for release, as we want to give 
people a chance to work with the new API some before tagging a new version. 
Feel free to provide feedback in the form of an issue or pull request to the 
repository!

 

Note that this update only supports Julia v0.4.

 

Best,

Jarrett

 

 



[julia-users] Re: Get time between two DateTime values in hours (and minutes if simple)

2015-08-14 Thread Jeffrey Sarnoff
Dates.Hour, .. Dates.Millisecond  what to put their parens around DateTime 
entities only.
Dates.Year. .. Dates.Day are more open-minded, enparenning DateTime or Date 
entities.

take 'em for a spin like this:
 Dates.Hour(time_series[2]) - Dates.Hour(time_series[1])

Here's to  a Good Evening
On Friday, August 14, 2015 at 7:41:04 PM UTC-4, Ian Butterworth wrote:

 Trying to get the number of hours between these two dates (ideally x 
 hours and y minutes), but can't figure out how to convert the duration 
 variable into hours. The bottom line currently errors

 timein = 2015/8/13 10:19:50
 timein2 = 2015/8/14 13:12:34

 time_series[1] = DateTime(timein,/mm/dd HH:MM:SS)
 time_series[2] = DateTime(timein2,/mm/dd HH:MM:SS)

 duration = time_series[2]-time_series[1]
 Dates.Hour(duration)



[julia-users] Re: Creating a show method for type alias

2015-08-14 Thread Jeffrey Sarnoff
Ben, much as I would like there to be a second kind of typealias, *typealiased 
-- *that let us work with the renanamings wiithout risk to the objects of 
the type originally aliased -- this is not on the radar now.  It is hard to 
peel off enough to form the CIGAR when the role of typealias is to preclude 
introducing distictiction outside of recognizing a the alias as if it were 
a nickname.



On Friday, August 14, 2015 at 7:26:07 PM UTC-4, Ben Ward wrote:

 Would that work? The variable to be printed isn't fed in as the second 
 option? 

 On Wednesday, August 12, 2015 at 1:34:16 AM UTC+1, colint...@gmail.com 
 wrote:

 Does the following work?

 function Base.show(io::IO, ::Type{CIGARString})
 #your code here
 end



 On Tuesday, 11 August 2015 03:07:15 UTC+10, Ben Ward wrote:

 Hi, I have implemented a basic immutable type with a type alias for a 
 vector of said type:

 immutable CIGAR
 OP::Operation
 Size::Int
 end


 function CIGAR(op::Char, size::Int)
 return CIGAR(Operation(op), size)
 end


 function convert(::Type{String}, cigar::CIGAR)
 return $(cigar.Size)$(Char(cigar.OP))
 end


 function show(io::IO, cigar::CIGAR)
 write(io, convert(String, cigar))
 end


 typealias CIGARString Vector{CIGAR}


 function convert(::Type{CIGARString}, str::String)
 matches = matchall(r(\d+)(\w), str)
 cigarString = Vector{CIGAR}(length(matches))
 @inbounds for i in 1:length(matches)
 m = matches[i]
 cigarString[i] = CIGAR(m[end], parse(Int, m[1:end-1]))
 end
 return cigarString
 end


 macro cigar_str(str)
 return CIGARString(str)
 end

 I also want to define a show method for the alias CIGARString, so as it 
 is converted to a string that can be used with a show method:

 function convert(::Type{String}, cigarString::CIGARString)
 outString = 
 for cigar in cigarString
 outString *= String(cigar)
 end
 return outString
 end


 function show(io::IO, cigarstr::CIGARString)
 write(io, convert(String, cigarstr))
 end

 However the output a see on the REPL is:

 *3-element Array{Bio.Align.CIGAR,1}:*

 * 5M*

 * 5N*

 * 5M*

 So, rather than the show method for CIGARString being called, the show 
 method for CIGAR is being called repeatedly for every element in the 
 CIGARString vector. How do I get Julia to use the show method I want for 
 CIGARString?

 Thanks.



[julia-users] Re: Error 403 loading Images package

2015-08-14 Thread Tony Kelman
Go into the /Git folder in your Julia installation and run git-bash.bat. 
Can you git clone anything from github from there? Either over git:// or 
https:// ?


On Friday, August 14, 2015 at 9:49:05 AM UTC-7, Daniel Fenn wrote:

 More information: this isn't specific to the Images packages. 
 Running Pkg.update() gives the same error.

 Any ideas?

 On Thursday, August 13, 2015 at 5:22:08 PM UTC-4, Daniel Fenn wrote:

 Hi,

 I just downloaded the Juno IDE to give Julia a try. I'm going through the 
 initial tutorial, and when I try to run the line : Pkg.add(Images) [line 
 87], I get the following output:

 INFO: Cloning cache of BinDeps from git://
 github.com/JuliaLang/BinDeps.jl.git
 fatal: unable to access 'https://github.com/JuliaLang/BinDeps.jl.git/': 
 The requested URL returned error: 403

 I was getting a different error earlier about self-signed certificates, 
 so I ran 

 git config --global http.sslVerify false

 Previous to that, I had to run this line to get anything to work at all:

 git config --global url.https://.insteadOf git://

 Not sure if either of those are related. I'm trying to run this on 
 Windows 7, and it's on my work computer, so I'm sure there is a firewall.

 Does anyone have any ideas? I'd appreciate any help you could give me.

 Thanks,

 Daniel



[julia-users] Re: Creating a show method for type alias

2015-08-14 Thread Ben Ward
Would that work? The variable to be printed isn't fed in as the second 
option? 

On Wednesday, August 12, 2015 at 1:34:16 AM UTC+1, colint...@gmail.com 
wrote:

 Does the following work?

 function Base.show(io::IO, ::Type{CIGARString})
 #your code here
 end



 On Tuesday, 11 August 2015 03:07:15 UTC+10, Ben Ward wrote:

 Hi, I have implemented a basic immutable type with a type alias for a 
 vector of said type:

 immutable CIGAR
 OP::Operation
 Size::Int
 end


 function CIGAR(op::Char, size::Int)
 return CIGAR(Operation(op), size)
 end


 function convert(::Type{String}, cigar::CIGAR)
 return $(cigar.Size)$(Char(cigar.OP))
 end


 function show(io::IO, cigar::CIGAR)
 write(io, convert(String, cigar))
 end


 typealias CIGARString Vector{CIGAR}


 function convert(::Type{CIGARString}, str::String)
 matches = matchall(r(\d+)(\w), str)
 cigarString = Vector{CIGAR}(length(matches))
 @inbounds for i in 1:length(matches)
 m = matches[i]
 cigarString[i] = CIGAR(m[end], parse(Int, m[1:end-1]))
 end
 return cigarString
 end


 macro cigar_str(str)
 return CIGARString(str)
 end

 I also want to define a show method for the alias CIGARString, so as it 
 is converted to a string that can be used with a show method:

 function convert(::Type{String}, cigarString::CIGARString)
 outString = 
 for cigar in cigarString
 outString *= String(cigar)
 end
 return outString
 end


 function show(io::IO, cigarstr::CIGARString)
 write(io, convert(String, cigarstr))
 end

 However the output a see on the REPL is:

 *3-element Array{Bio.Align.CIGAR,1}:*

 * 5M*

 * 5N*

 * 5M*

 So, rather than the show method for CIGARString being called, the show 
 method for CIGAR is being called repeatedly for every element in the 
 CIGARString vector. How do I get Julia to use the show method I want for 
 CIGARString?

 Thanks.



[julia-users] Get time between two DateTime values in hours (and minutes if simple)

2015-08-14 Thread Ian Butterworth
Trying to get the number of hours between these two dates (ideally x hours 
and y minutes), but can't figure out how to convert the duration variable 
into hours. The bottom line currently errors

timein = 2015/8/13 10:19:50
timein2 = 2015/8/14 13:12:34

time_series[1] = DateTime(timein,/mm/dd HH:MM:SS)
time_series[2] = DateTime(timein2,/mm/dd HH:MM:SS)

duration = time_series[2]-time_series[1]
Dates.Hour(duration)


[julia-users] Re: ANN: Major overhaul of ForwardDiff.jl

2015-08-14 Thread Miles Lubin
Thanks Jarrett!

This work is the product of a Julia Summer of Code project. Please kick the 
tires, we're planning letting the new code sit on master for a bit before 
tagging a new release. Users of Julia 0.3 will be stuck on the old API, 
since the code makes extensive use the generated function feature of Julia 
0.4.

On Friday, August 14, 2015 at 2:20:09 PM UTC-6, Jarrett Revels wrote:

 Hi!

 ForwardDiff.jl https://github.com/JuliaDiff/ForwardDiff.jl, a Julia 
 package for performing automatic differentiation, has just been updated and 
 is now much less buggy, much more performant, and much more comprehensively 
 tested. 

 An additional goal of the update was to provide a more friendly API, so 
 hopefully the package is now easier to use for newcomers (documentation can 
 be found in the master branch's README).

 *To use the updated version of the package, check out it's most recent 
 commit on the master branch*. The update is not yet tagged for release, 
 as we want to give people a chance to work with the new API some before 
 tagging a new version. Feel free to provide feedback in the form of an 
 issue or pull request to the repository!

 Note that this update only supports Julia v0.4.

 Best,
 Jarrett




Re: [julia-users] Creating a show method for type alias

2015-08-14 Thread Ben Ward
I tried this too, to override the method for Array{CIGAR, 1} but it still 
does not work:

function Base.show(io::IO, cigarstr::Array{CIGAR, 1})
write(io, convert(String, cigarstr))
end


On Tuesday, August 11, 2015 at 9:22:09 AM UTC+1, Mauro wrote:

 I think you cannot create a show method for a typealias as it is 
 indistinguishable from the type it aliases. 

 On Mon, 2015-08-10 at 19:07, Ben Ward axolotl...@gmail.com javascript: 
 wrote: 
  Hi, I have implemented a basic immutable type with a type alias for a 
 vector of 
  said type: 
  
  immutable CIGAR 
OP::Operation 
Size::Int 
  end 
  
  
  function CIGAR(op::Char, size::Int) 
return CIGAR(Operation(op), size) 
  end 
  
  
  function convert(::Type{String}, cigar::CIGAR) 
return $(cigar.Size)$(Char(cigar.OP)) 
  end 
  
  
  function show(io::IO, cigar::CIGAR) 
write(io, convert(String, cigar)) 
  end 
  
  
  typealias CIGARString Vector{CIGAR} 
  
  
  function convert(::Type{CIGARString}, str::String) 
matches = matchall(r(\d+)(\w), str) 
cigarString = Vector{CIGAR}(length(matches)) 
@inbounds for i in 1:length(matches) 
  m = matches[i] 
  cigarString[i] = CIGAR(m[end], parse(Int, m[1:end-1])) 
end 
return cigarString 
  end 
  
  
  macro cigar_str(str) 
return CIGARString(str) 
  end 
  
  I also want to define a show method for the alias CIGARString, so as it 
 is 
  converted to a string that can be used with a show method: 
  
  function convert(::Type{String}, cigarString::CIGARString) 
outString =  
for cigar in cigarString 
  outString *= String(cigar) 
end 
return outString 
  end 
  
  
  function show(io::IO, cigarstr::CIGARString) 
write(io, convert(String, cigarstr)) 
  end 
  
  However the output a see on the REPL is: 
  
  
  3-element Array{Bio.Align.CIGAR,1}: 
  
  
  5M 
  
  
  5N 
  
  
  5M 
  
  
  So, rather than the show method for CIGARString being called, the show 
 method 
  for CIGAR is being called repeatedly for every element in the 
 CIGARString 
  vector. How do I get Julia to use the show method I want for 
 CIGARString? 
  
  Thanks. 



Re: [julia-users] nbagg support in ijulia?

2015-08-14 Thread Isaiah Norton
Since those issues are still open, it is unlikely that there is support.

On Fri, Aug 14, 2015 at 4:05 PM, smokingbear hori...@gmail.com wrote:

 Is nbagg backend supported by ijulia? If so, can anyone give me an
 example? I tried to change the backend to nbagg but it doesn't really
 show any interactive plot in notebooks.

 ref.
 https://github.com/stevengj/PyPlot.jl/issues/137
 https://github.com/stevengj/PyCall.jl/issues/89

 Thank you,



[julia-users] Re: JuliaCon 2015 videos

2015-08-14 Thread Viral Shah
One more batch posted:

1. Jacob Quinn: Composable streams for data transfer and processing - 
http://t.co/DPuN42F3Qu
2. Tanmay Mohapatra: Interfacing Julia with Complex systems using Protocol 
Buffers - http://t.co/Ddxj60KL7g
3. Eric Davies: Towards A Consistent Database Interface - 
http://t.co/vdQwFRp7aD
4. Viral Shah: The present and future of sparse matrices in Julia - 
http://t.co/WVQY89GsiT
5. Jake Bolewski: Staged programming in Julia - http://t.co/XlYl2XGB9O
6. Robert Moss: Julia as a Specification Language for the next-generation 
Airborne Collision Avoidance System - http://t.co/QJN2ZfP1ZI

-viral

On Friday, August 14, 2015 at 7:33:04 PM UTC+5:30, Viral Shah wrote:

 Here are the next batch of videos. There is a JuliaCon 2015 channel now: 

 https://www.youtube.com/playlist?list=PLP8iPy9hna6Sdx4soiGrSefrmOPdUWixM 

 This batch includes: 

 David Sanders: Validated numerics in Julia - http://t.co/WRZcYGjhfl
 Patrick Sanan: Using Julia on a Cray Supercomputer 
 - https://youtu.be/NwyKz2KLdtY
 Keno Fischer: Shaving the Yak - http://t.co/cEJqCqAdRC
 Spencer Lyon: Methods, Models, and Moments - Julian Economics with 
 QuantEcon.jl - http://t.co/l0f5CH6k3u
 Randy Zwitch: Everyday Analytics and Visualization - http://t.co/7pbL7yd010

 -viral 



  On 13-Aug-2015, at 10:51 pm, Viral Shah vi...@mayin.org wrote: 
  
  Folks, 
  
  I am happy to announce that the videos are almost all ready, and I will 
 start posting them in batches. I am starting with Jeff’s talk on our 
 Youtube channel: 
  
  https://www.youtube.com/user/JuliaLanguage 
  
  Direct link to the video: 
  
  https://www.youtube.com/watch?v=xUP3cSKb8sI 
  
  -viral 
  
  
  



[julia-users] Re: Get time between two DateTime values in hours (and minutes if simple)

2015-08-14 Thread Ian Butterworth
I took 'em for a spin, but your approach doesn't have legs if the datetimes 
in time_series come from different days. I.e. Dates.Hour just returns the 
hour in that day.

I can imagine a long-winded solution where the relevant time units are 
extracted and differenced, but I was hoping for simpler..

Good evening to you too

On Friday, 14 August 2015 20:01:05 UTC-4, Jeffrey Sarnoff wrote:

 Dates.Hour, .. Dates.Millisecond  what to put their parens around DateTime 
 entities only.
 Dates.Year. .. Dates.Day are more open-minded, enparenning DateTime or 
 Date entities.

 take 'em for a spin like this:
  Dates.Hour(time_series[2]) - Dates.Hour(time_series[1])

 Here's to  a Good Evening
 On Friday, August 14, 2015 at 7:41:04 PM UTC-4, Ian Butterworth wrote:

 Trying to get the number of hours between these two dates (ideally x 
 hours and y minutes), but can't figure out how to convert the duration 
 variable into hours. The bottom line currently errors

 timein = 2015/8/13 10:19:50
 timein2 = 2015/8/14 13:12:34

 time_series[1] = DateTime(timein,/mm/dd HH:MM:SS)
 time_series[2] = DateTime(timein2,/mm/dd HH:MM:SS)

 duration = time_series[2]-time_series[1]
 Dates.Hour(duration)



[julia-users] Re: ANN: Major overhaul of ForwardDiff.jl

2015-08-14 Thread Jeffrey Sarnoff
+1 for your clean-up  (understated and well-articulated)

On Friday, August 14, 2015 at 4:20:09 PM UTC-4, Jarrett Revels wrote:

 Hi!

 ForwardDiff.jl https://github.com/JuliaDiff/ForwardDiff.jl, a Julia 
 package for performing automatic differentiation, has just been updated and 
 is now much less buggy, much more performant, and much more comprehensively 
 tested. 

 An additional goal of the update was to provide a more friendly API, so 
 hopefully the package is now easier to use for newcomers (documentation can 
 be found in the master branch's README).

 *To use the updated version of the package, check out it's most recent 
 commit on the master branch*. The update is not yet tagged for release, 
 as we want to give people a chance to work with the new API some before 
 tagging a new version. Feel free to provide feedback in the form of an 
 issue or pull request to the repository!

 Note that this update only supports Julia v0.4.

 Best,
 Jarrett




[julia-users] Possible to use filter! on a child dict within a parent dict, to remove the entire parent dict if condition in child is met?

2015-08-14 Thread Ian Butterworth
I have a dict containing both key+value pairs, and key+[array of dict] 
pairs.

Can I use filter! to remove the entire parent dict if condition in child is 
met?

i.e. 

If measurements[uniqueentrykey][studyid] == bad study then remove 
measurements[uniqueentrykey]

Thanks


Re: [julia-users] big matrices in Julia

2015-08-14 Thread Matt Bauman
You could create a phony 2-dimensional array that computes the distances 
on the fly… but you won't be able to pass this matrix to, e.g., BLAS.

immutable DistanceMatrix : AbstractArray{Float64, 2}
locs::Array{Float64, 2} # a 2xN or 3xN matrix containing the location 
coordinates
end
Base.size(A::DistanceMatrix) = (length(A.locs), length(A.locs))
Base.getindex(A::DistanceMatrix, i::Int, j::Int) = dist(A.locs[:, i], A.locs
[:, j]) # could be further optimized

(Untested)

On Friday, August 14, 2015 at 11:03:06 AM UTC-4, Stefan Karpinski wrote:

 On Friday, August 14, 2015, Charles Novaes de Santana 
 charles...@gmail.com javascript: wrote:


 1) to use only the subset of suitable habitats to build the matrix of 
 distances (and then to use sparse matrix as suggested by Stefan)


 Distance matrices are not usually sparse – since the farthest apart pairs 
 of points have large distances and are the most common and least 
 interesting. However, you could store only distances for close points in a 
 sparse matrix and use zero to represent the distance between pairs of 
 points that are not close enough to be of interest. Either that or you 
 could store 1/d instead of d and then closer points have higher weights and 
 you can threshold 1/distance so that far apart points have zero entries.
  

 2) to use a machine with more memory and try to run my models using the 
 matrices with all the sites


 This is probably the easiest thing to do since your data set is not of a 
 truly unreasonable size, just largish. However, you may be much happier if 
 you can make your problem smaller than O(n^2).
  

 3) to try another language/library that might work better with such big 
 amount of data (like python, or R).


 This problem isn't going to be fundamentally different no matter what 
 language you use: you have more data than fits in memory. Spilling memory 
 to disk is going to be *much* slower than just recomputing distances – 
 orders of magnitude slower. As John suggested, is there any particular 
 reason you need to materialize all of these values in a matrix? What 
 computation are you going to perform over that matrix?



Re: [julia-users] Re: big matrices in Julia

2015-08-14 Thread Tim Holy
bigmemory is presumably the same thing as mmap_array.

--Tim

On Friday, August 14, 2015 01:03:10 AM Charles Novaes de Santana wrote:
 Dear all,
 
 Thank you very much for your help and suggestions! I have learned a lot
 from you. Indeed, I want to use this matrix and  not only to read and store
 the data.
 
 I should have written in my email that I was wondering if Julia had
 something similar to bigmemory and bigalgebra in R (
 https://sites.google.com/site/bigmemoryorg/home/bigalgebra). I know they
 make the allocation of huge amounts of data easier, but I didn't try to do
 it for my data yet (all my project is in Julia, so I want to try it until
 the infinite before using other languages).
 
 As it seems to be a problem related to my computational resources, my first
 shot will be to try to run it in Julia in a cluster with more memory. If it
 doesn't work I will take some time to think in a different way to solve my
 problem (in worst case I will need to avoid this high-resolution dataset
 for now).
 
 Thanks a lot!
 
 Charles
 
 On 14 August 2015 at 00:18, Marcio Sales marciole...@hotmail.com wrote:
  Charles,
  If your work ends with the matrix, then you could write a binary file on
  dink, and make your loop calculate and hold a bunch of values each time
  and
  save it to the binary file on disk periodically, until all values are
  saved. Try to make the loop hold as many values as possible, so you don't
  need to save as frequently, to improve performance.
  
  But If you then need to use this matrix for other operations, then you
  have a problem... unless you buy enough memory, or you can somehow do the
  operation in parts.
  Marcio
  
  
  Em quinta-feira, 13 de agosto de 2015 07:26:55 UTC-3, Charles Santana
  
  escreveu:
  Hi all,
  
  Do you recommend a way to work with bit matrices in Julia. By big I
  mean a 65600 x 65600 symmetric matrix (the upper triangular matrix is
  equal
  to the lower triangular one).
  
  I am studying the distances between sites at different resolution maps.
  For low resolution we have few sites, and for big resolution we have more
  sites (S).
  
  For few sites (small matrices) I was doing something like this:
  
  S = 100;#number of sites
  M = zeros(S,S);
  for i in 1:(S-1)
  
 for j in (i+1):S
 
M[i,j] = dist(i,j);#where dist(i,j) is the distance between sites i
  
  and j
  
 end
  
  end
  
  However, for big matrices I get the following message:
  
  S=65600;
  M = zeros(S,S);
  ERROR: OutOfMemoryError()
  
   in call at essentials.jl:201
   in zeros at array.jl:233
  
  I am using Julia Version 0.4.0-dev+5920 in Ubuntu 14.04.
  
  Thanks for any tip!
  
  Best,
  
  Charles
  --
  Um axé! :)
  
  --
  Charles Novaes de Santana, PhD
  http://www.imedea.uib-csic.es/~charles



Re: [julia-users] Re: Can Julia function be serialized and sent by network?

2015-08-14 Thread Tim Holy
If you define the function with @everywhere, it will be defined on all existing 
workers. Likewise, `using MyPackage` loads the package on all workers.

--Tim

On Thursday, August 13, 2015 03:10:54 PM Andrei Zh wrote:
 Ok, after going through serialization code, it's clear that default
 implementation doesn't support serializing function code, but only its
 name. For example, here's relevant section from
 `deserialize(::SerializationState, ::Function)`:
 mod = deserialize(s)::Module
 name = deserialize(s)::Symbol
 if !isdefined(mod,name)
 return (args...)-error(function $name not defined on process
 $(myid()))
 end
 
 
 
 This doesn't fit my needs (essentially, semantics of Spark), and I guess
 there's no existing solution for full function serialization. Thus I'm
 going to write new solution for this.
 
 So far the best idea I have is to get function's AST and recursively
 serialize it, catching calls to the other non-Base function and any bound
 variables. But this looks quite complicated. Is there better / easier way
 to get portable function's representation?
 
 On Monday, August 10, 2015 at 11:48:55 PM UTC+3, Andrei Zh wrote:
  Yes, I incorrectly assumed `serialize` / `deserialize` use JLD format. But
  anyway, even when I saved the function into example.jls or even plain
  byte array (using IOBuffer and `takebuf_array`), nothing changed. Am I
  missing something obvious?
  
  On Monday, August 10, 2015 at 11:40:03 PM UTC+3, Tim Holy wrote:
  On Monday, August 10, 2015 01:13:15 PM Tony Kelman wrote:
   Should
   probably use some different extension for that, .jls or something, to
  
  avoid
  
   confusion.
  
  Yes. That has been sufficiently confusing in the past, we even cover this
  here:
  
  https://github.com/JuliaLang/JLD.jl#saving-and-loading-variables-in-julia
  -data-format-jld
  
  --Tim
  
   On Monday, August 10, 2015 at 12:45:35 PM UTC-7, Stefan Karpinski
  
  wrote:
JLD doesn't support serializing functions but Julia itself does.

On Mon, Aug 10, 2015 at 3:43 PM, Andrei Zh faithle...@gmail.com

javascript: wrote:
I'm afraid it's not quite true, and I found simple way to show it.
  
  In the
  
next code snippet I define function `f` and serialize it to a file:

julia f(x) = x + 1
f (generic function with 1 method)

julia f(5)
6

julia open(example.jld, w) do io serialize(io, f) end


Then I close Julia REPL and in a new session try to load and use
  
  this
  
function:

julia f2 = open(example.jld) do io deserialize(io) end
(anonymous function)

julia f2(5)
ERROR: function f not defined on process 1

 in error at error.jl:21
 in anonymous at serialize.jl:398

So deserialized function still refers to the old definition, which
  
  is not
  
available in this new session.

Is there any better way to serialize a function and run it on an
unrelated Julia process?

On Monday, August 10, 2015 at 2:33:11 PM UTC+3, Jeff Waller wrote:
My question is: does Julia's serialization produce completely
self-containing code that can be run on workers? In other words,
  
  is it
  
possible to send serialized function over network to another host
  
  /
  
Julia
process and applied there without any additional information from
  
  the
  
first
process?

I made some tests on a single machine, and when I defined function
without `@everywhere`, worker failed with a message function
  
  myfunc
  
not
defined on process 1. With `@everywhere`, my code worked, but
  
  will it
  
work
on multiple hosts with essentially independent Julia processes?

According to Jey here

  
  https://groups.google.com/forum/#!searchin/julia-users/jey/julia-users/
  
bolLGcSCrs0/fGGVLgNhI2YJ, Base.serialize does what we want; it's
contained in serialize.jl
https://github.com/JuliaLang/julia/blob/master/base/serialize.jl



Re: [julia-users] Re: Can Julia function be serialized and sent by network?

2015-08-14 Thread Andrei Zh
Yes, but once again, I'm not using Julia workers, but instead completely 
independent Julia processes, running on different machines and ruled by 
Spark, not by Julia's ClusterManager. I.e. workflow looks like this:

1. Julia process 1 starts JVM and connects to Spark master node. 
2. Julia process 1 sends serialized function to Spark master node. 
3. Spark master node notifies Spark worker nodes (say, there are N of them) 
about upcoming computations. 
4. Each Spark worker node creates its own Julia process, independent from 
Julia process 1. 
5. Each Spark worker node receives serialized function and passes it to its 
local Julia process. 

So with N workers in Spark cluster, there's in total N+1 Julia processes, 
and when function in question is created, Julia processes from 2 to N+1 
don't even exist yet.


On Friday, August 14, 2015 at 12:35:18 PM UTC+3, Tim Holy wrote:

 If you define the function with @everywhere, it will be defined on all 
 existing 
 workers. Likewise, `using MyPackage` loads the package on all workers. 

 --Tim 

 On Thursday, August 13, 2015 03:10:54 PM Andrei Zh wrote: 
  Ok, after going through serialization code, it's clear that default 
  implementation doesn't support serializing function code, but only its 
  name. For example, here's relevant section from 
  `deserialize(::SerializationState, ::Function)`: 
  mod = deserialize(s)::Module 
  name = deserialize(s)::Symbol 
  if !isdefined(mod,name) 
  return (args...)-error(function $name not defined on process 
  $(myid())) 
  end 
  
  
  
  This doesn't fit my needs (essentially, semantics of Spark), and I guess 
  there's no existing solution for full function serialization. Thus I'm 
  going to write new solution for this. 
  
  So far the best idea I have is to get function's AST and recursively 
  serialize it, catching calls to the other non-Base function and any 
 bound 
  variables. But this looks quite complicated. Is there better / easier 
 way 
  to get portable function's representation? 
  
  On Monday, August 10, 2015 at 11:48:55 PM UTC+3, Andrei Zh wrote: 
   Yes, I incorrectly assumed `serialize` / `deserialize` use JLD format. 
 But 
   anyway, even when I saved the function into example.jls or even 
 plain 
   byte array (using IOBuffer and `takebuf_array`), nothing changed. Am I 
   missing something obvious? 
   
   On Monday, August 10, 2015 at 11:40:03 PM UTC+3, Tim Holy wrote: 
   On Monday, August 10, 2015 01:13:15 PM Tony Kelman wrote: 
Should 
probably use some different extension for that, .jls or something, 
 to 
   
   avoid 
   
confusion. 
   
   Yes. That has been sufficiently confusing in the past, we even cover 
 this 
   here: 
   
   
 https://github.com/JuliaLang/JLD.jl#saving-and-loading-variables-in-julia 
   -data-format-jld 
   
   --Tim 
   
On Monday, August 10, 2015 at 12:45:35 PM UTC-7, Stefan Karpinski 
   
   wrote: 
 JLD doesn't support serializing functions but Julia itself does. 
 
 On Mon, Aug 10, 2015 at 3:43 PM, Andrei Zh faithle...@gmail.com 
 
 javascript: wrote: 
 I'm afraid it's not quite true, and I found simple way to show 
 it. 
   
   In the 
   
 next code snippet I define function `f` and serialize it to a 
 file: 
 
 julia f(x) = x + 1 
 f (generic function with 1 method) 
 
 julia f(5) 
 6 
 
 julia open(example.jld, w) do io serialize(io, f) end 
 
 
 Then I close Julia REPL and in a new session try to load and use 
   
   this 
   
 function: 
 
 julia f2 = open(example.jld) do io deserialize(io) end 
 (anonymous function) 
 
 julia f2(5) 
 ERROR: function f not defined on process 1 
 
  in error at error.jl:21 
  in anonymous at serialize.jl:398 
 
 So deserialized function still refers to the old definition, 
 which 
   
   is not 
   
 available in this new session. 
 
 Is there any better way to serialize a function and run it on an 
 unrelated Julia process? 
 
 On Monday, August 10, 2015 at 2:33:11 PM UTC+3, Jeff Waller 
 wrote: 
 My question is: does Julia's serialization produce completely 
 self-containing code that can be run on workers? In other 
 words, 
   
   is it 
   
 possible to send serialized function over network to another 
 host 
   
   / 
   
 Julia 
 process and applied there without any additional information 
 from 
   
   the 
   
 first 
 process? 
 
 I made some tests on a single machine, and when I defined 
 function 
 without `@everywhere`, worker failed with a message function 
   
   myfunc 
   
 not 
 defined on process 1. With `@everywhere`, my code worked, but 
   
   will it 
   
 work 
 on multiple hosts with essentially independent Julia 
 processes? 
 
 According to Jey here 
  
   
   
 https://groups.google.com/forum/#!searchin/julia-users/jey/julia-users/