[julia-users] Good example of reproducible research with Julia

2016-11-09 Thread Charles Novaes de Santana
Hi people,

I just found a very interesting paper (published in Nature Genetics in
January/2016) about cancer evolution modeling in which the authors used
Julia to implement their model. More than this, they did a nice notebook to
make their research reproducible.

paper - http://www.nature.com/ng/journal/v48/n3/full/ng.3489.html

notebook -
https://github.com/andreasottoriva/neutral-tumor-evolution/blob/master/Identification%20of%20neutral%20tumor%20evolution%20across%20cancer%20types%20-%20%20Simulation%20Results.ipynb

This is really inspiring! It is a great way of making science reproducible
and to spread the word about Julia. I wish I (and all scientists in the
Julia community) could do the same kind of thing with our scientific works
in the future.

Best,

Charles
-- 
Um axé! :)

--
Charles Novaes de Santana, PhD
https://github.com/cndesantana


Re: [julia-users] Re: Create distributed array from a file

2016-01-26 Thread Charles Novaes de Santana
Hi Christopher,

Regarding to the limitations of your machine, you could consider using
CloudArray.jl (https://github.com/gsd-ufal/CloudArray.jl) and their cloud
platform CloudArrayBox (http://cloudarraybox.cloudapp.net/)

Hope it helps,

Charles

On 26 January 2016 at 18:41, Christopher Fisher <fishe...@miamioh.edu>
wrote:

> Perhaps if its a precompling issue, it would be faster if I precomplied
> with a smaller distributed array. I'll try that and report back in the next
> day or two.
>
>
> On Tuesday, January 26, 2016 at 12:28:21 PM UTC-5, Christopher Fisher
> wrote:
>>
>> Thanks for the idea. It may not apply in my particular case. I forgot to
>> mention that my memory is 32GB on the machine I am using. So swapping with
>> the hard drive does not seem likely.
>>
>> Given that the second execution of the function is much faster (1 second
>> vs 5 min), my best guess is that the long initial run might be due to
>> compiling.
>>
>> On Tuesday, January 26, 2016 at 12:12:41 PM UTC-5, nae...@ic.ufal.br
>> wrote:
>>>
>>> Hello Christopher,
>>>
>>> I saw you code and you noticed you are reading all the data(3GB)
>>> locally, maybe it's causing your machine to use swap memory, which leads to
>>> the performance issue.
>>> You can check that by
>>> 1: open htop in one terminal (apt-get install -y htop)
>>> 2: run your application
>>> 3: check the memory usage on htop, if it use 100% of memory, then the
>>> machine will start to swap
>>>
>>> Please, correct me if I'm wrong.
>>>
>>


-- 
Um axé! :)

--
Charles Novaes de Santana, PhD
https://github.com/cndesantana


Re: [julia-users] Re: good approach to run julia scripts in parallel in a PC

2016-01-13 Thread Charles Novaes de Santana
Absolutely amazing!!! Thanks a lot, Greg! It works like a charm!

Best,

Charles

On 13 January 2016 at 11:20, 'Greg Plowman' via julia-users <
julia-users@googlegroups.com> wrote:

>
> You might be able to use pmap:
>
> http://docs.julialang.org/en/release-0.4/manual/parallel-computing/#parallel-map-and-loops
>
> http://docs.julialang.org/en/release-0.4/stdlib/parallel/?highlight=pmap#Base.pmap
>
> Perhaps something like:
>
> @everywhere function test1(p)
> println("doing stuff with $p")
> return 2*p
> end
>
> function main()
> parameters = collect(0.001:0.001:0.6)
> results = pmap(test1, parameters)
> end
>
> main()
>
>
> On Wednesday, January 13, 2016 at 1:32:08 AM UTC+11, Charles Santana wrote:
>>
>> Hi julians,
>>
>> Parallel computing is not my focus, but I would like to run a  julia
>> script in parallel in my PC in order to save time. The PC has an 8-core
>> processor so I would like to run at least 4 replicates of my script
>> (test1.jl) at the same time, each one with one different parameter.
>>
>> So far I was working on a cluster and I was using qsub in order to submit
>> my jobs. I didn't need to configure anything. I had a quota of 20 jobs, so
>> if I launched 200 jobs 20 of them would run and the others would be in a
>> queue waiting for their moment to run.
>>
>> Now I would like to run my scripts in my machine and I would like to do
>> something similar. For me it is fine if I wait for the current jobs to
>> finish running in order to launch another bunch of jobs. As well as it is
>> fine if I launch a new job for each experiment that finishes. The easiest
>> option the best :)
>>
>> My script does not receive any file as input, but it writes the outputs
>> to unique files (the file names are unique for each job).
>>
>> Do you recommend a good way to do it in Julia? Let's say my script is
>> called "test1.jl". So far I was trying the following code to call my jobs:
>>
>> function main()
>> parameters = collect(0.001:0.001:0.6);
>> @parallel for(p in parameters)
>> command1 = `/home/cdesantana/Downloads/julia -p 4
>> /home/cdesantana/Experiments/test1.jl $p`;
>> run(command1);
>> end
>> end
>>
>> main();
>>
>> I really don't understand what is happening here, but I am sure it is not
>> working 4 jobs of my scripts... :(
>>
>> cdesantana@c-de-santana:~/Data/Dendritics/poster2016$ ps aux|grep julia
>> cdesant+  1964  3.7  1.3 9214696 107356 pts/10 Sl   15:20   0:01
>> /home/cdesantana/Downloads/julia/julia script.jl
>> cdesant+  1994 92.2  2.7 9489844 214388 pts/10 Rl   15:20   0:31
>> /home/cdesantana/Downloads/julia/julia -p4
>> /home/cdesantana/Experiments/test1.jl 1 0.001
>> cdesant+  2013  8.7  1.5 9189424 120340 ?  Ssl  15:20   0:02
>> /home/cdesantana/Downloads/julia/usr/bin/julia -Cnative
>> -J/home/cdesantana/Downloads/julia/usr/lib/julia/sys.so --bind-to
>> 192.168.89.174 --worker
>> cdesant+  2016  9.2  1.6 9288520 131600 ?  Ssl  15:20   0:03
>> /home/cdesantana/Downloads/julia/usr/bin/julia -Cnative
>> -J/home/cdesantana/Downloads/julia/usr/lib/julia/sys.so --bind-to
>> 192.168.89.174 --worker
>> cdesant+  2018  6.7  1.6 9353972 131772 ?  Ssl  15:20   0:02
>> /home/cdesantana/Downloads/julia/usr/bin/julia -Cnative
>> -J/home/cdesantana/Downloads/julia/usr/lib/julia/sys.so --bind-to
>> 192.168.89.174 --worker
>> cdesant+  2023  7.7  1.6 9419496 131604 ?  Ssl  15:20   0:02
>> /home/cdesantana/Downloads/julia/usr/bin/julia -Cnative
>> -J/home/cdesantana/Downloads/julia/usr/lib/julia/sys.so --bind-to
>> 192.168.89.174 --worker
>> cdesant+  2159  0.0  0.0  11716   892 pts/10   S+   15:21   0:00 grep
>> --color=auto julia
>>
>> I was expecting that it would be running my script 4 times, each one with
>> one different value of $p (0.001, 0.002, 0.003, 0.004).
>>
>> Any suggestion? My machine has ubuntu installed so I am fine if I need to
>> combine Linux programs with Julia.
>>
>> Many thanks in advance for any help!
>>
>> Best,
>>
>> Charles
>> --
>> Um axé! :)
>>
>> --
>> Charles Novaes de Santana, PhD
>> https://github.com/cndesantana
>>
>


-- 
Um axé! :)

--
Charles Novaes de Santana, PhD
https://github.com/cndesantana


[julia-users] good approach to run julia scripts in parallel in a PC

2016-01-12 Thread Charles Novaes de Santana
Hi julians,

Parallel computing is not my focus, but I would like to run a  julia script
in parallel in my PC in order to save time. The PC has an 8-core processor
so I would like to run at least 4 replicates of my script (test1.jl) at the
same time, each one with one different parameter.

So far I was working on a cluster and I was using qsub in order to submit
my jobs. I didn't need to configure anything. I had a quota of 20 jobs, so
if I launched 200 jobs 20 of them would run and the others would be in a
queue waiting for their moment to run.

Now I would like to run my scripts in my machine and I would like to do
something similar. For me it is fine if I wait for the current jobs to
finish running in order to launch another bunch of jobs. As well as it is
fine if I launch a new job for each experiment that finishes. The easiest
option the best :)

My script does not receive any file as input, but it writes the outputs to
unique files (the file names are unique for each job).

Do you recommend a good way to do it in Julia? Let's say my script is
called "test1.jl". So far I was trying the following code to call my jobs:

function main()
parameters = collect(0.001:0.001:0.6);
@parallel for(p in parameters)
command1 = `/home/cdesantana/Downloads/julia -p 4
/home/cdesantana/Experiments/test1.jl $p`;
run(command1);
end
end

main();

I really don't understand what is happening here, but I am sure it is not
working 4 jobs of my scripts... :(

cdesantana@c-de-santana:~/Data/Dendritics/poster2016$ ps aux|grep julia
cdesant+  1964  3.7  1.3 9214696 107356 pts/10 Sl   15:20   0:01
/home/cdesantana/Downloads/julia/julia script.jl
cdesant+  1994 92.2  2.7 9489844 214388 pts/10 Rl   15:20   0:31
/home/cdesantana/Downloads/julia/julia -p4
/home/cdesantana/Experiments/test1.jl 1 0.001
cdesant+  2013  8.7  1.5 9189424 120340 ?  Ssl  15:20   0:02
/home/cdesantana/Downloads/julia/usr/bin/julia -Cnative
-J/home/cdesantana/Downloads/julia/usr/lib/julia/sys.so --bind-to
192.168.89.174 --worker
cdesant+  2016  9.2  1.6 9288520 131600 ?  Ssl  15:20   0:03
/home/cdesantana/Downloads/julia/usr/bin/julia -Cnative
-J/home/cdesantana/Downloads/julia/usr/lib/julia/sys.so --bind-to
192.168.89.174 --worker
cdesant+  2018  6.7  1.6 9353972 131772 ?  Ssl  15:20   0:02
/home/cdesantana/Downloads/julia/usr/bin/julia -Cnative
-J/home/cdesantana/Downloads/julia/usr/lib/julia/sys.so --bind-to
192.168.89.174 --worker
cdesant+  2023  7.7  1.6 9419496 131604 ?  Ssl  15:20   0:02
/home/cdesantana/Downloads/julia/usr/bin/julia -Cnative
-J/home/cdesantana/Downloads/julia/usr/lib/julia/sys.so --bind-to
192.168.89.174 --worker
cdesant+  2159  0.0  0.0  11716   892 pts/10   S+   15:21   0:00 grep
--color=auto julia

I was expecting that it would be running my script 4 times, each one with
one different value of $p (0.001, 0.002, 0.003, 0.004).

Any suggestion? My machine has ubuntu installed so I am fine if I need to
combine Linux programs with Julia.

Many thanks in advance for any help!

Best,

Charles
-- 
Um axé! :)

--
Charles Novaes de Santana, PhD
https://github.com/cndesantana


[julia-users] Error running examples of parallel computing with Julia

2016-01-12 Thread Charles Novaes de Santana
Hi,

I am trying to figure out how to work with parallel computing with Julia.
The documentation looks great, even for someone that has never worked with
Parallel Computing (and that does not understand most of the concepts
behind the documentation ;)).

Just to mention: I am working in a PC with Ubuntu. It has a 4-core
processor.

To run the code I describe below I am calling the julia terminal as:

$ julia -p 4

I am following the documentation here:
http://docs.julialang.org/en/latest/manual/parallel-computing/

For one example, specifically, I am facing some problems.

In this section:
http://docs.julialang.org/en/latest/manual/parallel-computing/#id2

I am trying to run the following piece of code:

@everywhere advection_shared_chunk!(q, u) = advection_chunk!(q, u,
myrange(q)..., 1:size(q,3)-1)

function advection_shared!(q, u)
@sync begin
for p in procs(q)
@async remotecall_wait(advection_shared_chunk!, p, q, u)
end
end
q
end

q = SharedArray(Float64, (500,500,500))
u = SharedArray(Float64, (500,500,500))

#Run once to JIT-compile
advection_shared!(q,u)

But I am facing the following error:

ERROR: MethodError: `remotecall_wait` has no method matching
remotecall_wait(::Function, ::Int64, ::SharedArray{Float64,3},
::SharedArray{Float64,3})
Closest candidates are:
  remotecall_wait(::LocalProcess, ::Any, ::Any...)
  remotecall_wait(::Base.Worker, ::Any, ::Any...)
  remotecall_wait(::Integer, ::Any, ::Any...)
 in anonymous at task.jl:447

...and 3 other exceptions.

 in sync_end at ./task.jl:413
 [inlined code] from task.jl:422
 in advection_shared! at none:2

What am I doing wrong here? As far as I know I am just reproducing the
example in the docs... or not?

Thanks for any help,

Charles


-- 
Um axé! :)

--
Charles Novaes de Santana, PhD
https://github.com/cndesantana


Re: [julia-users] Re: ANN: A potential new Discourse-based Julia forum

2016-01-12 Thread Charles Novaes de Santana
My $0.02: I consider julia-users as a mailing-list. In general, my main
communication is through emails. I write the posts to the mailing list
using a webmail interface, but I use to read the posts of others from an
email client or from mobile. Of course I can adapt myself and use another
platform to communicate, but it would certainly take some time to be used
to it. My vote is to keep the mailing list working as it is, even if we
decide to put efforts in the other platform too.

Best,

Charles

On 12 January 2016 at 14:46, Tom Breloff <t...@breloff.com> wrote:

> Just to throw in my $0.02... I use gmail most of the time, and I have a
> few filters to auto-partition into a directory structure I like which
> combines github and google groups emails.  If I could no longer do this I
> would be disappointed.
>
> On Tue, Jan 12, 2016 at 6:08 AM, Mauro <mauro...@runbox.com> wrote:
>
>> I second Tamas: a good email interface is a must.  This seems to be
>> lacking currently:
>> https://meta.discourse.org/t/email-interface-suggested-improvements/32140
>>
>> On Tue, 2016-01-12 at 11:32, Tamas Papp <tkp...@gmail.com> wrote:
>> > On Tue, Jan 12 2016, DNF wrote:
>> >
>> >> Hmm, I didn't consider that. I *never* read the emails, instead using
>> the
>> >> email notifications as jumping-off points to go into the forum. I
>> always
>> >> thought it strange that people refer to posts as 'mails'.
>> >
>> > I don't see an alternative given my preferences --- as I said, I don't
>> > want to deal with different web interfaces. Also, sometimes I work
>> > offline.
>> >
>> >> But, surely, plain text for code is *terrible*. Wrong or no
>> indentation, no
>> >> syntax highlighting, no font contrast between code and text? Or are you
>> >> able to achieve some of those with your Emacs setup?
>> >
>> > Fixed width font takes care of indentation. For short code snippets, I
>> > can live without highlighting, for longer code I prefer if people post
>> > it as a gist.
>> >
>> > Best,
>> >
>> > Tamas
>>
>
>


-- 
Um axé! :)

--
Charles Novaes de Santana, PhD
https://github.com/cndesantana


[julia-users] Re: Problems using log and Arrays of AbstractFloats

2016-01-04 Thread Charles Novaes de Santana
And (maybe) the most important question:

For which reason the square of an Array{AbstractFloat,1} is Array{Any,1}
instead of Array{AbstractFloat,1}?

julia> typeof(f)
Array{AbstractFloat,1}

julia> typeof(f.^2)
Array{Any,1}

thanks,

Charles

On 4 January 2016 at 13:47, Charles Novaes de Santana <
charles.sant...@gmail.com> wrote:

> Hi people,
>
> I would like to work with matrices represented as Arrays of Arrays of
> AbstractFloats. Something like this:
>
> F=Array{AbstractFloat}[];#initialize the matrix F as an Array of
> Arrays of Float
> for (i in 1:10)
> Fi = Array(AbstractFloat,0);#initialize the vector Fi as an
> Array of Float
> for (k in 1:5)
> push!(Fi,k^2+i^2)
> end#end-fork
> push!(F,Fi);
> end#end-fori
>
> typeof(F)
> Array{Array{AbstractFloat,N},1}
>
> But I am experiencing problems to work with rows/columns of such Arrays. I
> would like to calculate the logarithm of the square of elements of those
> rows/columns like this:
>
> f = F[1];#a vector of AbstractFloat
>
> typeof(f)
> Array{AbstractFloat,1}
>
> typeof(f.^2)
> Array{Any,1}
>
> log(f.^2)
> ERROR: MethodError: `log` has no method matching
> log(::Array{Any,1})
>
>
> I understand this error only happens because I am working with Arrays of
> Arrays of AbstractFloats. If I run a similar code using a Matrix instead of
> Array I don't have such problems:
>
>A = rand(10,5);#a matrix of floats (similar to an array of arrays)
>
> typeof(A)
> Array{Float64,2}
>
> a = A[1,:];#a vector of Float
>
> typeof(a)
> Array{Float64,2}
>
> typeof(a.^2)
> Array{Float64,2}
>
> log(a.^2)
>
>
> everything runs smoothly.
>
> My question: Am I doing something wrong in the way I am dealing with the
> Array of Arrays of AbstractFloat? Should I convert it to a Matrix? Or
> should I convert its elements to Array of Float instead of Array of Any?
> Any other suggestion?
>
> Thanks for your attention and for any advice!
>
> 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] Problems using log and Arrays of AbstractFloats

2016-01-04 Thread Charles Novaes de Santana
Hi people,

I would like to work with matrices represented as Arrays of Arrays of
AbstractFloats. Something like this:

F=Array{AbstractFloat}[];#initialize the matrix F as an Array of
Arrays of Float
for (i in 1:10)
Fi = Array(AbstractFloat,0);#initialize the vector Fi as an
Array of Float
for (k in 1:5)
push!(Fi,k^2+i^2)
end#end-fork
push!(F,Fi);
end#end-fori

typeof(F)
Array{Array{AbstractFloat,N},1}

But I am experiencing problems to work with rows/columns of such Arrays. I
would like to calculate the logarithm of the square of elements of those
rows/columns like this:

f = F[1];#a vector of AbstractFloat

typeof(f)
Array{AbstractFloat,1}

typeof(f.^2)
Array{Any,1}

log(f.^2)
ERROR: MethodError: `log` has no method matching log(::Array{Any,1})


I understand this error only happens because I am working with Arrays of
Arrays of AbstractFloats. If I run a similar code using a Matrix instead of
Array I don't have such problems:

   A = rand(10,5);#a matrix of floats (similar to an array of arrays)

typeof(A)
Array{Float64,2}

a = A[1,:];#a vector of Float

typeof(a)
Array{Float64,2}

typeof(a.^2)
Array{Float64,2}

log(a.^2)


everything runs smoothly.

My question: Am I doing something wrong in the way I am dealing with the
Array of Arrays of AbstractFloat? Should I convert it to a Matrix? Or
should I convert its elements to Array of Float instead of Array of Any?
Any other suggestion?

Thanks for your attention and for any advice!

Charles

-- 
Um axé! :)

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


Re: [julia-users] Problems using log and Arrays of AbstractFloats

2016-01-04 Thread Charles Novaes de Santana
Thanks a lot for your message, Tim.

I was wondering that it could be because of the AbstractFloat too. It makes
sense.

I am using AbstractFloat because I want to make it clear that the matrix
has Float elements, but I don't want to specify the architecture of the
machine of the user, because I had problems with users using 32bits
machines.

I will definitely read the link you sent me. And I will let you know what I
decide to use in our code. Thanks for your suggestion too!!

Best,

Charles

On 4 January 2016 at 14:03, Tim Holy <tim.h...@gmail.com> wrote:

> It has nothing to do with whether you're using a Matrix (which is just an
> Array{T,2}) or general Arrays. The question is, do you have to use
> AbstractFloat?
>
> julia> a = Float64[1,2,3]
> 3-element Array{Float64,1}:
>  1.0
>  2.0
>  3.0
>
> julia> b = AbstractFloat[1,2,3]
> 3-element Array{AbstractFloat,1}:
>  1.0
>  2.0
>  3.0
>
> julia> log(a.^2)
> 3-element Array{Float64,1}:
>  0.0
>  1.38629
>  2.19722
>
> julia> log(b.^2)
> ERROR: MethodError: `log` has no method matching log(::Array{Any,1})
>
> julia> typeof(a.^2)
> Array{Float64,1}
>
> julia> typeof(b.^2)
> Array{Any,1}
>
> julia> Base.return_types(*, (AbstractFloat, AbstractFloat))
> 8-element Array{Any,1}:
>  Float32
>  Float64
>  Float16
>  BigFloat
>  BigFloat
>  BigFloat
>  Union{}
>  Any
>
>
>
> You could do this:
> julia> b2 = AbstractFloat[v^2 for v in b]
> 3-element Array{AbstractFloat,1}:
>  1.0
>  4.0
>  9.0
>
> julia> log(b2)
> 3-element Array{Any,1}:
>  0.0
>  1.38629
>  2.19722
>
>
> But overall, I highly recommend reading the performance tips page and these
> two sections of the FAQ:
> http://docs.julialang.org/en/stable/manual/faq/#what-does-type-stable-mean
>
> http://docs.julialang.org/en/stable/manual/faq/#how-do-abstract-or-ambiguous-fields-in-types-interact-with-the-compiler
>
> Best,
> --Tim
>
> On Monday, January 04, 2016 01:47:44 PM Charles Novaes de Santana wrote:
> > Hi people,
> >
> > I would like to work with matrices represented as Arrays of Arrays of
> > AbstractFloats. Something like this:
> >
> > F=Array{AbstractFloat}[];#initialize the matrix F as an Array of
> > Arrays of Float
> > for (i in 1:10)
> > Fi = Array(AbstractFloat,0);#initialize the vector Fi as an
> > Array of Float
> > for (k in 1:5)
> > push!(Fi,k^2+i^2)
> > end#end-fork
> > push!(F,Fi);
> > end#end-fori
> >
> > typeof(F)
> > Array{Array{AbstractFloat,N},1}
> >
> > But I am experiencing problems to work with rows/columns of such Arrays.
> I
> > would like to calculate the logarithm of the square of elements of those
> > rows/columns like this:
> >
> > f = F[1];#a vector of AbstractFloat
> >
> > typeof(f)
> > Array{AbstractFloat,1}
> >
> > typeof(f.^2)
> > Array{Any,1}
> >
> > log(f.^2)
> > ERROR: MethodError: `log` has no method matching
> log(::Array{Any,1})
> >
> >
> > I understand this error only happens because I am working with Arrays of
> > Arrays of AbstractFloats. If I run a similar code using a Matrix instead
> of
> > Array I don't have such problems:
> >
> >A = rand(10,5);#a matrix of floats (similar to an array of arrays)
> >
> > typeof(A)
> > Array{Float64,2}
> >
> > a = A[1,:];#a vector of Float
> >
> >     typeof(a)
> > Array{Float64,2}
> >
> > typeof(a.^2)
> > Array{Float64,2}
> >
> > log(a.^2)
> >
> >
> > everything runs smoothly.
> >
> > My question: Am I doing something wrong in the way I am dealing with the
> > Array of Arrays of AbstractFloat? Should I convert it to a Matrix? Or
> > should I convert its elements to Array of Float instead of Array of Any?
> > Any other suggestion?
> >
> > Thanks for your attention and for any advice!
> >
> > Charles
>
>


-- 
Um axé! :)

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


Re: [julia-users] Type mismatch: MethodError, !Matched::Int64, etc...

2016-01-02 Thread Charles Novaes de Santana
Hi Tero,

Thanks for the suggestion. Done:
https://github.com/JuliaLang/julia/commit/f17dc963f76bc07623bb6be0605f8406f4cffab2

Best,

Charles

On 2 January 2016 at 20:51, Tero Frondelius <tero.frondel...@gmail.com>
wrote:

> Hi
> You should update the documentation to be clearer, thus others wouldn't
> have to struggle with the same misunderstanding in the future.
>



-- 
Um axé! :)

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


Re: [julia-users] Type mismatch: MethodError, !Matched::Int64, etc...

2016-01-01 Thread Charles Novaes de Santana
Hi Kristoffer,

