Re: [julia-users] shared array of user defined type

2016-10-14 Thread Alexandros Fakos
Thank you Mauro. If I understand correctly, this means that in SharedArrays I cannot use immutable types whose fields contain arrays. Is that right? Thanks a lot, Alex On Friday, October 14, 2016 at 1:57:42 AM UTC-5, Mauro wrote: > > On Fri, 2016-10-14 at 00:02, Alexandros Fakos &l

[julia-users] shared array of user defined type

2016-10-13 Thread Alexandros Fakos
Hi, Is there a way to create a shared array of a user defined composite type? I want to parallelize using pmap() on a function f() which has as arguments user defined composite types. Thanks, Alex

[julia-users] newest stable version of julia on EC2 AWS instances - starcluster

2016-09-09 Thread Alexandros Fakos
Hi, I am trying to run julia in parallel on EC2 AWS. I use the starcluster package to create a cluster of instances. The problem is that the instances have already installed the 0.3.0 prerelease. I log in the starcluster master node and use the instructions from

[julia-users] Re: whole arrays pass by reference while matrix columns by value?

2016-09-09 Thread Alexandros Fakos
thank you all for your helpful suggestions! alex On Wednesday, September 7, 2016 at 7:00:00 PM UTC-5, Alexandros Fakos wrote: > > Hi, > > a=rand(10,2) > b=rand(10) > sort!(b) modifies b > but sort!(a[:,1]) does not modify the first column of matrix a > > why is that? D

[julia-users] whole arrays pass by reference while matrix columns by value?

2016-09-07 Thread Alexandros Fakos
Hi, a=rand(10,2) b=rand(10) sort!(b) modifies b but sort!(a[:,1]) does not modify the first column of matrix a why is that? Does this mean that i cannot write functions that modify their arguments and apply it to columns of matrices? Is trying to modify columns of matrices bad programming

[julia-users] Re: Question about how to use uninitialized fields for Composite type

2015-05-08 Thread Alexandros Fakos
Thanks Toivo, Best, Alex On Friday, May 8, 2015 at 4:55:38 AM UTC-4, Toivo Henningsson wrote: You can also use whichever order you want if you create the new instance with just new() in the constructor and then fill in all the fields that you want just after.

[julia-users] Re: Question about how to use uninitialized fields for Composite type

2015-05-07 Thread Alexandros Fakos
If I don't want to leave fields uninitialized what is the easiest and most correct way to initialize them? Put them all zero with an inner constructor? Thanks a lot, Alex On Thursday, May 7, 2015 at 12:56:35 PM UTC-4, Alexandros Fakos wrote: Andrew, I found your suggestion very helpful

[julia-users] Re: Question about how to use uninitialized fields for Composite type

2015-05-07 Thread Alexandros Fakos
, then whenever you are actually using the type (e.g. not in the constructor) you (most commonly) refer to fields by name so the order in which they were declared doesn't matter. On Thursday, May 7, 2015 at 2:04:36 PM UTC-4, Alexandros Fakos wrote: If I don't want to leave fields uninitialized what

Re: [julia-users] Asking for generic-data-type definition advice

2015-05-07 Thread Alexandros Fakos
Thank you all so much! All your comments were really helpful ! Best, Alex On Thursday, May 7, 2015 at 5:52:39 AM UTC-4, Tim Holy wrote: See also http://docs.julialang.org/en/release-0.3/manual/faq/#how-do-abstract-or-ambiguous-fields-in-types-interact-with-the-compiler --Tim On

[julia-users] Re: Question about how to use uninitialized fields for Composite type

2015-05-07 Thread Alexandros Fakos
Andrew, I found your suggestion very helpful. However, it seems complicated to place uninitialized fields last. Why is this? The field have names and when calling *new() *you are using these names. For example: *julia type foo* * a :: Int64* * b :: Int64* * function foo()* *

[julia-users] show fields of a variable of a composite type

2015-05-06 Thread Alexandros Fakos
Hi, Suppose I have type dat a :: Array{Float64,1} b :: Float64 end and variable *data *of type *dat* is there a function that prints out the fields of *data* with some information about each field? Thanks a lot, Alex

