[julia-users] efficiency of sparse array creation

2014-04-29 Thread Ryan Gardner
Creating sparse arrays seems exceptionally slow. I can set up the non-zero data of the array relatively quickly. For example, the following code takes about 80 seconds on one machine. vec_len = 70 row_ind = Uint64[] col_ind = Uint64[] value = Float64[] for j = 1:70 for k = 1:700

[julia-users] Re: Array constructor

2014-04-29 Thread Renoir
Uninitialized, i forgot this. Thx. Il giorno mercoledì 30 aprile 2014 00:17:14 UTC+2, Jake Bolewski ha scritto: > > Renoir, > > Array(Int, 1) is a constructor for an uninitialized array. The contents > of an uninitialized array are just what is in memory at those addresses. > > On Tuesday, Apr

[julia-users] Re: Trying to import a graph from NetworkX

2014-04-29 Thread Miles Gould
I've now merged this fix, and released it as part of v0.4.2 (and thanks to Miles for merging my PR on METADATA.jl!). If you run Pkg.update() you should find the bug is now fixed. (Other) Miles On Saturday, 26 April 2014 18:22:38 UTC+1, Miles Lubin wrote: > > Hi Ohad, > > There was indeed a bug

[julia-users] Re: Array constructor

2014-04-29 Thread Jake Bolewski
Renoir, Array(Int, 1) is a constructor for an uninitialized array. The contents of an uninitialized array are just what is in memory at those addresses. On Tuesday, April 29, 2014 6:10:47 PM UTC-4, Renoir wrote: > > Hi all. Just curious for this: > > a1 = Array(Int, 1) > a1[1] is 0 > a2 = Arr

Re: [julia-users] Array constructor

2014-04-29 Thread John Myles White
You're just getting dirty memory, which has random values in it. -- John On Apr 29, 2014, at 3:10 PM, Renoir wrote: > Hi all. Just curious for this: > > a1 = Array(Int, 1) > a1[1] is 0 > a2 = Array(Int,1) > and a2[1] is always 0. > ... > > once, and only once, i get > > julia> a = Array

[julia-users] Array constructor

2014-04-29 Thread Renoir
Hi all. Just curious for this: a1 = Array(Int, 1) a1[1] is 0 a2 = Array(Int,1) and a2[1] is always 0. ... once, and only once, i get julia> a = Array(Int,1) 1-element Array{Int64,1}: 4294967296 and a[1] was 4294967296 why that value? I was using Julia 0.2.0 Regards

Re: [julia-users] Array/Cell - a useful distinction, or not?

2014-04-29 Thread Milan Bouchet-Valat
Le mardi 29 avril 2014 à 11:51 -0400, Stefan Karpinski a écrit : [...] > 1. > > The explicit distinction between A – the actual parameter type of x – > and B, which is simply an upper bound on A, becomes clearer in > situations like this: > > > frob{A<:B}(x::P{A}, y::A) >

[julia-users] Re: Vector to column matrix

2014-04-29 Thread Matt Bauman
Ah, this was tried once before to get included in Base, and it was turned down. Colon makes much more sense here (and works better, too). https://github.com/JuliaLang/julia/pull/4263 One final iteration (I'll see if we can get this version into Base): function Base.reshape{N}(a::AbstractArray

Re: [julia-users] Re: Julia Hack Nights?

2014-04-29 Thread Jiahao Chen
I've been busy, so the cajun meetups have slipped somewhat from the original monthly plan. I can certainly advertise on julia-cajun if someone wants to put together such a hack night. I believe Cameron mentioned to me May 9 as a possibility. Thanks, Jiahao Chen Staff Research Scientist MIT Compute

Re: [julia-users] Re: Julia Hack Nights?

2014-04-29 Thread Cameron McBride
On Tue, Apr 29, 2014 at 2:13 PM, Iain Dunning wrote: > Nothing has really been happening in Cambridge more often than those. What > exactly is a hack night? > All I had in mind was an informal meeting where there is work on something julia for the evening (an hour or two or so). Basically, no s

Re: [julia-users] Re: Julia Hack Nights?

