Re: [julia-users] Getting Subarray with Multiple Boolean Comparions (Logical Indexing)

2015-03-30 Thread Tim Holy
A=rand(4,4); A[:,vec(A[1,:].0.7)] --Tim On Sunday, March 29, 2015 12:07:10 PM Andreas ten Pas wrote: How can we do the following *Matlab* code in *Julia*? A=rand(4); A(:,A(1,:)0.7) I've tried this in *Julia*: A=rand(4,4); A[:,A[1,:].0.7] And how would we combine multiple *boolean

[julia-users] Re: Applying Mean/Min/Max/Sum (and similar) over conditional subsets of Vectors/Matrices / Is it possible without creating copies?

2015-03-30 Thread bernhard
After some thinking I defined a custom function (looping over the array) for the mean. This is a bit cumbersome but fine given that it is about 3 times faster and has only 288 bytes of memory allocation (compared to 1 GB!) in the example below. If anyone knows how to do this faster I would

[julia-users] Applying Mean/Min/Max/Sum (and similar) over conditional subsets of Vectors/Matrices / Is it possible without creating copies?

2015-03-30 Thread bernhard
Hello all I understand that indexing a vector creates a copy thereof. This does not seem to be the optimal way to, say, sum over all elements which satisfy a certain condition. Is there a way to optimize the performance of the toy examples below? I just did read up on various functions such as

Re: [julia-users] Understanding the Cost of Virtualization

2015-03-30 Thread Stefan Karpinski
When it comes to advanced techniques for optimizing dynamic code, we have barely scratched the surface. What Julia does now is essentially just static compilation at runtime – enabled by aggressive specialization and type inference. All the fancy things that fast JavaScript implementations do to

[julia-users] Re: DL_LOAD_PATH moved

2015-03-30 Thread Tony Kelman
see https://github.com/JuliaLang/Compat.jl On Monday, March 30, 2015 at 6:53:30 AM UTC-7, Abel Soares Siqueira wrote: Hi, I have this code: push!(DL_LOAD_PATH,.) But the master moved DL_LOAD_PATH to Libdl. I want my code to work on release-0.3 and master, so I changed it to

Re: [julia-users] Getting Subarray with Multiple Boolean Comparions (Logical Indexing)

2015-03-30 Thread Stefan Karpinski
Related to https://github.com/JuliaLang/julia/issues/10618 – I think this should be fixed. On Mon, Mar 30, 2015 at 6:08 AM, Milan Bouchet-Valat nalimi...@club.fr wrote: Le lundi 30 mars 2015 à 04:54 -0500, Tim Holy a écrit : A=rand(4,4); A[:,vec(A[1,:].0.7)] And as regards your second

[julia-users] DL_LOAD_PATH moved

2015-03-30 Thread Abel Soares Siqueira
Hi, I have this code: push!(DL_LOAD_PATH,.) But the master moved DL_LOAD_PATH to Libdl. I want my code to work on release-0.3 and master, so I changed it to this: try push!(DL_LOAD_PATH,.) catch push!(Libdl.DL_LOAD_PATH,.) end Is there a better option? Best

Re: [julia-users] Getting Subarray with Multiple Boolean Comparions (Logical Indexing)

2015-03-30 Thread Tim Holy
On Monday, March 30, 2015 09:30:48 AM Stefan Karpinski wrote: Related to https://github.com/JuliaLang/julia/issues/10618 – I think this should be fixed. And as that link points out, it is...once we can merge #10525. --Tim On Mon, Mar 30, 2015 at 6:08 AM, Milan Bouchet-Valat