[julia-users] Re: show fields of a variable of a composite type

2015-05-06 Thread Alexandros Fakos
) fieldnames(data) fieldnames(dat) fieldtype(data, :a) Best, Simon Am Mittwoch, 6. Mai 2015 16:27:24 UTC+2 schrieb Alexandros Fakos: Hi, Suppose I have type dat a :: Array{Float64,1} b :: Float64 end and variable *data *of type *dat* is there a function that prints out the fields

[julia-users] Asking for generic-data-type definition advice

2015-05-06 Thread Alexandros Fakos
Hi, Reading the Julia style guide I see avoid writing overly-specific types http://julia.readthedocs.org/en/latest/manual/style-guide/#avoid-writing-overly-specific-types *The main reason I use composite types is in order to aggregate variables and avoid variable name conflicts (the same

[julia-users] Re: show fields of a variable of a composite type

2015-05-06 Thread Alexandros Fakos
Great! now it works. Thanks a lot, Alex On Wednesday, May 6, 2015 at 11:07:02 AM UTC-4, Simon Danisch wrote: Ah yeah it was renamed in 0.4. Its just names(...) in 0.3... Am Mittwoch, 6. Mai 2015 16:27:24 UTC+2 schrieb Alexandros Fakos: Hi, Suppose I have type dat a :: Array

[julia-users] using variables from the workspace to define JuMP problem

2015-05-04 Thread Alexandros Fakos
Hi, z is a variable in the workspace Ideally I would like to define variable x for the optimization problem like: @defVar(m, x[ 1 : length(z) ] = z ) which gives the error ERROR: `Variable` has no method matching Variable(::Model, ::Array{Float64,1}, ::Float64, ::Symbol, ::ASCIIString,

[julia-users] Re: using variables from the workspace to define JuMP problem

2015-05-04 Thread Alexandros Fakos
:23:45 PM UTC-4, Alexandros Fakos wrote: Hi, z is a variable in the workspace Ideally I would like to define variable x for the optimization problem like: @defVar(m, x[ 1 : length(z) ] = z ) which gives the error ERROR: `Variable` has no method matching Variable(::Model, ::Array

Re: [julia-users] Re: function similar to matlab tabulate

2015-05-02 Thread Alexandros Fakos
be faster because it does not end up allocating any memory. --Tim On Thursday, April 30, 2015 02:05:37 PM Alexandros Fakos wrote: Thanks a lot. countmap returns a dictionary but I would prefer an array. How can I do that? Thank you On Thursday, April 30, 2015 at 4:41:43 PM UTC-4

[julia-users] function similar to matlab tabulate

2015-04-30 Thread Alexandros Fakos
Hi, Is there a way to get a table of frequencies of the unique values in an array in Julia? Something like matlab's tabulate Thanks a lot, Alex

[julia-users] broadcast comparison operators

2015-04-30 Thread Alexandros Fakos
Hi, Why the following commands give different results? julia broadcast(.==,[1.0],[0.0,1.0]) 2-element Array{Float64,1}: 0.0 1.0 julia repmat([1.0],2,1).==[0.0,1.0] 2x1 BitArray{2}: false true How can I use broadcast for array comparisons (with a bit array as output)? Thanks, Alex

[julia-users] Re: function similar to matlab tabulate

2015-04-30 Thread Alexandros Fakos
Thanks a lot. countmap returns a dictionary but I would prefer an array. How can I do that? Thank you On Thursday, April 30, 2015 at 4:41:43 PM UTC-4, Johan Sigfrids wrote: countmap in the StatsBase.jl package does this. On Thursday, April 30, 2015 at 11:11:37 PM UTC+3, Alexandros Fakos

Re: [julia-users] broadcast comparison operators

2015-04-30 Thread Alexandros Fakos
BitArray{1}: false true On Thu, Apr 30, 2015 at 2:50 PM, Alexandros Fakos alexand...@gmail.com javascript: wrote: Hi, Why the following commands give different results? julia broadcast(.==,[1.0],[0.0,1.0]) 2-element Array{Float64,1}: 0.0 1.0 julia repmat([1.0],2,1).==[0.0,1.0] 2x1