Thanks for pointing this out! Actually, I had in mind that annotation *had*
impact on performance. I read the documentation about performance-tips
before and I understood that the exceptions listed in
http://docs.julialang.org/en/release-0.4/manual/performance-tips/#type-declarations
were the rule.

I know it is a matter of my bad English together with my distraction during
the reading the docs. It happens quite often with me, especially when the
main statement is not in the beginning of the sentence (that is the case of
the sentence "In many languages with optional type declarations, adding
declarations is the principal way to make code run faster. This is *not*
the case in Julia. (...)").

In other words: you just opened my mind for this. Your message was clear :)
Thanks!

Best,

Charles

On 1 January 2016 at 21:35, Kristoffer Carlsson <kcarlsso...@gmail.com>
wrote:

> Maybe you know it but it is worth pointing out. Type annotation has ZERO
> impact on performance because Julia compiles the function for the given
> type arguments anyway.
>
> There are reasons to annotate as a way of documenting what types the
> function expects or to implement dispatch rules, However, from what I have
> seen, it is common for new Julia users coming from statically typed
> languages to put the type annotations too narrow.
>



-- 
Um axé! :)

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


Re: [julia-users] Type mismatch: MethodError, !Matched::Int64, etc...

2016-01-01 Thread Charles Novaes de Santana
Thanks Yichao, Eric, and Kevin for your messages. I learned a lot from you!

I solved this specific problem using AbstractFloat and Integer, as you
suggested.

But I see I have a lot of old code where I was using "Float64" and "Int64"
and I now understand I need to change all of them to make them a bit more
portable. For example, to use template (function f1{T}(p1::T,
v1::Vector{T}, m1::Matrix{T}).

Thanks a lot!

Charles

On 1 January 2016 at 09:02, Eric Forgy <eric.fo...@gmail.com> wrote:

> Ah. Thanks for the correction :)
>
> Happy New Year!
>



-- 
Um axé! :)

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


[julia-users] Type mismatch: MethodError, !Matched::Int64, etc...

2015-12-31 Thread Charles Novaes de Santana
Hi people,

I defined a simple function that is running perfectly in my machine, but a
collaborator of mine is facing problems to run this function in a Ubuntu 32
bits running in Virtualbox (he has a windows machine 64 bits, but for some
reason he can not run Ubuntu 64 bits in Virtualbox).

Below you can find the prototype of the function I have and how I call it

function main(Qi::Float64, Qf::Float64, dq::Float64, Np::Int64,
r2dq::Float64, r2fa::Float64, torem::Int64)

#code here#

end

main(-5.0,5.0,1.0,9,-1.0,-1.0,1);

And now you can find the error message he receives:

ERROR: LoadError: MethodError: `main` has no method matching
main(::Float64, ::Float64, ::Float64, ::Int32, ::Float64, ::Float64,
::Int32)
Closest candidates are:
  main(::Float64, ::Float64, ::Float64, !Matched::Int64, ::Float64,
::Float64, !Matched::Int64)
 in include at ./boot.jl:261
 in include_from_node1 at ./loading.jl:304
 in process_options at ./client.jl:280
 in _start at ./client.jl:378
while loading /home/lucas/.julia/v0.4/Multifractal/test/runtests.jl, in
expression starting on line 16


According to this (
http://docs.julialang.org/en/release-0.4/manual/methods/#defining-methods)
I understand this problem could be solved by replacing all my "Float64" and
"Int64" by "Number". Is that the good practice? Wouldn't it make my code
slower as the exact type is not defined?

thanks for any help! have a nice last day of Gregorian year! ;)

Charles


-- 
Um axé! :)

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


[julia-users] Re: Type mismatch: MethodError, !Matched::Int64, etc...

2015-12-31 Thread Charles Novaes de Santana
By the way: I am running my function in a Ubuntu 64 bits with Julia Version
0.4.2-pre+16

Best,

Charles

On 31 December 2015 at 16:41, Charles Novaes de Santana <
charles.sant...@gmail.com> wrote:

> Hi people,
>
> I defined a simple function that is running perfectly in my machine, but a
> collaborator of mine is facing problems to run this function in a Ubuntu 32
> bits running in Virtualbox (he has a windows machine 64 bits, but for some
> reason he can not run Ubuntu 64 bits in Virtualbox).
>
> Below you can find the prototype of the function I have and how I call it
>
> function main(Qi::Float64, Qf::Float64, dq::Float64, Np::Int64,
> r2dq::Float64, r2fa::Float64, torem::Int64)
>
> #code here#
>
> end
>
> main(-5.0,5.0,1.0,9,-1.0,-1.0,1);
>
> And now you can find the error message he receives:
>
> ERROR: LoadError: MethodError: `main` has no method matching
> main(::Float64, ::Float64, ::Float64, ::Int32, ::Float64, ::Float64,
> ::Int32)
> Closest candidates are:
>   main(::Float64, ::Float64, ::Float64, !Matched::Int64, ::Float64,
> ::Float64, !Matched::Int64)
>  in include at ./boot.jl:261
>  in include_from_node1 at ./loading.jl:304
>  in process_options at ./client.jl:280
>  in _start at ./client.jl:378
> while loading /home/lucas/.julia/v0.4/Multifractal/test/runtests.jl, in
> expression starting on line 16
>
>
> According to this (
> http://docs.julialang.org/en/release-0.4/manual/methods/#defining-methods)
> I understand this problem could be solved by replacing all my "Float64" and
> "Int64" by "Number". Is that the good practice? Wouldn't it make my code
> slower as the exact type is not defined?
>
> thanks for any help! have a nice last day of Gregorian year! ;)
>
> 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


Re: [julia-users] Re: Optimize sum of elements in an Array according to some conditions

2015-12-30 Thread Charles Novaes de Santana
Thanks, Dan! Indeed my "x" vector is sorted and your suggestion is really
fast!

Best,

Charles

On 30 December 2015 at 12:08, Dan <getz...@gmail.com> wrote:

> Thanks Kristoffer, turns out there is always interesting stuff in the bag
> of optimization tricks.
> Regarding the original function, a cheat could make it faster: The `x`
> vector is sorted, which means:
>
> function calcSum4(x::Array{Float64,1}, y::Array{Float64,1}, Ei::Float64,
> Ef::Float64, N::Int64)
>mysum=0.0::Float64;
>i=1
>@inbounds while i<=N && x[i]<=Ei i+=1 ; end
>j=i
>@inbounds while j<=N && x[j]<=Ef j+=1 ; end
>@inbounds @simd for k=i:(j-1) mysum += y[k] ; end
>return(mysum);
>end
>
> returns the same answer.
> there are always more options ;)
>
> On Wednesday, December 30, 2015 at 12:19:41 PM UTC+2, Charles Santana
> wrote:
>>
>> The magic of @inbounds and @simd :)
>>
>> Thanks, Kristoffer!
>>
>> Charles
>>
>>
>> On Wednesday, December 30, 2015, Kristoffer Carlsson <kcarl...@gmail.com>
>> wrote:
>>
>>> If you want to get an even faster version you could do something like:
>>>
>>> function calcSum_simd{T}(x::Vector{T}, y::Vector{T}, Ei::T, Ef::T)
>>> mysum = zero(T)
>>> @inbounds @simd for i in eachindex(x, y)
>>>  mysum += ifelse(Ei < x[i] <= Ef, y[i], zero(T))
>>>
>>> end
>>> return mysum
>>> end
>>>
>>> which would use SIMD instructions.
>>>
>>> Timing difference:
>>>
>>> N = 1000
>>> y = rand(N);
>>> x = rand(N)
>>> Ei = 0.2;
>>> Ef = 0.7;
>>>
>>> julia> @time calcSum_simd(x,y,Ei, Ef);
>>>   0.021155 seconds (5 allocations: 176 bytes)
>>>
>>>
>>> julia> @time calcSum(x,y,Ei, Ef)
>>>   0.069911 seconds (5 allocations: 176 bytes)
>>>
>>>
>>> Regarding map being slow. That is worked on here
>>> https://github.com/JuliaLang/julia/pull/13412
>>>
>>>
>>> On Wednesday, December 30, 2015 at 3:05:47 AM UTC+1, Charles Santana
>>> wrote:
>>>>
>>>> Sorry, there was a typo in the function calcSum2. Please consider the
>>>> following code:
>>>>
>>>> function calcSum2(x::Array{Float64,1}, y::Array{Float64,1},
>>>> Ei::Float64, Ef::Float64, N::Int64)
>>>>
>>>> return sum(y[map(v -> Ei < v <= Ef, x)]);
>>>> end
>>>>
>>>>
>>>> And so the results of the calls for this function change a bit (but not
>>>> the performance):
>>>>
>>>> @time calcSum2(x,y,Ei,Ef,N)
>>>>   0.000110 seconds (1.01 k allocations: 20.969 KB)
>>>> 246.1975746121703
>>>>
>>>> @time calcSum2(x,y,Ei,Ef,N)
>>>>   0.79 seconds (1.01 k allocations: 20.969 KB)
>>>> 246.1975746121703
>>>>
>>>> @time calcSum2(x,y,Ei,Ef,N)
>>>>   0.51 seconds (1.01 k allocations: 20.969 KB)
>>>> 246.1975746121703
>>>>
>>>>
>>>> Thanks again, sorry for this inconvenience!
>>>>
>>>> Charles
>>>>
>>>> On 30 December 2015 at 03:00, Charles Novaes de Santana <
>>>> charles...@gmail.com> wrote:
>>>>
>>>>> Dear all,
>>>>>
>>>>> In a project I am developing a @profile shows me that the slowest part
>>>>> of the code is the sum of elements of an Array that follow some 
>>>>> conditions.
>>>>>
>>>>> Please consider the following code:
>>>>>
>>>>> y = rand(1000);
>>>>> x = collect(0.0:0.001:0.999);
>>>>> Ei = 0.2;
>>>>> Ef = 0.7;
>>>>> N = length(x)
>>>>>
>>>>> I want to calculate the sum of elements in "y" for which elements the
>>>>> respective values in "x" are between "Ei" and "Ef". If I was using R, for
>>>>> example, I would use something like:
>>>>>
>>>>> mysum = sum(y[which((x < Ef)&&(x > Ei))]); #(not tested in R, but I
>>>>> suppose that is the way to do it)
>>>>>
>>&

[julia-users] Re: Optimize sum of elements in an Array according to some conditions

2015-12-30 Thread Charles Novaes de Santana
The magic of @inbounds and @simd :)

Thanks, Kristoffer!

Charles

On Wednesday, December 30, 2015, Kristoffer Carlsson <kcarlsso...@gmail.com>
wrote:

> If you want to get an even faster version you could do something like:
>
> function calcSum_simd{T}(x::Vector{T}, y::Vector{T}, Ei::T, Ef::T)
> mysum = zero(T)
> @inbounds @simd for i in eachindex(x, y)
>  mysum += ifelse(Ei < x[i] <= Ef, y[i], zero(T))
>
> end
> return mysum
> end
>
> which would use SIMD instructions.
>
> Timing difference:
>
> N = 1000
> y = rand(N);
> x = rand(N)
> Ei = 0.2;
> Ef = 0.7;
>
> julia> @time calcSum_simd(x,y,Ei, Ef);
>   0.021155 seconds (5 allocations: 176 bytes)
>
>
> julia> @time calcSum(x,y,Ei, Ef)
>   0.069911 seconds (5 allocations: 176 bytes)
>
>
> Regarding map being slow. That is worked on here
> https://github.com/JuliaLang/julia/pull/13412
>
>
> On Wednesday, December 30, 2015 at 3:05:47 AM UTC+1, Charles Santana wrote:
>>
>> Sorry, there was a typo in the function calcSum2. Please consider the
>> following code:
>>
>> function calcSum2(x::Array{Float64,1}, y::Array{Float64,1}, Ei::Float64,
>> Ef::Float64, N::Int64)
>>
>> return sum(y[map(v -> Ei < v <= Ef, x)]);
>> end
>>
>>
>> And so the results of the calls for this function change a bit (but not
>> the performance):
>>
>> @time calcSum2(x,y,Ei,Ef,N)
>>   0.000110 seconds (1.01 k allocations: 20.969 KB)
>> 246.1975746121703
>>
>> @time calcSum2(x,y,Ei,Ef,N)
>>   0.79 seconds (1.01 k allocations: 20.969 KB)
>> 246.1975746121703
>>
>> @time calcSum2(x,y,Ei,Ef,N)
>>   0.51 seconds (1.01 k allocations: 20.969 KB)
>> 246.1975746121703
>>
>>
>> Thanks again, sorry for this inconvenience!
>>
>> Charles
>>
>> On 30 December 2015 at 03:00, Charles Novaes de Santana <
>> charles...@gmail.com> wrote:
>>
>>> Dear all,
>>>
>>> In a project I am developing a @profile shows me that the slowest part
>>> of the code is the sum of elements of an Array that follow some conditions.
>>>
>>> Please consider the following code:
>>>
>>> y = rand(1000);
>>> x = collect(0.0:0.001:0.999);
>>> Ei = 0.2;
>>> Ef = 0.7;
>>> N = length(x)
>>>
>>> I want to calculate the sum of elements in "y" for which elements the
>>> respective values in "x" are between "Ei" and "Ef". If I was using R, for
>>> example, I would use something like:
>>>
>>> mysum = sum(y[which((x < Ef)&&(x > Ei))]); #(not tested in R, but I
>>> suppose that is the way to do it)
>>>
>>> In Julia, I can think in at least two ways to calculate it:
>>>
>>> function calcSum(x::Array{Float64,1}, y::Array{Float64,1}, Ei::Float64,
>>> Ef::Float64, N::Int64)
>>> mysum=0.0::Float64;
>>> for(i in 1:N)
>>>  if( Ei < x[i] <= Ef)
>>>  mysum += y[i];
>>>  end
>>> end
>>> return(mysum);
>>> end
>>>
>>> function calcSum2(x::Array{Float64,1}, y::Array{Float64,1}, Ei::Float64,
>>> Ef::Float64, N::Int64)
>>> return sum(y[map(v -> Ei < v < Ef, x)]);
>>> end
>>>
>>> As you can see below, for the first function (calcSum) I got a much
>>> better performance than for the second one (minimum 10x faster).
>>>
>>>
>>>  @time calcSum(x,y,Ei,Ef,N)
>>>   0.003986 seconds (2.56 k allocations: 125.168 KB)
>>> 246.19757461217014
>>>
>>> @time calcSum(x,y,Ei,Ef,N)
>>>       0.000003 seconds (5 allocations: 176 bytes)
>>> 246.19757461217014
>>>
>>>     @time calcSum(x,y,Ei,Ef,N)
>>>   0.02 seconds (5 allocations: 176 bytes)
>>>     246.19757461217014
>>>
>>> @time calcSum2(x,y,Ei,Ef,N)
>>>   0.003762 seconds (1.61 k allocations: 53.743 KB)
>>> 245.48156534879303
>>>
>>> @time calcSum2(x,y,Ei,Ef,N)
>>>   0.50 seconds (1.01 k allocations: 20.969 KB)
>>> 245.48156534879303
>>>
>>> @time calcSum2(x,y,Ei,Ef,N)
>>>   0.000183 seconds (1.01 k allocations: 20.969 KB)
>>> 245.48156534879303
>>>
>>> Does any one have an idea about how to improve the performance here?
>>>
>>> Many thanks for any help! Happy new year to all of you!
>>>
>>> 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
>>
>

-- 
Um axé! :)

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


[julia-users] Re: Optimize sum of elements in an Array according to some conditions

2015-12-29 Thread Charles Novaes de Santana
Sorry, there was a typo in the function calcSum2. Please consider the
following code:

function calcSum2(x::Array{Float64,1}, y::Array{Float64,1}, Ei::Float64,
Ef::Float64, N::Int64)

return sum(y[map(v -> Ei < v <= Ef, x)]);
end


And so the results of the calls for this function change a bit (but not the
performance):

@time calcSum2(x,y,Ei,Ef,N)
  0.000110 seconds (1.01 k allocations: 20.969 KB)
246.1975746121703

@time calcSum2(x,y,Ei,Ef,N)
  0.79 seconds (1.01 k allocations: 20.969 KB)
246.1975746121703

@time calcSum2(x,y,Ei,Ef,N)
  0.51 seconds (1.01 k allocations: 20.969 KB)
246.1975746121703


Thanks again, sorry for this inconvenience!

Charles

On 30 December 2015 at 03:00, Charles Novaes de Santana <
charles.sant...@gmail.com> wrote:

> Dear all,
>
> In a project I am developing a @profile shows me that the slowest part of
> the code is the sum of elements of an Array that follow some conditions.
>
> Please consider the following code:
>
> y = rand(1000);
> x = collect(0.0:0.001:0.999);
> Ei = 0.2;
> Ef = 0.7;
> N = length(x)
>
> I want to calculate the sum of elements in "y" for which elements the
> respective values in "x" are between "Ei" and "Ef". If I was using R, for
> example, I would use something like:
>
> mysum = sum(y[which((x < Ef)&&(x > Ei))]); #(not tested in R, but I
> suppose that is the way to do it)
>
> In Julia, I can think in at least two ways to calculate it:
>
> function calcSum(x::Array{Float64,1}, y::Array{Float64,1}, Ei::Float64,
> Ef::Float64, N::Int64)
> mysum=0.0::Float64;
> for(i in 1:N)
>  if( Ei < x[i] <= Ef)
>  mysum += y[i];
>  end
> end
> return(mysum);
> end
>
> function calcSum2(x::Array{Float64,1}, y::Array{Float64,1}, Ei::Float64,
> Ef::Float64, N::Int64)
> return sum(y[map(v -> Ei < v < Ef, x)]);
> end
>
> As you can see below, for the first function (calcSum) I got a much better
> performance than for the second one (minimum 10x faster).
>
>
>  @time calcSum(x,y,Ei,Ef,N)
>   0.003986 seconds (2.56 k allocations: 125.168 KB)
> 246.19757461217014
>
> @time calcSum(x,y,Ei,Ef,N)
>   0.03 seconds (5 allocations: 176 bytes)
> 246.19757461217014
>
> @time calcSum(x,y,Ei,Ef,N)
>   0.02 seconds (5 allocations: 176 bytes)
> 246.19757461217014
>
> @time calcSum2(x,y,Ei,Ef,N)
>   0.003762 seconds (1.61 k allocations: 53.743 KB)
> 245.48156534879303
>
> @time calcSum2(x,y,Ei,Ef,N)
>   0.50 seconds (1.01 k allocations: 20.969 KB)
> 245.48156534879303
>
> @time calcSum2(x,y,Ei,Ef,N)
>       0.000183 seconds (1.01 k allocations: 20.969 KB)
> 245.48156534879303
>
> Does any one have an idea about how to improve the performance here?
>
> Many thanks for any help! Happy new year to all of you!
>
> 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] Optimize sum of elements in an Array according to some conditions

2015-12-29 Thread Charles Novaes de Santana
Dear all,

In a project I am developing a @profile shows me that the slowest part of
the code is the sum of elements of an Array that follow some conditions.

Please consider the following code:

y = rand(1000);
x = collect(0.0:0.001:0.999);
Ei = 0.2;
Ef = 0.7;
N = length(x)

I want to calculate the sum of elements in "y" for which elements the
respective values in "x" are between "Ei" and "Ef". If I was using R, for
example, I would use something like:

mysum = sum(y[which((x < Ef)&&(x > Ei))]); #(not tested in R, but I suppose
that is the way to do it)

In Julia, I can think in at least two ways to calculate it:

function calcSum(x::Array{Float64,1}, y::Array{Float64,1}, Ei::Float64,
Ef::Float64, N::Int64)
mysum=0.0::Float64;
for(i in 1:N)
 if( Ei < x[i] <= Ef)
 mysum += y[i];
 end
end
return(mysum);
end

function calcSum2(x::Array{Float64,1}, y::Array{Float64,1}, Ei::Float64,
Ef::Float64, N::Int64)
return sum(y[map(v -> Ei < v < Ef, x)]);
end

As you can see below, for the first function (calcSum) I got a much better
performance than for the second one (minimum 10x faster).


 @time calcSum(x,y,Ei,Ef,N)
  0.003986 seconds (2.56 k allocations: 125.168 KB)
246.19757461217014

@time calcSum(x,y,Ei,Ef,N)
  0.03 seconds (5 allocations: 176 bytes)
246.19757461217014

@time calcSum(x,y,Ei,Ef,N)
  0.02 seconds (5 allocations: 176 bytes)
246.19757461217014

@time calcSum2(x,y,Ei,Ef,N)
  0.003762 seconds (1.61 k allocations: 53.743 KB)
245.48156534879303

@time calcSum2(x,y,Ei,Ef,N)
  0.50 seconds (1.01 k allocations: 20.969 KB)
245.48156534879303

@time calcSum2(x,y,Ei,Ef,N)
  0.000183 seconds (1.01 k allocations: 20.969 KB)
245.48156534879303

Does any one have an idea about how to improve the performance here?

Many thanks for any help! Happy new year to all of you!

Charles




-- 
Um axé! :)

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


Re: [julia-users] Re: Convert SubString{ASCIIString} to String

2015-12-04 Thread Charles Novaes de Santana
wow! That simple! Yes it works!

Thanks, Seth!

Charles

On 4 December 2015 at 23:53, Seth <catch...@bromberger.com> wrote:

> Maybe this will work for you?
>
> julia> a = "foobarbaz"
> "foobarbaz"
>
> julia> b = SubString(a,3,6)
> "obar"
>
> julia> typeof(b)
> SubString{ASCIIString}
>
> julia> c = ASCIIString(b)
> "obar"
>
> julia> typeof(c)
> ASCIIString
>
>
>
> On Friday, December 4, 2015 at 2:48:12 PM UTC-8, Charles Santana wrote:
>>
>> Hi people,
>>
>> Maybe it is a trivial question for most of you, but I really could not
>> find a way to solve my problem.
>>
>> I am using the function quandlget(id::ASCIIString) from the library
>> https://github.com/milktrader/Quandl.jl (a great contribution, by the
>> way!)
>>
>> Everything works fine when I use it in a straightforward way:
>>
>> julia> mydat = quandl("GOOG/NASDAQ_GOOG",rows=100,format="DataFrame")
>> 100x6 DataFrames.DataFrame
>> | Row | Date   | Open   | High   | Low| Close  | Volume|
>> |-||||||---|
>> | 1   | 2015-07-08 | 521.05 | 522.73 | 516.11 | 516.83 | 1.2967e6  |
>> | 2   | 2015-07-09 | 523.12 | 523.77 | 520.35 | 520.68 | 1.84235e6 |
>> | 3   | 2015-07-10 | 526.29 | 532.56 | 525.55 | 530.13 | 1.95668e6 |
>>
>>
>> or when I do:
>>
>> julia> myid = "GOOG/NASDAQ_GOOG"
>> "GOOG/NASDAQ_GOOG"
>>
>> julia> typeof(myid)
>> ASCIIString
>>
>> julia> mydat = quandl(myid,rows=100,format="DataFrame")
>> 100x6 DataFrames.DataFrame
>> | Row | Date   | Open   | High   | Low| Close  | Volume|
>> |-||||||---|
>> | 1   | 2015-07-08 | 521.05 | 522.73 | 516.11 | 516.83 | 1.2967e6  |
>> | 2   | 2015-07-09 | 523.12 | 523.77 | 520.35 | 520.68 | 1.84235e6 |
>> | 3   | 2015-07-10 | 526.29 | 532.56 | 525.55 | 530.13 | 1.95668e6 |
>>
>>
>> However, I get an error when I read my data from an external file. Assume
>> I have an ascii file containing only one line:
>>
>> $ echo "GOOG/NASDAQ_GOOG" > portfolio.txt
>>
>> $ cat portfolio.txt
>> GOOG/NASDAQ_GOOG
>>
>>
>> I just read the content of this file by using readdlm and try to use it
>> to call the same function quandl, but it does not work.
>>
>> julia> myportfolio = readdlm("./portfolio.txt",'\n')
>> 1x1 Array{Any,2}:
>>  "GOOG/NASDAQ_GOOG"
>>
>> julia> typeof(myportfolio[1])
>> SubString{ASCIIString}
>>
>> julia> mydat = quandl(myportfolio[1],rows=100,format="DataFrame")
>> ERROR: MethodError: `quandlget` has no method matching
>> quandlget(::SubString{ASCIIString})
>>
>>
>> I suppose the easiest way to solve this problem is to convert my
>> SubString{ASCIIString} variable to ASCIIString. Am I right here? How can I
>> do it?
>>
>> Does any of you have another suggestion? May be I could read my data in a
>> different way instead of using readdlm?
>>
>> 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] Convert SubString{ASCIIString} to String