[julia-users] Re: Extending a DataFrame (or, why aren't my imports working?)

2015-03-30 Thread kevin . dale . smith
I think I've got my head pretty much wrapped around all of this. I figured I'd recap just in case anyone else comes across any of the issues discussed. import DataFrames # Like import DataFrames in Python, requires DataFrames.foo for all methods using DataFrames# Like import DataFrames;

Re: [julia-users] Re: Applying Mean/Min/Max/Sum (and similar) over conditional subsets of Vectors/Matrices / Is it possible without creating copies?

2015-03-30 Thread Tim Holy
Nope, that's the best way to do it. Yet another illustration that it's trivial to write code that beats any attempt to cleverly mix together library functions. I'd get rid of the @inbounds, though, it doesn't serve any purpose for a function that runs a long loop. Inlining too much can

Re: [julia-users] Re: encode 4 x 1 byte into a one 4 bytes variable

2015-03-30 Thread J Luis
Thanks, I ended up using Stefan's bit shifts solution because it works and doesn't require any additional dependency.

Re: [julia-users] Re: Extending a DataFrame (or, why aren't my imports working?)

2015-03-30 Thread Mauro
Thanks for the summary! I think something like this should go into the manual as it is not particularly clear... On Mon, 2015-03-30 at 17:09, kevin.dale.sm...@gmail.com wrote: I think I've got my head pretty much wrapped around all of this. I figured I'd recap just in case anyone else comes

[julia-users] map returns DataArray{Any, 1} instead of Array{Int64, 1}

2015-03-30 Thread Philip Tellis
I have a DataArray{UTF8String,1} and I have a Dict generated using indexmap that should take this UTF8String and return an Int64, however, when I pass this through `map`, I get back a DataArray{Any, 1} instead of an Array{Int64, 1} Any idea why and what I can do to fix it? I'm using Julia

Re: [julia-users] converting array of Int64 to array of UTF8String doesn't quite work

2015-03-30 Thread Philip Tellis
On Sunday, March 29, 2015 at 1:06:29 PM UTC-4, Milan Bouchet-Valat wrote: Le dimanche 29 mars 2015 à 09:46 -0700, Philip Tellis a écrit : As to my actual problem, what I have is a DataFrame with two columns, one a DataArray{UTF8String, 1} and the other a DataArray{Int64, 1}, and I need

[julia-users] map returns DataArray{Any, 1} instead of Array{Int64, 1} [fixed formatting]

2015-03-30 Thread Philip Tellis
I have a DataArray{UTF8String, 1} and I am trying to map it to an Array{Int64, 1} using a Dict lookup. My Dict is of type Dict{String, Int64}, and I'm using map to do the lookup. However, it seems that the map returns a DataArray{Any, 1} instead of an Array{Int64, 1}, and I don't understand

Re: [julia-users] how to model semicontinuous variables in Julia

2015-03-30 Thread Miles Lubin
Hi Michela, It looks like you're referring to JuMP, in which case: @defVar(m, a = x = b, SemiCont) should do the trick. See also the documentation: http://jump.readthedocs.org/en/release-0.8/refvariable.html?highlight=semicontinuous We prefer to direct optimization-related questions to

[julia-users] Dealing with memory accumulation on worker processes

2015-03-30 Thread Gregory Plumb
Hello, I have a function that pushes some data onto other processes. It does this by constructing a RemoteRef on each worker process and then using put!() to put the data onto each process. These RemoteRef's are stored in an array. The main function then calls some other functions on the

Re: [julia-users] Re: Applying Mean/Min/Max/Sum (and similar) over conditional subsets of Vectors/Matrices / Is it possible without creating copies?

2015-03-30 Thread Milan Bouchet-Valat
Le lundi 30 mars 2015 à 09:46 -0500, Tim Holy a écrit : Nope, that's the best way to do it. Yet another illustration that it's trivial to write code that beats any attempt to cleverly mix together library functions. I'd get rid of the @inbounds, though, it doesn't serve any purpose for

[julia-users] semicontinuous variables

2015-03-30 Thread Michela Di Lullo
how do I model in Julia a variable that can be either zero or in some range non containing zero? e.g. x \in 0 \cup [a,b] where a0. Thanks in advance for any information! Michela

[julia-users] how to model semicontinuous variables in Julia

2015-03-30 Thread Michela Di Lullo
Hallo everyone! how do I model a variable (array of variables) that can either be zero or in some range not containing zero? e.g. x∈0∪[a,b] where a0 Thank you in advance for any information! Michela

Re: [julia-users] Re: DL_LOAD_PATH moved

2015-03-30 Thread Abel Siqueira
Thanks very much, it worked. Best Regards, Abel On 03/30/2015 11:31 AM, Tony Kelman wrote: see https://github.com/JuliaLang/Compat.jl On Monday, March 30, 2015 at 6:53:30 AM UTC-7, Abel Soares Siqueira wrote: Hi, I have this code: push!(DL_LOAD_PATH,.) But the

Re: [julia-users] how to model semicontinuous variables in Julia

2015-03-30 Thread Kevin Squire
Hi Michela, I think you're going to need to provide some additional information. Are you modeling this in JuMP by chance? Cheers, Kevin On Mon, Mar 30, 2015 at 12:25 PM, Michela Di Lullo michela.dilu...@uniroma1.it wrote: Hallo everyone! how do I model a variable (array of variables)

[julia-users] Performance differences between these two constructs?

2015-03-30 Thread Seth
Hi all, Consider the following: typealias Edge Pair{Int,Int} src(e::Edge) = e.first dst(e::Edge) = e.second Under what circumstances, if any, will calling src(e) or dst(e) incur a performance penalty relative to p = Pair{Int,Int}(...) p.first, p.second ? Thanks.

[julia-users] Indexing with Reals is deprecated

2015-03-30 Thread Júlio Hoffimann
What is the rationale for the change? It makes Julia faster? Right now I only see this as a limitation from an user perspective. -Júlio

Re: [julia-users] Indexing with Reals is deprecated

2015-03-30 Thread Isaiah Norton
Extended discussion: https://github.com/JuliaLang/julia/issues/10154 On Mon, Mar 30, 2015 at 6:22 PM, Júlio Hoffimann julio.hoffim...@gmail.com wrote: What is the rationale for the change? It makes Julia faster? Right now I only see this as a limitation from an user perspective. -Júlio

[julia-users] Re: Is it possible to use Nullable with abstract types?

2015-03-30 Thread Steve Cordwell
Actually there were some bugs in the code. The following code works: zero_mask!{T,N}(a::AbstractArray{T,N}, mask::AbstractArray{Bool,N}) = setindex!(a, zero(T), find(!mask)) function do_stuff{N}(rows, columns, mask::Nullable{Array{Bool,N}}) a = rand(rows, columns) isnull(mask) ? nothing

[julia-users] ANN: Match.jl v0.1.0 released

2015-03-30 Thread Kevin Squire
Hi all, Match.jl provides both simple and advanced pattern matching capabilities for Julia. Features include: - Matching against most data types - Deep matching within data types and matrices - Variable binding within matches Usage generally looks like this: using Match @match item

[julia-users] Is it possible to use Nullable with abstract types?

2015-03-30 Thread Steve Cordwell
Say I want to be able to set the value of an array to zero where a boolean mask array is false, then I can define this function: zero_mask!(a::AbstractArray, mask::AbstractArray{Bool}) = setindex!(a, zero(T), find(!mask)) I have a function that constructs arrays and part of its job is to

Re: [julia-users] how to model semicontinuous variables in Julia

2015-03-30 Thread Michela Di Lullo
Il giorno lunedì 30 marzo 2015 21:45:13 UTC+2, Miles Lubin ha scritto: Hi Michela, It looks like you're referring to JuMP, in which case: @defVar(m, a = x = b, SemiCont) should do the trick. See also the documentation:

[julia-users] Finding mode(s) of density estimate

2015-03-30 Thread Benjamin Deonovic
I have some data for which I want to find the mode(s) of the kernel density estimate of the data. Is there anything that already does this? If not what is the best approach?

Re: [julia-users] how to model semicontinuous variables in Julia

2015-03-30 Thread Miles Lubin
No explicit loop is needed: @defVar(m, inf[i]= pt[i=1:hmax] =sup[i], SemiCont) They keyword SemiCont means that the variable can be either equal to zero or fall within the given bounds. Be sure to use a solver which supports this class of variables (Gurobi or CPLEX). On Monday, March 30,

[julia-users] Performance differences between these two constructs?

2015-03-30 Thread Toivo Henningsson
As long as no other methods for src and dst might apply, they should be inlined and I believe the performance should be exactly the same.