2014-04-29 Thread Iain Dunning
(BTW, the Cambridge meetup is great, everyone in the area should come!) On Tuesday, April 29, 2014 2:13:31 PM UTC-4, Iain Dunning wrote: > > Nothing has really been happening in Cambridge more often than those. What > exactly is a hack night?

Re: [julia-users] Re: Array/Cell - a useful distinction, or not?

2014-04-29 Thread Jacob Quinn
Excellent points Tomas. I think this would be particularly helpful for those coming from Java. Perhaps some of your comments could be worked into the manual or FAQ somewhere. -Jacob On Tue, Apr 29, 2014 at 2:43 PM, Tomas Lycken wrote: > Yet another point of view - incidentally the one that conv

Re: [julia-users] Re: Array/Cell - a useful distinction, or not?

2014-04-29 Thread Tomas Lycken
Yes, when declaring function arguments, which I believe fall under case 2. in this list. Is it possible for a usage of `::` that falls under category 1? // T On Tuesday, April 29, 2014 9:07:08 PM UTC+2, Tim Holy wrote: > > On

Re: [julia-users] Re: Array/Cell - a useful distinction, or not?

2014-04-29 Thread Tim Holy
On Tuesday, April 29, 2014 11:43:03 AM Tomas Lycken wrote: > Say I have a variable x, and I want to make sure that it's an array > of real numbers that are all of the same type, but I don't care which one. > Can I say x::Array{T<:Real} as a type assertion? function f{T<:Real}(x::Array{T}) ...

[julia-users] Re: Vector to column matrix