2015-12-04 Thread Charles Novaes de Santana
Hi people,

Maybe it is a trivial question for most of you, but I really could not find
a way to solve my problem.

I am using the function quandlget(id::ASCIIString) from the library
https://github.com/milktrader/Quandl.jl (a great contribution, by the way!)

Everything works fine when I use it in a straightforward way:

julia> mydat = quandl("GOOG/NASDAQ_GOOG",rows=100,format="DataFrame")
100x6 DataFrames.DataFrame
| Row | Date   | Open   | High   | Low| Close  | Volume|
|-||||||---|
| 1   | 2015-07-08 | 521.05 | 522.73 | 516.11 | 516.83 | 1.2967e6  |
| 2   | 2015-07-09 | 523.12 | 523.77 | 520.35 | 520.68 | 1.84235e6 |
| 3   | 2015-07-10 | 526.29 | 532.56 | 525.55 | 530.13 | 1.95668e6 |


or when I do:

julia> myid = "GOOG/NASDAQ_GOOG"
"GOOG/NASDAQ_GOOG"

julia> typeof(myid)
ASCIIString

julia> mydat = quandl(myid,rows=100,format="DataFrame")
100x6 DataFrames.DataFrame
| Row | Date   | Open   | High   | Low| Close  | Volume|
|-||||||---|
| 1   | 2015-07-08 | 521.05 | 522.73 | 516.11 | 516.83 | 1.2967e6  |
| 2   | 2015-07-09 | 523.12 | 523.77 | 520.35 | 520.68 | 1.84235e6 |
| 3   | 2015-07-10 | 526.29 | 532.56 | 525.55 | 530.13 | 1.95668e6 |


However, I get an error when I read my data from an external file. Assume I
have an ascii file containing only one line:

$ echo "GOOG/NASDAQ_GOOG" > portfolio.txt

$ cat portfolio.txt
GOOG/NASDAQ_GOOG


I just read the content of this file by using readdlm and try to use it to
call the same function quandl, but it does not work.

julia> myportfolio = readdlm("./portfolio.txt",'\n')
1x1 Array{Any,2}:
 "GOOG/NASDAQ_GOOG"

julia> typeof(myportfolio[1])
SubString{ASCIIString}

julia> mydat = quandl(myportfolio[1],rows=100,format="DataFrame")
ERROR: MethodError: `quandlget` has no method matching
quandlget(::SubString{ASCIIString})


I suppose the easiest way to solve this problem is to convert my
SubString{ASCIIString} variable to ASCIIString. Am I right here? How can I
do it?

Does any of you have another suggestion? May be I could read my data in a
different way instead of using readdlm?

Thanks for any tip!

best,

Charles
-- 
Um axé! :)

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


Re: [julia-users] Fwd: [ANN] Nemo 0.4 released!

2015-12-04 Thread Charles Novaes de Santana
It would be a great pleasure to help with this! I will keep it in my TODO
list. But I have the same feeling as Eric (and I am sure most of us have it
too). I need clones of myself to do collaborate in all the amazing projects
we know everyday and still have a life :)

I know some algebra teachers (that are not programming fans) that are
looking for a way to make their classes more interesting, and a notebook of
this amazing library would be great. Let's see...

Best,

Charles

On 5 December 2015 at 01:16, Bill Hart <goodwillh...@googlemail.com> wrote:

> Not yet Charles, but we plan to add some eventually (they take time to
> write). Of course contributions are welcome.
>
> There's lots of examples in the documentation by the way.
>
> Bill.
>
> On Saturday, 5 December 2015 00:46:28 UTC+1, Charles Santana wrote:
>>
>> Amazing!! Congratulations to all of you!!
>>
>> One question: Is there any IJulia notebook about Nemo?
>>
>> Thanks,
>>
>> Charles
>>
>> On 4 December 2015 at 23:50, 'Bill Hart' via julia-users <
>> julia...@googlegroups.com> wrote:
>>
>>>
>>> Hi all,
>>>
>>> It is with great pleasure that we release Nemo-0.4.
>>>
>>> Nemo is a computer algebra package written in the Julia programming
>>> language, with the eventual aim of covering commutative algebra, number
>>> theory and group theory.
>>>
>>> For instructions on getting and using Nemo-0.4, including full
>>> documentation see:
>>>
>>> http://nemocas.org/downloads.html
>>>
>>> One of the things we've worked really hard on in this release is
>>> fleshing out the generic matrix algorithms over rings, including fast
>>> generic algorithms for:
>>>
>>> * LU factorisation
>>> * reduced row echelon form
>>> * determinant
>>> * rank
>>> * linear solving
>>> * upper triangular solving
>>> * matrix inverse
>>> * (vector space) nullspace
>>> * hessenberg form
>>> * characteristic polynomial
>>> * minimal polynomial
>>>
>>> Most of these algorithms now have specialisations for generic matrices
>>> over fields in addition to the more generic version for general commutative
>>> rings, with further specialisations in some cases for the integers or for
>>> rings where there is coefficient explosion, e.g. with modular,
>>> interpolation or fraction free algorithms.
>>>
>>> Numerous benchmarks have been added to our benchmarks page to show that
>>> these implementations are competitive with other systems.
>>>
>>> http://nemocas.org/benchmarks.html
>>>
>>> Some other improvements in Nemo-0.4 include:
>>>
>>> * Arb is now available on Windows 64
>>> * OSX build is more reliable (>= 1 successful build report on OSX El
>>> Capitan)
>>> * better handling of rpaths on Linux
>>> * build Pari in single threaded mode (slight speedup)
>>> * wrap Flint's Howell form
>>> * update to MPIR-2.7.2
>>> * upgrade to MPFR-3.1.3
>>> * better catching of impossible inverses
>>> * random similarity transforms (for test code)
>>> * baby-steps giant-steps generic polynomial subst
>>> * Z["x"] polynomial ring syntax supported
>>> * R[a, b c] matrix syntax supported for Nemo types
>>> * conversion to and from Newton bases
>>> * wrap Flint permutations
>>> * rename Collection to Nemo.Set
>>> * added Nemo.Group abstract type
>>> * big speedups for polynomial resultant and Euclidean division
>>> * multinomial powering
>>> * update to Julia-0.4.1 (no changes required)
>>> * many small helper functions and bug fixes
>>>
>>> The main contributors to this release were:
>>>
>>> * William Hart
>>> * Tommy Hofmann
>>> * Claus Fieker
>>> * Fredrik Johansson.
>>>
>>> A number of others contributed to build testing.
>>>
>>> We've actually been working on Nemo-0.5 in parallel, so this should be
>>> released in January.
>>>
>>> If anyone is interested in learning Julia or contributing to Nemo,
>>> there's a list of interesting projects on our development page:
>>>
>>> http://nemocas.org/development.html
>>>
>>> We've focused here on projects that might be interesting for CS or Maths
>>> students to implement or which might make interesting open ended research
>>> projects, (as opposed to small bits and pieces of maintenance, which we've
>>> confined to our todo.txt).
>>>
>>> Suggestions of additional projects are also very welcome.
>>>
>>> Enjoy!!
>>>
>>> And please do let us know of successful/unsuccessful builds.
>>>
>>> Best Wishes,
>>>
>>> Bill Hart
>>> Tommy Hofmann
>>> Claus Fieker
>>> Fredrik Johansson
>>>
>>>
>>
>>
>> --
>> 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


Re: [julia-users] Fwd: [ANN] Nemo 0.4 released!

2015-12-04 Thread Charles Novaes de Santana
It would be a great pleasure to help with this! I will keep it in my TODO
list. But I have the same feeling as Eric (and I am sure most of us have it
too). I need clones of myself to do collaborate in all the amazing projects
we know everyday and still have a life :)

I know some algebra teachers (that are not programming fans) that are
looking for a way to make their classes more interesting, and a notebook of
this amazing library would be great. Let's see...

Best,

Charles

On 5 December 2015 at 01:16, Bill Hart <goodwillh...@googlemail.com> wrote:

> Not yet Charles, but we plan to add some eventually (they take time to
> write). Of course contributions are welcome.
>
> There's lots of examples in the documentation by the way.
>
> Bill.
>
> On Saturday, 5 December 2015 00:46:28 UTC+1, Charles Santana wrote:
>>
>> Amazing!! Congratulations to all of you!!
>>
>> One question: Is there any IJulia notebook about Nemo?
>>
>> Thanks,
>>
>> Charles
>>
>> On 4 December 2015 at 23:50, 'Bill Hart' via julia-users <
>> julia...@googlegroups.com> wrote:
>>
>>>
>>> Hi all,
>>>
>>> It is with great pleasure that we release Nemo-0.4.
>>>
>>> Nemo is a computer algebra package written in the Julia programming
>>> language, with the eventual aim of covering commutative algebra, number
>>> theory and group theory.
>>>
>>> For instructions on getting and using Nemo-0.4, including full
>>> documentation see:
>>>
>>> http://nemocas.org/downloads.html
>>>
>>> One of the things we've worked really hard on in this release is
>>> fleshing out the generic matrix algorithms over rings, including fast
>>> generic algorithms for:
>>>
>>> * LU factorisation
>>> * reduced row echelon form
>>> * determinant
>>> * rank
>>> * linear solving
>>> * upper triangular solving
>>> * matrix inverse
>>> * (vector space) nullspace
>>> * hessenberg form
>>> * characteristic polynomial
>>> * minimal polynomial
>>>
>>> Most of these algorithms now have specialisations for generic matrices
>>> over fields in addition to the more generic version for general commutative
>>> rings, with further specialisations in some cases for the integers or for
>>> rings where there is coefficient explosion, e.g. with modular,
>>> interpolation or fraction free algorithms.
>>>
>>> Numerous benchmarks have been added to our benchmarks page to show that
>>> these implementations are competitive with other systems.
>>>
>>> http://nemocas.org/benchmarks.html
>>>
>>> Some other improvements in Nemo-0.4 include:
>>>
>>> * Arb is now available on Windows 64
>>> * OSX build is more reliable (>= 1 successful build report on OSX El
>>> Capitan)
>>> * better handling of rpaths on Linux
>>> * build Pari in single threaded mode (slight speedup)
>>> * wrap Flint's Howell form
>>> * update to MPIR-2.7.2
>>> * upgrade to MPFR-3.1.3
>>> * better catching of impossible inverses
>>> * random similarity transforms (for test code)
>>> * baby-steps giant-steps generic polynomial subst
>>> * Z["x"] polynomial ring syntax supported
>>> * R[a, b c] matrix syntax supported for Nemo types
>>> * conversion to and from Newton bases
>>> * wrap Flint permutations
>>> * rename Collection to Nemo.Set
>>> * added Nemo.Group abstract type
>>> * big speedups for polynomial resultant and Euclidean division
>>> * multinomial powering
>>> * update to Julia-0.4.1 (no changes required)
>>> * many small helper functions and bug fixes
>>>
>>> The main contributors to this release were:
>>>
>>> * William Hart
>>> * Tommy Hofmann
>>> * Claus Fieker
>>> * Fredrik Johansson.
>>>
>>> A number of others contributed to build testing.
>>>
>>> We've actually been working on Nemo-0.5 in parallel, so this should be
>>> released in January.
>>>
>>> If anyone is interested in learning Julia or contributing to Nemo,
>>> there's a list of interesting projects on our development page:
>>>
>>> http://nemocas.org/development.html
>>>
>>> We've focused here on projects that might be interesting for CS or Maths
>>> students to implement or which might make interesting open ended research
>>> projects, (as opposed to small bits and pieces of maintenance, which we've
>>> confined to our todo.txt).
>>>
>>> Suggestions of additional projects are also very welcome.
>>>
>>> Enjoy!!
>>>
>>> And please do let us know of successful/unsuccessful builds.
>>>
>>> Best Wishes,
>>>
>>> Bill Hart
>>> Tommy Hofmann
>>> Claus Fieker
>>> Fredrik Johansson
>>>
>>>
>>
>>
>> --
>> 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


Re: [julia-users] Fwd: [ANN] Nemo 0.4 released!

2015-12-04 Thread Charles Novaes de Santana
Amazing!! Congratulations to all of you!!

One question: Is there any IJulia notebook about Nemo?

Thanks,

Charles

On 4 December 2015 at 23:50, 'Bill Hart' via julia-users <
julia-users@googlegroups.com> wrote:

>
> Hi all,
>
> It is with great pleasure that we release Nemo-0.4.
>
> Nemo is a computer algebra package written in the Julia programming
> language, with the eventual aim of covering commutative algebra, number
> theory and group theory.
>
> For instructions on getting and using Nemo-0.4, including full
> documentation see:
>
> http://nemocas.org/downloads.html
>
> One of the things we've worked really hard on in this release is fleshing
> out the generic matrix algorithms over rings, including fast generic
> algorithms for:
>
> * LU factorisation
> * reduced row echelon form
> * determinant
> * rank
> * linear solving
> * upper triangular solving
> * matrix inverse
> * (vector space) nullspace
> * hessenberg form
> * characteristic polynomial
> * minimal polynomial
>
> Most of these algorithms now have specialisations for generic matrices
> over fields in addition to the more generic version for general commutative
> rings, with further specialisations in some cases for the integers or for
> rings where there is coefficient explosion, e.g. with modular,
> interpolation or fraction free algorithms.
>
> Numerous benchmarks have been added to our benchmarks page to show that
> these implementations are competitive with other systems.
>
> http://nemocas.org/benchmarks.html
>
> Some other improvements in Nemo-0.4 include:
>
> * Arb is now available on Windows 64
> * OSX build is more reliable (>= 1 successful build report on OSX El
> Capitan)
> * better handling of rpaths on Linux
> * build Pari in single threaded mode (slight speedup)
> * wrap Flint's Howell form
> * update to MPIR-2.7.2
> * upgrade to MPFR-3.1.3
> * better catching of impossible inverses
> * random similarity transforms (for test code)
> * baby-steps giant-steps generic polynomial subst
> * Z["x"] polynomial ring syntax supported
> * R[a, b c] matrix syntax supported for Nemo types
> * conversion to and from Newton bases
> * wrap Flint permutations
> * rename Collection to Nemo.Set
> * added Nemo.Group abstract type
> * big speedups for polynomial resultant and Euclidean division
> * multinomial powering
> * update to Julia-0.4.1 (no changes required)
> * many small helper functions and bug fixes
>
> The main contributors to this release were:
>
> * William Hart
> * Tommy Hofmann
> * Claus Fieker
> * Fredrik Johansson.
>
> A number of others contributed to build testing.
>
> We've actually been working on Nemo-0.5 in parallel, so this should be
> released in January.
>
> If anyone is interested in learning Julia or contributing to Nemo, there's
> a list of interesting projects on our development page:
>
> http://nemocas.org/development.html
>
> We've focused here on projects that might be interesting for CS or Maths
> students to implement or which might make interesting open ended research
> projects, (as opposed to small bits and pieces of maintenance, which we've
> confined to our todo.txt).
>
> Suggestions of additional projects are also very welcome.
>
> Enjoy!!
>
> And please do let us know of successful/unsuccessful builds.
>
> Best Wishes,
>
> Bill Hart
> Tommy Hofmann
> Claus Fieker
> Fredrik Johansson
>
>


-- 
Um axé! :)

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


Re: [julia-users] Adding 1 to an Array{Array{Int64,1},1}

2015-12-04 Thread Charles Novaes de Santana
As you probably noted, I suggested a wrong function :( Sorry, I copied and
pasted and didn't read

here is the function I would like to suggest you:

julia> function newsum(a::Array{Array{Int64,1},1}, i::Int)
   lengtha = size(a,1);
   return(a + [[i,i] for j = 1:lengtha])
   end
newsum (generic function with 1 method)

julia> newsum(a,1)
5-element Array{Array{Int64,1},1}:
 [2,2]
 [2,2]
 [2,2]
 [2,2]
 [2,2]

best,

Charles


On 5 December 2015 at 02:45, Charles Novaes de Santana <
charles.sant...@gmail.com> wrote:

> Hi Chris,
>
> Unfortunately I don't know why the type changes from Array{Array{Int64,1},1}
> to Array{Any,1}. But I have a suggestion to what you can do to keep it as
> Array{Array{Int64,1},1}.
>
> My initial shot would be to do a + [[1,1] for i = 1:5] instead of a + 1:
>
> julia> a + [[1,1] for i = 1:5]
> 5-element Array{Array{Int64,1},1}:
>  [2,2]
>  [2,2]
>  [2,2]
>  [2,2]
>  [2,2]
>
> Or, if you want to simplify the way you do it, just define a function like
> this:
>
> julia> function newsum(a::Array{Array{Int64,1},1}, i::Int)
>lengtha = size(a,1);
>return([[i,i] for i = 1:lengtha])
>end
> newsum (generic function with 1 method)
>
> julia> newsum(a,1)
> 5-element Array{Array{Int64,1},1}:
>  [1,1]
>  [2,2]
>  [3,3]
>  [4,4]
>  [5,5]
>
> But I am sure you will find many more suggestions here! ;)
>
> Best,
>
> Charles
>
> On 5 December 2015 at 02:16, Chris <7hunderstr...@gmail.com> wrote:
>
>> I am confused about the following:
>>
>> julia> a = [[1,1] for i = 1:5]
>> 5-element Array{Array{Int64,1},1}:
>>  [1,1]
>>  [1,1]
>>  [1,1]
>>  [1,1]
>>  [1,1]
>>
>> julia> a + 1
>> 5-element Array{Any,1}:
>>  [2,2]
>>  [2,2]
>>  [2,2]
>>  [2,2]
>>  [2,2]
>>
>> Specifically, why does the type change from Array{Array{Int64,1},1} to
>> Array{Any,1}, and what can I do to keep it as Array{Array{Int64,1},1}?
>>
>> Thanks,
>> Chris
>>
>
>
>
> --
> 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


Re: [julia-users] Re: Convert SubString{ASCIIString} to String

2015-12-04 Thread Charles Novaes de Santana
Here it is late, so of course I forgive you the typo! :) But many thanks
for the TIP! :)

However, it doesn't seem to work here. My problem was that my matrix was
composed by SubString{ASCIIString}. So, if I call typeof(myportfolio[1]) I
get:

julia> typeof(myportfolio[1])
SubString{ASCIIString}

And the same if I call typeof(myportfolio[1,1]):

julia> typeof(myportfolio[1,1])
SubString{ASCIIString}

Could you please send the result of typeof(myportfolio[1]) in your example?
I suppose it would be an ASCIIString.

Seth's suggestion worked fine for me. To use a cast to ASCIIString to
convert myportfolio[1], like this:

julia> typeof(ASCIIString(myportfolio[1]))
ASCIIString

But thanks anyway!

Best,

Charles


On 5 December 2015 at 01:46, Eric Forgy <eric.fo...@gmail.com> wrote:

> It's early and I didn't finish my first cup of coffee yet, so forgive the
> typo :)
>
> julia> myportfolio
> 1x1 Array{Any,2}:
>  "GOOG/NASDAQ_GOOG"
>
> julia> myportfolio[1,1]
> "GOOG/NASDAQ_GOOG"
>
> julia> typeof(myportfolio[1,1])
> ASCIIString
>
>
> On Saturday, December 5, 2015 at 8:38:05 AM UTC+8, Eric Forgy wrote:
>>
>> Hi Charles,
>>
>> myportfolio is a Matrix, i.e. Array{Any,2}, so you need two indices to
>> access it:
>>
>> julia> myportfolio
>> 1x1 Array{Any,2}:
>>  "GOOG/NASDAQ_GOOD"
>>
>> julia> myportfolio[1,1]
>> "GOOG/NASDAQ_GOOD"
>>
>> julia> typeof(myportfolio[1,1])
>> ASCIIString
>>
>> Best regards,
>> Eric
>>
>> On Saturday, December 5, 2015 at 6:59:41 AM UTC+8, Charles Santana wrote:
>>>
>>> wow! That simple! Yes it works!
>>>
>>> Thanks, Seth!
>>>
>>> Charles
>>>
>>> On 4 December 2015 at 23:53, Seth <catc...@bromberger.com> wrote:
>>>
>>>> Maybe this will work for you?
>>>>
>>>> julia> a = "foobarbaz"
>>>> "foobarbaz"
>>>>
>>>> julia> b = SubString(a,3,6)
>>>> "obar"
>>>>
>>>> julia> typeof(b)
>>>> SubString{ASCIIString}
>>>>
>>>> julia> c = ASCIIString(b)
>>>> "obar"
>>>>
>>>> julia> typeof(c)
>>>> ASCIIString
>>>>
>>>>
>>>>
>>>> On Friday, December 4, 2015 at 2:48:12 PM UTC-8, Charles Santana wrote:
>>>>>
>>>>> Hi people,
>>>>>
>>>>> Maybe it is a trivial question for most of you, but I really could not
>>>>> find a way to solve my problem.
>>>>>
>>>>> I am using the function quandlget(id::ASCIIString) from the library
>>>>> https://github.com/milktrader/Quandl.jl (a great contribution, by the
>>>>> way!)
>>>>>
>>>>> Everything works fine when I use it in a straightforward way:
>>>>>
>>>>> julia> mydat = quandl("GOOG/NASDAQ_GOOG",rows=100,format="DataFrame")
>>>>> 100x6 DataFrames.DataFrame
>>>>> | Row | Date   | Open   | High   | Low| Close  | Volume|
>>>>> |-||||||---|
>>>>> | 1   | 2015-07-08 | 521.05 | 522.73 | 516.11 | 516.83 | 1.2967e6  |
>>>>> | 2   | 2015-07-09 | 523.12 | 523.77 | 520.35 | 520.68 | 1.84235e6 |
>>>>> | 3   | 2015-07-10 | 526.29 | 532.56 | 525.55 | 530.13 | 1.95668e6 |
>>>>>
>>>>>
>>>>> or when I do:
>>>>>
>>>>> julia> myid = "GOOG/NASDAQ_GOOG"
>>>>> "GOOG/NASDAQ_GOOG"
>>>>>
>>>>> julia> typeof(myid)
>>>>> ASCIIString
>>>>>
>>>>> julia> mydat = quandl(myid,rows=100,format="DataFrame")
>>>>> 100x6 DataFrames.DataFrame
>>>>> | Row | Date   | Open   | High   | Low| Close  | Volume|
>>>>> |-||||||---|
>>>>> | 1   | 2015-07-08 | 521.05 | 522.73 | 516.11 | 516.83 | 1.2967e6  |
>>>>> | 2   | 2015-07-09 | 523.12 | 523.77 | 520.35 | 520.68 | 1.84235e6 |
>>>>> | 3   | 2015-07-10 | 526.29 | 532.56 | 525.55 | 530.13 | 1.95668e6 |
>>>>>
>>>>>
>>>>> However, I get an error when I read my data from an external file.
>>>>> Assume I have an ascii file con

Re: [julia-users] Adding 1 to an Array{Array{Int64,1},1}

2015-12-04 Thread Charles Novaes de Santana
Hi Chris,

Unfortunately I don't know why the type changes from Array{Array{Int64,1},1}
to Array{Any,1}. But I have a suggestion to what you can do to keep it as
Array{Array{Int64,1},1}.

My initial shot would be to do a + [[1,1] for i = 1:5] instead of a + 1:

julia> a + [[1,1] for i = 1:5]
5-element Array{Array{Int64,1},1}:
 [2,2]
 [2,2]
 [2,2]
 [2,2]
 [2,2]

Or, if you want to simplify the way you do it, just define a function like
this:

julia> function newsum(a::Array{Array{Int64,1},1}, i::Int)
   lengtha = size(a,1);
   return([[i,i] for i = 1:lengtha])
   end
newsum (generic function with 1 method)

julia> newsum(a,1)
5-element Array{Array{Int64,1},1}:
 [1,1]
 [2,2]
 [3,3]
 [4,4]
 [5,5]

But I am sure you will find many more suggestions here! ;)

Best,

Charles

On 5 December 2015 at 02:16, Chris <7hunderstr...@gmail.com> wrote:

