[julia-users] Function to get Index of nonzero entries in sparse vector

2014-10-10 Thread JVaz
Hello,
I have a sparse vector, is there any function that returns an array with 
the index of its nonzero entires?

E.g I have

A 

1048576x1 sparse matrix with 2 Float64 entries:
[1  ,   1]  =  0.5
[32801  ,   1]  =  0.5


I want a function(A) -- [1,32801]


Thanks!

(I thought this wold be basic, but I couldn't find info in the documentation or 
the forums, sorry if I missed it)



[julia-users] Developping and debugging a module

2014-10-10 Thread Ján Dolinský
Hello,

I am developing a module. I load it using using module. Then I call a 
function from the module to test it out. If I get an error I fix it in 
module.jl but Julia is still using the older unfixed version of the module. 
Running using module again does not help so I have to quit Julia and 
start over to reflect the changes.

I guess there is a smarter way ? :). Thanks in advance.

Jan   


[julia-users] Developping and debugging a module

2014-10-10 Thread Toivo Henningsson
If you include() the source file for the module, it will be replaced. Then you 
just have to make sure that you don't have any references to stuff in the old 
module that stick around. If you always reference things in the module via dot 
notation you should be fine. Another way, which I usually use, is to create a 
module for my test code as well, which I reload via include() after reloading 
the module (or that reloads the module before using it).


[julia-users] Re: Developping and debugging a module

2014-10-10 Thread Ján Dolinský
There seems to an answer in the Julia FAQ but nevertheless any tips are 
welcome.

Thanks,
Jan

Dňa piatok, 10. októbra 2014 11:04:34 UTC+2 Ján Dolinský napísal(-a):

 Hello,

 I am developing a module. I load it using using module. Then I call a 
 function from the module to test it out. If I get an error I fix it in 
 module.jl but Julia is still using the older unfixed version of the module. 
 Running using module again does not help so I have to quit Julia and 
 start over to reflect the changes.

 I guess there is a smarter way ? :). Thanks in advance.

 Jan   



[julia-users] Re: Developping and debugging a module

2014-10-10 Thread Ján Dolinský
Hello Toivo,

Thanks for the tip. This is also the recommended way I found later in FAQ. 
Thanks a lot.

Jan

Dňa piatok, 10. októbra 2014 11:27:14 UTC+2 Toivo Henningsson napísal(-a):

 If you include() the source file for the module, it will be replaced. Then 
 you just have to make sure that you don't have any references to stuff in 
 the old module that stick around. If you always reference things in the 
 module via dot notation you should be fine. Another way, which I usually 
 use, is to create a module for my test code as well, which I reload via 
 include() after reloading the module (or that reloads the module before 
 using it).



[julia-users] Re: Installing Julia Studio properly on Windows 7 - Step by Step Instructions

2014-10-10 Thread pamjervis
Thanks Iain. So then how could I fix it?

On Wednesday, November 27, 2013 8:17:32 AM UTC, Dominik Holenstein wrote:


 I needed several attempts until I could start working with Julia Studio on 
 Windows 7. 

 Most of the issues I faced were related to the package management and that 
 Julia Studio creates the package folder for Julia automatically if you 
 don't set the JULIA_PKGDIR path. This may work in most environments but it 
 didn't on the notebook I use at work. 

 These are the steps I had to follow to make Julia Studio (v. 0.43) running 
 properly on Windows 7:

- Set the JULIA_PKGDIR variable
   - Create a folder named for example *Julia Packages* on your 
   computer. 
  - I added it to the *My Documents* folder 
  - I tried to create this folder in the Google Drive folder but 
  this did not work properly 
- Go to
   Control Panel - System - Advanced System Settings - Environment 
   Variables 
   - Under *User variables* click *New...* and add this: 
  - Variable Name: JULIA_PKGDIR 
  - Variable Value: [the path to your *Julia Packages* folder] 
 - Download and install Julia Studio: 
http://forio.com/julia/downloads/ 
- Start Julia Studio 
- No packages are installed. This is correct 
- If you are behind a firewall you may have to run this command in the 
console first: 
   - run(`git config --global url.https://.insteadOf git://`) 
 - Initialize the package repository now by running this command in 
the console: 
   - Pkg.status() 
 - Now you can start adding packages to your environment 
   - 
   
 http://docs.julialang.org/en/release-0.2/manual/packages/#adding-and-removing-packages
  
 - Done + Enjoy! 


 Is this useful for you? 

 Inputs, corrections, comments and questions are much appreciated. 

 Regards,
 Dominik




Re: [julia-users] How to define rounding macros depending on type

2014-10-10 Thread Simon Byrne