2014-04-29 Thread Matt Bauman
Oops: prod, not sum: function Base.reshape{N}(a::AbstractArray, dims::NTuple{N,Union(Int,())}) missing_mask = [isa(x,Tuple) for x in dims] sum(missing_mask) == 1 || throw(DimensionMismatch("new dimensions $(dims) may only have up to one omitted dimension")) sz = length(a) / prod(dims

[julia-users] Re: Vector to column matrix

2014-04-29 Thread Matt Bauman
It'd be nice to allow up to one missing dimension in the dimension tuple, and calculate it automatically. Something like this works nicely, where the missing dimension is specified by (): function Base.reshape{N}(a::AbstractArray, dims::NTuple{N,Union(Int,())}) missing_mask = [isa(x,Tuple)

[julia-users] Re: recommended way to change components of custom types / how to write a function!()

2014-04-29 Thread Tomas Lycken
Function values are passed by reference, so you can just add to my.x inside your function: julia> myadd = function(z,my::mytype) my.x += z end julia> my = mytype() mytype(1.1) julia> myadd(3.0,my)

[julia-users] Re: How to choose from the array to the new array only selected columns?

2014-04-29 Thread paul analyst
thanks, b = a[:;[1; 3; 5]] and b = a[:,[1, 3, 5]] woks too... What is the difference between "," and ";" Paul W dniu wtorek, 29 kwietnia 2014 20:34:44 UTC+2 użytkownik Patrick O'Leary napisał: > > b = a[:,[1; 3; 5]] > > or if they are always going to be evenly spaced indexes like that, you ca

[julia-users] Re: Array/Cell - a useful distinction, or not?

2014-04-29 Thread Tomas Lycken
Yet another point of view - incidentally the one that convinced me that Julia has got this right, while most others don't - is the fact that in the grand scheme of things, JIT is *cheap *while working with types that might have subtypes is *really painful* if you don't want to compromise with p

[julia-users] Re: How to choose from the array to the new array only selected columns?

2014-04-29 Thread Patrick O'Leary
b = a[:,[1; 3; 5]] or if they are always going to be evenly spaced indexes like that, you can use a range: b = a[:, 1:2:5] On Tuesday, April 29, 2014 1:23:36 PM UTC-5, paul analyst wrote: > > a =rand(5,5) > b=slicedim(a,2,1,3,5) > ERROR: no method slicedim(Array{Float64,2}, Int64, Int64, Int64,

[julia-users] Re: Problem loading libcurl in windows environment: error compiling setup_easy_handle: could not load module libcurl

2014-04-29 Thread Tony Kelman
Hi. When you cross-post the same question to both the mailing list and as a new Github issue, it would help people keep track of things if you could post links from one to the other - https://github.com/JuliaLang/julia/issues/6687 As I wrote on the Github issue, this is due to the LibCURL.jl pa

[julia-users] How to choose from the array to the new array only selected columns?

2014-04-29 Thread paul analyst
a =rand(5,5) b=slicedim(a,2,1,3,5) ERROR: no method slicedim(Array{Float64,2}, Int64, Int64, Int64, Int64) how to choose from matrix a column 1,3,5 wihout while etc.? Paul

Re: [julia-users] Re: Julia Hack Nights?

2014-04-29 Thread Iain Dunning
Nothing has really been happening in Cambridge more often than those. What exactly is a hack night?

[julia-users] Vector to column matrix

2014-04-29 Thread Tom Nickson
Is there an built-in way to convert a vector to a column matrix without transposing twice? I can make a matrix into a vector with vec or squeeze, but I can't see a simple way to convert from a 1d array to a 2d without initialising it, calling reshape and having to measure the size. I've put thi

[julia-users] recommended way to change components of custom types / how to write a function!()

2014-04-29 Thread Florian Oswald
Hi all, suppose i have a custom type julia> type mytype x :: Float64; # constructor function mytype() new(1.1) end end julia> my=mytype() mytype(1.1) and I want to modify x many times, always keeping track of the most recent state. suppose x is a

[julia-users] Re: Array/Cell - a useful distinction, or not?

2014-04-29 Thread Jason Merrill
On Tuesday, April 29, 2014 9:29:56 AM UTC-7, Oliver Woodford wrote: > > On Tuesday, April 29, 2014 5:14:01 PM UTC+1, Jason Merrill wrote: >> >> Suppose the types that you want existed. Let's call them ConcreteArray, >> and Cell. >> >> ConcreteArray gives the guarantee that all of it's elements are

Re: [julia-users] CMA-ES implementation

2014-04-29 Thread Hans W Borchers
In R there are implementations of both the minimal CMA-ES code (also called bareCMAES or pureCMAES, the Wikipedia version) and an adaption of the Matlab code in parts. We have done lots of tests with these implementations. It turned out in too many cases that the implementations are unstable an

Re: [julia-users] Re: Release process

2014-04-29 Thread Stefan Karpinski
I think that the only thing we're waiting on is my hashing branch. I've been working on bringing comparisons (isequal, isless) into line with the new hashing behavior that it introduced. It's pretty tedious work, but I've made a fair amount of progress.

Re: [julia-users] Re: Release process

2014-04-29 Thread Ryan Gardner
Any rough estimate on what "soon" is? ...not trying to push, of course. We're trying to lock in on a version of Julia and if soon is like 2 days, this may affect what we decide to do. On Monday, April 28, 2014 2:33:26 PM UTC-4, Isaiah wrote: > > There is no official schedule yet. It has been

Re: [julia-users] Re: Array/Cell - a useful distinction, or not?

2014-04-29 Thread Matt Bauman
Perhaps the Julian curly-brace array syntax makes Any[] arrays seem special (especially to Matlab converts), when they're really not all that different. Yes, users need to learn that Array{Real} is not a supertype of Array{Int}. But that's a common theme throughout Julia's type system, and re

Re: [julia-users] Re: Array/Cell - a useful distinction, or not?

2014-04-29 Thread Stefan Karpinski
On Tue, Apr 29, 2014 at 12:13 PM, Oliver Woodford wrote: > Quick question, folks: > > Does f(x::Array{Union(Int8,Int16)}) mean that x must be all Int8 or all > Int16 (homogenous), or each element can be either Int8 or Int16 > (heterogeneous)? > > If the latter, then would I need to > use f(x::Uni

[julia-users] Re: Array/Cell - a useful distinction, or not?

2014-04-29 Thread Oliver Woodford
On Tuesday, April 29, 2014 5:14:01 PM UTC+1, Jason Merrill wrote: > > Suppose the types that you want existed. Let's call them ConcreteArray, > and Cell. > > ConcreteArray gives the guarantee that all of it's elements are stored > directly with a fixed stride. > > Can you give some examples of fu

Re: [julia-users] Re: Array/Cell - a useful distinction, or not?

2014-04-29 Thread Oliver Woodford
On Tuesday, April 29, 2014 5:13:08 PM UTC+1, Jacob Quinn wrote: > > In my experience, I can think of a single time when having an array of a > specific abstract type was useful (how multiple Period arithmetic is > handled: > https://github.com/karbarcca/Dates.jl/blob/master/src/periods.jl#L88).

Re: [julia-users] Array/Cell - a useful distinction, or not?

2014-04-29 Thread Stefan Karpinski
Thinking about it some more, the big problem with covariance is that it forces the confusion of two distinct meanings of P{B} for abstract B: 1. The concrete instance of type P with actual parameter type B. 2. The abstract type including all instances P{A} where A <: B. If P{B} meant the la

[julia-users] Array/Cell - a useful distinction, or not?

2014-04-29 Thread Jason Merrill
Suppose the types that you want existed. Let's call them ConcreteArray, and Cell. ConcreteArray gives the guarantee that all of it's elements are stored directly with a fixed stride. Can you give some examples of functions that would use these in their type signature?

Re: [julia-users] Re: Array/Cell - a useful distinction, or not?

2014-04-29 Thread Jacob Quinn
In my experience, I can think of a single time when having an array of a specific abstract type was useful (how multiple Period arithmetic is handled: https://github.com/karbarcca/Dates.jl/blob/master/src/periods.jl#L88). Almost always, I'm concentrating on making sure Arrays I work with are of a

[julia-users] Re: Array/Cell - a useful distinction, or not?

2014-04-29 Thread Oliver Woodford
Quick question, folks: Does f(x::Array{Union(Int8,Int16)}) mean that x must be all Int8 or all Int16 (homogenous), or each element can be either Int8 or Int16 (heterogeneous)? If the latter, then would I need to use f(x::Union(Array{Int8},Array{Int16})) to achieve the former? If so, then what

[julia-users] Re: Array/Cell - a useful distinction, or not?

2014-04-29 Thread Oliver Woodford
On Tuesday, April 29, 2014 4:53:05 PM UTC+1, Matt Bauman wrote: > > I use cell arrays very often in Matlab, too, but I've found that I often > don't really need to even worry about the distinction in julia. Square > brackets will constrain the types as much as possible, and if it's not > poss

Re: [julia-users] Re: Julia Hack Nights?

2014-04-29 Thread Cameron McBride
There is this an organized meetup in Cambrige (MA), but does anything more regular happen locally? http://www.meetup.com/julia-cajun/ I guess hack nights could probably be organized through the same meetup? Any interest? Cameron On Tue, Apr 29, 2014 at 2:48 AM, svakSha wrote: > On Tue, Apr 2

[julia-users] Re: Array/Cell - a useful distinction, or not?

2014-04-29 Thread Oliver Woodford
On Tuesday, April 29, 2014 4:41:52 PM UTC+1, Patrick O'Leary wrote: > > It might be easier to understand if we start by stripping away the > constraints and the function syntax and look just at the array type. > > Array{Real} is a concrete type. It's an array whose elements are all > subtypes of

[julia-users] Re: Array/Cell - a useful distinction, or not?

2014-04-29 Thread Matt Bauman
I use cell arrays very often in Matlab, too, but I've found that I often don't really need to even worry about the distinction in julia. Square brackets will constrain the types as much as possible, and if it's not possible, Any[] == {}. Moreover, most of what I used cell arrays for in Matlab

Re: [julia-users] Array/Cell - a useful distinction, or not?

2014-04-29 Thread Stefan Karpinski
The real root issue here is parametric variance. Julia has opted for parametric invariance – i.e. that P{A} <: P{B} only if A = B – which is what James mentions in his StackOverflow answer. The wikipedia page does a de

Re: [julia-users] Re: Array/Cell - a useful distinction, or not?

2014-04-29 Thread Oliver Woodford
On Tuesday, April 29, 2014 4:38:59 PM UTC+1, John Myles White wrote: > > On Apr 29, 2014, at 8:28 AM, Oliver Woodford > > > wrote: > > > Are you saying that f{T<:Real}(a::Array{T}) covers both homogeneous and > heterogeneous arrays, whereas f(a::Array{Real}) only covers heterogeneous > arrays

Re: [julia-users] Re: Array/Cell - a useful distinction, or not?

2014-04-29 Thread Stefan Karpinski
On Tue, Apr 29, 2014 at 11:38 AM, John Myles White wrote: > Array{Any} is also a single type. Not to nit-pick, but there's a second type parameter, so it's actually still abstract. But Array{Any,1} is a single type with no subtypes, which I think is what you meant.

[julia-users] Re: Array/Cell - a useful distinction, or not?

2014-04-29 Thread Patrick O'Leary
It might be easier to understand if we start by stripping away the constraints and the function syntax and look just at the array type. Array{Real} is a concrete type. It's an array whose elements are all subtypes of the abstract type Real. Array{T} is a family of types. It describes a whole bu

Re: [julia-users] Re: Array/Cell - a useful distinction, or not?

2014-04-29 Thread John Myles White
On Apr 29, 2014, at 8:28 AM, Oliver Woodford wrote: > > Are you saying that f{T<:Real}(a::Array{T}) covers both homogeneous and > heterogeneous arrays, whereas f(a::Array{Real}) only covers heterogeneous > arrays? If that's the case it strikes me as just as confusing. This is indeed how param

[julia-users] Re: Array/Cell - a useful distinction, or not?

2014-04-29 Thread Oliver Woodford
On Tuesday, April 29, 2014 3:48:52 PM UTC+1, Ivar Nesje wrote: > > Sorry for nitpicking, but point 3 is wrong, and it might cause trouble in > the following discussion. > > f{T<:Real}(a::Array{T}) > Matches any array with a element type that is a subtype of Real (eg. > Integer[1,2,BigInt(44)] an

[julia-users] Re: Array/Cell - a useful distinction, or not?

2014-04-29 Thread Oliver Woodford
On Tuesday, April 29, 2014 4:10:37 PM UTC+1, Jason Merrill wrote: > > Do you find yourself dealing with heterogeneous arrays often? It might be > useful to post some examples where this comes up to the list. In my Matlab code I use cell arrays (heterogenous) a great deal, and of course normal a

[julia-users] Array/Cell - a useful distinction, or not?

2014-04-29 Thread Jason Merrill
Do you find yourself dealing with heterogeneous arrays often? It might be useful to post some examples where this comes up to the list. Julia compiles specialized versions of functions for the concrete types they are called with at run time, so you should usually think of the types in function

[julia-users] Re: Array/Cell - a useful distinction, or not?

2014-04-29 Thread Ivar Nesje
Sorry for nitpicking, but point 3 is wrong, and it might cause trouble in the following discussion. f{T<:Real}(a::Array{T}) Matches any array with a element type that is a subtype of Real (eg. Integer[1,2,BigInt(44)] and Real[1, 3.4]) I have had trouble with this too, but now that I somewhat un

[julia-users] Problem loading libcurl in windows environment: error compiling setup_easy_handle: could not load module libcurl

2014-04-29 Thread sam cooper
When trying to run the Plotly.plot function in julia (running on windows 8 unfortunatley I can't change this having tried extensivley) I am encountering the error message: error compiling setup_easy_handle: could not load module libcurl This problem seems to be a recurrent problem in windows e

Re: [julia-users] CMA-ES implementation

2014-04-29 Thread Nikolaus Hansen
good question, the Matlab version is now also released in the public domain. The code is in any case also given in Wikipedia. -- Niko On Wednesday, 4 September 2013 17:07:13 UTC+2, John Myles White wrote: > > If someone feels up to it, it would be great to ask the author why the > Python versi

Re: [julia-users] CMA-ES implementation

2014-04-29 Thread Nikolaus Hansen
On Wednesday, 4 September 2013 16:29:28 UTC+2, Isaiah wrote: Maybe this is less useful, but the basic/demo version (by the author > himself) is public domain: > https://www.lri.fr/~hansen/barecmaes2.py > > And the Apache commons Java version claims to be Apache licensed, though > it is explicitl

[julia-users] Array/Cell - a useful distinction, or not?

2014-04-29 Thread Oliver Woodford
A habitual MATLAB user, I've been trying out Julia over the last two weeks to see if it might be a suitable replacement. I want something that is as fast to develop using, but has much faster runtime. Perhaps I'll write about my general thoughts in another post. However, in this thread I want t

[julia-users] Re: Memory allocation for vectorized operations

2014-04-29 Thread John Aslanides
Avik: this is actually the situation I'm in. My tight inner loops involve elementwise operations on many small arrays, so the runtime cost of using vectorized code is enormous. Using the macros provided by Devectorize.jl only somewhat alleviates this problem, so I ended up hand-writing devector

Re: [julia-users] how to convert csv file to bin and how to read bin file in Julia

2014-04-29 Thread Tim Holy
By "processes" you mean other programs that can't read HDF5? Then you have to pick some binary format that all of your programs can handle---there is no such thing as a "binary CSV file," CSV is by definition an ascii format. --Tim On Tuesday, April 29, 2014 10:08:23 AM Paul Analyst wrote: > W

[julia-users] Re: Memory allocation for vectorized operations

2014-04-29 Thread Avik Sengupta
That overhead seems constant, beyond a single temporary. So I dont suppose there is that much to be worried about, unless you are using many small arrays. julia> 800-sizeof(rand(2)) 784 julia> 944-sizeof(rand(20)) 784 On Tuesday, 29 April 2014 10:40:10 UTC+1, Carlos Becker wrote: > > Besides

[julia-users] Re: Memory allocation for vectorized operations

2014-04-29 Thread Carlos Becker
Besides Julia internals, I suppose there is memory overhead in terms of the structure holding the array itself (when temporaries are created). I suppose an array isn't just the size in bytes of the data it holds, but also information about its size/type/etc. Though I doubt that would add up to 8

[julia-users] Re: Memory allocation for vectorized operations

2014-04-29 Thread Carlos Becker
I just saw another part of your message, I am wondering also why memory consumption is so high. El martes, 29 de abril de 2014 11:31:09 UTC+2, Carlos Becker escribió: > > This is likely to be because Julia is creating temporaries. This is > probably why you get increasing memory usage when incre

[julia-users] Re: Memory allocation for vectorized operations

2014-04-29 Thread Carlos Becker
This is likely to be because Julia is creating temporaries. This is probably why you get increasing memory usage when increasing array size. This is a long topic, that will have to be solved (hopefully soon), I had a previous question related to something similar here: https://groups.google.com

[julia-users] Re: Bindling a command line utility with a package

2014-04-29 Thread Mike Innes
I'm not sure that packages should export main() functions – that's going to complicated things when a user wants to require CRC and define their own main(). How about leaving it unexported and using julia -e "using PKG; PKG.main(ARGS)"? On Sunday, 27 April 2014 16:12:41 UTC+1, andrew cooke wro

Re: [julia-users] Anyone created MIME type for julia files?

2014-04-29 Thread Mike Innes
I'm using "text/julia" at the moment. That's following CodeMirror's standard of using e.g. "text/x-python", but with the x dropped because it's been deprecated.

Re: [julia-users] how to convert csv file to bin and how to read bin file in Julia

2014-04-29 Thread Paul Analyst
W dniu 2014-04-28 22:34, Tim Holy pisze: Read as CSV, and write as HDF5? --Tim On Monday, April 28, 2014 11:24:06 AM paul analyst wrote: How to convert csv big file (utf8) to bin format ? csv file: 12356.5,12455.5,12545.4,124784.2 12564.2,25488.01,25544.6,125847.2 ... How to read new file (bi

Re: [julia-users] Odd performance when summing/scaling more than 3 complex numbers

2014-04-29 Thread Ivar Nesje
Another point about coding style. You use the `@inbounds` macro without explicitly checking bounds first. That might be acceptable for benchmarking and testing, but when you share your code online I think it is important to be aware of the dangers if this kind of pattern is used in production co