> I am confused about the following:
>
> julia> a = [[1,1] for i = 1:5]
> 5-element Array{Array{Int64,1},1}:
>  [1,1]
>  [1,1]
>  [1,1]
>  [1,1]
>  [1,1]
>
> julia> a + 1
> 5-element Array{Any,1}:
>  [2,2]
>  [2,2]
>  [2,2]
>  [2,2]
>  [2,2]
>
> Specifically, why does the type change from Array{Array{Int64,1},1} to
> Array{Any,1}, and what can I do to keep it as Array{Array{Int64,1},1}?
>
> Thanks,
> Chris
>



-- 
Um axé! :)

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


[julia-users] Silicon Valley Start-Up Software Engineer Position

2015-12-03 Thread Charles Novaes de Santana
Hi people,

Just received this advertisement. It makes me feel so bappy when I see
Julia as a reference for such great job positions... :)

Charles

--

SFI External Faculty member Jessica Green is advertising the following
position at her company Phylagen http://phylagen.com/ .  The ad is below
and can be found here: https://goo.gl/RfO9jv .  Please feel free to
distribute.

-Jennifer Dunne

Vice President for Science | Santa Fe Institute



*Bioinformatics Engineer Full Time Position*

We are adding a new team member at Phylagen, Inc. (phylagen.com). If you
know a software engineer who fits, please direct them to
j...@phylagen.com <javascript:;> <mailto:j...@phylagen.com <javascript:;>> .

We are an energized team developing microbiome data analytic tools and
bioinformatics pipelines that are being applied to a wide range of
environments.

We plan to bring on an innovative coder - ideally with a M.S or Ph.D. in
computer science, engineering, statistics, or bioinformatics
(translating to 4-5 years software engineering experience). We want
someone deeply knowledgeable in data analysis scripting
(R/Python/Julia), and in algorithm optimization, including
parallelization, distributed execution and implementing methods in a
lower-level language (e.g. C, C++, Java). The position will entail
combining code and data from different disciplines, translating and
optimizing published research algorithms into industry products, and
creating reference databases that can be used in machine learning
applications. Expertise in the analysis of metagenomics data and
bioinformatics pipelines is a bonus. We are looking someone who is
flexible - a fast learner with relevant experience that will allow them
to contribute quickly. You will be a key player in a cutting edge,
rapidly growing venture-backed microbiome startup.






-- 
Um axé! :)

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


Attached
Description: Binary data


[julia-users] Re: Fw: Fwd: [External-faculty] Silicon Valley Start-Up Software Engineer Position

2015-12-03 Thread Charles Novaes de Santana
"bappy" is "happy" before 10am :)

Charles

On Thursday, December 3, 2015, Charles Novaes de Santana <
charles.sant...@gmail.com> wrote:

> Hi people,
>
> Just received this advertisement. It makes me feel so bappy when I see
> Julia as a reference for such great job positions... :)
>
> Charles
>
> --
>
> SFI External Faculty member Jessica Green is advertising the following
> position at her company Phylagen http://phylagen.com/ .  The ad is below
> and can be found here: https://goo.gl/RfO9jv .  Please feel free to
> distribute.
>
> -Jennifer Dunne
>
> Vice President for Science | Santa Fe Institute
>
>
> 
>
> *Bioinformatics Engineer Full Time Position*
>
> We are adding a new team member at Phylagen, Inc. (phylagen.com). If you
> know a software engineer who fits, please direct them to
> j...@phylagen.com <mailto:j...@phylagen.com> .
>
> We are an energized team developing microbiome data analytic tools and
> bioinformatics pipelines that are being applied to a wide range of
> environments.
>
> We plan to bring on an innovative coder - ideally with a M.S or Ph.D. in
> computer science, engineering, statistics, or bioinformatics
> (translating to 4-5 years software engineering experience). We want
> someone deeply knowledgeable in data analysis scripting
> (R/Python/Julia), and in algorithm optimization, including
> parallelization, distributed execution and implementing methods in a
> lower-level language (e.g. C, C++, Java). The position will entail
> combining code and data from different disciplines, translating and
> optimizing published research algorithms into industry products, and
> creating reference databases that can be used in machine learning
> applications. Expertise in the analysis of metagenomics data and
> bioinformatics pipelines is a bonus. We are looking someone who is
> flexible - a fast learner with relevant experience that will allow them
> to contribute quickly. You will be a key player in a cutting edge,
> rapidly growing venture-backed microbiome startup.
>
>
>
>
>
>
> --
> 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


Re: [julia-users] Re: Access Bloomberg data with Julia

2015-11-20 Thread Charles Novaes de Santana
Hi Antonio,

Thanks for your email. I also was able to compile the Python Bloomberg's
API and to import it using PyCall.jl :)

I am now reading the API documentation to understand how it works and then
to implement my personal Julia project :)
http://www.bloomberglabs.com/files/2014/07/blpapi-developers-guide-2.54.pdf

In the meanwhile, I will try to contribute to Bloomberg.jl too.
https://github.com/milktrader/Bloomberg.jl  Let's see :)

Best,

Charles

On 19 November 2015 at 09:24, Antonio Suriano <antonio.suri...@gmail.com>
wrote:

>
> Hi,
>
> it is easy to compile blpapi for python (if you have 3.5) or even easier
> to download blpapi module if you have earlier python version.
> If you import with PyCall it works fine.
>
> I use through python because I have wrapped requests to produce pandas
> dataframes.
>
>
>
> Il giorno mercoledì 18 novembre 2015 23:58:56 UTC+1, Charles Santana ha
> scritto:
>>
>> Hi,
>>
>> Does anyone know a way to access Bloomberg data with Julia?
>>
>


-- 
Um axé! :)

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


Re: [julia-users] Re: Access Bloomberg data with Julia

2015-11-19 Thread Charles Novaes de Santana
Wow! Great initiative!! I am watching it.

Thanks for being so proactive! Although it is the very first time I am
trying to do something related to finances I hope I can help somehow.

Cheers,

Charles

On 20 November 2015 at 00:38, milktrader <milktra...@gmail.com> wrote:

> I'll start on this package but not promising I have time to devote right
> now. https://github.com/milktrader/Bloomberg.jl
>
> Stop by and check the progress though and feel free to contribute.
>
> Cheers,
>
> Dan
>
> On Thursday, November 19, 2015 at 4:46:42 PM UTC-5, Charles Santana wrote:
>>
>> Hi,
>>
>> Thanks for the tips! I am taking a look at their python api and my first
>> idea was to use PyCall.jl to call their functions. But I will also consider
>> the option to adapt Quandl.jl functions.
>>
>> I forgot to send the link for the bloomberg open source initiative:
>> http://www.bloomberglabs.com/api/libraries/
>>
>> Thanks!
>>
>>
>> On 19 November 2015 at 22:12, milktrader <milkt...@gmail.com> wrote:
>>
>>> Hmm, looking at the Bloomberg API it appears you'll need to wrap their C
>>> API, so a bit more involved than what Quandl.jl does.
>>>
>>> I didn't realize Bloomberg had an open source initiative.
>>>
>>>
>>> On Thursday, November 19, 2015 at 3:21:31 PM UTC-5, milktrader wrote:
>>>>
>>>> It wouldn't take much to make a Julia package for this. Bloomberg data
>>>> is subscription-based, no? You could copy how Quandl.jl does this and
>>>> simply replace the Quandl api with the Bloomberg api.
>>>>
>>>> Good luck
>>>>
>>>>
>>>>
>>>> On Wednesday, November 18, 2015 at 5:58:56 PM UTC-5, Charles Santana
>>>> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> Does anyone know a way to access Bloomberg data with Julia?
>>>>>
>>>>> I know there is a library in R (
>>>>> http://ftp.auckland.ac.nz/software/CRAN/src/contrib/Descriptions/RBloomberg.html)
>>>>> but I think it is no longer updated.
>>>>>
>>>>> There is also an API for Python, available here:
>>>>> https://github.com/filmackay/blpapi-py  I might try to use PyCall.jl
>>>>>
>>>>> However, I would prefer to use some library in Julia, if it exists. I
>>>>> found some packages to work with finances, but I didn't see any mention to
>>>>> Bloomberg database.
>>>>>
>>>>> Thanks for any tip!
>>>>>
>>>>> 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
>>
>


-- 
Um axé! :)

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


Re: [julia-users] Re: Access Bloomberg data with Julia

2015-11-19 Thread Charles Novaes de Santana
Hi,

Thanks for the tips! I am taking a look at their python api and my first
idea was to use PyCall.jl to call their functions. But I will also consider
the option to adapt Quandl.jl functions.

I forgot to send the link for the bloomberg open source initiative:
http://www.bloomberglabs.com/api/libraries/

Thanks!


On 19 November 2015 at 22:12, milktrader <milktra...@gmail.com> wrote:

> Hmm, looking at the Bloomberg API it appears you'll need to wrap their C
> API, so a bit more involved than what Quandl.jl does.
>
> I didn't realize Bloomberg had an open source initiative.
>
>
> On Thursday, November 19, 2015 at 3:21:31 PM UTC-5, milktrader wrote:
>>
>> It wouldn't take much to make a Julia package for this. Bloomberg data is
>> subscription-based, no? You could copy how Quandl.jl does this and simply
>> replace the Quandl api with the Bloomberg api.
>>
>> Good luck
>>
>>
>>
>> On Wednesday, November 18, 2015 at 5:58:56 PM UTC-5, Charles Santana
>> wrote:
>>>
>>> Hi,
>>>
>>> Does anyone know a way to access Bloomberg data with Julia?
>>>
>>> I know there is a library in R (
>>> http://ftp.auckland.ac.nz/software/CRAN/src/contrib/Descriptions/RBloomberg.html)
>>> but I think it is no longer updated.
>>>
>>> There is also an API for Python, available here:
>>> https://github.com/filmackay/blpapi-py  I might try to use PyCall.jl
>>>
>>> However, I would prefer to use some library in Julia, if it exists. I
>>> found some packages to work with finances, but I didn't see any mention to
>>> Bloomberg database.
>>>
>>> Thanks for any tip!
>>>
>>> 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] Access Bloomberg data with Julia

2015-11-18 Thread Charles Novaes de Santana
Hi,

Does anyone know a way to access Bloomberg data with Julia?

I know there is a library in R (
http://ftp.auckland.ac.nz/software/CRAN/src/contrib/Descriptions/RBloomberg.html)
but I think it is no longer updated.

There is also an API for Python, available here:
https://github.com/filmackay/blpapi-py  I might try to use PyCall.jl

However, I would prefer to use some library in Julia, if it exists. I found
some packages to work with finances, but I didn't see any mention to
Bloomberg database.

Thanks for any tip!

Charles

-- 
Um axé! :)

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


Re: [julia-users] Moore foundation grant.

2015-11-11 Thread Charles Novaes de Santana
Wow!! Congratulations! Definitely, well deserved!!

I am looking forward to see what Julia can represent for Scientific
Computing in a couple of years!

Best,

Charles

On 12 November 2015 at 08:12, Viral Shah <vi...@mayin.org> wrote:

> The core focus is actually on the compiler, debugger and libraries. On the
> IDE front, we’ll be working on providing hooks to integrate the debugger
> and such into existing IDE efforts - the prime being the Juno work, but
> other projects will use it as well.
>
> Independently, we are also discussing with the Eclipse Foundation to see
> how we can work with their scientific community and have a good Eclipse
> plugin for Julia.
>
> -viral
>
>
>
> > On 11-Nov-2015, at 10:42 PM, Hans-Peter <gcha...@gmail.com> wrote:
> >
> > Great! Congratulations!!
> >
> > I read about an IDE. Do you already have ideas, plans what  such an IDE
> could look like? And/or a word about technology?
> >
> >
> > On Wednesday, 11 November 2015 09:00:50 UTC+1, Viral Shah wrote:
> > Yes, we are really excited. This grant is to focus on core Julia
> compiler infrastructure and key math libraries. Much of the libraries focus
> will be on statistical Computing.
> > -viral
> >
>
>


-- 
Um axé! :)

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


Re: [julia-users] Re: IDE for Julia

2015-10-31 Thread Charles Novaes de Santana
It looks very nice!! The basic interface looks pretty much with Rstudio.
Thanks for sharing! (and for keeping this thread alive heehhe)

Best,

Charles

On 30 October 2015 at 16:03, Tomas Mikoviny <tomas.mikov...@gmail.com>
wrote:

> maybe someone with more javascript insight can get inspired by this python
> IDE one day :)
>
> https://github.com/yhat/rodeo
>
>
> On Thursday, August 27, 2015 at 5:12:22 AM UTC+2, Deb Midya wrote:
>>
>> Hi,
>>
>> Thanks in advance.
>>
>> I am new to Julia and using Julia-0.3.7 on Windows 8.
>>
>> I am looking for an IDE for Julia (like RStudio in R).
>>
>> Once again, thank you very much for the time you have given..
>>
>> Regards,
>>
>> Deb
>>
>


-- 
Um axé! :)

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


[julia-users] Re: ANN: CloudArray.jl: Easy Big Data programming in the Cloud

2015-10-30 Thread Charles Novaes de Santana
That is just amazing!!! Thanks, Andre!! And congratulations!! I definetly
need to try it!

Charles

On Friday, October 30, 2015, André Lage <prof.al...@gmail.com> wrote:

> PS: Here it goes a IJulia Notebook with some examples to use at
> http://cloudarraybox.cloudapp.net:
>
> https://github.com/gsd-ufal/CloudArray.jl/blob/master/docs/cloudarray.ipynb
>
>
> André Lage.
>
> On Fri, Oct 30, 2015 at 12:13 AM, André Lage <prof.al...@gmail.com
> <javascript:_e(%7B%7D,'cvml','prof.al...@gmail.com');>> wrote:
>
>> Dear Julia community,
>>
>> We are proud to announce the very first release of *CloudArray.jl*
>> <https://github.com/gsd-ufal/CloudArray.jl>, a programming support that
>> eases big data programming in the cloud. CloudArray loads data from files
>> and books the right amount of virtual machines (VMs) able to process it.
>> Data loading and VM management are entirely automatic and performed
>> on-demand.
>>
>> CloudArray builds on top of Julia DistributedArrays. Indeed, a CloudArray
>> is a DistributedArray whose data and VM managements are automatic: data
>> load, resource booking and allocation. Therefore, existent codes that use
>> DistributedArrays don't need to be adapted in order to use CloudArray: just
>> use CloudArray and configure your cloud authentication settings.
>>
>> If you are interested in CloudArray, please *try it for free at our
>> Azure VMs <http://cloudarraybox.cloudapp.net>*. If you need any help,
>> you can write to this list or send me an e-mail (prof.alage at gmail.com)
>> that we'll be glad to help you in developing your distributed application
>> in the cloud with CloudArray.
>>
>> CloudArray and CloudArrayBox are research prototypes which intend to be a
>> contribution to DistributedArrays and JuliaBox, not a replacement of them
>> at all. We intend in the future to pull requests to JuliaBox and Julia
>> Parallel communities as CloudArray code evolves. We also would like to
>> thank Julia developers and community for the great work. It's amazing how
>> Julia puts together high-level programming and efficiency, Julia really
>> inspired us in designing and implementing CloudArray.
>>
>> Moreover, we are open to work with Julia community, so please fell free
>> to propose any improvements or to pull requests to CloudArray code. 
>> CloudArray
>> roadmap <https://github.com/gsd-ufal/CloudArray.jl#future-features>
>> includes interesting features such as: support for Amazon EC2, OpenStack;
>> allow to set a price threshold; provide different QoS (SLA).
>>
>> We are looking forward to getting feedback from you.
>>
>> Sincerely,
>>
>>
>> André Lage.
>> Ph.D. in Computer Science
>> https://sites.google.com/a/ic.ufal.br/andrelage/home/cv
>>
>
>

-- 
Um axé! :)

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


Re: [julia-users] List non-empty files in a folder

2015-10-29 Thread Charles Novaes de Santana
Thanks! stat is great!! :)

My R-biased programming can solve the problem by using the following code:

minsize=100
folder=".";
files =
filter!(r"\.txt$",readdir(folder))[map(filesize,filter!(r"\.txt$",readdir(folder))).>minsize]

It solves my problem. But I would appreciate if anyone has any other
suggestion to do it in a Julia-style :)

Thanks a lot!

Best,

Charles

On 29 October 2015 at 16:25, Yichao Yu <yyc1...@gmail.com> wrote:

> stat[1] should have the info you need to write your own filter.
>
> [1]
> http://julia.readthedocs.org/en/latest/stdlib/file/?highlight=stat#Base.stat
>
> On Thu, Oct 29, 2015 at 11:22 AM, Charles Novaes de Santana
> <charles.sant...@gmail.com> wrote:
> > Hi julians,
> >
> > I am using readdir() and filter!() to list files in a folder that match a
> > given pattern (lets' say, to list all .txt files).
> >
> > Now I would like to filter the files according to their sizes. I only
> want
> > to list non-empty files within a folder, so my first shot is to list
> files
> > which sizes are higher than zero bytes.
> >
> > Some days ago there was a thread about listing the last modified file,
> that
> > used map() and mtime(). Do you know something similar to list files by
> size?
> >
> > 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: List non-empty files in a folder

2015-10-29 Thread Charles Novaes de Santana
Just to give a code to work. My code now is:

folder=".";
files = filter!(r"\.txt$",readdir(folder));

Thanks!

Charles

On 29 October 2015 at 16:22, Charles Novaes de Santana <
charles.sant...@gmail.com> wrote:

> Hi julians,
>
> I am using readdir() and filter!() to list files in a folder that match a
> given pattern (lets' say, to list all .txt files).
>
> Now I would like to filter the files according to their sizes. I only want
> to list non-empty files within a folder, so my first shot is to list files
> which sizes are higher than zero bytes.
>
> Some days ago there was a thread about listing the last modified file,
> that used map() and mtime(). Do you know something similar to list files by
> size?
>
> 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] List non-empty files in a folder

2015-10-29 Thread Charles Novaes de Santana
Hi julians,

I am using readdir() and filter!() to list files in a folder that match a
given pattern (lets' say, to list all .txt files).

Now I would like to filter the files according to their sizes. I only want
to list non-empty files within a folder, so my first shot is to list files
which sizes are higher than zero bytes.

Some days ago there was a thread about listing the last modified file, that
used map() and mtime(). Do you know something similar to list files by
size?

Thanks for any tip!

Best,

Charles

-- 
Um axé! :)

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


Re: [julia-users] List non-empty files in a folder

2015-10-29 Thread Charles Novaes de Santana
Thank you both! :) These different ways of doing the same thing in Julia
are quite useful (and funny! :))

Best,

Charles

On 29 October 2015 at 18:29, Stefan Karpinski <ste...@karpinski.org> wrote:

> You can also use do-block syntax to make it a little easer to read:
>
> files = filter!(readdir(folder)) do fname
> splitext(fname)[2] == "txt" && filesize(fname) >= minsize
> end
>
>
> Using the splitext function avoids the somewhat unlikely corner case of
> having a hidden file whose entire name is ".txt" which should probably not
> be considered to have the extension ".txt" even though it does technically
> end with that string.
>
> On Thu, Oct 29, 2015 at 11:53 AM, Yichao Yu <yyc1...@gmail.com> wrote:
>
>> On Thu, Oct 29, 2015 at 11:41 AM, Charles Novaes de Santana
>> <charles.sant...@gmail.com> wrote:
>> > Thanks! stat is great!! :)
>> >
>> > My R-biased programming can solve the problem by using the following
>> code:
>> >
>> > minsize=100
>> > folder=".";
>> > files =
>> >
>> filter!(r"\.txt$",readdir(folder))[map(filesize,filter!(r"\.txt$",readdir(folder))).>minsize]
>>
>> I don't think `readdir` necessarily garentee returning the files in
>> the same order every time you call it on all platforms. The simplest
>> improvement is just to call filter twice but you could also just do
>>
>> ```
>> filter!(fname->(endswith(fname, ".txt") && filesize(fname) > minsize),
>> readdir(folder))
>> ```
>>
>> Note that you don't need a regular expression for endswith...
>>
>> >
>> > It solves my problem. But I would appreciate if anyone has any other
>> > suggestion to do it in a Julia-style :)
>> >
>> > Thanks a lot!
>> >
>> > Best,
>> >
>> > Charles
>> >
>> > On 29 October 2015 at 16:25, Yichao Yu <yyc1...@gmail.com> wrote:
>> >>
>> >> stat[1] should have the info you need to write your own filter.
>> >>
>> >> [1]
>> >>
>> http://julia.readthedocs.org/en/latest/stdlib/file/?highlight=stat#Base.stat
>> >>
>> >> On Thu, Oct 29, 2015 at 11:22 AM, Charles Novaes de Santana
>> >> <charles.sant...@gmail.com> wrote:
>> >> > Hi julians,
>> >> >
>> >> > I am using readdir() and filter!() to list files in a folder that
>> match
>> >> > a
>> >> > given pattern (lets' say, to list all .txt files).
>> >> >
>> >> > Now I would like to filter the files according to their sizes. I only
>> >> > want
>> >> > to list non-empty files within a folder, so my first shot is to list
>> >> > files
>> >> > which sizes are higher than zero bytes.
>> >> >
>> >> > Some days ago there was a thread about listing the last modified
>> file,
>> >> > that
>> >> > used map() and mtime(). Do you know something similar to list files
>> by
>> >> > size?
>> >> >
>> >> > 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
>>
>
>


-- 
Um axé! :)

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


Re: [julia-users] Plotting evoked potential data as a "head" picture using Julia

2015-10-19 Thread Charles Novaes de Santana
Thanks, Christof!

EEG.jl is great, but as far as I understand it does not plot the heads
completely fulfilled (the heads have sparse coloured points) (
https://raw.githubusercontent.com/codles/EEG.jl/master/doc/images/sources.png).


Anyway, I will take a careful look to see if I can adapt the plot in EEG.jl
to the one we want to do.

Thanks,

Charles

On 19 October 2015 at 14:51, Christof Stocker <stocker.chris...@gmail.com>
wrote:

> Does https://github.com/codles/EEG.jl help?
>
>
> On 2015-10-19 14:45, Charles Novaes de Santana wrote:
>
>> Dear all,
>>
>> I have .csv file with the evoked potential of different electrodes
>> obtained from EEG signals of a human subject and I would like to plot a
>> head figure representing the evoked potentials. My csv file has 1000 lines
>> (from 1ms to 1000 ms) and 12 columns (each column for each electrode I am
>> studying).
>>
>> Do you know a way to use this csv files to plot a head representing the
>> evoked potential at specific temporal points (like P300, N100, etc) using
>> Julia? (I know a way to plot it in Matlab using ERPLAB and EEGLAB, but
>> Matlab is not an option in our Lab).
>>
>> The idea is to have a head figure similar to the one in the following
>> picture:
>> http://d2avczb82rh8fa.cloudfront.net/content/jn/113/3/740/F3.large.jpg
>>
>> Thanks for any help, sorry for not having a reproducible example.
>>
>> Best,
>>
>> Charles
>>
>>
>> --
>> Um axé! :)
>>
>> --
>> Charles Novaes de Santana, PhD
>> http://www.imedea.uib-csic.es/~charles <
>> http://www.imedea.uib-csic.es/%7Echarles>
>>
>
>
>


-- 
Um axé! :)

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


Re: [julia-users] Re: How to find connected components in a matrix using Julia

2015-09-25 Thread Charles Novaes de Santana
Hi Valentin,

Thanks a lot for your suggestion! It makes exactly what I need, with a
clear code. I still don't know if efficiency will be an issue for my
problems, but I hope it won't.

Just don't agree with your advice to only post in one place. Is there any
special reason for it besides the overlap of users?

I see some differences between asking in the mailing-list or in
stackoverflow, even if there is an overlap between of users of both forums.
In stackoverflow there is kind of a competition of the best responses that
I think is interesting, we can learn a lot from everyone there. And I think
it is not the focus of this list. Just my opinion.

By the way, the final solution for my problem is the following piece of
code:

using Images

function findMat(mat,value)
return(collect(zip(ind2sub(size(mat),find( x -> x == value, mat))...)));
end

mat = [1 1 0 0 0 ; 1 1 0 0 0 ; 0 0 0 0 1 ; 0 0 0 1 1]

labels = label_components(mat);