On Friday, 10 October 2014 04:12:37 UTC+1, David P. Sanders wrote:

 I believe (but please correct me if I'm wrong) that I do need a macro, 
 since I use it with whole expressions to ensure the correct rounding, for 
 example
 (simplifying) something like

 @round_down( min(a*b, c*d) )


You can use with_rounding for this:

with_rounding(() - min(a*b,c*d), T, RoundDown)

or equivalently, with do syntax:

with_rounding(T, RoundDown) do
min(a*b,c*d)
end

-Simon 


Re: [julia-users] Function to get Index of nonzero entries in sparse vector

2014-10-10 Thread Pontus Stenetorp
On 10 October 2014 17:07, JVaz joanvazquezmol...@gmail.com wrote:

 I have a sparse vector, is there any function that returns an array with the
 index of its nonzero entires?

 E.g I have

 A

 1048576x1 sparse matrix with 2 Float64 entries:
 [1  ,   1]  =  0.5
 [32801  ,   1]  =  0.5


 I want a function(A) -- [1,32801]

The following should hold.

A = sparse(zeros(4711))
idxs = rand(1:length(A), 17)
A[idxs] = rand(17)
@assert findnz(A)[1] == sort(idxs)

A reference for the function.

http://julia.readthedocs.org/en/release-0.3/stdlib/base/#Base.findnz

 (I thought this wold be basic, but I couldn't find info in the documentation
 or the forums, sorry if I missed it)

No worries, what I usually do is use the page I linked and do a few
text searches.

Pontus


[julia-users] Re: Function to get Index of nonzero entries in sparse vector

2014-10-10 Thread JVaz
Thanks Pontus!

El viernes, 10 de octubre de 2014 17:07:25 UTC+9, JVaz escribió:

 Hello,
 I have a sparse vector, is there any function that returns an array with 
 the index of its nonzero entires?

 E.g I have

 A 

 1048576x1 sparse matrix with 2 Float64 entries:
   [1  ,   1]  =  0.5
   [32801  ,   1]  =  0.5


 I want a function(A) -- [1,32801]


 Thanks!

 (I thought this wold be basic, but I couldn't find info in the documentation 
 or the forums, sorry if I missed it)



[julia-users] Re: Loading data just once

2014-10-10 Thread Gunnar Farnebäck
I wrote this when I wanted to cache the results of matread. Your problem 
sounds like it could be similar.

let matread_cache = (String = Any)[]
global caching_matread
function caching_matread(filename)
if !haskey(matread_cache, filename)
matread_cache[filename] = matread(filename)
end
return matread_cache[filename]
end
end


Den torsdagen den 9:e oktober 2014 kl. 10:08:23 UTC+2 skrev 
cormu...@mac.com:

 A beginner's question...

 I'm writing a function that wants to load a set of data from a file, 
 depending on an argument passed to the function (so a different argument 
 requires a different set of data to be loaded). I'd like each set of data 
 to be stored somehow in separate variables so that when the function is 
 called again with the same argument, it doesn't have to load that 
 particular data again (because it takes 5 seconds to load).

 I'm not sure whether this requires the use of global variables? I looked 
 through the documents (
 http://julia.readthedocs.org/en/latest/search/?q=global) but didn't gain 
 enlightenment. :)

 I think I can test for the existence of a previously-defined variable 
 using:

 if !isdefined(symbol(string(dataset)))
dataset = include($(dataset).jl)
 end

 but I'm not convinced this works correctly, because this creates a 
 variable inside the function...



Re: [julia-users] Re: Loading data just once

2014-10-10 Thread Peter Boardman
 On 10 Oct 2014, at 12:46, Gunnar Farnebäck gun...@lysator.liu.se wrote:
 
 I wrote this when I wanted to cache the results of matread. Your problem 
 sounds like it could be similar.
 
 let matread_cache = (String = Any)[]
 global caching_matread
 function caching_matread(filename)
 if !haskey(matread_cache, filename)
 matread_cache[filename] = matread(filename)
 end
 return matread_cache[filename]
 end
 end

Looks pretty useful -- thanks!

Re: [julia-users] DataFrame groupby error

2014-10-10 Thread Tom Short
Frederico, the best way to solve this is to provide a reproducible
example. If you file a bug report at the following with an example,
there'll be less of a chance that this gets lost:

https://github.com/JuliaStats/DataFrames.jl/issues/

On Wed, Oct 8, 2014 at 3:32 PM, Frederico Novaes
frederico.nov...@gmail.com wrote:
 Hi,

 I have a DataFrame with 10 columns, say :c1 to :c10. I need to do a
 groupby, grouping by 4 of these columns. When I try,

 $ groupby(df,[:c1,:c3,:c4,:c7])

 I get the following error:

 MemoryError()
 while loading In[13], in expression starting on line 1

  in groupsort_indexer at
 /home/cloudopen/.julia/v0.3/DataArrays/src/grouping.jl:7
  in groupsort_indexer at
 /home/cloudopen/.julia/v0.3/DataArrays/src/grouping.jl:5
  in groupby at
 /home/cloudopen/.julia/v0.3/DataFrames/src/groupeddataframe/grouping.jl:44


 Any help ?

 Thanks.


Re: [julia-users] How to define rounding macros depending on type

2014-10-10 Thread David P. Sanders


El viernes, 10 de octubre de 2014 05:15:48 UTC-5, Simon Byrne escribió:



 On Friday, 10 October 2014 04:12:37 UTC+1, David P. Sanders wrote:

 I believe (but please correct me if I'm wrong) that I do need a macro, 
 since I use it with whole expressions to ensure the correct rounding, for 
 example
 (simplifying) something like

 @round_down( min(a*b, c*d) )


 You can use with_rounding for this:

 with_rounding(() - min(a*b,c*d), T, RoundDown)

 or equivalently, with do syntax:

 with_rounding(T, RoundDown) do
 min(a*b,c*d)
 end



Thanks. I should have been more clear.
I was previously using with_rounding, but in order to avoid this being 
littered through the code, I wanted to hide it somewhere, 
and this somewhere thus has to be a macro, in order to avoid the arithmetic 
being performed before the function was even called:

macro round_down(expr)quote
with_rounding(BigFloat, RoundDown) do $expr end endend

(Not sure what happened to the indentation when copying from GitHub, sorry.)

This works great when everything is BigFloats.
But now I want to add the possibility that intervals store either Float64s 
or BigFloats, so I wanted the
macro to also check the type of its argument, which is where my original 
code came from.

One solution would be to add an explicit parameter T to the @round_down 
macro, e.g. the following
which avoids eval at the expense of a repetitive code smell:

macro new_round_down(expr, T)
if T == :Float64
quote
with_rounding(Float64, RoundDown) do
$expr
end
end
elseif T == :BigFloat
quote
with_rounding(BigFloat, RoundDown) do
$expr
end
end
end
end

But this again makes the code more messy, since the Interval type must now 
be parametrised (which may be a good idea anyway!)



Re: [julia-users] How to define rounding macros depending on type

2014-10-10 Thread Simon Byrne
Ah, I see. I don't have any good suggestions I'm afraid (other than change 
both rounding modes), but you can simplify your macro slightly:

macro new_round_down(expr, T)
quote
with_rounding($T, RoundDown) do
$expr
end
end
end

As someone who cares about rounding modes, you might also be interested in 
this discussion on the julia-dev list:
https://groups.google.com/d/topic/julia-dev/yuq-2phXon0/discussion

Simon

On Friday, 10 October 2014 14:03:02 UTC+1, David P. Sanders wrote:



 El viernes, 10 de octubre de 2014 05:15:48 UTC-5, Simon Byrne escribió:



 On Friday, 10 October 2014 04:12:37 UTC+1, David P. Sanders wrote:

 I believe (but please correct me if I'm wrong) that I do need a macro, 
 since I use it with whole expressions to ensure the correct rounding, for 
 example
 (simplifying) something like

 @round_down( min(a*b, c*d) )


 You can use with_rounding for this:

 with_rounding(() - min(a*b,c*d), T, RoundDown)

 or equivalently, with do syntax:

 with_rounding(T, RoundDown) do
 min(a*b,c*d)
 end



 Thanks. I should have been more clear.
 I was previously using with_rounding, but in order to avoid this being 
 littered through the code, I wanted to hide it somewhere, 
 and this somewhere thus has to be a macro, in order to avoid the 
 arithmetic being performed before the function was even called:

 macro round_down(expr)quote
 with_rounding(BigFloat, RoundDown) do $expr end endend

 (Not sure what happened to the indentation when copying from GitHub, 
 sorry.)

 This works great when everything is BigFloats.
 But now I want to add the possibility that intervals store either Float64s 
 or BigFloats, so I wanted the
 macro to also check the type of its argument, which is where my original 
 code came from.

 One solution would be to add an explicit parameter T to the @round_down 
 macro, e.g. the following
 which avoids eval at the expense of a repetitive code smell:

 macro new_round_down(expr, T)
 if T == :Float64
 quote
 with_rounding(Float64, RoundDown) do
 $expr
 end
 end
 elseif T == :BigFloat
 quote
 with_rounding(BigFloat, RoundDown) do
 $expr
 end
 end
 end
 end

 But this again makes the code more messy, since the Interval type must now 
 be parametrised (which may be a good idea anyway!)



Re: [julia-users] How to define rounding macros depending on type

2014-10-10 Thread David P. Sanders


El viernes, 10 de octubre de 2014 08:16:26 UTC-5, Simon Byrne escribió:

 Ah, I see. I don't have any good suggestions I'm afraid (other than change 
 both rounding modes), 


Actually my current branch does change both rounding modes ;)
I guess the correct way to do this would be to nest 
`with_rounding(Float64, RoundDown)` inside `with_rounding(BigFloat, 
RoundDown)`?

[By the way, does the `try` block inside `with_rounding` not lead to a 
performance penalty compared to just using `set_rounding`? But for some 
reason `with_rounding` avoids the problem of returning the rounding mode 
that was set instead of value I'm trying to calculate.)

 

 but you can simplify your macro slightly:

 macro new_round_down(expr, T)
 quote
 with_rounding($T, RoundDown) do
 $expr
 end
 end
 end


Oh yes, that was exactly what I was looking for but for some reason I 
hadn't hit on that version. Many thanks!

 

 As someone who cares about rounding modes, you might also be interested in 
 this discussion on the julia-dev list:
 https://groups.google.com/d/topic/julia-dev/yuq-2phXon0/discussion


I had seen it but will take another look, thanks.

David.
 



 Simon

 On Friday, 10 October 2014 14:03:02 UTC+1, David P. Sanders wrote:



 El viernes, 10 de octubre de 2014 05:15:48 UTC-5, Simon Byrne escribió:



 On Friday, 10 October 2014 04:12:37 UTC+1, David P. Sanders wrote:

 I believe (but please correct me if I'm wrong) that I do need a macro, 
 since I use it with whole expressions to ensure the correct rounding, for 
 example
 (simplifying) something like

 @round_down( min(a*b, c*d) )


 You can use with_rounding for this:

 with_rounding(() - min(a*b,c*d), T, RoundDown)

 or equivalently, with do syntax:

 with_rounding(T, RoundDown) do
 min(a*b,c*d)
 end



 Thanks. I should have been more clear.
 I was previously using with_rounding, but in order to avoid this being 
 littered through the code, I wanted to hide it somewhere, 
 and this somewhere thus has to be a macro, in order to avoid the 
 arithmetic being performed before the function was even called:

 macro round_down(expr)quote
 with_rounding(BigFloat, RoundDown) do $expr end endend

 (Not sure what happened to the indentation when copying from GitHub, 
 sorry.)

 This works great when everything is BigFloats.
 But now I want to add the possibility that intervals store either 
 Float64s or BigFloats, so I wanted the
 macro to also check the type of its argument, which is where my original 
 code came from.

 One solution would be to add an explicit parameter T to the @round_down 
 macro, e.g. the following
 which avoids eval at the expense of a repetitive code smell:

 macro new_round_down(expr, T)
 if T == :Float64
 quote
 with_rounding(Float64, RoundDown) do
 $expr
 end
 end
 elseif T == :BigFloat
 quote
 with_rounding(BigFloat, RoundDown) do
 $expr
 end
 end
 end
 end

 But this again makes the code more messy, since the Interval type must 
 now be parametrised (which may be a good idea anyway!)



Re: [julia-users] How to define rounding macros depending on type

2014-10-10 Thread Simon Byrne
On 10 October 2014 14:21, David P. Sanders dpsand...@gmail.com wrote:

 Actually my current branch does change both rounding modes ;)
 I guess the correct way to do this would be to nest
 `with_rounding(Float64, RoundDown)` inside `with_rounding(BigFloat,
 RoundDown)`?


That should work.


 [By the way, does the `try` block inside `with_rounding` not lead to a
 performance penalty compared to just using `set_rounding`? But for some
 reason `with_rounding` avoids the problem of returning the rounding mode
 that was set instead of value I'm trying to calculate.)


Possibly (I don't know enough about the internals), but the reason for it
is so that if the function throws an exception, the rounding mode still
gets reset.


[julia-users] Re: Structure and Interpretation of Classical Mechanics

2014-10-10 Thread Amuthan A. Ramabathiran
Any updates on this?

Amuthan

On Tuesday, January 14, 2014 3:31:16 PM UTC-8, Brian Cohen wrote:

 Most code examples for Julia are aimed at users of existing statistical 
 and numerical software without demonstrating how functional programming can 
 be substantially more useful for their field. In many ways, Julia is a Lisp 
 without S-Expressions, so I didn't think it would be unwise to port code 
 examples from Structure and Interpretation of Classical Mechanics 
 http://en.wikipedia.org/wiki/Structure_and_Interpretation_of_Classical_Mechanics
  
 from Scheme to Julia. This book shows how functional programming can be 
 directly applied to the formalism of Lagrangian and Hamiltonian Mechanics, 
 but Scheme  SCMUtils 
 http://groups.csail.mit.edu/mac/users/gjs/6946/refman.txt may be too 
 obscure and syntactically different from what people are used to for most 
 people in the physical sciences.

 Book review: http://www.ids.ias.edu/~piet/publ/other/sicm.html

 I was impatient, and decided to just start porting code, so the first 
 example was easy enough:

 (define ((L-free-particle mass) local)
   (let ((v (velocity local)))
   (* 1/2 mass (dot-product v v

 would become something like lFreeParticle(mass) = tuple - begin v = 
 velocity(tuple); mass * dot(v,v) / 2 end. So far so good.

 But it's not long that I encounter usage of SCMUTILS

 (define q
   (up (literal-function ’x)
   (literal-function ’y)
   (literal-function ’z)))

 So I turn to the Appendix which talks about Symbolic values in Scheme, and 
 confirming it in the SCMUTILS documentation, it appears that symbols have 
 the same type as real numbers, which seems very different than symbolic 
 expressions as described in the Julia documentation. Here, up constructs 
 a tuple, and literal-function is a constructor for symbolic manipulation. 
 At this point, I'm not sure how to proceed, but am still looking into the 
 matter. I see that the only packages that mention symbolic manipulation are 
 a SymPy interface and a Calculus package.



Re: [julia-users] Re: Function roots() in package Polynomial

2014-10-10 Thread Alan Edelman
Related topic: 
 I'd like to propose that roots and polyval be part of base.
I can promise firsthand that they are among the first things a 12 year old 
user
of Julia would just want to be there.  



On Tuesday, June 17, 2014 11:30:04 AM UTC-4, Stefan Karpinski wrote:

 On Tue, Jun 17, 2014 at 10:53 AM, Iain Dunning iaind...@gmail.com 
 javascript: wrote:

 I see both Polynomial and Polynomials in METADATA - is Polynomials a 
 replacement for Polynomial?


 Yes, Polynomials is the newer version with good indexing order – i.e. p[0] 
 is the constant term. We should probably get this in better order. It may 
 make sense to break the connection with the old repo and put it under some 
 organization so that more people can work on it. What org would be most 
 appropriate? 
  


Re: [julia-users] Re: Structure and Interpretation of Classical Mechanics

2014-10-10 Thread Erik Schnetter
I'm not quite certain about Scheme syntax. So L-free-particle is a
function accepting one argument mass that returns another function
accepting an argument local? And you are renaming local to
tuple? (I would have gone with loc.)

What do you mean by constructor for symbolic manipulation? Julia
does support symbolic manipulation; this is e.g. used in macros, and
there is a class Expr that holds unevaluated expressions. However,
there are no built-in functions in Julia e.g. for differentiation or
simplification of such expressions as you would find in a computer
algebra system. Do SCMUTILS provide these?

Let me take a wild guess: The function q assembles a tuple consisting
of three functions. These functions are known by their names, but
their definitions may not be available yet. This would read the
following way in Julia:

```
q = quote (x,y,z) end
```
or in a more concise notation
```
q = :(x,y,z)
```

Later, in an environment where x, y, and z are defined, you can
eval(q), as in eval(q)[1](value), which would be equivalent to
x(value).

-erik



On Fri, Oct 10, 2014 at 9:32 AM, Amuthan A. Ramabathiran
apar...@gmail.com wrote:
 Any updates on this?

 Amuthan

 On Tuesday, January 14, 2014 3:31:16 PM UTC-8, Brian Cohen wrote:

 Most code examples for Julia are aimed at users of existing statistical
 and numerical software without demonstrating how functional programming can
 be substantially more useful for their field. In many ways, Julia is a Lisp
 without S-Expressions, so I didn't think it would be unwise to port code
 examples from Structure and Interpretation of Classical Mechanics from
 Scheme to Julia. This book shows how functional programming can be directly
 applied to the formalism of Lagrangian and Hamiltonian Mechanics, but Scheme
  SCMUtils may be too obscure and syntactically different from what people
 are used to for most people in the physical sciences.

 Book review: http://www.ids.ias.edu/~piet/publ/other/sicm.html

 I was impatient, and decided to just start porting code, so the first
 example was easy enough:

 (define ((L-free-particle mass) local)
   (let ((v (velocity local)))
   (* 1/2 mass (dot-product v v

 would become something like lFreeParticle(mass) = tuple - begin v =
 velocity(tuple); mass * dot(v,v) / 2 end. So far so good.

 But it's not long that I encounter usage of SCMUTILS

 (define q
   (up (literal-function 'x)
   (literal-function 'y)
   (literal-function 'z)))

 So I turn to the Appendix which talks about Symbolic values in Scheme, and
 confirming it in the SCMUTILS documentation, it appears that symbols have
 the same type as real numbers, which seems very different than symbolic
 expressions as described in the Julia documentation. Here, up constructs a
 tuple, and literal-function is a constructor for symbolic manipulation. At
 this point, I'm not sure how to proceed, but am still looking into the
 matter. I see that the only packages that mention symbolic manipulation are
 a SymPy interface and a Calculus package.



-- 
Erik Schnetter schnet...@cct.lsu.edu
http://www.perimeterinstitute.ca/personal/eschnetter/


Re: [julia-users] Re: ANN: GeometricalPredicates.jl

2014-10-10 Thread Ariel Keselman
just opened the PR for METADATA.jl


Re: [julia-users] Re: Function roots() in package Polynomial

2014-10-10 Thread Tony Kelman
Polynomials is a good candidate for “default packages” however that ends up 
being implemented. Installed by default for the vast majority of users who 
aren’t trying to do something with a “minimal Julia,” but not strictly 
necessary for the rest of the language to function.


From: Alan Edelman 
Sent: Friday, October 10, 2014 8:42 AM
To: julia-users@googlegroups.com 
Subject: Re: [julia-users] Re: Function roots() in package Polynomial

Related topic: 
I'd like to propose that roots and polyval be part of base.
I can promise firsthand that they are among the first things a 12 year old user
of Julia would just want to be there.  



On Tuesday, June 17, 2014 11:30:04 AM UTC-4, Stefan Karpinski wrote: 
  On Tue, Jun 17, 2014 at 10:53 AM, Iain Dunning iaind...@gmail.com wrote:

I see both Polynomial and Polynomials in METADATA - is Polynomials a 
replacement for Polynomial?

  Yes, Polynomials is the newer version with good indexing order – i.e. p[0] is 
the constant term. We should probably get this in better order. It may make 
sense to break the connection with the old repo and put it under some 
organization so that more people can work on it. What org would be most 
appropriate? 

[julia-users] Multi-OS (Linux + Mac) testing in Travis

2014-10-10 Thread Tony Kelman
Heads up for package developers - looks like Travis got some additional 
capacity and is accepting new repositories for multi-OS support. See 
http://docs.travis-ci.com/user/multi-os/ - you need to send an email to 
supp...@travis-ci.com asking them to enable multi-OS support for your 
package, with a link to the repository. Then change your .travis.yml as 
follows:

Add
```
os:
- linux
- osx
```

Replace
```
before_install:
- sudo add-apt-repository ppa:staticfloat/julia-deps -y
- sudo add-apt-repository ppa:staticfloat/${JULIAVERSION} -y
- sudo apt-get update -qq -y
- sudo apt-get install libpcre3-dev julia -y
```

with
```
before_install:
- if [ `uname` = Linux ]; then
sudo add-apt-repository ppa:staticfloat/julia-deps -y;
sudo add-apt-repository ppa:staticfloat/${JULIAVERSION} -y;
sudo apt-get update -qq -y;
sudo apt-get install libpcre3-dev julia -y;
  elif [ `uname` = Darwin ]; then
if [ $JULIAVERSION = julianightlies ]; then
  wget -O julia.dmg http://status.julialang.org/download/osx10.7+;;
else
  wget -O julia.dmg http://status.julialang.org/stable/osx10.7+;;
fi;
hdiutil mount julia.dmg;
cp -Ra /Volumes/Julia/*.app/Contents/Resources/julia ~;
export PATH=$PATH:$(echo ~)/julia/bin;
  fi
```

Elliot got this working a while back when Travis originally announced the 
feature, I just tweaked it a little so it works whether or not you've 
enabled multi-OS support. To force a build on a Mac worker before Travis 
responds to your email, you can temporarily change `language: cpp` to 
`language: objective-c`. I think you'll need to change it back to get 
builds on both Linux and Mac once support is enabled.

I'll probably make a PR to base to turn this on in the default .travis.yml 
from Pkg.generate, since it doesn't hurt anything.

-Tony



[julia-users] Re: JUNO: Couldn't Connect to Julia

2014-10-10 Thread Mike Innes
Hi Thomas,

I've decided to wait until 0.4 has settled down a bit before supporting it 
in Juno, so it's best to grab the latest release of Julia (v0.3). Building 
from git should work fine but you could also try using the Ubuntu packages 
https://launchpad.net/~staticfloat/+archive/ubuntu/juliareleases if 
that's not working for you.

On Thursday, 9 October 2014 03:15:13 UTC+1, Thomas Moore wrote:

 I've been trying to get Juno to work (a Julia plugin for Light Table), but 
 after following the installation instructions on their website 
 http://junolab.org/docs/installing.html I end up getting the following 
 error, both on startup and when attempting to execute Julia commands:


 Couldn't connect to Julia

 WARNING: deprecated syntax (eltype(xs)=Int)[] at 
 /home/thomas/.julia/v0.4/Lazy/src/collections.jl:23.
 Use Dict{eltype(xs),Int}() instead.

 WARNING: deprecated syntax (String=Vector{Function})[] at 
 /home/thomas/.julia/v0.4/Jewel/src/lazymod.jl:8.
 Use Dict{String,Vector{Function}}() instead.
 ERROR: InexactError()
  in char at char.jl:1
  in include at ./boot.jl:245
  in include_from_node1 at ./loading.jl:128
  in include at ./boot.jl:245
  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 require_3B_3948 at /home/thomas/julia/usr/bin/../lib/julia/sys.so
  in require at /home/thomas/.julia/v0.4/Jewel/src/lazymod.jl:2
  in include at ./boot.jl:245
  in include_from_node1 at ./loading.jl:128
  in include at ./boot.jl:245
  in include_from_node1 at ./loading.jl:128
  in include at ./boot.jl:245
  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:52
  in require_3B_3948 at /home/thomas/julia/usr/bin/../lib/julia/sys.so
  in include at ./boot.jl:245
  in include_from_node1 at loading.jl:128
  in process_options at ./client.jl:293
  in _start at ./client.jl:362
  in _start_3B_3774 at /home/thomas/julia/usr/bin/../lib/julia/sys.so
 while loading /home/thomas/.julia/v0.4/JuliaParser/src/lexer.jl, in 
 expression starting on line 12
 while loading /home/thomas/.julia/v0.4/JuliaParser/src/JuliaParser.jl, in 
 expression starting on line 5
 while loading /home/thomas/.julia/v0.4/Jewel/src/parse/scope.jl, in 
 expression starting on line 4
 while loading /home/thomas/.julia/v0.4/Jewel/src/parse/parse.jl, in 
 expression starting on line 1
 while loading /home/thomas/.julia/v0.4/Jewel/src/Jewel.jl, in expression 
 starting on line 7
 while loading /home/thomas/.config/LightTable/plugins/Julia/jl/init.jl, in 
 expression starting on line 27


 I'm on Ubuntu 14.04 and have tried re-installing Julia (now on Version 
 0.4.0-dev+1021 (2014-10-08 21:56 UTC) though I was on v0.3 before (it seems 
 github automatically gave me the 0.4 version :) )) and also LightTable, but 
 I haven't had any luck.

 Any advice?



Re: [julia-users] Behaviour of expanduser is inconsistent between platforms.

2014-10-10 Thread Sean Marshallsay
Hmmm... looking at how bash handles this it doesn't seem too difficult, I 
might give it a go over the weekend. I have no idea how to handle it on 
Windows though.

On Thursday, 9 October 2014 18:06:07 UTC+1, Stefan Karpinski wrote:

 This is definitely a bug. The implementation on both platforms seems to be 
 a hack – a more correct implementation would be a great contribution. It 
 should also be possible to map arbitrary user names to user IDs and user 
 IDs to user metadata.

 On Thu, Oct 9, 2014 at 1:00 PM, Sean Marshallsay srm@gmail.com 
 javascript: wrote:

 I noticed the other day that calling expanduser on an empty string throws 
 a BoundsError when using a UNIX platform. Whether this is a bug or a 
 feature will probably depend entirely on who you ask. More importantly 
 though, in my eyes, doing the same thing on Windows returns an empty string 
 instead. This inconsistency definitely seems like a bug to me.

 In my eyes the UNIX implementation should be changed to check for a empty 
 string and return it but I was wondering what other people thought of this?




Re: [julia-users] Behaviour of expanduser is inconsistent between platforms.

2014-10-10 Thread Stefan Karpinski
How does bash handle it?

On Fri, Oct 10, 2014 at 3:22 PM, Sean Marshallsay srm.1...@gmail.com
wrote:

 Hmmm... looking at how bash handles this it doesn't seem too difficult, I
 might give it a go over the weekend. I have no idea how to handle it on
 Windows though.

 On Thursday, 9 October 2014 18:06:07 UTC+1, Stefan Karpinski wrote:

 This is definitely a bug. The implementation on both platforms seems to
 be a hack – a more correct implementation would be a great contribution. It
 should also be possible to map arbitrary user names to user IDs and user
 IDs to user metadata.

 On Thu, Oct 9, 2014 at 1:00 PM, Sean Marshallsay srm@gmail.com
 wrote:

 I noticed the other day that calling expanduser on an empty string
 throws a BoundsError when using a UNIX platform. Whether this is a bug or a
 feature will probably depend entirely on who you ask. More importantly
 though, in my eyes, doing the same thing on Windows returns an empty string
 instead. This inconsistency definitely seems like a bug to me.

 In my eyes the UNIX implementation should be changed to check for a
 empty string and return it but I was wondering what other people thought of
 this?





[julia-users] more implementations of convert()

2014-10-10 Thread David van Leeuwen
Hi, 

I seem to need convert() a lot, and especially for arrays this is somewhat 
of a nuisance.  E.g., 

convert(Float32, rand(2,3))

does not work out of the box.  Luckily, for the numeric types there are the 
functions float64(), float32() etc that can operate on arrays.  This is all 
good, but for parameterized functions/types that need to convert to type T 
: Real it seems a bit of a hassle to find the accompanying convenience 
function for type T. 

So I wonder, would it be possible to include in Base a function

convert(T::Type) = the convenience function for T

so that you could say

t = Float32
convert(t)(randn(2,3))

My current solution for such conversion is

map(x-convert(t,x), randn(2,3))

but that doesn't seem great. 

An alternative would be to include in Base a number of declarations like

convert(Float32, x) = float32(x)

What is your view on this?

---david


Re: [julia-users] PPA for Ubuntu 14.04 (Trusty Tahr)

2014-10-10 Thread Helios De Rosario
It is 0.3.1~trusty2.

The crash message in the terminal only says core generated (in Spanish).
I suppose it means that there is a dump file somewhere with the details,
but I cannot find it. If somebody knows where should I look for it, I would
be happy to post those details.

Thanks
Helios



On Thu, Oct 9, 2014 at 8:47 AM, Elliot Saba staticfl...@gmail.com wrote:

 Hello Helios, can you tell me what version of the package you have
 installed?  You can get this via dpkg -l julia.  I'm looking for a
 version number like 0.3.1~trusty1 or similar.  Also, can you copy the
 message given at the crash here?

 Thanks,
 -E

 On Wed, Oct 8, 2014 at 5:56 PM, K Leo cnbiz...@gmail.com wrote:

 On Xubuntu 14.04 64, it seems to work fine:

_
_   _ _(_)_ |  A fresh approach to technical computing
   (_) | (_) (_)|  Documentation: http://docs.julialang.org
_ _   _| |_  __ _   |  Type help() for help.
   | | | | | | |/ _` |  |
   | | |_| | | | (_| |  |  Version 0.3.1 (2014-09-21 21:30 UTC)
  _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org release
 |__/   |  x86_64-linux-gnu



 On 2014年10月09日 08:50, Helios De Rosario wrote:

 Hi again,

 I saw that the 0.3.1 version of Julia was already available to install
 from the juliareleases repository, and tried to install it. But when I
 start Julia now it crashes. It generates a core file and suggests sending a
 report (I accepted).

 Somebody else has experienced this? I am using Lubuntu 14.04 in an i386
 machine. Julia 0.2.1 from the main Ubuntu repository worked normally. How
 could I report more details to help debug this problem?

 Thanks for your support
 Helios De Rosario






Re: [julia-users] PPA for Ubuntu 14.04 (Trusty Tahr)

2014-10-10 Thread Elliot Saba
What kind of computer do you have?  Is it a 32-bit machine or 64-bit?  Can
you try running julia inside of gdb and giving any information on what gdb
says such as a backtrace showing where it crashed?

To run julia inside of gdb, just run gdb julia, then when gdb is loaded
press r to run julia, and when it crashes, enter bt to get a backtrace.

On Fri, Oct 10, 2014 at 12:58 PM, Helios De Rosario 
helios.derosa...@gmail.com wrote:

 It is 0.3.1~trusty2.

 The crash message in the terminal only says core generated (in Spanish).
 I suppose it means that there is a dump file somewhere with the details,
 but I cannot find it. If somebody knows where should I look for it, I would
 be happy to post those details.

 Thanks
 Helios




 On Thu, Oct 9, 2014 at 8:47 AM, Elliot Saba staticfl...@gmail.com wrote:

 Hello Helios, can you tell me what version of the package you have
 installed?  You can get this via dpkg -l julia.  I'm looking for a
 version number like 0.3.1~trusty1 or similar.  Also, can you copy the
 message given at the crash here?

 Thanks,
 -E

 On Wed, Oct 8, 2014 at 5:56 PM, K Leo cnbiz...@gmail.com wrote:

 On Xubuntu 14.04 64, it seems to work fine:

_
_   _ _(_)_ |  A fresh approach to technical computing
   (_) | (_) (_)|  Documentation: http://docs.julialang.org
_ _   _| |_  __ _   |  Type help() for help.
   | | | | | | |/ _` |  |
   | | |_| | | | (_| |  |  Version 0.3.1 (2014-09-21 21:30 UTC)
  _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org release
 |__/   |  x86_64-linux-gnu



 On 2014年10月09日 08:50, Helios De Rosario wrote:

 Hi again,

 I saw that the 0.3.1 version of Julia was already available to install
 from the juliareleases repository, and tried to install it. But when I
 start Julia now it crashes. It generates a core file and suggests sending a
 report (I accepted).

 Somebody else has experienced this? I am using Lubuntu 14.04 in an i386
 machine. Julia 0.2.1 from the main Ubuntu repository worked normally. How
 could I report more details to help debug this problem?

 Thanks for your support
 Helios De Rosario







Re: [julia-users] more implementations of convert()

2014-10-10 Thread Tim Holy
I think the problem is in deciding when do I use the equivalent of map? and 
when do I convert as a whole object? For example, if I say

convert(Image, A)

I'm not asking to convert each _element_ of A to an Image, I'm asking to 
convert _A as a whole_ to an Image. But now let's say I had an array-of-
arrays; then I might wish this would convert each element of the outer array 
to its own Image. Of course, this would go horribly awry if I had decided to 
represent a single image as an array of 3-vectors (for r,g,b)---I'd get 
something completely unexpected out of that.

So basically, once you can have arrays-of-arrays-of-arrays-of..., it gets to 
be a little tricky to read the mind of whoever called that function.

That said, there is a place for convenience functions that make certain 
assumptions, especially in limited domains. Images, in fact, does that. But 
the base convert function, being so fundamental to so many things, is 
purposefully a bit finicky.

--Tim

On Friday, October 10, 2014 12:54:57 PM David van Leeuwen wrote:
 Hi,
 
 I seem to need convert() a lot, and especially for arrays this is somewhat
 of a nuisance.  E.g.,
 
 convert(Float32, rand(2,3))
 
 does not work out of the box.  Luckily, for the numeric types there are the
 functions float64(), float32() etc that can operate on arrays.  This is all
 good, but for parameterized functions/types that need to convert to type T
 : Real it seems a bit of a hassle to find the accompanying convenience
 function for type T.
 
 So I wonder, would it be possible to include in Base a function
 
 convert(T::Type) = the convenience function for T
 
 so that you could say
 
 t = Float32
 convert(t)(randn(2,3))
 
 My current solution for such conversion is
 
 map(x-convert(t,x), randn(2,3))
 
 but that doesn't seem great.
 
 An alternative would be to include in Base a number of declarations like
 
 convert(Float32, x) = float32(x)
 
 What is your view on this?
 
 ---david



[julia-users] QZ Decomposition Reordering

2014-10-10 Thread Ricardo Mayer
Can the schurfact(A,B) function reorder its output such that generalized 
eigenvalues appear in descending (or ascending) magnitude order?

I'm thinking on something like MATLAB's ordqz or R's ordqz (in QZ package). 

I'm really new to Julia (installed it just a few minutes ago, actually), 
but as far as I can tell there is no select  option for this function.

best,
Ricardo




[julia-users] Advise on Julia composite type to replace MATLAB struct

2014-10-10 Thread mfjonker
Dear Julia users,

For a computationally challenging problem I'm trying to port an existing 
design-optimization from MATLAB to Julia. Currently, the designs are 
organized in a MATLAB struct and I am looking for some advice on how to 
efficiently store and distribute the data for a parallel evaluation in 
Julia. The idea of the MATLAB algorithm is to make some random changes in 
each design, re-calculate their effiency (using everything in the MATLAB 
struct) within a parallel loop, and sorting the designs based on their 
updated efficiency. Below is how the data is organized in Matlab. I figured 
a composite type ( http://julia.readthedocs.org/en/latest/manual/types/ ) 
would be the relevant Julia structure, but I am not sure how to create a 
vector of composite types and whether to use type or immutable. Hence, 
a specific suggestion about how to do this in Julia would be much 
appreciated!

Thank you and best regards,
Marcel


% setup structure to save designs (only once)
for d = 1:100
 design(d).efficiency = 99;
 design(d).ind_eff= zeros(8,1);
 design(d).design   = zeros(14,12,8);
 design(d).X  = zeros(196,22,8);
 design(d).dX= zeros(144,22,8);

  for subNr=1:8
   for drawNr = 1:1
design(d).draws(subNr,drawNr).V = zeros(144,1);
design(d).draws(subNr,drawNr).expV= zeros(144,1);
design(d).draws(subNr,drawNr).sumExpV = zeros(144,1);
design(d).draws(subNr,drawNr).P = zeros(144,1);
design(d).draws(subNr,drawNr).PdX = zeros(144, 22);
design(d).draws(subNr,drawNr).sumPdX  = zeros(144, 22);
design(d).draws(subNr,drawNr).ZZ  = zeros(22,22);
   end
  end
end 


% update efficiency 
parfor d = 1:100
  updateEff( design(d) );
end

% sort designs based on updated efficiencies
[~,v]=sort( [design.efficiency] );
design=design(v);







Re: [julia-users] ANN: GeometricalPredicates.jl

2014-10-10 Thread Chris Foster
This is pretty cool.  Writing a robust set of geometric predicates
requires quite an attention to detail.

Some questions:

Restricting to the float range 1.0=x2.0 essentially makes the input
a fixed point representation, with fixed point scaling factor eps(1.0)
= 2.220446049250313e-16.  How does this compare to telling the user to
rescale their variables onto an integer lattice?  Using an integer
lattice arguably exposes the exact nature of the rescaling a little
more clearly though it might just be a pain to work with.

I expect that rescaling a set of points fails to preserve geometric
predicates between them.  If so, a comparison to CGAL performance may
not be entirely fair if they keep their vertices in the original
position.  Having said that, I think it's a totally practical tradeoff
- one that I'd certainly be willing to make for a bit of extra speed.

~Chris


On Fri, Oct 10, 2014 at 5:34 AM, Ariel Keselman skar...@gmail.com wrote:
 Fast and robust 2D  3D geometrical predicates. For documentation see here:

 https://github.com/skariel/GeometricalPredicates.jl

 This is used in a Delaunay/Voronoi implementation which I'll also package
 which is faster than CGAL.

 In addition, it could be used as the basis for a fast and robust geometry
 library, much like CGAL.

 read about how here:

 https://www.cgal.org/philosophy.html







[julia-users] About usage in Emacs (not display prompt of Julia)

2014-10-10 Thread kenichi sasagawa


Hello 
I like Julia very much. I switched from Scheme. 
By the way, please tell me usage in Emacs(on WIndows7). 
I'm in trouble that prompt is not displayed in the Shell. 
I'm guessing Julia display prompt without STDIO. 
Yours sincerely

example of running in shell
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Program Files\Julia\Julia-0.3.1\binjulia
julia
1
1
println(Hello world)
Hello world
sin(1)
0.8414709848078965
exit()

C:\Program Files\Julia\Julia-0.3.1\bin




Re: [julia-users] iterating through permutations in parallel

2014-10-10 Thread Jason Solack
thank you, this is very helpful.

On Wednesday, October 8, 2014 9:18:14 AM UTC-4, David Gonzales wrote:

 here is more source code sample for parallel permutation processing.
 this code goes over all permutation of `keys` and counts the number of 
 cycles into `resall`:


 https://gist.github.com/dvdgonzales17/2ebb7fd07af9c93994fc#file-parallel-permutation-loop

 On Wednesday, October 8, 2014 3:20:12 AM UTC+3, Jason Solack wrote:

 thank you for your input!  I will try your suggestions!

 On Tuesday, October 7, 2014 3:39:46 PM UTC-4, Jiahao Chen wrote:

 This is not a good strategy since your code generates all the 
 permutations explicitly in memory, and there are an exponentially large 
 number of them. Instead you could loop though k=1:factorial(n) and generate 
 the kth permutation programmatically using nthperm(the_keys, k). If your 
 computation performs a reduction you can use the @parallel (+) construct 
 (or something similar), otherwise you can distribute the work manually 
 across the p processors and write a loop like 

 for p in 1:nprocs()
#You'll have to do the rounding more carefully to avoid missing 
 permutations on the edges
@spawnat procs()[p] for 
 k=iround((p-1)*n/nprocs())+1:iround(p*n/nprocs()) do_stuff() end
 end

 Thanks,

 Jiahao Chen
 Staff Research Scientist
 MIT Computer Science and Artificial Intelligence Laboratory

 On Mon, Oct 6, 2014 at 8:57 PM, Jason Solack jays...@gmail.com wrote:

 Hello everyone,

 I'm trying to iterate through a collection of permutations in parallel 
 and i'm having trouble iterating through the collection.  In the code 
 below 
 i'm using next(p) in the place i'd like to grab the next permutation.  
 This is also the first bit of processing i've done in parallel in Julia so 
 if have any pointers on how i could do this more easily i'd appreciate any 
 advice.


 np = nprocs()
 output = Dict()
 p = permutations(the_keys)
 on_perm = 1
 @sync begin
 for on_proc=1:np
 if p != myid() || np == 1
 the_perm = next(p)
 @async begin
 while true
 output[on_perm] = remotecall_fetch(on_proc, 
 do_calcs, the_perm)
 on_perm += 1
 if on_perm  length(p)
 break
 end
 end
 end
 end
 end
 end
 return output

  Thank you for your help.

 Jason




[julia-users] Re: About usage in Emacs (not display prompt)

2014-10-10 Thread Patrick O'Leary
There is not currently a solution to this problem. There is an issue 
tracking it:

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

On Friday, October 10, 2014 8:52:00 PM UTC-5, kenichi sasagawa wrote:

 Hello 
 I like Julia very much. I switched from Scheme. 
 By the way, please tell me usage in Emacs(on WIndows7). 
 I'm in trouble that prompt is not displayed in the Shell. 
 I'm guessing Julia display prompt without STDIO. 
 Yours sincerely

 example of running in shell
 Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

 C:\Program Files\Julia\Julia-0.3.1\binjulia
 julia
 1
 1
 println(Hello world)
 Hello world
 sin(1)
 0.8414709848078965
 exit()

 C:\Program Files\Julia\Julia-0.3.1\bin




[julia-users] This week in Julia

2014-10-10 Thread Matt Bauman
This is an experiment.  I think it'd be really amazing to have weekly 
updates about what's going on in Julia master, particularly during this 
crazy 0.4-dev period.  So I figured I'd give it a shot.  Take a look:

http://thisweekinjulia.github.io/julia/2014/10/10/October-10.html

I first tried a post like this two weeks ago over on reddit and it was 
pretty well received.  But I think GitHub pages will make creating these 
posts much simpler.  No, this doesn't replace NEWS.md (that's where I glean 
a lot of this information from!), and I *really* don't expect folks who are 
implementing the features and changes to be updating this blog.  But I 
think it'd be great if other folks would help me keep it up-to-date.

Pull requests and collaborators are very welcome! 
 https://github.com/thisweekinjulia/thisweekinjulia.github.io


Re: [julia-users] This week in Julia

2014-10-10 Thread Elliot Saba
This is great.  Honestly, I can't believe that some of these things were
only 2 weeks ago.  It feels so much longer.  ;)
-E

On Fri, Oct 10, 2014 at 7:30 PM, Matt Bauman mbau...@gmail.com wrote:

 This is an experiment.  I think it'd be really amazing to have weekly
 updates about what's going on in Julia master, particularly during this
 crazy 0.4-dev period.  So I figured I'd give it a shot.  Take a look:

 http://thisweekinjulia.github.io/julia/2014/10/10/October-10.html

 I first tried a post like this two weeks ago over on reddit and it was
 pretty well received.  But I think GitHub pages will make creating these
 posts much simpler.  No, this doesn't replace NEWS.md (that's where I glean
 a lot of this information from!), and I *really* don't expect folks who are
 implementing the features and changes to be updating this blog.  But I
 think it'd be great if other folks would help me keep it up-to-date.

 Pull requests and collaborators are very welcome!
 https://github.com/thisweekinjulia/thisweekinjulia.github.io



[julia-users] Code slower if not enclosed in a function?

2014-10-10 Thread David Smith
This code runs in 0.5 sec in v0.3.2, but takes 0.64 s in v0.4:
tic() 
N = 256 
n = 80 
x = rand(N,N) + 1im*randn(N,N) 
f = zeros(Complex128, N, N, n) 
for t = 1:n 
f[:,:,t] = fft(x + float(t)) 
end 
toc()

If I enclose it in a function, as in the following, and then run it by 
calling the function, it runs in 0.3 s in both v0.3.2 and v0.4.
function bench()
tic() 
N = 256 
n = 80 
x = rand(N,N) + 1im*randn(N,N) 
f = zeros(Complex128, N, N, n) 
for t = 1:n 
f[:,:,t] = fft(x + float(t)) 
end 
toc()
end
bench()


What is going on?





[julia-users] Re: Advise on Julia composite type to replace MATLAB struct

2014-10-10 Thread Viral Shah
A composite type is the right data structure, given that you have large 
arrays you need to store in your type.

-viral

On Saturday, October 11, 2014 4:43:50 AM UTC+5:30, mfjo...@hotmail.com 
wrote:

 Dear Julia users,

 For a computationally challenging problem I'm trying to port an existing 
 design-optimization from MATLAB to Julia. Currently, the designs are 
 organized in a MATLAB struct and I am looking for some advice on how to 
 efficiently store and distribute the data for a parallel evaluation in 
 Julia. The idea of the MATLAB algorithm is to make some random changes in 
 each design, re-calculate their effiency (using everything in the MATLAB 
 struct) within a parallel loop, and sorting the designs based on their 
 updated efficiency. Below is how the data is organized in Matlab. I figured 
 a composite type ( http://julia.readthedocs.org/en/latest/manual/types/ ) 
 would be the relevant Julia structure, but I am not sure how to create a 
 vector of composite types and whether to use type or immutable. Hence, 
 a specific suggestion about how to do this in Julia would be much 
 appreciated!

 Thank you and best regards,
 Marcel


 % setup structure to save designs (only once)
 for d = 1:100
  design(d).efficiency = 99;
  design(d).ind_eff= zeros(8,1);
  design(d).design   = zeros(14,12,8);
  design(d).X  = zeros(196,22,8);
  design(d).dX= zeros(144,22,8);

   for subNr=1:8
for drawNr = 1:1
 design(d).draws(subNr,drawNr).V = zeros(144,1);
 design(d).draws(subNr,drawNr).expV= zeros(144,1);
 design(d).draws(subNr,drawNr).sumExpV = zeros(144,1);
 design(d).draws(subNr,drawNr).P = zeros(144,1);
 design(d).draws(subNr,drawNr).PdX = zeros(144, 22);
 design(d).draws(subNr,drawNr).sumPdX  = zeros(144, 22);
 design(d).draws(subNr,drawNr).ZZ  = zeros(22,22);
end
   end
 end 


 % update efficiency 
 parfor d = 1:100
   updateEff( design(d) );
 end

 % sort designs based on updated efficiencies
 [~,v]=sort( [design.efficiency] );
 design=design(v);







[julia-users] Re: Code slower if not enclosed in a function?

2014-10-10 Thread Patrick O'Leary
http://julia.readthedocs.org/en/release-0.3/manual/performance-tips/#avoid-global-variables

On Friday, October 10, 2014 10:56:36 PM UTC-5, David Smith wrote:

 This code runs in 0.5 sec in v0.3.2, but takes 0.64 s in v0.4:
 tic() 
 N = 256 
 n = 80 
 x = rand(N,N) + 1im*randn(N,N) 
 f = zeros(Complex128, N, N, n) 
 for t = 1:n 
 f[:,:,t] = fft(x + float(t)) 
 end 
 toc()

 If I enclose it in a function, as in the following, and then run it by 
 calling the function, it runs in 0.3 s in both v0.3.2 and v0.4.
 function bench()
 tic() 
 N = 256 
 n = 80 
 x = rand(N,N) + 1im*randn(N,N) 
 f = zeros(Complex128, N, N, n) 
 for t = 1:n 
 f[:,:,t] = fft(x + float(t)) 
 end 
 toc()
 end
 bench()


 What is going on?





[julia-users] Re: This week in Julia

2014-10-10 Thread Viral Shah
Really nice to have. Perhaps publish as a blog and post on 
juliabloggers.com?

-viral

On Saturday, October 11, 2014 8:00:11 AM UTC+5:30, Matt Bauman wrote:

 This is an experiment.  I think it'd be really amazing to have weekly 
 updates about what's going on in Julia master, particularly during this 
 crazy 0.4-dev period.  So I figured I'd give it a shot.  Take a look:

 http://thisweekinjulia.github.io/julia/2014/10/10/October-10.html

 I first tried a post like this two weeks ago over on reddit and it was 
 pretty well received.  But I think GitHub pages will make creating these 
 posts much simpler.  No, this doesn't replace NEWS.md (that's where I glean 
 a lot of this information from!), and I *really* don't expect folks who are 
 implementing the features and changes to be updating this blog.  But I 
 think it'd be great if other folks would help me keep it up-to-date.

 Pull requests and collaborators are very welcome!  
 https://github.com/thisweekinjulia/thisweekinjulia.github.io



[julia-users] Re: This week in Julia

2014-10-10 Thread Viral Shah
Is there an RSS feed already?

-viral

On Saturday, October 11, 2014 9:34:47 AM UTC+5:30, Viral Shah wrote:

 Really nice to have. Perhaps publish as a blog and post on 
 juliabloggers.com?

 -viral

 On Saturday, October 11, 2014 8:00:11 AM UTC+5:30, Matt Bauman wrote:

 This is an experiment.  I think it'd be really amazing to have weekly 
 updates about what's going on in Julia master, particularly during this 
 crazy 0.4-dev period.  So I figured I'd give it a shot.  Take a look:

 http://thisweekinjulia.github.io/julia/2014/10/10/October-10.html

 I first tried a post like this two weeks ago over on reddit and it was 
 pretty well received.  But I think GitHub pages will make creating these 
 posts much simpler.  No, this doesn't replace NEWS.md (that's where I glean 
 a lot of this information from!), and I *really* don't expect folks who are 
 implementing the features and changes to be updating this blog.  But I 
 think it'd be great if other folks would help me keep it up-to-date.

 Pull requests and collaborators are very welcome!  
 https://github.com/thisweekinjulia/thisweekinjulia.github.io



[julia-users] Re: Multi-OS (Linux + Mac) testing in Travis

2014-10-10 Thread Viral Shah
Now, if only they had Windows!

-viral

On Friday, October 10, 2014 11:19:26 PM UTC+5:30, Tony Kelman wrote:

 Heads up for package developers - looks like Travis got some additional 
 capacity and is accepting new repositories for multi-OS support. See 
 http://docs.travis-ci.com/user/multi-os/ - you need to send an email to 
 supp...@travis-ci.com asking them to enable multi-OS support for your 
 package, with a link to the repository. Then change your .travis.yml as 
 follows:

 Add
 ```
 os:
 - linux
 - osx
 ```

 Replace
 ```
 before_install:
 - sudo add-apt-repository ppa:staticfloat/julia-deps -y
 - sudo add-apt-repository ppa:staticfloat/${JULIAVERSION} -y
 - sudo apt-get update -qq -y
 - sudo apt-get install libpcre3-dev julia -y
 ```

 with
 ```
 before_install:
 - if [ `uname` = Linux ]; then
 sudo add-apt-repository ppa:staticfloat/julia-deps -y;
 sudo add-apt-repository ppa:staticfloat/${JULIAVERSION} -y;
 sudo apt-get update -qq -y;
 sudo apt-get install libpcre3-dev julia -y;
   elif [ `uname` = Darwin ]; then
 if [ $JULIAVERSION = julianightlies ]; then
   wget -O julia.dmg http://status.julialang.org/download/osx10.7+
 ;
 else
   wget -O julia.dmg http://status.julialang.org/stable/osx10.7+;;
 fi;
 hdiutil mount julia.dmg;
 cp -Ra /Volumes/Julia/*.app/Contents/Resources/julia ~;
 export PATH=$PATH:$(echo ~)/julia/bin;
   fi
 ```

 Elliot got this working a while back when Travis originally announced the 
 feature, I just tweaked it a little so it works whether or not you've 
 enabled multi-OS support. To force a build on a Mac worker before Travis 
 responds to your email, you can temporarily change `language: cpp` to 
 `language: objective-c`. I think you'll need to change it back to get 
 builds on both Linux and Mac once support is enabled.

 I'll probably make a PR to base to turn this on in the default .travis.yml 
 from Pkg.generate, since it doesn't hurt anything.

 -Tony



[julia-users] Re: About usage in Emacs (not display prompt)

2014-10-10 Thread kenichi sasagawa
Thank you


On Saturday, October 11, 2014 11:27:29 AM UTC+9, Patrick O'Leary wrote:

 There is not currently a solution to this problem. There is an issue 
 tracking it:

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

 On Friday, October 10, 2014 8:52:00 PM UTC-5, kenichi sasagawa wrote:

 Hello 
 I like Julia very much. I switched from Scheme. 
 By the way, please tell me usage in Emacs(on WIndows7). 
 I'm in trouble that prompt is not displayed in the Shell. 
 I'm guessing Julia display prompt without STDIO. 
 Yours sincerely

 example of running in shell
 Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

 C:\Program Files\Julia\Julia-0.3.1\binjulia
 julia
 1
 1
 println(Hello world)
 Hello world
 sin(1)
 0.8414709848078965
 exit()

 C:\Program Files\Julia\Julia-0.3.1\bin




[julia-users] Re: Multi-OS (Linux + Mac) testing in Travis

2014-10-10 Thread Jeff Waller
Wow, this is exactly what I need. As I just got Travis functional last 
night for the first time @ 3 (you should see the crazy binding.gyp file), I 
feel the universe is reaching out to me.  Thanks, Tony, thanks, universe.


Re: [julia-users] Re: Structure and Interpretation of Classical Mechanics

2014-10-10 Thread Kevin Lin
PS I didn't know about JuliaDiff, but it looks like an interesting effort 
to do in Julia some of the same things that ScmUtils does in Scheme.  See

  http://www.juliadiff.org/

 haven't used any of the packages, but one may be able to port some of 
ScmUtils using this.