for c in 1:maximum(labels)
comp = findMat(labels,c);
println("Component $c is composed by the following elements
(row,col)");
println("$comp\n");
end


Thanks again for your help!

Best,

Charles

On 25 September 2015 at 09:07, Valentin Churavy <v.chur...@gmail.com> wrote:

> Hej Charles,
>
> in the future please only post in one place. A lot of the people who
> answer on SO are also here.
>
> You can use the label_components function in Images.jl
> https://github.com/timholy/Images.jl/blob/master/doc/function_reference.md#label_components
> To get the the list of coordinates for each components you then would have
> to do something along the line of.
>
> for c in 1:maximum(labels)
>find(x-> x == c, labels)
> end
>
> Not very efficient but that should get you started.
>
> On Friday, 25 September 2015 07:56:20 UTC+9, Charles Santana wrote:
>>
>> Assume I have the following matrix:
>>
>> mat = [1 1 0 0 0 ; 1 1 0 0 0 ; 0 0 0 0 1 ; 0 0 0 1 1]
>>
>> Considering as a "component" a group of neighbour elements that have
>> value '1', how to identify that this matrix has 2 components and which
>> vertices compose each one?
>>
>> For the matrix *mat* above I would like to find the following result:
>>
>> Component 1 is composed by the following elements of the matrix
>> (row,column):
>>
>> (1,1)
>> (1,2)
>> (2,1)
>> (2,2)
>>
>> Component 2 is composed by the following elements:
>>
>> (3,5)
>> (4,4)
>> (4,5)
>>
>> I can use Graph algorithms like this
>> <http://graphsjl-docs.readthedocs.org/en/latest/algorithms.html#connected-components>
>> to identify components in square matrices. However such algorithms can not
>> be used for non-square matrices like the one I present here.
>>
>> Any idea will be much appreciated.
>>
>> I am open if your suggestion involves the use of a Python library +
>> PyCall for example. Although I would prefer to use a pure Julia solution.
>>
>> Regards
>> Charles
>> P.S.: Just asked the same question in Stackoverflow:
>> https://stackoverflow.com/questions/32772190/how-to-find-connected-components-in-a-matrix-using-julia
>>
>> --
>> 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


Re: [julia-users] Re: How to find connected components in a matrix using Julia

2015-09-25 Thread Charles Novaes de Santana
Actually, Thanks, a LOT! :)

Great increase in performance indeed!! :)

Charles

On 25 September 2015 at 11:41, Charles Novaes de Santana <
charles.sant...@gmail.com> wrote:

> Yes, it is my post in Stackoverflow :)
>
> Thanks,
>
> Charles
>
> On 25 September 2015 at 10:46, Tim Holy <tim.h...@gmail.com> wrote:
>
>> See also http://stackoverflow.com/a/32778103/1939814
>>
>> --Tim
>>
>> On Friday, September 25, 2015 09:55:31 AM Charles Novaes de Santana wrote:
>> > Hi Valentin,
>> >
>> > Thanks a lot for your suggestion! It makes exactly what I need, with a
>> > clear code. I still don't know if efficiency will be an issue for my
>> > problems, but I hope it won't.
>> >
>> > Just don't agree with your advice to only post in one place. Is there
>> any
>> > special reason for it besides the overlap of users?
>> >
>> > I see some differences between asking in the mailing-list or in
>> > stackoverflow, even if there is an overlap between of users of both
>> forums.
>> > In stackoverflow there is kind of a competition of the best responses
>> that
>> > I think is interesting, we can learn a lot from everyone there. And I
>> think
>> > it is not the focus of this list. Just my opinion.
>> >
>> > By the way, the final solution for my problem is the following piece of
>> > code:
>> >
>> > using Images
>> >
>> > function findMat(mat,value)
>> > return(collect(zip(ind2sub(size(mat),find( x -> x == value,
>> mat))...)));
>> > end
>> >
>> > mat = [1 1 0 0 0 ; 1 1 0 0 0 ; 0 0 0 0 1 ; 0 0 0 1 1]
>> >
>> > labels = label_components(mat);
>> >
>> > for c in 1:maximum(labels)
>> > comp = findMat(labels,c);
>> > println("Component $c is composed by the following elements
>> > (row,col)");
>> > println("$comp\n");
>> > end
>> >
>> >
>> > Thanks again for your help!
>> >
>> > Best,
>> >
>> > Charles
>> >
>> > On 25 September 2015 at 09:07, Valentin Churavy <v.chur...@gmail.com>
>> wrote:
>> > > Hej Charles,
>> > >
>> > > in the future please only post in one place. A lot of the people who
>> > > answer on SO are also here.
>> > >
>> > > You can use the label_components function in Images.jl
>> > >
>> https://github.com/timholy/Images.jl/blob/master/doc/function_reference.md
>> > > #label_components To get the the list of coordinates for each
>> components
>> > > you then would have to do something along the line of.
>> > >
>> > > for c in 1:maximum(labels)
>> > >
>> > >find(x-> x == c, labels)
>> > >
>> > > end
>> > >
>> > > Not very efficient but that should get you started.
>> > >
>> > > On Friday, 25 September 2015 07:56:20 UTC+9, Charles Santana wrote:
>> > >> Assume I have the following matrix:
>> > >> mat = [1 1 0 0 0 ; 1 1 0 0 0 ; 0 0 0 0 1 ; 0 0 0 1 1]
>> > >>
>> > >> Considering as a "component" a group of neighbour elements that have
>> > >> value '1', how to identify that this matrix has 2 components and
>> which
>> > >> vertices compose each one?
>> > >>
>> > >> For the matrix *mat* above I would like to find the following result:
>> > >>
>> > >> Component 1 is composed by the following elements of the matrix
>> > >>
>> > >> (row,column):
>> > >> (1,1)
>> > >> (1,2)
>> > >> (2,1)
>> > >> (2,2)
>> > >>
>> > >> Component 2 is composed by the following elements:
>> > >> (3,5)
>> > >> (4,4)
>> > >> (4,5)
>> > >>
>> > >> I can use Graph algorithms like this
>> > >> <
>> http://graphsjl-docs.readthedocs.org/en/latest/algorithms.html#connected
>> > >> -components> to identify components in square matrices. However such
>> > >> algorithms can not be used for non-square matrices like the one I
>> > >> present here.
>> > >>
>> > >> Any idea will be much appreciated.
>> > >>
>> > >> I am open if your suggestion involves the use of a Python library +
>> > >> PyCall for example. Although I would prefer to use a pure Julia
>> solution.
>> > >>
>> > >> Regards
>> > >> Charles
>> > >> P.S.: Just asked the same question in Stackoverflow:
>> > >>
>> https://stackoverflow.com/questions/32772190/how-to-find-connected-compon
>> > >> ents-in-a-matrix-using-julia
>> > >>
>> > >> --
>> > >> 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
>



-- 
Um axé! :)

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


[julia-users] How to find connected components in a matrix using Julia

2015-09-24 Thread Charles Novaes de Santana
Assume I have the following matrix:

mat = [1 1 0 0 0 ; 1 1 0 0 0 ; 0 0 0 0 1 ; 0 0 0 1 1]

Considering as a "component" a group of neighbour elements that have value
'1', how to identify that this matrix has 2 components and which vertices
compose each one?

For the matrix *mat* above I would like to find the following result:

Component 1 is composed by the following elements of the matrix
(row,column):

(1,1)
(1,2)
(2,1)
(2,2)

Component 2 is composed by the following elements:

(3,5)
(4,4)
(4,5)

I can use Graph algorithms like this
<http://graphsjl-docs.readthedocs.org/en/latest/algorithms.html#connected-components>
to identify components in square matrices. However such algorithms can not
be used for non-square matrices like the one I present here.

Any idea will be much appreciated.

I am open if your suggestion involves the use of a Python library + PyCall
for example. Although I would prefer to use a pure Julia solution.

Regards
Charles
P.S.: Just asked the same question in Stackoverflow:
https://stackoverflow.com/questions/32772190/how-to-find-connected-components-in-a-matrix-using-julia

-- 
Um axé! :)

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


Re: [julia-users] Convert an Array{Any,2} to an AbstractVector in Julia

2015-09-11 Thread Charles Novaes de Santana
Thanks, Kristoffer! Indeed, the cost of wordcloud is higher as compared
with the one of copying the array (that is not a large array). Everything
is crystal clear now!

Thank you all for your collaboration!

Best,

Charles

On 11 September 2015 at 09:09, Kristoffer Carlsson <kcarlsso...@gmail.com>
wrote:

> You have too short timings for them to say much at all. As you can see you
> have large variations in the times even after the first run. It is likely
> that myfunc2 and myfunc takes virtually the same time since the cost of
> copying the array is insignificant to the work that wordcloud has to do. As
> you can see in the allocation part, you only save ~400 bytes allocated out
> of a total of 20 000 in the wordcloud function.
>
> On Thursday, September 10, 2015 at 11:20:04 PM UTC+2, Charles Santana
> wrote:
>>
>> Many thanks, guys! Indeed reshape(a,length(a)) is much faster than doing
>> in the simplest way. However, it brings another question:
>>
>> When I ran the command:
>>
>> function myfunc1(corpus)
>> wc = wordcloud(x = corpus[:])
>> end
>>
>> function myfunc2(corpus)
>> wc = wordcloud(x = reshape(corpus,length(corpus)))
>> end
>>
>> I get the following performance:
>>
>> @time myfunc1(corpus)
>>
>> 1st running:  398.202 milliseconds (452 k allocations: 17406 KB)
>> 2nd running: 144.181 microseconds (374 allocations: 20832 bytes)
>> 3rd running:  99.270 microseconds (374 allocations: 20832 bytes)
>> 4th running:  93.860 microseconds (374 allocations: 20832 bytes)
>>
>> @time myfunc2(corpus)
>>
>> 1st running:  4.102 milliseconds (2667 allocations: 136 KB)
>> 2nd running: 110.182 microseconds (375 allocations: 20464 bytes)
>> 3rd running:  130.949 microseconds (375 allocations: 20464 bytes)
>> 4th running:  120.142 microseconds (375 allocations: 20464 bytes)
>>
>> It is clear that it is much faster and occupies much less memory in the
>> first running. And actually I only need to run it once. However I am
>> curious to know why would myfunc2 be slower than the myfunc1 as the number
>> of running increase?
>>
>> Thanks for everything!
>>
>> Best,
>>
>> Charles
>>
>> On 10 September 2015 at 19:24, Steven G. Johnson <steve...@gmail.com>
>> wrote:
>>
>>>
>>>
>>> On Thursday, September 10, 2015 at 10:39:58 AM UTC-4, Seth wrote:
>>>>
>>>> would vec() also work for you? It's supposed to be pretty fast.
>>>>
>>>>> <http://www.imedea.uib-csic.es/~charles>
>>>>>
>>>>
>>> vec(a) is equivalent to reshape(a, length(a)), and is fast because it
>>> doesn't make a copy of the data.
>>>
>>
>>
>>
>> --
>> 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


Re: [julia-users] Convert an Array{Any,2} to an AbstractVector in Julia

2015-09-10 Thread Charles Novaes de Santana
Mauro, you are a genius! :)

Thanks a lot! It worked perfectly!

Best,

Charles

On 10 September 2015 at 14:30, Mauro <mauro...@runbox.com> wrote:

> >>> wc = wordcloud(x = corpus)
> > ERROR: TypeError: typeassert: expected AbstractArray{T,1}, got
> Array{Any,2}
> >
> > Do you have any suggestion about how to convert an Array{Any,2} to an
> > AbstractVector? Or how to read a text file to an AbstractVector variable?
>
> Have you tried to just flatten the array:
>
> wc = wordcloud(x = corpus[:])
>



-- 
Um axé! :)

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


[julia-users] Convert an Array{Any,2} to an AbstractVector in Julia

2015-09-10 Thread Charles Novaes de Santana
Dear all,

I just started to play with Vega, a great Julia package for visualization,
developed by John Myles ( http://johnmyleswhite.github.io/Vega.jl ). One of
the features I like more is the wordcloud (
http://johnmyleswhite.github.io/Vega.jl/wordcloud.html).

I could easily reproduce the example he put in the webpage, in which the
text to be processed is defined as a the following:

>> corpus = [ "Julia is a high-level, high-performance dynamic programming
language for technical computing,...", "Julia programs are organized around
multiple dispatch; by defining functions and overloading them ..." ]

>> wc = wordcloud(x = corpus)

Now I would like to read a text from an ascii file. My first try was to
read an ascii file using the command readdlm. As follows:

>> corpus = readdlm("./textfile.txt",'\n');

(you can find the file textfile.txt here:
https://github.com/cndesantana/filestoshare/blob/master/textfile.txt)

The function used to build the wordcloud (wordcloud) asks as input an
AbstractVector. However, when I read the text using readdlm the variable
corpus is an Array{Any,2}. So, when I call the function wordcloud I have
the following (expected) error message:

>> wc = wordcloud(x = corpus)
ERROR: TypeError: typeassert: expected AbstractArray{T,1}, got Array{Any,2}

Do you have any suggestion about how to convert an Array{Any,2} to an
AbstractVector? Or how to read a text file to an AbstractVector variable?

Thanks for your attention and for any tip!

Best,

Charles
-- 
Um axé! :)

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


Re: [julia-users] Convert an Array{Any,2} to an AbstractVector in Julia

2015-09-10 Thread Charles Novaes de Santana
Many thanks, guys! Indeed reshape(a,length(a)) is much faster than doing in
the simplest way. However, it brings another question:

When I ran the command:

function myfunc1(corpus)
wc = wordcloud(x = corpus[:])
end

function myfunc2(corpus)
wc = wordcloud(x = reshape(corpus,length(corpus)))
end

I get the following performance:

@time myfunc1(corpus)

1st running:  398.202 milliseconds (452 k allocations: 17406 KB)
2nd running: 144.181 microseconds (374 allocations: 20832 bytes)
3rd running:  99.270 microseconds (374 allocations: 20832 bytes)
4th running:  93.860 microseconds (374 allocations: 20832 bytes)

@time myfunc2(corpus)

1st running:  4.102 milliseconds (2667 allocations: 136 KB)
2nd running: 110.182 microseconds (375 allocations: 20464 bytes)
3rd running:  130.949 microseconds (375 allocations: 20464 bytes)
4th running:  120.142 microseconds (375 allocations: 20464 bytes)

It is clear that it is much faster and occupies much less memory in the
first running. And actually I only need to run it once. However I am
curious to know why would myfunc2 be slower than the myfunc1 as the number
of running increase?

Thanks for everything!

Best,

Charles

On 10 September 2015 at 19:24, Steven G. Johnson <stevenj@gmail.com>
wrote:

>
>
> On Thursday, September 10, 2015 at 10:39:58 AM UTC-4, Seth wrote:
>>
>> would vec() also work for you? It's supposed to be pretty fast.
>>
>>> <http://www.imedea.uib-csic.es/~charles>
>>>
>>
> vec(a) is equivalent to reshape(a, length(a)), and is fast because it
> doesn't make a copy of the data.
>



-- 
Um axé! :)

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


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] big matrices in Julia

2015-08-13 Thread Charles Novaes de Santana
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: big matrices in Julia

2015-08-13 Thread Charles Novaes de Santana
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é! :)

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


Re: [julia-users] Re: Read GML format graphs by using LightGraphs.jl

2015-07-17 Thread Charles Novaes de Santana
Hi both,

Thank you very much for doing it!! I will take a look at the parser along
the weekend and I hope it can be useful for us. Thank you for being so
proactive and helpful!!

Best,

Charles

On 17 July 2015 at 08:45, Seth catch...@bromberger.com wrote:

 Hi Charles,

 I've implemented Andrew's excellent GML parser in LightGraphs (in the
 gml branch for now until a few things can be clarified and docs can be
 written). To use it, checkout the gml branch and then use g =
 readgml(/path/to/file.gml).

 Note that there are a few issues with the GML parser (see the ones I
 opened at https://github.com/andrewcooke/ParserCombinator.jl/issues) but
 it seems to work for smaller gml files at this point.

 Note also that readgml() is not type-stable, as it will create either a
 Graph or DiGraph depending on what it finds in the file. Not sure this is a
 huge problem.


 On Thursday, July 16, 2015 at 3:11:41 PM UTC-7, andrew cooke wrote:


 hi, seth contacted me to see whether my ParserCombinator library could do
 this, and i've just finished adding support for GML.  you can see it at
 https://github.com/andrewcooke/ParserCombinator.jl#parsers

 that is currently only available via git (not yet in a published
 release).  i've also emailed seth.  if either of you could have a look and
 tell me whether it's adequate or not, and / or report any bugs then i can
 look at releasing a version.

 cheers,
 andrew


 On Saturday, 11 July 2015 11:04:08 UTC-3, Seth wrote:

 Hi Charles,

 You're correct; for persistence, LightGraphs currently supports an
 internal graph representation and GraphML. If you can convert to GraphML
 you're in luck; otherwise, if you open up an issue someone might be able to
 code something up.

 The quickest thing, perhaps, would be to import the gml into NetworkX (
 http://networkx.github.io) and then write it out as GraphML, which you
 should then be able to use in LightGraphs.

 Seth.


 On Saturday, July 11, 2015 at 3:48:52 AM UTC-7, Charles Santana wrote:

 Hi folks,

 Following the suggestion of Seth (
 https://groups.google.com/forum/#!topic/julia-users/Ftdo2LmxC-g) I am
 trying to use LightGraphs.jl to read my graph files.

 My graphs are in GML format (
 http://gephi.github.io/users/supported-graph-formats/gml-format/).
 However, as far as I understand, LightGraphs.jl can not read graphs in this
 format.

 I just found this thread talking about the creation of a GraphsIO.jl
 and its integration with Graphs.jl and LightGraphs.jl (
 https://github.com/JuliaLang/Graphs.jl/issues/37) Do you have any news
 about it? How can I read GML files to work with LightGraphs.jl?

 Thanks for any help!

 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


Re: [julia-users] Problems using PyCall and Igraph

2015-07-11 Thread Charles Novaes de Santana
Thanks Seth, for your suggestion. I will take a look at LightGraphs.jl to
see if it has all the features I need. It would be great if I could use
only julia code (without using python libraries) in my project.

Best,

Charles

On 11 July 2015 at 05:45, Seth catch...@bromberger.com wrote:

 Hi Charles,

 igraph is indeed very good, but you might want to look at some
 Julia-native graph libraries. Graphs.jl and LightGraphs.jl are available,
 and the latter performs very favorably compared with igraph.

 On Friday, July 10, 2015 at 4:57:36 PM UTC-7, Charles Santana wrote:

 Hi again,

 Just to say that I have installed the nightly version of julia
 (0.4.0-dev+5920 (2015-07-10) and checked out the master branch of PyCall,
 by running:

 Pkg.rm(PyCall)
 Pkg.add(PyCall)
 Pkg.checkout(PyCall)

 Now my python-igraph library seems to be working perfectly. I could
 successfully run this toy example:

 ```
 julia using PyCall
 julia @pyimport igraph
 julia gg = igraph.Graph()
 julia g = gg[:Barabasi](5)
 julia g[:degree]()
 5-element Array{Any,1}:
  3
  1
  1
  2
  1

 ```

 I will start working with python-igraph, but I will also take a look at
 Cxx.jl to see if I can use it as an alternative. Thanks a lot for your help
 and your advice!

 Best,

 Charles

 On 11 July 2015 at 01:37, Yichao Yu yyc...@gmail.com wrote:

 On Fri, Jul 10, 2015 at 7:16 PM, Charles Novaes de Santana
 charles...@gmail.com wrote:
  Thanks for your answer, Yichao! I am installing the nightly version of
 julia
  and I will try the master version of PyCall.
 
  I was trying to wrap C++-Igraph into my julia code by using Cpp.jl,
 however
  it seems to be a bit tricky because my c++ codes are not that simple.
 Do you
  (or anybody else) recomend another way to wrap c++ code into julia? I
 took a
  look at Cxx.jl and it seems to be more intuitive to use, but I didn't
 try it
  yet.

 If it only has c++ interface (or you need to wrap the c++ interface)
 I'd probably recommand sticking to the python interface for now and
 use Cxx.jl once LLVM3.7 is out (and possibly after julia master
 swiches to it).

 If you want to compile julia and llvm yourself, you can try Cxx.jl now
 too.

 
  Best,
 
  Charles
 
  On 11 July 2015 at 00:39, Yichao Yu yyc...@gmail.com wrote:
 
  On Fri, Jul 10, 2015 at 6:07 PM, Charles Novaes de Santana
  charles...@gmail.com wrote:
   Dear Julians,
  
   Igraph is an amazing library to work with graphs, currently
 available
   for R,
   C/C++ and Python (http://igraph.org). I am trying to use it with
 Julia
   by
   using PyCall but I am facing some issues very similar to the ones
   related in
   the following links:
  
   https://github.com/JuliaLang/pyjulia/issues/32
  
   https://github.com/stevengj/PyCall.jl/issues/95
  
   https://github.com/stevengj/PyCall.jl/issues/96
  
   I just tried to run the following  commands:
  
   julia using PyCall
  
   julia @pyimport igraph
  
   And got the following error:
  
   signal (11): Segmentation fault
   PyType_Ready at /usr/lib/x86_64-linux-gnu/libpython2.7.so (unknown
 line)
   call at /home/cdesantana/.julia/v0.4/PyCall/src/pytype.jl:73
   pyjlwrap_type at
 /home/cdesantana/.julia/v0.4/PyCall/src/pytype.jl:415
   pyinitialize at
 /home/cdesantana/.julia/v0.4/PyCall/src/pyinit.jl:289
   jlcall_pyinitialize_42896 at  (unknown line)
   jl_apply_generic at
   /home/cdesantana/Downloads/julia/usr/bin/../lib/libjulia.so (unknown
   line)
   pyinitialize at
 /home/cdesantana/.julia/v0.4/PyCall/src/pyinit.jl:329
   jlcall_pyinitialize_42814 at  (unknown line)
   jl_apply_generic at
   /home/cdesantana/Downloads/julia/usr/bin/../lib/libjulia.so (unknown
   line)
   pyimport at /home/cdesantana/.julia/v0.4/PyCall/src/PyCall.jl:111
   jl_apply_generic at
   /home/cdesantana/Downloads/julia/usr/bin/../lib/libjulia.so (unknown
   line)
   unknown function (ip: -775406212)
   unknown function (ip: -775409006)
   unknown function (ip: -775406239)
   unknown function (ip: -775409006)
   unknown function (ip: -775409505)
   unknown function (ip: -775404607)
   unknown function (ip: -775403490)
   unknown function (ip: -775333218)
   jl_toplevel_eval_in at
   /home/cdesantana/Downloads/julia/usr/bin/../lib/libjulia.so (unknown
   line)
   eval_user_input at REPL.jl:54
   jlcall_eval_user_input_42620 at  (unknown line)
   jl_apply_generic at
   /home/cdesantana/Downloads/julia/usr/bin/../lib/libjulia.so (unknown
   line)
   anonymous at task.jl:83
   unknown function (ip: -775379519)
   unknown function (ip: 0)
   Segmentation fault (core dumped)
  
   I am running Julia version 0.4.0-dev+3735 (2015-03-09). I just
 installed
 
  FWIW, this is a REALLY old 0.4-dev version. There's been various bug
  fixes after that and you'll probably have more luck with a more recent
  version.
 
   PyCall by calling Pkg.add(PyCall). I have installed python-igraph
   version
   0.6.5-1.
 
  Note that the latest release of PyCall might not work with current
  master, You might need a checkout (master

[julia-users] Read GML format graphs by using LightGraphs.jl

2015-07-11 Thread Charles Novaes de Santana
Hi folks,

Following the suggestion of Seth (
https://groups.google.com/forum/#!topic/julia-users/Ftdo2LmxC-g) I am
trying to use LightGraphs.jl to read my graph files.

My graphs are in GML format (
http://gephi.github.io/users/supported-graph-formats/gml-format/). However,
as far as I understand, LightGraphs.jl can not read graphs in this format.

I just found this thread talking about the creation of a GraphsIO.jl and
its integration with Graphs.jl and LightGraphs.jl (
https://github.com/JuliaLang/Graphs.jl/issues/37) Do you have any news
about it? How can I read GML files to work with LightGraphs.jl?

Thanks for any help!

Charles

-- 
Um axé! :)

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


Re: [julia-users] Problems using PyCall and Igraph

2015-07-10 Thread Charles Novaes de Santana
Hi again,

Just to say that I have installed the nightly version of julia
(0.4.0-dev+5920 (2015-07-10) and checked out the master branch of PyCall,
by running:

Pkg.rm(PyCall)
Pkg.add(PyCall)
Pkg.checkout(PyCall)

Now my python-igraph library seems to be working perfectly. I could
successfully run this toy example:

```
julia using PyCall
julia @pyimport igraph
julia gg = igraph.Graph()
julia g = gg[:Barabasi](5)
julia g[:degree]()
5-element Array{Any,1}:
 3
 1
 1
 2
 1

```

I will start working with python-igraph, but I will also take a look at
Cxx.jl to see if I can use it as an alternative. Thanks a lot for your help
and your advice!

Best,

Charles

On 11 July 2015 at 01:37, Yichao Yu yyc1...@gmail.com wrote:

 On Fri, Jul 10, 2015 at 7:16 PM, Charles Novaes de Santana
 charles.sant...@gmail.com wrote:
  Thanks for your answer, Yichao! I am installing the nightly version of
 julia
  and I will try the master version of PyCall.
 
  I was trying to wrap C++-Igraph into my julia code by using Cpp.jl,
 however
  it seems to be a bit tricky because my c++ codes are not that simple. Do
 you
  (or anybody else) recomend another way to wrap c++ code into julia? I
 took a
  look at Cxx.jl and it seems to be more intuitive to use, but I didn't
 try it
  yet.

 If it only has c++ interface (or you need to wrap the c++ interface)
 I'd probably recommand sticking to the python interface for now and
 use Cxx.jl once LLVM3.7 is out (and possibly after julia master
 swiches to it).

 If you want to compile julia and llvm yourself, you can try Cxx.jl now too.

 
  Best,
 
  Charles
 
  On 11 July 2015 at 00:39, Yichao Yu yyc1...@gmail.com wrote:
 
  On Fri, Jul 10, 2015 at 6:07 PM, Charles Novaes de Santana
  charles.sant...@gmail.com wrote:
   Dear Julians,
  
   Igraph is an amazing library to work with graphs, currently available
   for R,
   C/C++ and Python (http://igraph.org). I am trying to use it with
 Julia
   by
   using PyCall but I am facing some issues very similar to the ones
   related in
   the following links:
  
   https://github.com/JuliaLang/pyjulia/issues/32
  
   https://github.com/stevengj/PyCall.jl/issues/95
  
   https://github.com/stevengj/PyCall.jl/issues/96
  
   I just tried to run the following  commands:
  
   julia using PyCall
  
   julia @pyimport igraph
  
   And got the following error:
  
   signal (11): Segmentation fault
   PyType_Ready at /usr/lib/x86_64-linux-gnu/libpython2.7.so (unknown
 line)
   call at /home/cdesantana/.julia/v0.4/PyCall/src/pytype.jl:73
   pyjlwrap_type at /home/cdesantana/.julia/v0.4/PyCall/src/pytype.jl:415
   pyinitialize at /home/cdesantana/.julia/v0.4/PyCall/src/pyinit.jl:289
   jlcall_pyinitialize_42896 at  (unknown line)
   jl_apply_generic at
   /home/cdesantana/Downloads/julia/usr/bin/../lib/libjulia.so (unknown
   line)
   pyinitialize at /home/cdesantana/.julia/v0.4/PyCall/src/pyinit.jl:329
   jlcall_pyinitialize_42814 at  (unknown line)
   jl_apply_generic at
   /home/cdesantana/Downloads/julia/usr/bin/../lib/libjulia.so (unknown
   line)
   pyimport at /home/cdesantana/.julia/v0.4/PyCall/src/PyCall.jl:111
   jl_apply_generic at
   /home/cdesantana/Downloads/julia/usr/bin/../lib/libjulia.so (unknown
   line)
   unknown function (ip: -775406212)
   unknown function (ip: -775409006)
   unknown function (ip: -775406239)
   unknown function (ip: -775409006)
   unknown function (ip: -775409505)
   unknown function (ip: -775404607)
   unknown function (ip: -775403490)
   unknown function (ip: -775333218)
   jl_toplevel_eval_in at
   /home/cdesantana/Downloads/julia/usr/bin/../lib/libjulia.so (unknown
   line)
   eval_user_input at REPL.jl:54
   jlcall_eval_user_input_42620 at  (unknown line)
   jl_apply_generic at
   /home/cdesantana/Downloads/julia/usr/bin/../lib/libjulia.so (unknown
   line)
   anonymous at task.jl:83
   unknown function (ip: -775379519)
   unknown function (ip: 0)
   Segmentation fault (core dumped)
  
   I am running Julia version 0.4.0-dev+3735 (2015-03-09). I just
 installed
 
  FWIW, this is a REALLY old 0.4-dev version. There's been various bug
  fixes after that and you'll probably have more luck with a more recent
  version.
 
   PyCall by calling Pkg.add(PyCall). I have installed python-igraph
   version
   0.6.5-1.
 
  Note that the latest release of PyCall might not work with current
  master, You might need a checkout (master) version of PyCall.
 
  
   Any clue? I am seriously thinking about wrapping Igraph for C/C++ into
   my
   julia code. Do you think it can be more stable?
 
  Depending on how simple that interface is, that might be a good idea.
  And I think that's a better way in the long term.
 
  
   Thanks for any help!
  
   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




-- 
Um axé! :)

--
Charles Novaes de Santana, PhD

[julia-users] Problems using PyCall and Igraph

2015-07-10 Thread Charles Novaes de Santana
Dear Julians,

Igraph is an amazing library to work with graphs, currently available for
R, C/C++ and Python (http://igraph.org). I am trying to use it with Julia
by using PyCall but I am facing some issues very similar to the ones
related in the following links:

https://github.com/JuliaLang/pyjulia/issues/32

https://github.com/stevengj/PyCall.jl/issues/95

https://github.com/stevengj/PyCall.jl/issues/96

I just tried to run the following  commands:

julia using PyCall

julia @pyimport igraph

And got the following error:

signal (11): Segmentation fault
PyType_Ready at /usr/lib/x86_64-linux-gnu/libpython2.7.so (unknown line)
call at /home/cdesantana/.julia/v0.4/PyCall/src/pytype.jl:73
pyjlwrap_type at /home/cdesantana/.julia/v0.4/PyCall/src/pytype.jl:415
pyinitialize at /home/cdesantana/.julia/v0.4/PyCall/src/pyinit.jl:289
jlcall_pyinitialize_42896 at  (unknown line)
jl_apply_generic at
/home/cdesantana/Downloads/julia/usr/bin/../lib/libjulia.so (unknown line)
pyinitialize at /home/cdesantana/.julia/v0.4/PyCall/src/pyinit.jl:329
jlcall_pyinitialize_42814 at  (unknown line)
jl_apply_generic at
/home/cdesantana/Downloads/julia/usr/bin/../lib/libjulia.so (unknown line)
pyimport at /home/cdesantana/.julia/v0.4/PyCall/src/PyCall.jl:111
jl_apply_generic at
/home/cdesantana/Downloads/julia/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: -775406212)
unknown function (ip: -775409006)
unknown function (ip: -775406239)
unknown function (ip: -775409006)
unknown function (ip: -775409505)
unknown function (ip: -775404607)
unknown function (ip: -775403490)
unknown function (ip: -775333218)
jl_toplevel_eval_in at
/home/cdesantana/Downloads/julia/usr/bin/../lib/libjulia.so (unknown line)
eval_user_input at REPL.jl:54
jlcall_eval_user_input_42620 at  (unknown line)
jl_apply_generic at
/home/cdesantana/Downloads/julia/usr/bin/../lib/libjulia.so (unknown line)
anonymous at task.jl:83
unknown function (ip: -775379519)
unknown function (ip: 0)
Segmentation fault (core dumped)

I am running Julia version 0.4.0-dev+3735 (2015-03-09). I just installed
PyCall by calling Pkg.add(PyCall). I have installed python-igraph
version 0.6.5-1.

Any clue? I am seriously thinking about wrapping Igraph for C/C++ into my
julia code. Do you think it can be more stable?

Thanks for any help!

Best,

Charles
-- 
Um axé! :)

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


[julia-users] Re: Problems using PyCall and Igraph

2015-07-10 Thread Charles Novaes de Santana
Sorry, just to mention: I am using a machine with Ubuntu 14.04.1.

Best,

Charles

On 11 July 2015 at 00:07, Charles Novaes de Santana 
charles.sant...@gmail.com wrote:

 Dear Julians,

 Igraph is an amazing library to work with graphs, currently available for
 R, C/C++ and Python (http://igraph.org). I am trying to use it with Julia
 by using PyCall but I am facing some issues very similar to the ones
 related in the following links:

 https://github.com/JuliaLang/pyjulia/issues/32

 https://github.com/stevengj/PyCall.jl/issues/95

 https://github.com/stevengj/PyCall.jl/issues/96

 I just tried to run the following  commands:

 julia using PyCall

 julia @pyimport igraph

 And got the following error:

 signal (11): Segmentation fault
 PyType_Ready at /usr/lib/x86_64-linux-gnu/libpython2.7.so (unknown line)
 call at /home/cdesantana/.julia/v0.4/PyCall/src/pytype.jl:73
 pyjlwrap_type at /home/cdesantana/.julia/v0.4/PyCall/src/pytype.jl:415
 pyinitialize at /home/cdesantana/.julia/v0.4/PyCall/src/pyinit.jl:289
 jlcall_pyinitialize_42896 at  (unknown line)
 jl_apply_generic at
 /home/cdesantana/Downloads/julia/usr/bin/../lib/libjulia.so (unknown line)
 pyinitialize at /home/cdesantana/.julia/v0.4/PyCall/src/pyinit.jl:329
 jlcall_pyinitialize_42814 at  (unknown line)
 jl_apply_generic at
 /home/cdesantana/Downloads/julia/usr/bin/../lib/libjulia.so (unknown line)
 pyimport at /home/cdesantana/.julia/v0.4/PyCall/src/PyCall.jl:111
 jl_apply_generic at
 /home/cdesantana/Downloads/julia/usr/bin/../lib/libjulia.so (unknown line)
 unknown function (ip: -775406212)
 unknown function (ip: -775409006)
 unknown function (ip: -775406239)
 unknown function (ip: -775409006)
 unknown function (ip: -775409505)
 unknown function (ip: -775404607)
 unknown function (ip: -775403490)
 unknown function (ip: -775333218)
 jl_toplevel_eval_in at
 /home/cdesantana/Downloads/julia/usr/bin/../lib/libjulia.so (unknown line)
 eval_user_input at REPL.jl:54
 jlcall_eval_user_input_42620 at  (unknown line)
 jl_apply_generic at
 /home/cdesantana/Downloads/julia/usr/bin/../lib/libjulia.so (unknown line)
 anonymous at task.jl:83
 unknown function (ip: -775379519)
 unknown function (ip: 0)
 Segmentation fault (core dumped)

 I am running Julia version 0.4.0-dev+3735 (2015-03-09). I just installed
 PyCall by calling Pkg.add(PyCall). I have installed python-igraph
 version 0.6.5-1.

 Any clue? I am seriously thinking about wrapping Igraph for C/C++ into my
 julia code. Do you think it can be more stable?

 Thanks for any help!

 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] Awesome Julia

2015-06-19 Thread Charles Novaes de Santana
Hi Julians,

Just saw it: http://getawesomeness.com/get/julia

awesome!

Charles

-- 
Um axé! :)

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


Re: [julia-users] Re: How to deploy Julia

2015-06-17 Thread Charles Novaes de Santana
Did I hear AstroJulia? :)

Best,

Charles

On 16 June 2015 at 14:38, Daniel Carrera dcarr...@gmail.com wrote:

 I would love to see the paper when it comes out. I cannot use your code
 directly because I need to do a direct NBody rather than a tree code (I am
 modelling planetary systems). But it's nice to see another astronomer using
 Julia.

 Cheers,
 Daniel.


 On 16 June 2015 at 08:28, Ariel Keselman skar...@gmail.com wrote:

 FYI just since NBody was mentioned -- I wrote a gravitational NBody tree
 code with parallel shared memory execution. I run it with many millions of
 particles and I'm very pleased with the results. They are comparable (or
 even faster) than some very popular C codes (e.g. Gadget2). I'm working on
 a paper currently, will publish a package once everything is cleaned up,
 documented, etc.




 --
 When an engineer says that something can't be done, it's a code phrase
 that means it's not fun to do.




-- 
Um axé! :)

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


[julia-users] Zurich Julia Meetup

2015-06-12 Thread Charles Novaes de Santana
Hi all,

In the same mood of René's email: we are organizing a Julia Meetup in
Zürich for the next July 9th. If there is any Julia user interested in
joining us.

We created a doodle in order to know how many of us can make it:
http://doodle.com/kxew38zp56fparr5 Please feel free to fulfil if you are
interested in participating on it.

Here the link for the Zurich Julia Meetup:
http://www.meetup.com/Zurich-Julia-User-Group/

Best wishes,

Charles

-- 
Um axé! :)

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


Re: [julia-users] Re: Read EDF (European Data Format) files in Julia

2015-03-22 Thread Charles Novaes de Santana
Hi Tobias,

Thank you for this good start! ;) I was just wondering if there was any
built function to do this before starting to do my own function. Tomorrow
is Monday, if I don't find any built function I will move towards the
direction you indicated ;) The R and Matlab functions I use can also help.

Have a nice Sunday!

Best,

Charles

On Sun, Mar 22, 2015 at 12:25 PM, Tobias Knopp tobias.kn...@googlemail.com
wrote:

 I have recently created functions for reading and writing a similar format
 (Analyze/Nifti). Its not very complicated.

 Something like the following to give you a start:

 function load_edf(filename::String)

   header = Dict{ASCIIString,Any}()

   open(filename,r) do fd
 version =  bytestring( read(fd, Uint8, 8) )
 header[version] = version

 localPatientId =  bytestring( read(fd, Uint8, 80) )
 header[version] = localPatientId

 ...

 # here the data would be read
   end
   return data, header
 end



 Am Sonntag, 22. März 2015 08:28:20 UTC+1 schrieb Charles Santana:

 Dear all,

 Does any of you know if there is a library or a function to read EDF
 files with Julia?

 http://www.edfplus.info/specs/edf.html

 EDF is a format for exchange and storage of multichannel biological and
 physical signals. In our case, we have polysomnographic data stored in this
 format.

 We use to read this kind of data using functions written in R or Matlab,
 or to use a free open-source software (edfbrowser) to convert the data to
 ASCII. But as we always use Julia to do the analysis of the converted data
 I was wondering if there is something written in Julia to read them in
 their original format.

 Thanks in advance for any help.

 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] Read EDF (European Data Format) files in Julia

2015-03-22 Thread Charles Novaes de Santana
Dear all,

Does any of you know if there is a library or a function to read EDF files
with Julia?

http://www.edfplus.info/specs/edf.html

EDF is a format for exchange and storage of multichannel biological and
physical signals. In our case, we have polysomnographic data stored in this
format.

We use to read this kind of data using functions written in R or Matlab, or
to use a free open-source software (edfbrowser) to convert the data to
ASCII. But as we always use Julia to do the analysis of the converted data
I was wondering if there is something written in Julia to read them in
their original format.

Thanks in advance for any help.

Best,

Charles
-- 
Um axé! :)

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


Re: [julia-users] Re: Read EDF (European Data Format) files in Julia

2015-03-22 Thread Charles Novaes de Santana
Great news! Thanks for the information, Sam! I will try this before
starting something from scratch!

Best,

Charles

On Sun, Mar 22, 2015 at 3:18 PM, Samuele Carcagno sam.carca...@gmail.com
wrote:

 Hi Charles,

 if you start creating your own function it may be useful to look at the
 BDF.jl package https://github.com/sam81/BDF.jl which deals with Biosemi
 BDF files closely related to EDF files http://www.biosemi.com/faq/
 file_format.htm

 there is a fork of BDF.jl here https://github.com/codles/BDF.jl that
 appears to have started to add support for EDF files, but I haven't tested
 it.

 Cheers,

 Sam


 Thank you for this good start! ;) I was just wondering if there was any
 built function to do this before starting to do my own function.
 Tomorrow is Monday, if I don't find any built function I will move
 towards the direction you indicated ;) The R and Matlab functions I use
 can also help.

 Have a nice Sunday!

 Best,

 Charles

 On Sun, Mar 22, 2015 at 12:25 PM, Tobias Knopp
 tobias.kn...@googlemail.com mailto:tobias.kn...@googlemail.com wrote:

 I have recently created functions for reading and writing a similar
 format (Analyze/Nifti). Its not very complicated.

 Something like the following to give you a start:

 |
 functionload_edf(filename::String)

header =Dict{ASCIIString,Any}()

open(filename,r)dofd
  version = bytestring(read(fd,Uint8,8))
  header[version]=version

  localPatientId = bytestring(read(fd,Uint8,80))
  header[version]=localPatientId

 ...

 # here the data would be read
 end
 returndata,header
 end
 |



 Am Sonntag, 22. März 2015 08:28:20 UTC+1 schrieb Charles Santana:

 Dear all,

 Does any of you know if there is a library or a function to read
 EDF files with Julia?

 http://www.edfplus.info/specs/__edf.html
 http://www.edfplus.info/specs/edf.html

 EDF is a format for exchange and storage of multichannel
 biological and physical signals. In our case, we have
 polysomnographic data stored in this format.

 We use to read this kind of data using functions written in R or
 Matlab, or to use a free open-source software (edfbrowser) to
 convert the data to ASCII. But as we always use Julia to do the
 analysis of the converted data I was wondering if there is
 something written in Julia to read them in their original format.

 Thanks in advance for any help.

 Best,

 Charles
 --
 Um axé! :)

 --
 Charles Novaes de Santana, PhD
 http://www.imedea.uib-csic.es/__~charles
 http://www.imedea.uib-csic.es/~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


Re: [julia-users] Different ways to create a vector of strings in Julia

2015-03-12 Thread Charles Novaes de Santana
Thank you all for the explanation! We don't stop learning in this list!

Best,

Charles

On Thu, Mar 12, 2015 at 3:10 PM, Tamas Papp tkp...@gmail.com wrote:


 On Thu, Mar 12 2015, Ivar Nesje wrote:

 
  So, what you would want to do is `Array{String,1}()`.
  That ought to construct a array of strings with dimension 1 but doesn't.
 
 
  But in 0.4 you can use Array{String,1}(0) to create a 1d array with 0
  elements. Note that you have to provide the size of the array, and 0 is
 not
  default (, but maybe it should be?)

 Array{T}(dims...)

 is equivalent to

 Array{T,length(dims)}(dims...)

 while the latter has a redundant parameter. So instead of providing a
 default for dims..., wouldn't

 Array{T}(0)

 be an idiomatic solution for creating an empty vector of eltype T? Has
 one less character than

 Array{T,1}(0)

 :D

 Best,

 Tamas




-- 
Um axé! :)

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


[julia-users] Different ways to create a vector of strings in Julia

2015-03-12 Thread Charles Novaes de Santana
Dear all,

I was trying to create a vector of strings in Julia and I didn't understand
why the following ways give me different results.

Everything is fine If I try the following two approaches:
names = String[];
push!(names,word1);

names = Array(String,0);
push!(names,word1);

However, I supposed this other way should work too, but it didn't:
names = Array{String};
push!(names,word2);

It gives me the following error: ERROR: `push!` has no method matching
push!(::Type{Array{String,N}}, ::ASCIIString)

Why is String[] and Array(String,0) different from Array{String}?

Thanks for any help!

Best,

Charles

-- 
Um axé! :)

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


[julia-users] how to create an empty 2-dimensional array of Int64 in Julia

2015-03-03 Thread Charles Novaes de Santana
Dear all,

Sorry if this question is too silly. But I would like to know how to create
an empty 2-dimensional Array of Int64 with Julia.

To create a empty Array{Int64,1} I can use this:

a = Int64[]
length(a)
0

To create an empty 2-dimensional Array of Int64 I tried this:
a = Array{Int64,2}

But it doesn't allow me to ask for the size of the array using length(a)
julia length(a)
ERROR: MethodError: `length` has no method matching
length(::Type{Array{Int64,2}})

Any help would be much appreciated!

Best

Charles


-- 
Um axé! :)

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


Re: [julia-users] how to create an empty 2-dimensional array of Int64 in Julia

2015-03-03 Thread Charles Novaes de Santana
Great! Thanks, René, for your quick response!

Best,

Charles

On Tue, Mar 3, 2015 at 4:13 PM, René Donner li...@donner.at wrote:

 You can use this:

 julia Array(Int64,0,0)
 0x0 Array{Int64,2}



 Am 03.03.2015 um 16:09 schrieb Charles Novaes de Santana 
 charles.sant...@gmail.com:

  Dear all,
 
  Sorry if this question is too silly. But I would like to know how to
 create an empty 2-dimensional Array of Int64 with Julia.
 
  To create a empty Array{Int64,1} I can use this:
 
  a = Int64[]
  length(a)
  0
 
  To create an empty 2-dimensional Array of Int64 I tried this:
  a = Array{Int64,2}
 
  But it doesn't allow me to ask for the size of the array using length(a)
  julia length(a)
  ERROR: MethodError: `length` has no method matching
 length(::Type{Array{Int64,2}})
 
  Any help would be much appreciated!
 
  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] Downgrade to a previous version of Julia

2014-11-04 Thread Charles Novaes de Santana
Dear list,

I am trying to downgrade my julia installation to the version
0.4.0-dev+734. Currently I have the nightly Julia Version 0.4.0-dev+1408.

I tried the following command:

git checkout 0.4.0-dev+734

But I got the following error message: error: pathspec '0.4.0-dev+734' did
not match any file(s) known to git.

I successfully could do a downgrade to version 0.3 by running git checkout
release-0.3. Why is it different for a previous version of 0.4.0-dev?

Sorry if this is a question regarding to Github more than Julia scope. And
thanks in advance for any help.

Best,

Charles

-- 
Um axé! :)

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


Re: [julia-users] Re: Downgrade to a previous version of Julia

2014-11-04 Thread Charles Novaes de Santana
Great! Thank you very much for your response, Ivar! I will definitely take
a time to study Github. I only use Github to organize my own projects, so I
have never gone into the details of it. Thanks for your advice!

Best,

Charles

On Tue, Nov 4, 2014 at 7:14 PM, Ivar Nesje iva...@gmail.com wrote:

 Git work with a tree of commits, you need to write down the SHA of the
 commit rather than the number. `release-0.3` and `v0.3.X` works because we
 have a branch named `release-0.3` and tags named `v0.3.0`, `v0.3.1` and
 `v0.3.2` that points to the correct commits.

 There are numerous Git tutorials online, and if you want to be involved in
 any collaborative coding I'd strongly recommend that you spend some time to
 learn to be friends with git, rather than trying to fight it. Your time
 will be well spent.

 kl. 18:57:23 UTC+1 tirsdag 4. november 2014 skrev Ivar Nesje følgende:

 You need to do

 git checkout c1fd3ab4edefcd7194


 kl. 16:24:54 UTC+1 tirsdag 4. november 2014 skrev Charles Santana
 følgende:

 Dear list,

 I am trying to downgrade my julia installation to the version
 0.4.0-dev+734. Currently I have the nightly Julia Version 0.4.0-dev+1408.

 I tried the following command:

 git checkout 0.4.0-dev+734

 But I got the following error message: error: pathspec '0.4.0-dev+734'
 did not match any file(s) known to git.

 I successfully could do a downgrade to version 0.3 by running git
 checkout release-0.3. Why is it different for a previous version of
 0.4.0-dev?

 Sorry if this is a question regarding to Github more than Julia scope.
 And thanks in advance for any help.

 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] Julia off-line documentation

2014-10-02 Thread Charles Novaes de Santana
Dear all,

I was wondering if there is any official Julia documentation that can be
accessed off-line.

What do you recommend to use if I want to read the docs without
connecting to internet. I looked for documents like these but I couldn't
find a good general one so far.

Thanks in advance for any comment!

Best,

Charles

-- 
Um axé! :)

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


Re: [julia-users] Julia off-line documentation

2014-10-02 Thread Charles Novaes de Santana
Obrigado, João! Thank you, Jake! I didn't know this simple tips! :)

Just out of curiosity: Would it be possible to have a built-in
documentation for each function/package, similar to R, for example?
Something intrinsic to the installation of any package? Is there a
specific reason for the way the documentation is written today (in
readthedocs)?

Thanks again!

Best,

Charles

On Thu, Oct 2, 2014 at 6:06 PM, Jake Bolewski jakebolew...@gmail.com
wrote:

 Read the docs allows you to download the content in epub and zipped html
 (look at the lower right hand corder for the documentation version popup).

 On Thursday, October 2, 2014 12:01:22 PM UTC-4, João Felipe Santos wrote:

 You can build the docs as a PDF or as HTML and read them on your
 computer. Check https://github.com/JuliaLang/julia/tree/release-0.3/doc

 --
 João Felipe Santos

 On Thu, Oct 2, 2014 at 11:59 AM, Charles Novaes de Santana 
 charles...@gmail.com wrote:

 Dear all,

 I was wondering if there is any official Julia documentation that can
 be accessed off-line.

 What do you recommend to use if I want to read the docs without
 connecting to internet. I looked for documents like these but I couldn't
 find a good general one so far.

 Thanks in advance for any comment!

 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


Re: [julia-users] Julia off-line documentation

2014-10-02 Thread Charles Novaes de Santana
Great to know it! Thank you, Steven! I will try to follow this discussion!
;)

Charles

On Thu, Oct 2, 2014 at 9:58 PM, Steven G. Johnson stevenj@gmail.com
wrote:



 On Thursday, October 2, 2014 12:12:25 PM UTC-4, Charles Santana wrote:

 Just out of curiosity: Would it be possible to have a built-in
 documentation for each function/package, similar to R, for example?
 Something intrinsic to the installation of any package? Is there a
 specific reason for the way the documentation is written today (in
 readthedocs)?
 http://www.imedea.uib-csic.es/~charles


 This is being worked on for Julia 0.4.   See
 https://github.com/JuliaLang/julia/issues/8514 and
 https://github.com/JuliaLang/julia/issues/3988 ... the details have been
 debated for a while, but some consensus seems to be building.




-- 
Um axé! :)

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


Re: [julia-users] @grisu_ccall not defined when using Gadfly

2014-09-24 Thread Charles Novaes de Santana
Please take a look at this link:

https://github.com/dcjones/Gadfly.jl/issues/409#issuecomment-56643684

I was facing the same problem and everything was solved after doing this:


Pkg.free(Gadfly)
Pkg.free(Showoff)

Pkg.checkout(Gadfly)

Pkg.chekcout(Showoff)


I hope it helps!

Charles


On Wed, Sep 24, 2014 at 9:58 AM, xiongji...@gmail.com wrote:

 I've uploaded julia to the newest development version yesterday.

 Julia Version 0.4.0-dev+728
 Commit f7172d3* (2014-09-22 12:08 UTC)
 Platform Info:
   System: Linux (x86_64-redhat-linux)
   CPU: Intel(R) Xeon(R) CPU E5-2690 v2 @ 3.00GHz
   WORD_SIZE: 64
   BLAS: libopenblas (USE64BITINT NO_AFFINITY NEHALEM)
   LAPACK: libopenblas
   LIBM: libopenlibm
   LLVM: libLLVM-3.3

 However, when I using Gadfly then, a error is showed:


 using Gadfly

 @grisu_ccall not defined
 while loading /home/JXiong/.julia/v0.4/Gadfly/src/format.jl, in expression 
 starting on line 56
 while loading /home/JXiong/.julia/v0.4/Gadfly/src/Gadfly.jl, in expression 
 starting on line 50
 while loading In[1], in expression starting on line 1

  in include at ./boot.jl:246
  in include_from_node1 at ./loading.jl:128
  in include at ./boot.jl:246
  in include_from_node1 at ./loading.jl:128
  in reload_path at loading.jl:152
  in _require at loading.jl:67
  in require at loading.jl:51


 I tried Pkd.update(), but the problem is the same. The Gadfly works file
 in the first version of Julia 0.4.0 released last month. Is the
 @grisu_ccall removed in this updating?




-- 
Um axé! :)

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


Re: [julia-users] cumsum and Multinomial distribution with a huge Sparse matrix in Julia

2014-09-24 Thread Charles Novaes de Santana
Amazing!! Thank you, Tim! Actually my main problem is time consuming, but
of course it may be associated to a dense matrix, so I think your
suggestions will help me a lot!!! I have a lot of things to study from your
email, I will let you know how it evolves.

Thanks a lot!

Best,

Charles

On Wed, Sep 24, 2014 at 1:17 PM, Tim Holy tim.h...@gmail.com wrote:

 Presumably the problem is that cumsum generates a dense matrix? I think
 what
 you'll need to do is create a new sparse cumsum type:

 type StairVector{T} : AbstractArray{T,1}
 index::Vector{Int}
 value::Vector{T}
 end

 v.index will be a sorted vector of indexes at which the cumsum increments,
 and
 val the value at those locations. The idea is that for v a StairVector,
 v[k]
 is found by searching for the last j such that v.index[j] = k (you can do
 this efficiently by binary search); then the value of v[k] is v.value[j].
 For
 this particular problem, though, you may not actually have to implement
 v[k]
 for arbitrary k; I'm just using it to illustrate what this represents.

 The key point is that you can define cummat in terms of a
 Vector{StairVector},
 one StairVector per column of mat.

 One tip: this will be _vastly_ more efficient if you do the cumsum over
 columns,
 not rows. You're going to have to dig into the internal representation of a
 SparseMatrixCSC.

 Best,
 --Tim

 On Wednesday, September 24, 2014 12:16:02 PM Charles Novaes de Santana
 wrote:
  Dear all,
 
  I am working with huge matrices (65600 x 65600) that represent the
  euclidean distances between sites. So, mat[i,j] = mat[j,i].
 
  I would like to use a multinomial distribution to define to which site an
  element from site i can move: the closer is the target site j, the higher
  is the probability to move from i to j.
 
  For smaller matrices, I could do a cumsum like:
 
  cummat = cumsum(mat,2);
 
  and generate random numbers between 0 and maximum(cummat[i,:]).
 
  But with such huge matrices it is impossible to do this with the
 machines I
  have access to.
 
  I can load the matrices in a sparse-matrix format, that has 15,682,058 of
  non-zero elements (0.3% of the total elements of the matrix). I tried to
  run the cumsum in the sparse matrices, but it is still too slow.  I can
 not
  figure out how to do a Multinomial Distribution with these huge matrices
  (sparse or not).
 
  I saw this
  https://groups.google.com/forum/#!topic/julia-dev/TLyWeDHGU6M
  and this
 
 http://dmbates.blogspot.ch/2012/03/julia-version-of-multinomial-sampler_12.h
  tml
 
  But it seems to work only when the matrix is already a probability
 matrix,
  with each of the 65600 rows summing to 1. But to do this I would need to
 do
  a cumsum first.
 
  Any idea about how to deal with such huge matrices?
 
  Thank you for your attention!
 
  Best,
 
  Charles




-- 
Um axé! :)

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


Re: [julia-users] @grisu_ccall not defined when using Gadfly

2014-09-24 Thread Charles Novaes de Santana
Have you tried to remove your .julia directory and add the package by
using: Pkg.checkout(Gadfly) ?

Charles

On Wed, Sep 24, 2014 at 3:59 PM, xiongji...@gmail.com wrote:

 However,

 julia Pkg.free(Gadfly)
 ERROR: Gadfly cannot be freed – repo is dirty
  in free at pkg/entry.jl:204
  in anonymous at pkg/dir.jl:28
  in cd at ./file.jl:20
  in __cd#230__ at ./pkg/dir.jl:28
  in free at pkg.jl:37

 julia Pkg.free(Showoff)
 ERROR: Showoff is not a git repo
  in free at pkg/entry.jl:200
  in anonymous at pkg/dir.jl:28
  in cd at ./file.jl:20
  in __cd#230__ at ./pkg/dir.jl:28
  in free at pkg.jl:37


 On Wednesday, September 24, 2014 11:56:53 AM UTC+2, Charles Santana wrote:

 Please take a look at this link:

 https://github.com/dcjones/Gadfly.jl/issues/409#issuecomment-56643684

 I was facing the same problem and everything was solved after doing this:


 Pkg.free(Gadfly)
 Pkg.free(Showoff)

 Pkg.checkout(Gadfly)

 Pkg.chekcout(Showoff)


 I hope it helps!

 Charles


 On Wed, Sep 24, 2014 at 9:58 AM, xiong...@gmail.com wrote:

 I've uploaded julia to the newest development version yesterday.

 Julia Version 0.4.0-dev+728
 Commit f7172d3* (2014-09-22 12:08 UTC)
 Platform Info:
   System: Linux (x86_64-redhat-linux)
   CPU: Intel(R) Xeon(R) CPU E5-2690 v2 @ 3.00GHz
   WORD_SIZE: 64
   BLAS: libopenblas (USE64BITINT NO_AFFINITY NEHALEM)
   LAPACK: libopenblas
   LIBM: libopenlibm
   LLVM: libLLVM-3.3

 However, when I using Gadfly then, a error is showed:


 using Gadfly

 @grisu_ccall not defined
 while loading /home/JXiong/.julia/v0.4/Gadfly/src/format.jl, in expression 
 starting on line 56
 while loading /home/JXiong/.julia/v0.4/Gadfly/src/Gadfly.jl, in expression 
 starting on line 50
 while loading In[1], in expression starting on line 1

  in include at ./boot.jl:246
  in include_from_node1 at ./loading.jl:128
  in include at ./boot.jl:246
  in include_from_node1 at ./loading.jl:128
  in reload_path at loading.jl:152
  in _require at loading.jl:67
  in require at loading.jl:51


 I tried Pkd.update(), but the problem is the same. The Gadfly works file
 in the first version of Julia 0.4.0 released last month. Is the
 @grisu_ccall removed in this updating?




 --
 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] Problem loading package Distributions

2014-09-23 Thread Charles Novaes de Santana
Dear Julia users,

I was trying to use package Distributions, but I got the following error:

julia using Distributions
Warning: could not import Base.add! into NumericExtensions
Warning: could not import Base.add! into PDMats
ERROR: Cholesky not defined
 in include at ./boot.jl:246
 in include_from_node1 at ./loading.jl:128
 in reload_path at loading.jl:152
 in _require at loading.jl:67
 in require at loading.jl:54
 in include at ./boot.jl:246
 in include_from_node1 at ./loading.jl:128
 in reload_path at loading.jl:152
 in _require at loading.jl:67
 in require at loading.jl:51
while loading /home/charles/.julia/PDMats/src/PDMats.jl, in expression
starting on line 31
while loading /home/charles/.julia/Distributions/src/Distributions.jl, in
expression starting on line 4

I found some posts about the same problem. One of the most recent is this
one: https://github.com/JuliaLang/julia/issues/6436

However, even after running Pkg.update() the error continues.

Any idea about it?

My versiton of Julia is: Version 0.4.0-dev+734 (2014-09-23 18:22 UTC)

Thank you for any comment!

Best,

Charles



-- 
Um axé! :)

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


Re: [julia-users] Problem loading package Distributions

2014-09-23 Thread Charles Novaes de Santana
Hi guys, thank you for the quick reply!

About my version of Distributions:
julia Pkg.status(Distributions)
 - Distributions 0.4.2  master

And, yes, I am building julia from master (the default option, right?). I
tried to update Distributions and I got the following error:

julia Pkg.checkout(Distributions)
INFO: Checking out Distributions master...
INFO: Pulling Distributions latest master...
WARNING: ArrayViews is fixed at 0.4.1+ conflicting with requirement for
Distributions: [0.4.3-,∞)
WARNING: PDMats is fixed at 0.1.1+ conflicting with requirement for
Distributions: [0.2.2-,∞)
ERROR: fixed packages introduce conflicting requirements for StatsBase:
 Distributions requires versions [0.5.1-,∞) [none of the available
versions can satisfy this requirement]
   available versions are 0.0.0, 0.2.0, 0.2.1, 0.2.3, 0.2.4, 0.2.5,
0.2.6, 0.2.7, 0.2.8, 0.2.9, 0.3.0, 0.3.1, 0.3.2, 0.3.3, 0.3.4, 0.3.5,
0.3.6, 0.3.7, 0.3.8 and 0.3.9
 in error at error.jl:21
 in check_requirements at pkg/query.jl:109
 in resolve at ./pkg/entry.jl:387
 in resolve at pkg/entry.jl:371
 in anonymous at pkg/entry.jl:189
 in transact at pkg/git.jl:81
 in _checkout at pkg/entry.jl:181
 in checkout at pkg/entry.jl:196
 in anonymous at pkg/dir.jl:28
 in cd at ./file.jl:20
 in cd at pkg/dir.jl:28
 in checkout at pkg.jl:34

So, I will try to checkout version 0.3 of Julia and see what happens. It
seems that this problem with Cholesky is a very common issue, but so far I
couldn't find a good solution for it in the forums in internet.

Best,

Charles

On Tue, Sep 23, 2014 at 11:45 PM, Tim Holy tim.h...@gmail.com wrote:

 I assume you're building julia from master. One likely cure is to check out
 the release-0.3 branch and stick with that. Alternatively, see if you can
 update Distributions so it works on 0.4-dev.

 Best
 --Tim

 On Tuesday, September 23, 2014 11:08:40 PM Charles Novaes de Santana wrote:
  Dear Julia users,
 
  I was trying to use package Distributions, but I got the following error:
 
  julia using Distributions
  Warning: could not import Base.add! into NumericExtensions
  Warning: could not import Base.add! into PDMats
  ERROR: Cholesky not defined
   in include at ./boot.jl:246
   in include_from_node1 at ./loading.jl:128
   in reload_path at loading.jl:152
   in _require at loading.jl:67
   in require at loading.jl:54
   in include at ./boot.jl:246
   in include_from_node1 at ./loading.jl:128
   in reload_path at loading.jl:152
   in _require at loading.jl:67
   in require at loading.jl:51
  while loading /home/charles/.julia/PDMats/src/PDMats.jl, in expression
  starting on line 31
  while loading /home/charles/.julia/Distributions/src/Distributions.jl, in
  expression starting on line 4
 
  I found some posts about the same problem. One of the most recent is this
  one: https://github.com/JuliaLang/julia/issues/6436
 
  However, even after running Pkg.update() the error continues.
 
  Any idea about it?
 
  My versiton of Julia is: Version 0.4.0-dev+734 (2014-09-23 18:22 UTC)
 
  Thank you for any comment!
 
  Best,
 
  Charles




-- 
Um axé! :)

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


Re: [julia-users] Problem loading package Distributions

2014-09-23 Thread Charles Novaes de Santana
Hi again,

I don't know why PDMats and ArrayViews are fixed. I don't even know what
it means in Julia. Sorry.

I tried Pkg.free(ArrayViews) and Pkg.free(PDMats) as you suggested, but
I got some errors (below):

WARNING: StatsBase is fixed at 0.3.9+ conflicting with requirement for
Distributions: [0.5.1-,∞)
WARNING: PDMats is fixed at 0.1.1+ conflicting with requirement for
Distributions: [0.2.2-,∞)
ERROR: fixed packages introduce conflicting requirements for ArrayViews:
 StatsBase requires versions [0.4.6-,∞) [none of the available
versions can satisfy this requirement]
 PDMats requires versions [0.4.0-,∞)
 Distributions requires versions [0.4.3-,∞) [none of the available
versions can satisfy this requirement]
   available versions are 0.1.0, 0.1.1, 0.2.0, 0.2.1, 0.2.2, 0.2.3,
0.2.4, 0.2.5, 0.3.0, 0.4.0 and 0.4.1
 in error at error.jl:21
 in check_requirements at pkg/query.jl:109
 in resolve at ./pkg/entry.jl:387
 in resolve at pkg/entry.jl:371
 in anonymous at pkg/entry.jl:189
 in transact at pkg/git.jl:81
 in _checkout at pkg/entry.jl:181
 in free at pkg/entry.jl:211
 in anonymous at pkg/dir.jl:28
 in cd at ./file.jl:20
 in __cd#230__ at ./pkg/dir.jl:28
 in free at pkg.jl:37

But I followed some instructions in this webpage:
http://julia.readthedocs.org/en/latest/manual/packages/

It says: Your package requirements are in the file ~/.julia/v0.3/REQUIRE.
You can edit this file by hand and then call Pkg.resolve() to install,
upgrade or remove packages to optimally satisfy the requirements

So I edited the REQUIRE file by removing the line Distributions. Then I
came back to Julia and run

julia Pkg.resolve()

julia Pkg.checkout(Distributions)

julia Pkg.status(Distributions)
 - Distributions 0.4.2+ master

julia using Distributions

And I could load Distributions correctly.

I tried the same thing for ArrayViews and PDMats but I got the following
message from Pkg.resolve()

julia Pkg.resolve()
WARNING: ArrayViews is fixed at 0.4.1+ conflicting with requirement for
StatsBase: [0.4.6-,∞)
WARNING: ArrayViews is fixed at 0.4.1+ conflicting with requirement for
Distributions: [0.4.3-,∞)
WARNING: StatsBase is fixed at 0.3.9+ conflicting with requirement for
Distributions: [0.5.1-,∞)
WARNING: PDMats is fixed at 0.1.1+ conflicting with requirement for
Distributions: [0.2.2-,∞)
INFO: No packages to install, update or remove

Thank you for your help! I see I have too much to study to better
understand how Julia works.

Best,

Charles


On Tue, Sep 23, 2014 at 11:57 PM, Andreas Noack 
andreasnoackjen...@gmail.com wrote:

 Do you have a reason to have ArrayViews and PDMats fixed? If not try
 Pkg.free(ArrayViews) and Pkg.free(PDMats)

 Med venlig hilsen

 Andreas Noack

 2014-09-23 17:51 GMT-04:00 Charles Novaes de Santana 
 charles.sant...@gmail.com:

 Hi guys, thank you for the quick reply!

 About my version of Distributions:
 julia Pkg.status(Distributions)
  - Distributions 0.4.2  master

 And, yes, I am building julia from master (the default option, right?). I
 tried to update Distributions and I got the following error:

 julia Pkg.checkout(Distributions)
 INFO: Checking out Distributions master...
 INFO: Pulling Distributions latest master...
 WARNING: ArrayViews is fixed at 0.4.1+ conflicting with requirement for
 Distributions: [0.4.3-,∞)
 WARNING: PDMats is fixed at 0.1.1+ conflicting with requirement for
 Distributions: [0.2.2-,∞)
 ERROR: fixed packages introduce conflicting requirements for StatsBase:
  Distributions requires versions [0.5.1-,∞) [none of the
 available versions can satisfy this requirement]
available versions are 0.0.0, 0.2.0, 0.2.1, 0.2.3, 0.2.4, 0.2.5,
 0.2.6, 0.2.7, 0.2.8, 0.2.9, 0.3.0, 0.3.1, 0.3.2, 0.3.3, 0.3.4, 0.3.5,
 0.3.6, 0.3.7, 0.3.8 and 0.3.9
  in error at error.jl:21
  in check_requirements at pkg/query.jl:109
  in resolve at ./pkg/entry.jl:387
  in resolve at pkg/entry.jl:371
  in anonymous at pkg/entry.jl:189
  in transact at pkg/git.jl:81
  in _checkout at pkg/entry.jl:181
  in checkout at pkg/entry.jl:196
  in anonymous at pkg/dir.jl:28
  in cd at ./file.jl:20
  in cd at pkg/dir.jl:28
  in checkout at pkg.jl:34

 So, I will try to checkout version 0.3 of Julia and see what happens. It
 seems that this problem with Cholesky is a very common issue, but so far I
 couldn't find a good solution for it in the forums in internet.

 Best,

 Charles

 On Tue, Sep 23, 2014 at 11:45 PM, Tim Holy tim.h...@gmail.com wrote:

 I assume you're building julia from master. One likely cure is to check
 out
 the release-0.3 branch and stick with that. Alternatively, see if you can
 update Distributions so it works on 0.4-dev.

 Best
 --Tim

 On Tuesday, September 23, 2014 11:08:40 PM Charles Novaes de Santana
 wrote:
  Dear Julia users,
 
  I was trying to use package Distributions, but I got the following
 error:
 
  julia using Distributions
  Warning: could not import Base.add

Re: [julia-users] Problem loading package Distributions

2014-09-23 Thread Charles Novaes de Santana
Great, Andreas!! I have removed my folder .julia and followed your
instructions:

julia Pkg.init()
INFO: Initializing package repository /home/charles/.julia/v0.4
INFO: Cloning METADATA from git://github.com/JuliaLang/METADATA.jl

julia Pkg.add(Distributions)
INFO: Cloning cache of ArrayViews from git://
github.com/lindahua/ArrayViews.jl.git
INFO: Cloning cache of Distributions from git://
github.com/JuliaStats/Distributions.jl.git
INFO: Cloning cache of PDMats from git://github.com/JuliaStats/PDMats.jl.git
INFO: Cloning cache of StatsBase from git://
github.com/JuliaStats/StatsBase.jl.git
INFO: Installing ArrayViews v0.4.6
INFO: Installing Distributions v0.5.4
INFO: Installing PDMats v0.2.4
INFO: Installing StatsBase v0.6.5
INFO: Package database updated

julia Pkg.status()
2 required packages:
 - Distributions 0.5.4
4 additional packages:
 - ArrayViews0.4.6
 - DataStructures0.3.2
 - PDMats0.2.4
 - StatsBase 0.6.5

julia using Distributions

Now Everything is working perfectly!

Thank you very much for your time! :)

Best,

Charles



On Wed, Sep 24, 2014 at 12:20 AM, Andreas Noack 
andreasnoackjen...@gmail.com wrote:

 If you don't want to delete the directory you could try to print the
 output from Pkg.status()

 Med venlig hilsen

 Andreas Noack

 2014-09-23 18:19 GMT-04:00 Andreas Noack andreasnoackjen...@gmail.com:

 If you are using Julia 0.4 then your packages are in .julia/v0.4 not 0.3.
 I don't think you should edit any of these files by hand. Somehow your
 packages have gone into a weird state.

 I'd just delete the .julia/v0.4 directory and then run
 Pkg.init();Pkg.add(Distributions)

 Med venlig hilsen

 Andreas Noack

 2014-09-23 18:12 GMT-04:00 Charles Novaes de Santana 
 charles.sant...@gmail.com:

 Hi again,

 I don't know why PDMats and ArrayViews are fixed. I don't even know
 what it means in Julia. Sorry.

 I tried Pkg.free(ArrayViews) and Pkg.free(PDMats) as you suggested,
 but I got some errors (below):

 WARNING: StatsBase is fixed at 0.3.9+ conflicting with requirement for
 Distributions: [0.5.1-,∞)
 WARNING: PDMats is fixed at 0.1.1+ conflicting with requirement for
 Distributions: [0.2.2-,∞)
 ERROR: fixed packages introduce conflicting requirements for ArrayViews:
  StatsBase requires versions [0.4.6-,∞) [none of the available
 versions can satisfy this requirement]
  PDMats requires versions [0.4.0-,∞)
  Distributions requires versions [0.4.3-,∞) [none of the
 available versions can satisfy this requirement]
available versions are 0.1.0, 0.1.1, 0.2.0, 0.2.1, 0.2.2, 0.2.3,
 0.2.4, 0.2.5, 0.3.0, 0.4.0 and 0.4.1
  in error at error.jl:21
  in check_requirements at pkg/query.jl:109
  in resolve at ./pkg/entry.jl:387
  in resolve at pkg/entry.jl:371
  in anonymous at pkg/entry.jl:189
  in transact at pkg/git.jl:81
  in _checkout at pkg/entry.jl:181
  in free at pkg/entry.jl:211
  in anonymous at pkg/dir.jl:28
  in cd at ./file.jl:20
  in __cd#230__ at ./pkg/dir.jl:28
  in free at pkg.jl:37

 But I followed some instructions in this webpage:
 http://julia.readthedocs.org/en/latest/manual/packages/

 It says: Your package requirements are in the file
 ~/.julia/v0.3/REQUIRE. You can edit this file by hand and then call
 Pkg.resolve() to install, upgrade or remove packages to optimally
 satisfy the requirements

 So I edited the REQUIRE file by removing the line Distributions. Then
 I came back to Julia and run

 julia Pkg.resolve()

 julia Pkg.checkout(Distributions)

 julia Pkg.status(Distributions)
  - Distributions 0.4.2+ master

 julia using Distributions

 And I could load Distributions correctly.

 I tried the same thing for ArrayViews and PDMats but I got the following
 message from Pkg.resolve()

 julia Pkg.resolve()
 WARNING: ArrayViews is fixed at 0.4.1+ conflicting with requirement for
 StatsBase: [0.4.6-,∞)
 WARNING: ArrayViews is fixed at 0.4.1+ conflicting with requirement for
 Distributions: [0.4.3-,∞)
 WARNING: StatsBase is fixed at 0.3.9+ conflicting with requirement for
 Distributions: [0.5.1-,∞)
 WARNING: PDMats is fixed at 0.1.1+ conflicting with requirement for
 Distributions: [0.2.2-,∞)
 INFO: No packages to install, update or remove

 Thank you for your help! I see I have too much to study to better
 understand how Julia works.

 Best,

 Charles


 On Tue, Sep 23, 2014 at 11:57 PM, Andreas Noack 
 andreasnoackjen...@gmail.com wrote:

 Do you have a reason to have ArrayViews and PDMats fixed? If not try
 Pkg.free(ArrayViews) and Pkg.free(PDMats)

 Med venlig hilsen

 Andreas Noack

 2014-09-23 17:51 GMT-04:00 Charles Novaes de Santana 
 charles.sant...@gmail.com:

 Hi guys, thank you for the quick reply!

 About my version of Distributions:
 julia Pkg.status(Distributions)
  - Distributions 0.4.2  master

 And, yes, I am building julia from master (the default option,
 right?). I

[julia-users] create a matrix dynamically with Julia

2014-09-11 Thread Charles Novaes de Santana
Dear all,

I would like to create dynamically a matrix with two columns and N rows
(where N can be any number between 0 and 1000). I thought I could do it by
using the function cat, but I am facing some problems with this.

My code:
A=[];
(...)
A=cat(1,A,[1 2]);

Is it a good way to create a matrix without defining its dimension a
priori?

I was expecting that A would be a matrix 1x2, but I got the following error
message:

ERROR: mismatch in dimension 2
 in cat_t at abstractarray.jl:689
 in cat at abstractarray.jl:666

I am using julia Version 0.4.0-dev+523 (2014-09-10 15:51 UTC)

Thank you in advance for any comment,

Charles

-- 
Um axé! :)

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


Re: [julia-users] Re: create a matrix dynamically with Julia

2014-09-11 Thread Charles Novaes de Santana
Thank you very much, Douglas, for your great suggestions!

Best,

Charles

On Thu, Sep 11, 2014 at 7:38 PM, Douglas Bates dmba...@gmail.com wrote:

 The short answer is vcat, as in

 julia A = Array(Int,(0,2))
 0x2 Array{Int64,2}

 julia vcat(A,[1,2]')
 1x2 Array{Int64,2}:
  1  2

 Note that the ' is important as it cause the column vector [1,2] to be
 reshaped into a 1 by 2 matrix.

 You may find it more effective to create the columns separately using
 push! and then use hcat to create the matrix when you are done, if this is
 feasible.  Using push! to append a new element onto the end of a vector is
 likely to be more efficient than vcat'ing matrices.

 julia c1 = Int[]; c2 = Int[]
 0-element Array{Int64,1}

 julia for i in 1:10
   push!(c1,i)
   push!(c2,abs2(i))
end

 julia hcat(c1,c2)
 10x2 Array{Int64,2}:
   11
   24
   39
   4   16
   5   25
   6   36
   7   49
   8   64
   9   81
  10  100



 On Thursday, September 11, 2014 11:54:45 AM UTC-5, Charles Santana wrote:


 Dear all,

 I would like to create dynamically a matrix with two columns and N rows
 (where N can be any number between 0 and 1000). I thought I could do it by
 using the function cat, but I am facing some problems with this.

 My code:
 A=[];
 (...)
 A=cat(1,A,[1 2]);

 Is it a good way to create a matrix without defining its dimension a
 priori?

 I was expecting that A would be a matrix 1x2, but I got the following
 error message:

 ERROR: mismatch in dimension 2
  in cat_t at abstractarray.jl:689
  in cat at abstractarray.jl:666

 I am using julia Version 0.4.0-dev+523 (2014-09-10 15:51 UTC)

 Thank you in advance for any comment,

 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] About conversion of a 5-decimal-digit float to string

2014-08-13 Thread Charles Novaes de Santana
Dear all,

I would like to convert a float variable with more than 5 decimal digits to
a string, but in the literal notation, not in the logarithmic one.

For example, if I do:

floatvar = 0.1;
charvar = string(cost_,floatvar);
println(charvar);

charvar is written as: cost_1.0e-5. Instead of that, I would like to get
cost_0.1.

Any idea about how to do that? I am sorry for this very basic question, but
so far I couldn't realize by myself neither find in the forums a way to do
that.

Thank you for your attention and for any help!

Best,

Charles


-- 
Um axé! :)

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


Re: [julia-users] About conversion of a 5-decimal-digit float to string

2014-08-13 Thread Charles Novaes de Santana
Thank you, guys! It worked perfectly!

Best,

Charles


On Wed, Aug 13, 2014 at 7:24 PM, gentlebeldin gentlebel...@hotmail.com
wrote:

 That (after correcting the typo, the missing ) would give
 cons_0.10. The right way would be

 charvar = @sprintf(cons_%.5f, 0.1)

 Am Mittwoch, 13. August 2014 13:48:40 UTC+2 schrieb Andreas Noack:

 One solution is to use the @sprintf macro, i.e. something like
  @sprintf(cons_%f, 0.1).

 Med venlig hilsen

 Andreas Noack


 2014-08-13 7:42 GMT-04:00 Charles Novaes de Santana charles...@gmail.com
 :

 Dear all,

 I would like to convert a float variable with more than 5 decimal digits
 to a string, but in the literal notation, not in the logarithmic one.

 For example, if I do:

 floatvar = 0.1;
 charvar = string(cost_,floatvar);
 println(charvar);

 charvar is written as: cost_1.0e-5. Instead of that, I would like to
 get cost_0.1.

 Any idea about how to do that? I am sorry for this very basic question,
 but so far I couldn't realize by myself neither find in the forums a way to
 do that.

 Thank you for your attention and for any help!

 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: Create a Graph from a matrix by using Graphs.jl

2014-07-06 Thread Charles Novaes de Santana
Just to complete the information. I am using Julia Version
0.3.0-prerelease+3841 (2014-06-22 11:24 UTC)

Charles


On Sun, Jul 6, 2014 at 1:32 AM, Charles Novaes de Santana 
charles.sant...@gmail.com wrote:

 Dear all,

 I am starting to use Graphs.jl and some simple questions arrived. It is
 not clear for me how to create a Graph from my data if my data is in a
 matrix format, for example.

 The documentation is plenty of information about how the classes, types,
 and algorithms are defined, and they also provide some good examples to use
 these functions once you have a graph object. But I couldn't find a clear
 example about how to create a graph from my data. Let's suppose my data is
 the matrix 'mat' (representing the distances between each pair of nodes in
 my graph), as defined below:

 julia mat=rand(4,4);

 julia for i in 1:4
 mat[i,i]=0;
 end

 julia mat
 4x4 Array{Float64,2}:
  0.0   0.310287  0.497059  0.0472071
  0.624904  0.0   0.256988  0.675347
  0.305605  0.504063  0.0   0.915409
  0.85426   0.145528  0.055314  0.0

 Please forgive me if this information has been asked before and I didn't
 find the correct reference. I would much appreciate any help.

 Best wishes,

 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


Re: [julia-users] Re: Create a Graph from a matrix by using Graphs.jl

2014-07-06 Thread Charles Novaes de Santana
Thank you, Benjamin!

I was wondering if Graphs had something like function graph.adjacency in
Igraph library (
http://www.inside-r.org/packages/cran/igraph/docs/graph.adjacency). But
your suggestion is very good for what I am doing. Thank you, indeed!!

Best regards,

Charles


On Sun, Jul 6, 2014 at 3:21 PM, Benjamin Lind lind.benja...@gmail.com
wrote:

 There are a few ways to do it. I prefer to make arrays of the vertices and
 then the edges and enter them into the graph function. For example:

 mat=rand(4,4)

 nnodes = size(mat, 1)
 nedges = nnodes * (nnodes - 1)
 vlist = Array(KeyVertex{Int64}, nnodes)
 for i = 1:nnodes
 vlist[i] = KeyVertex(i, i)
 end
 ecounter = 1
 elist = Array(ExEdge{typeof(vlist[1])}, nedges)
 for i = 1:nnodes
 for j = 1:nnodes
 if i != j
 elist[ecounter] = ExEdge(ecounter, vlist[i], vlist[j])
 elist[ecounter].attributes[distance] = mat[i, j]
 ecounter += 1
 end
 end
 end

 g = graph(vlist, elist, is_directed = true)

 On Sunday, July 6, 2014 12:09:50 PM UTC+4, Charles Santana wrote:

 Just to complete the information. I am using Julia Version
 0.3.0-prerelease+3841 (2014-06-22 11:24 UTC)

 Charles


 On Sun, Jul 6, 2014 at 1:32 AM, Charles Novaes de Santana 
 charles...@gmail.com wrote:

 Dear all,

 I am starting to use Graphs.jl and some simple questions arrived. It is
 not clear for me how to create a Graph from my data if my data is in a
 matrix format, for example.

 The documentation is plenty of information about how the classes, types,
 and algorithms are defined, and they also provide some good examples to use
 these functions once you have a graph object. But I couldn't find a clear
 example about how to create a graph from my data. Let's suppose my data is
 the matrix 'mat' (representing the distances between each pair of nodes in
 my graph), as defined below:

 julia mat=rand(4,4);

 julia for i in 1:4
 mat[i,i]=0;
 end

 julia mat
 4x4 Array{Float64,2}:
  0.0   0.310287  0.497059  0.0472071
  0.624904  0.0   0.256988  0.675347
  0.305605  0.504063  0.0   0.915409
  0.85426   0.145528  0.055314  0.0

 Please forgive me if this information has been asked before and I didn't
 find the correct reference. I would much appreciate any help.

 Best wishes,

 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




-- 
Um axé! :)

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


[julia-users] Create a Graph from a matrix by using Graphs.jl

2014-07-05 Thread Charles Novaes de Santana
Dear all,

I am starting to use Graphs.jl and some simple questions arrived. It is not
clear for me how to create a Graph from my data if my data is in a matrix
format, for example.

The documentation is plenty of information about how the classes, types,
and algorithms are defined, and they also provide some good examples to use
these functions once you have a graph object. But I couldn't find a clear
example about how to create a graph from my data. Let's suppose my data is
the matrix 'mat' (representing the distances between each pair of nodes in
my graph), as defined below:

julia mat=rand(4,4);

julia for i in 1:4
mat[i,i]=0;
end

julia mat
4x4 Array{Float64,2}:
 0.0   0.310287  0.497059  0.0472071
 0.624904  0.0   0.256988  0.675347
 0.305605  0.504063  0.0   0.915409
 0.85426   0.145528  0.055314  0.0

Please forgive me if this information has been asked before and I didn't
find the correct reference. I would much appreciate any help.

Best wishes,

Charles

-- 
Um axé! :)

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


[julia-users] Read XLS files with Julia

2014-06-26 Thread Charles Novaes de Santana
Dear colleagues,

Is there a way to read an XLS file with Julia? Sorry, but I didn't find any
information about this in the forums.

The best work around I see now is to convert my xls files to csv and to
read them with readdlm or other functions in Julia. Any other?

Thanks in advance for any suggestion!

Best,

Charles

-- 
Um axé! :)

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


Re: [julia-users] Re: Read XLS files with Julia

2014-06-26 Thread Charles Novaes de Santana
Thank you guys,

I have just installed Taro.jl. It seems to be perfect for my simple task.

Best,

Charles


On Thu, Jun 26, 2014 at 3:15 PM, Viral Shah vi...@mayin.org wrote:

 Taro.jl uses Apache POI, which is probably the best open source xls reader
 out there.

 -viral


 On Thursday, June 26, 2014 7:01:42 AM UTC-5, Oliver Lylloff wrote:

 Hi Charles,

 Just found this: https://github.com/aviks/Taro.jl

 Hope that's what you need.

 Best,
 Oliver

 Den torsdag den 26. juni 2014 13.32.16 UTC+2 skrev Charles Santana:

 Dear colleagues,

 Is there a way to read an XLS file with Julia? Sorry, but I didn't find
 any information about this in the forums.

 The best work around I see now is to convert my xls files to csv and
 to read them with readdlm or other functions in Julia. Any other?

 Thanks in advance for any suggestion!

 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


Re: [julia-users] Re: How to improve performance in cumsum

2014-06-24 Thread Charles Novaes de Santana
Thank you, Dahua, for your suggestion. I will definitely take a look in
this package! :)

Best,

Charles


On Mon, Jun 23, 2014 at 4:35 PM, Dahua Lin linda...@gmail.com wrote:

 Hi, Charles,

 Looks like you are doing sampling based on given/computed probabilities.

 You might want to checkout the sampling facilities provided in StatsBase
 (see http://statsbasejl.readthedocs.org/en/latest/sampling.html for
 details).

 That package provides a series of optimized sampling algorithms, which may
 probably make your program even faster (than calling cumsum).

 Dahua



 On Friday, June 20, 2014 10:15:55 AM UTC-5, Charles Santana wrote:

 Dear Julia users,

 First of all, Congratulations for this amazing community and for this
 impressive language! I used to program in C++ and in R, I started to
 program with Julia 3 months ago and it has changed my life for better!!
 Thank you!!

 By checking the profile of a program we are developing we noted that the
 bottleneck seems to be in a cumulative sum along a dimension in a matrix,
 for what we use the function cumsum.

 We are doing something like this:

 DI = rand(5,5);
 Dc = cumsum(DI,2);

 Just to try to clarify what we are doing: Imagine that Matrix DI(i,j)
 represents the probability of an individual to move from a site i to a site
 j. We use Dc to determine to which site an individual in site i will move,
 by generating a random number between 0 and maximum(Dc[i,:]). That means,
 we are trying to perform a Multinomial Distribution.

 Do you know an alternative to cumsum or do you indicate a good way to use
 this function.

 Thanks in advance for any help!

 Best regards,

 Charles Novaes de Santana
 --
 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


Re: [julia-users] Re: How to improve performance in cumsum

2014-06-22 Thread Charles Novaes de Santana
Hi people,

Just to let you know that I have installed the new version of Julia (the
one in Github), that has the new implementation of cumsum and the
improvement in performance is absolutely amazing!

By performing @profile for my function using the former version of cumsum
the resulting backtrace was 1921. For the new version of cumsum the
backtrace was 139. One order of magnitude lower!!

Thank you again for your huge effort in making Julia such a dynamic
project! Long life to Julia!

Best,

Charles


On Sat, Jun 21, 2014 at 1:24 AM, Charles Novaes de Santana 
charles.sant...@gmail.com wrote:

 Thank you again, Dahua! I hope it can be changed easy.

 Best,

 Charles


 On Sat, Jun 21, 2014 at 1:06 AM, Dahua Lin linda...@gmail.com wrote:

 I have looked the codes of cumsum and friends. They are still using
 old-style slice-based implementation, instead of the new cache friendly
 ways (the way we are implementing reduction).

 Not sure how quickly these will be resolved. If this is not addressed in
 2 - 3 weeks, I may take a shot to reimplement them.

 Dahua


 On Friday, June 20, 2014 5:53:44 PM UTC-5, Charles Santana wrote:

 Hi again,

 Just to let you know about the issue I just opened in Github:

 https://github.com/JuliaLang/julia/issues/7342

 Thank you for everything!

 Best,

 Charles


 On Fri, Jun 20, 2014 at 10:07 PM, Charles Novaes de Santana 
 charles...@gmail.com wrote:

 Thank you, Dahua!

 I will open an issue in Github as suggested by you. In meanwhile I will
 see if by using sum I can get a better performance.

 Best,

 Charles


 On Fri, Jun 20, 2014 at 5:54 PM, Dahua Lin lind...@gmail.com wrote:

 The cumsum / cummax / cummin / cumprod, etc have suboptimal
 performance currently, which are about 20x slower than the sum/prod etc
 (which we spent a lot of efforts to optimize and tune).

 Please open an issue in Github, and we will try to address this
 problem later.

 Dahua


 On Friday, June 20, 2014 10:15:55 AM UTC-5, Charles Santana wrote:

 Dear Julia users,

 First of all, Congratulations for this amazing community and for this
 impressive language! I used to program in C++ and in R, I started to
 program with Julia 3 months ago and it has changed my life for better!!
 Thank you!!

 By checking the profile of a program we are developing we noted that
 the bottleneck seems to be in a cumulative sum along a dimension in a
 matrix, for what we use the function cumsum.

 We are doing something like this:

 DI = rand(5,5);
 Dc = cumsum(DI,2);

 Just to try to clarify what we are doing: Imagine that Matrix DI(i,j)
 represents the probability of an individual to move from a site i to a 
 site
 j. We use Dc to determine to which site an individual in site i will 
 move,
 by generating a random number between 0 and maximum(Dc[i,:]). That means,
 we are trying to perform a Multinomial Distribution.

 Do you know an alternative to cumsum or do you indicate a good way to
 use this function.

 Thanks in advance for any help!

 Best regards,

 Charles Novaes de Santana
 --
 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




 --
 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




-- 
Um axé! :)

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


[julia-users] How to improve performance in cumsum

2014-06-20 Thread Charles Novaes de Santana
Dear Julia users,

First of all, Congratulations for this amazing community and for this
impressive language! I used to program in C++ and in R, I started to
program with Julia 3 months ago and it has changed my life for better!!
Thank you!!

By checking the profile of a program we are developing we noted that the
bottleneck seems to be in a cumulative sum along a dimension in a matrix,
for what we use the function cumsum.

We are doing something like this:

DI = rand(5,5);
Dc = cumsum(DI,2);

Just to try to clarify what we are doing: Imagine that Matrix DI(i,j)
represents the probability of an individual to move from a site i to a site
j. We use Dc to determine to which site an individual in site i will move,
by generating a random number between 0 and maximum(Dc[i,:]). That means,
we are trying to perform a Multinomial Distribution.

Do you know an alternative to cumsum or do you indicate a good way to use
this function.

Thanks in advance for any help!

Best regards,

Charles Novaes de Santana
-- 
Um axé! :)

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


Re: [julia-users] Re: How to improve performance in cumsum

2014-06-20 Thread Charles Novaes de Santana
Thank you, Dahua!

I will open an issue in Github as suggested by you. In meanwhile I will see
if by using sum I can get a better performance.

Best,

Charles


On Fri, Jun 20, 2014 at 5:54 PM, Dahua Lin linda...@gmail.com wrote:

 The cumsum / cummax / cummin / cumprod, etc have suboptimal performance
 currently, which are about 20x slower than the sum/prod etc (which we spent
 a lot of efforts to optimize and tune).

 Please open an issue in Github, and we will try to address this problem
 later.

 Dahua


 On Friday, June 20, 2014 10:15:55 AM UTC-5, Charles Santana wrote:

 Dear Julia users,

 First of all, Congratulations for this amazing community and for this
 impressive language! I used to program in C++ and in R, I started to
 program with Julia 3 months ago and it has changed my life for better!!
 Thank you!!

 By checking the profile of a program we are developing we noted that the
 bottleneck seems to be in a cumulative sum along a dimension in a matrix,
 for what we use the function cumsum.

 We are doing something like this:

 DI = rand(5,5);
 Dc = cumsum(DI,2);

 Just to try to clarify what we are doing: Imagine that Matrix DI(i,j)
 represents the probability of an individual to move from a site i to a site
 j. We use Dc to determine to which site an individual in site i will move,
 by generating a random number between 0 and maximum(Dc[i,:]). That means,
 we are trying to perform a Multinomial Distribution.

 Do you know an alternative to cumsum or do you indicate a good way to use
 this function.

 Thanks in advance for any help!

 Best regards,

 Charles Novaes de Santana
 --
 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


Re: [julia-users] Re: How to improve performance in cumsum

2014-06-20 Thread Charles Novaes de Santana
Hi again,

Just to let you know about the issue I just opened in Github:

https://github.com/JuliaLang/julia/issues/7342

Thank you for everything!

Best,

Charles


On Fri, Jun 20, 2014 at 10:07 PM, Charles Novaes de Santana 
charles.sant...@gmail.com wrote:

 Thank you, Dahua!

 I will open an issue in Github as suggested by you. In meanwhile I will
 see if by using sum I can get a better performance.

 Best,

 Charles


 On Fri, Jun 20, 2014 at 5:54 PM, Dahua Lin linda...@gmail.com wrote:

 The cumsum / cummax / cummin / cumprod, etc have suboptimal performance
 currently, which are about 20x slower than the sum/prod etc (which we spent
 a lot of efforts to optimize and tune).

 Please open an issue in Github, and we will try to address this problem
 later.

 Dahua


 On Friday, June 20, 2014 10:15:55 AM UTC-5, Charles Santana wrote:

 Dear Julia users,

 First of all, Congratulations for this amazing community and for this
 impressive language! I used to program in C++ and in R, I started to
 program with Julia 3 months ago and it has changed my life for better!!
 Thank you!!

 By checking the profile of a program we are developing we noted that the
 bottleneck seems to be in a cumulative sum along a dimension in a matrix,
 for what we use the function cumsum.

 We are doing something like this:

 DI = rand(5,5);
 Dc = cumsum(DI,2);

 Just to try to clarify what we are doing: Imagine that Matrix DI(i,j)
 represents the probability of an individual to move from a site i to a site
 j. We use Dc to determine to which site an individual in site i will move,
 by generating a random number between 0 and maximum(Dc[i,:]). That means,
 we are trying to perform a Multinomial Distribution.

 Do you know an alternative to cumsum or do you indicate a good way to
 use this function.

 Thanks in advance for any help!

 Best regards,

 Charles Novaes de Santana
 --
 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




-- 
Um axé! :)

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


Re: [julia-users] Re: How to improve performance in cumsum

2014-06-20 Thread Charles Novaes de Santana
Thank you again, Dahua! I hope it can be changed easy.

Best,

Charles


On Sat, Jun 21, 2014 at 1:06 AM, Dahua Lin linda...@gmail.com wrote:

 I have looked the codes of cumsum and friends. They are still using
 old-style slice-based implementation, instead of the new cache friendly
 ways (the way we are implementing reduction).

 Not sure how quickly these will be resolved. If this is not addressed in 2
 - 3 weeks, I may take a shot to reimplement them.

 Dahua


 On Friday, June 20, 2014 5:53:44 PM UTC-5, Charles Santana wrote:

 Hi again,

 Just to let you know about the issue I just opened in Github:

 https://github.com/JuliaLang/julia/issues/7342

 Thank you for everything!

 Best,

 Charles


 On Fri, Jun 20, 2014 at 10:07 PM, Charles Novaes de Santana 
 charles...@gmail.com wrote:

 Thank you, Dahua!

 I will open an issue in Github as suggested by you. In meanwhile I will
 see if by using sum I can get a better performance.

 Best,

 Charles


 On Fri, Jun 20, 2014 at 5:54 PM, Dahua Lin lind...@gmail.com wrote:

 The cumsum / cummax / cummin / cumprod, etc have suboptimal performance
 currently, which are about 20x slower than the sum/prod etc (which we spent
 a lot of efforts to optimize and tune).

 Please open an issue in Github, and we will try to address this problem
 later.

 Dahua


 On Friday, June 20, 2014 10:15:55 AM UTC-5, Charles Santana wrote:

 Dear Julia users,

 First of all, Congratulations for this amazing community and for this
 impressive language! I used to program in C++ and in R, I started to
 program with Julia 3 months ago and it has changed my life for better!!
 Thank you!!

 By checking the profile of a program we are developing we noted that
 the bottleneck seems to be in a cumulative sum along a dimension in a
 matrix, for what we use the function cumsum.

 We are doing something like this:

 DI = rand(5,5);
 Dc = cumsum(DI,2);

 Just to try to clarify what we are doing: Imagine that Matrix DI(i,j)
 represents the probability of an individual to move from a site i to a 
 site
 j. We use Dc to determine to which site an individual in site i will move,
 by generating a random number between 0 and maximum(Dc[i,:]). That means,
 we are trying to perform a Multinomial Distribution.

 Do you know an alternative to cumsum or do you indicate a good way to
 use this function.

 Thanks in advance for any help!

 Best regards,

 Charles Novaes de Santana
 --
 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




 --
 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