[julia-users] Re: Julia code 5x to 30x slower than Matlab code

2015-09-25 Thread J Luis


sexta-feira, 25 de Setembro de 2015 às 14:47:49 UTC+1, Marcio Sales 
escreveu:
>
> all right... Well.. Julia's price will allways be better... 
> Btw.. what about crowdfunded initiatives? Has anyone tried that? I would 
> be wiling to donate for a geospatial visualization package, for example...
>
 

Would this http://gmt.soest.hawaii.edu/ fit your wishes?


[julia-users] Julia equivalent to a static member function in C++/MATLAB

2015-09-25 Thread Joel Andersson
Hi,

In C++ or in MATLAB I would use static member functions to keep the 
constructors nice and simple, e.g.
class MyMatrix {
  public:
  static MyMatrix zeros(int n, int m);
  static MyMatrix ones(int n, int m);
  static MyMatrix eye(int n);
  ...
};

Which allows me to create class instances with an IMO natural syntax, which 
should also be relatively efficient due to return value optimization:
MyMatrix x = MyMatrix::zeros(3,4);

In MATLAB, I would do the same with a static method, e.g.:
x = MyMatrix.zeros(3,4);

What is the equivalent way to do it in Julia? I have seen discussions of 
whether and how to overload the dot operator ".", but I did not fully 
understand if this discussion applies to the above case or if that's 
already possible somehow.

Best regards,
Joel



[julia-users] Re: help!

2015-09-25 Thread Marcio Sales
Thanks!


[julia-users] Re: Julia equivalent to a static member function in C++/MATLAB

2015-09-25 Thread Steven G. Johnson


On Friday, September 25, 2015 at 11:56:46 AM UTC-4, Joel Andersson wrote:
>
> Hi,
>
> In C++ or in MATLAB I would use static member functions to keep the 
> constructors nice and simple, e.g.
> class MyMatrix {
>   public:
>   static MyMatrix zeros(int n, int m);
>   static MyMatrix ones(int n, int m);
>   static MyMatrix eye(int n);
>   ...
> };
>
> Which allows me to create class instances with an IMO natural syntax, 
> which should also be relatively efficient due to return value optimization:
> MyMatrix x = MyMatrix::zeros(3,4);
>
>
In Julia, you can do the same thing, it is just spelled differently.  You 
could do
 x = zeros(MyMatrix, 3, 4)
where you have defined
 Base.zeros(::Type{MyMatrix}, m, n) = .


Re: [julia-users] FFTW.REDFT00 and FFT.RODFT00 are ~10x slower than other routines?

2015-09-25 Thread Steven G. Johnson


On Wednesday, September 23, 2015 at 9:07:51 PM UTC-4, Sheehan Olver wrote:
>
> OK that makes sense.  But then why is rfft on a vector length 2*(n-1) more 
> than 2x faster than FFT.REDFT00?
>
> *julia> **r=rand(10);@time for k=1:100 FFTW.r2r(r,FFTW.REDFT00) end;*
>   2.496130 seconds (8.30 k allocations: 76.703 MB, 0.76% gc time)
> *julia> **r=rand(2*(10-1));@time for k=1:100 rfft(r) end;*
>   0.943706 seconds (8.30 k allocations: 152.985 MB, 1.58% gc time)
>

The short answer is that rfft is much more optimized in FFTW than than the 
r2r transforms.

The long answer is REDFT00 transforms of *even* lengths n are especially 
bad, because the algorithms for this problem are not very attractive.   For 
an even length, the options are:

   1) use an algorithm from FFTPACK or Numerical Recipes that turns it into 
a rfft of the same length plus O(n) pre/post-processing.   We implemented 
this, but don't use it because it seems to suffer from severe accuracy 
problems: https://github.com/FFTW/fftw3/blob/master/reodft/redft00e-r2hc.c
2) pad symmetrically to an rfft of twice the length.  This is accurate, 
but sacrices a factor of 2 in speed as you noticed: 
 https://github.com/FFTW/fftw3/blob/master/reodft/redft00e-r2hc-pad.c
3) if n-1 has a small prime factor r, implement a pruned version of the 
analogous radix-r Cooley-Tukey algorithm.  This would work and be accurate, 
but is a lot of work to implement, and we didn't both except in the case 
where n is *odd* (so that we can use radix r=2, or actually split 
radix: https://github.com/FFTW/fftw3/blob/master/reodft/reodft00e-splitradix.c)
  

> PS  Why doesn't fft(::Vector{Float64}) automatically call rfft and 
> re-interpret the output? 
>

We could, but my feeling was that if you really care about factors of two 
in performance, you should be using rfft directly.  That also lets you save 
a factor of two in memory, and a factor of two in any post-processing 
computations as well, and additionally lets you save a factor of two in any 
subsequent inverse transform (if you need it, e.g. for convolutions or 
filtering).

Matlab, in contrast, doesn't expose an rfft interface, so you can't get all 
of the savings that are possible in this case.  So they might as well get 
what they can from fft(x).
 


[julia-users] Re: Julia code 5x to 30x slower than Matlab code

2015-09-25 Thread Marcio Sales
This just came to while I remembered that Matlab is so expensive.. I never 
did this myself, but heard that Openstreetmaps, for example, was/is 
crowdsourced, so why not trying it for Julia development?


Re: [julia-users] Re: What are the "strengths" of the Julia "ecosystem" (e.g. for bio and quants/finance)? This is not a very specific question (while sub-questions are), you've been warned..

2015-09-25 Thread Andrei Zh
 

> From browsing issues, it looks like the HttpServer.jl performance issue 
> you referenced below should be now fixed by 
> https://github.com/JuliaWeb/HttpServer.jl/pull/59.


Yes, this issue has been fixed. 

 It seems Julia can have low latency 


Yes, on my later tests latency was pretty good

(are Flask and Splay [numbers, for it and throughput] considered 
> best-in-class, at least for those language?)


Spray is pretty good, Flask is here just for comparison. I don't think 
Flask has been developed with performance in mind. 

Do you only disagree, then only, with the "high throughput" 


As you can see from results in #40, HttpServer.jl already has pretty good 
performance, just I believe Julia has no blockers not to get even more 
(comparable to best-in-class). 

I wander how difficult or stupid it is to support old APIs here in some 
> way..


In most cases it's unreasonable to keep outdated API for many reasons. 

But "probably comparable with Erlang" was not an error, taken 
> conservatively, you are probably talking about what pure benchmark numbers 
> of concurrency (only) might indicate. I believe Erlang has more (than 
> speed) currently not in Julia, while not better for non-concurrency related.


When processing large number of small requests (e.g. text messages in 
social network or requests to API), blocking network operations become a 
bottleneck. E.g. if you have blocking "get()" operation, you either need to 
waste processing time until request is complete or switch processor 
context. Both of these are quite expensive and set a limit to a maximum 
throughput. Erlang has actor-based concurrency, which means that you can 
switch between tasks without switching processor context and get high 
utilization of CPU. Scala's Spray is built on Akka, which is an 
implementation of the same actor model, and gets very good performance. 
Julia has similar concurrency model using Tasks, and that's why I'm so 
optimistic regarding future of the web frameworks in Julia. 

Even if this would work perfectly, I'm not sure (most) Julia (or Java?) 
> users would want to mix (I guess ok for truly good/critical libraries..) at 
> least for GUI/enterprise applications..


Consider, for example, Apache Spark and the whole Hadoop infrastructure. 
There's nothing even close to it in non-JVM world, and that's why other 
languages (including Python and R) build their interfaces to JVM. 


On Friday, September 25, 2015 at 4:39:51 PM UTC+3, Jameson wrote:
>
> From browsing issues, it looks like the HttpServer.jl performance issue 
> you referenced below should be now fixed by 
> https://github.com/JuliaWeb/HttpServer.jl/pull/59.
>
> On Fri, Sep 25, 2015 at 5:47 AM Páll Haraldsson  > wrote:
>
>> On Thursday, September 24, 2015 at 11:07:56 PM UTC, Andrei Zh wrote:
>>>
>>>  
>>>
 I find this statement highly surprising.. wander if you meant to 
 reverse this.. My quant friend who had worked for years in Python had 
 trouble parallelizing Python code (may be resolved now..). I'm not 
 familiar 
 with R, but Python has the GIL and associated problems. I also thought 
 Erlang was best-in-class (for concurrent, not "parallel").

>>>
>>> Oops, you are right, it's exactly the opposite. Consider it a result of 
>>> quick answer between 2 meetings. Julia's capabilities are much better for 
>>> concurrent and parallel programming than these in Python or R. 
>>>
>>
>> But "probably comparable with Erlang" was not an error, taken 
>> conservatively, you are probably talking about what pure benchmark numbers 
>> of concurrency (only) might indicate. I believe Erlang has more (than 
>> speed) currently not in Julia, while not better for non-concurrency related.
>>
>>
>>> For those in the Java/Scala world, I'm less sure about reusing that, I 
 know you can with JavaCall.jl, but understand there are bugs and 
 limitations to it.
>>>
>>>
>>> Unfortunately, that's true. @aviks has made a great work connecting 
>>> Julia to JVMs via Java Native Interface, but as far as I can see, JNI is 
>>> shitty by itself, and it's very hard to to make integration between Julia 
>>> and Java really stable.
>>>
>>
>> Even if this would work perfectly, I'm not sure (most) Julia (or Java?) 
>> users would want to mix (I guess ok for truly good/critical libraries..) at 
>> least for GUI/enterprise applications.. At least for me, it seems involving 
>> a JVM or any VM, is outdated.. Yes, Julia has LLVM, but it's not the same. 
>>
>>>
>>> "HttpServer.jl, has low latency 0.5 ms and high throughput (latency on 
 the same order of Python's Flask and Scala's Spray mature frameworks, and 
 throughput also comparable[82])." 
>>>
>>>
>>> That's funny, because specified reference leads to an issue on 
>>> performance that was opened by me and incorrectly interpreted by the author 
>>> of Wikipedia page. At that test Julia outperformed Flask, but was still 3-6 
>>> times slower than Spray.

[julia-users] Re: Crowdsourced Julia development

2015-09-25 Thread Jonathan Malmaud
$5 to the first person to take transposes 
seriously 
https://www.bountysource.com/issues/1333116-taking-vector-transposes-seriously/backers

On Friday, September 25, 2015 at 10:45:30 AM UTC-4, Tom Breloff wrote:
>
> Moving the discussion from the matlab thread...
>
> The idea was brought up about being able to contribute money to package 
> development to motivate developers... a quick search brought up this: 
> https://www.bountysource.com/
>
> Does anyone have any experience with this?  Are there other similar 
> options?  Are there users out there that would pledge money for specific 
> bug fixes and functionality right now?  
>


[julia-users] Crowdsourced Julia development

2015-09-25 Thread Tom Breloff
Moving the discussion from the matlab thread...

The idea was brought up about being able to contribute money to package 
development to motivate developers... a quick search brought up 
this: https://www.bountysource.com/

Does anyone have any experience with this?  Are there other similar 
options?  Are there users out there that would pledge money for specific 
bug fixes and functionality right now?  


[julia-users] Re: help!

2015-09-25 Thread harven
You can also use 

julia> @doc sin
  sin(x)

  Compute sine of x, where x is in radians



[julia-users] Why two based indexing? [A package.. it's not the default..]

2015-09-25 Thread Páll Haraldsson
https://libraries.io/julia/TwoBasedIndexing


http://python-history.blogspot.is/2013/10/why-python-uses-0-based-indexing.html

[While Guido's former ABC used 1-based]

"Guido van RossumOctober 24, 2013 at 8:49 AM
To anyone who prefers 1-based indexing: you are the same people who screwed 
up the calendar, starting at year 1"


I think my next year will start at January 2..

I do not want to start an argument on 0-based vs. 1-based, I've grown to 
like Julia's 1-based variant. Just 2-based seemed odd.. Probably a prove of 
concept, for more general n-based/Pascal arrays..

-- 
Palli.



[julia-users] Re: Julia equivalent to a static member function in C++/MATLAB

2015-09-25 Thread 'Greg Plowman' via julia-users
 

> In Julia, you can do the same thing, it is just spelled differently.  You 
> could do  

   x = zeros(MyMatrix, 3, 4)

where you have defined

 Base.zeros(::Type{MyMatrix}, m, n) = .

Show trimmed content 

Of course in Julia you can do anything you want.
However, is it recommended to redefine the meaning of generic functions?
I would assume zeros(MyMatrix,3,4) creates a 3x4 Array{MyMatrix,2}



[julia-users] Re: Pkg.[update()/install()/build()] woes on Windows 10 64 bit

2015-09-25 Thread Tony Kelman
Try deleting everything in C:\Users\ejfie\.julia\v0.3\.cache  - something 
might be corrupt there

On Friday, September 25, 2015 at 12:29:14 PM UTC-7, Evan Fields wrote:
>
> I've been encountering problems with packages. Here's what happened:
>
>- I installed Julia 0.3.11 via the 64 bit .exe on julialang.org
>- Changed the install path to C:\Julia-0.3.11 but otherwise all 
>default options
>- On Windows 10 x64, not using Cygwin or related
>- Right after install I opened a Julia terminal window; I had the 
>session below.
>
> The errors are shown in the session below. I've tried
> - Running as an administrator
> - Running git config --global url."https://".insteadOf git:// in shell 
> mode
> - Running Pkg.init() (already initialized)
> - Trying to clone a repository in Julia/Git using the git-bash there (it 
> worked over https)
>
>_   _ _(_)_ |  A fresh approach to technical computing
>   (_) | (_) (_)|  Documentation: http://docs.julialang.org
>_ _   _| |_  __ _   |  Type "help()" for help.
>   | | | | | | |/ _` |  |
>   | | |_| | | | (_| |  |  Version 0.3.11 (2015-07-27 06:18 UTC)
>  _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
> |__/   |  x86_64-w64-mingw32
>
> julia> Pkg.add("Images")
> INFO: Nothing to be done
> INFO: METADATA is out-of-date — you may not have the latest version of Images
> INFO: Use `Pkg.update()` to get the latest versions of your packages
>
> julia> Pkg.update()
> INFO: Updating METADATA...
> Checking out files: 100% (1627/1627), done.
> INFO: Updating cache of Hexagons...
> INFO: Updating cache of Gadfly...
> INFO: Updating cache of ArrayViews...
> INFO: Updating cache of Lazy...
> INFO: Updating cache of ImmutableArrays...
> INFO: Updating cache of Graphics...
> INFO: Updating cache of StatsBase...
> INFO: Updating cache of Requires...
> INFO: Updating cache of MacroTools...
> INFO: Updating cache of NaNMath...
> INFO: Updating cache of FactCheck...
> INFO: Updating cache of DataArrays...
> INFO: Updating cache of Grid...
> INFO: Updating cache of Loess...
> INFO: Updating cache of Compat...
> INFO: Updating cache of FixedPointNumbers...
> INFO: Updating cache of WoodburyMatrices...
> INFO: Updating cache of Compose...
> INFO: Updating cache of JuliaParser...
> INFO: Updating cache of Iterators...
> INFO: Updating cache of JSON...
> INFO: Updating cache of DataFrames...
> INFO: Updating cache of GZip...
> INFO: Updating cache of Reexport...
> INFO: Updating cache of Showoff...
> INFO: Updating cache of Distributions...
> INFO: Updating cache of Optim...
> INFO: Updating cache of Color...
> INFO: Updating cache of SortingAlgorithms...
> INFO: Updating cache of Docile...
> INFO: Updating cache of Calculus...
> INFO: Updating cache of PDMats...
> INFO: Updating cache of DualNumbers...
> INFO: Updating cache of DataStructures...
> INFO: Updating cache of Jewel...
> ERROR: couldn't update C:\Users\ejfie\.julia\v0.3\.cache\Hexagons using `git 
> remote update`
>  in wait at task.jl:284
>  in wait at task.jl:194
>  in wait at task.jl:48
>  in sync_end at task.jl:311
>  in update at pkg/entry.jl:319
>  in anonymous at pkg/dir.jl:28
>  in cd at file.jl:30
>  in cd at pkg/dir.jl:28
>  in update at pkg.jl:41
>
> julia> using Images
> ERROR: Images not properly installed. Please run Pkg.build("Images") then 
> restart Julia.
>  in error at error.jl:21 (repeats 2 times)
> while loading 
> C:\Users\ejfie\.julia\v0.3\Images\src\ioformats/libmagickwand.jl, in 
> expression starting on line 31
> while loading C:\Users\ejfie\.julia\v0.3\Images\src\Images.jl, in expression 
> starting on line 38
>
> julia> Pkg.build("Images")
> INFO: Building Images
> =[ ERROR: Images 
> ]=
>
>
> type Nothing has no field match
> while loading C:\Users\ejfie\.julia\v0.3\Images\deps\build.jl, in expression 
> starting on line 37
>
> ===
>
>
> =[ BUILD ERRORS 
> ]==
>
>
> WARNING: Images had build errors.
>
>  - packages with build errors remain installed in C:\Users\ejfie\.julia\v0.3
>  - build the package(s) and all dependencies with `Pkg.build("Images")`
>  - build a single package by running its `deps/build.jl` script
>
> ===
>
>
> julia>
>
>
> Hopefully I'm missing something simple here! Any suggestion?
>


[julia-users] Is there a tutorial on how to set up my own Julia cluster?

2015-09-25 Thread Ismael VC
Hello everyone!

I am trying to set up a Julia cluster with 20 nodes, this is the very first 
time I've tried something like this. I have looked around for examples, but 
documentation is not very helpful for me:

*Julia can be started in parallel mode with either the -p or 
the --machinefile options. -p n will launch an additional n worker 
processes, while --machinefile file will launch a worker for each line in 
file file. The machines defined in file must be accessible via a 
passwordless ssh login, with Julia installed at the same location as the 
current host. Each machine definition takes the 
form [count*][user@]host[:port] [bind_addr[:port]] . user defaults to 
current user, port to the standard ssh port. count is the number of workers 
to spawn on the node, and defaults to 1. The 
optional bind-to bind_addr[:port] specifies the ip-address and port that 
other workers should use to connect to this worker.*

This is what I think I have understood so far:

Ok I list the machines on a machine file, that's easy, I have a file like 
this:

n user@555.555.555.555
n user@555.555.555.556
n user@555.555.555.555


*The machines defined in file must be accessible via a 
passwordless ssh login,*

This is the part that is difficult for me the most, it says that machines 
must be accesible via paswordless ssh

* with Julia installed at the same location as the current host.*

I understand this as I need to install Julia en every node in the same 
location, so I have 20 nodes, same software and hardware stacks. Does this 
means that the nodes must be of the same operating system? the same bits 
(32/64) only?

Right now I have *20 CentOS 6.7 (64 bits)* nodes with* julia-0.3.11* 
installed from the *generic linux binaries (64bits)*, all of them installed 
at */opt/julia-0.3.11/bin* (added to the PATH and already exported in 
/etc/profile)

Now the plan in my mind is to use my laptop *(windows 7 64 bits, 
julia-0.3.11 64 bits)* as master node and control the cluster with that, so 
according to what I understand, I'll need to do (leaving password blank):

ssh-keygen -t rsa


>From my Windows laptop (I plan to install Arch Linux soon), in order to create 
>my ssh key and then:


cat ~/.ssh/id_rsa.pub | ssh user@hostname 'cat >> .ssh/authorized_keys'



To every node? So I have to be running the ssh server at every one of them? (I 
understand I'll need it at the master node) This is where I simply don't 
understand anymore, I haven't seen any tutorial, or article, or something like 
that, just that paragraph in the manual, I know there is ClusterManagers.jl but 
that sounds even more complicated for me right now.


I also want to help David Sanders to set up another cluster (once I got this 
figured out) in his lab at Science Faculty, UNAM. I promise to enhance the 
documentation around this topic once I understand this.


What do you guys think, do I have it all wrong?


If anyone can help me, I'll be very grateful, thank's in advance!



[julia-users] Re: Optimal Control using Dynamic Programming

2015-09-25 Thread Alex Dowling
I'm also bias to recommend formulating a nonlinear programming problem and 
using JuMP with IPOPT. This approach has been successfully demonstrated in 
the chemical engineering controls/systems literature on some rather nasty 
large nonlinear systems.

Here is a sample problem for nonlinear control of a chemical reactor using 
the discretized NLP approach in GAMS:
http://cepac.cheme.cmu.edu/pasi2011/library/biegler/hicks.pdf


[julia-users] Large HDF5 matrix multiplication

2015-09-25 Thread Jim Garrison
I have a very large, dense matrix (too large to fit in RAM) "A" saved in
an HDF5/JLD file.  I also have several vectors of the same dimension
v[1]..v[n], which *are* able to fit in memory, and I would like to know
the result of multiplying each vector by my matrix A.

My current idea is to do this manually -- simply loading each row or
column from the matrix dataset, one at a time, and implementing
matrix-vector multiplication myself.  However, it is possible that my
large matrix is already stored is some sort of "chunked"/block form in
the HDF5 file, and it would be nice to choose my blocks accordingly so
the calculation happens as efficiently as possible.  Is there a way to
load all blocks of an HDF5 dataset in the most efficient way?

In terms of the bigger picture, I've also considered that it might be
nice to implement in JLD all general matrix-matrix and matrix-vector
operations for JldDataset (which would throw an error when the
dimensions of the objects do not match, or when the data types do not
make sense for multiplication).  But I could also see this being an
unwelcome "feature," as it would be quite easy to accidentally call this
even when it is possible to load the matrix into memory.  (Also, it
would not be the most efficient way to handle my problem, as it would
involve loading the dataset n times, once for each vector v[i].)



[julia-users] Re: Large HDF5 matrix multiplication

2015-09-25 Thread Steven G. Johnson
What you are asking for is called an "out of core" matrix-multiplication 
algorithm.  If you google for it, you'll find several papers on this.  The 
key (as is also true for in-memory matrix operations), is to maximize 
memory locality.

However, there doesn't seem to be much free code available for this 
problem.  My suspicion is that it is not so popular because:

1) If your problem doesn't fit in memory, these days the first choice is 
usually to go to a distributed-memory cluster rather than hitting the disk.
2) The cubic scaling of matrix-matrix products means that you can't 
increase the size too much anyway.  If you give me 1000x more processing 
power, I can handle a 10x bigger matrix rank (assuming dense matrices).

PS. HDF5 lets you specify how an array is "chunked" for storage, and lets 
you read back subsets of an array at a time.  All of this functionality is 
exposed in HDF5.jl, I believe.  Possibly it would be more efficient to 
memory-map the array and let the OS deal with paging it in and out of 
memory.  Note that Julia matrices are stored in column-major format 
(contiguous columns stored one after another), so you'll want to access the 
matrix column-by-column in your matrix-vector products.


Re: [julia-users] Re: Crowdsourced Julia development

2015-09-25 Thread Tero Frondelius
I don't know, if I made the right conclusion, but it looks like this guy 
made 27 k$ in a month: https://www.bountysource.com/people/34958-arigo 

On Friday, September 25, 2015 at 7:55:16 PM UTC+3, Stefan Karpinski wrote:
>
> Is anyone aware of success stories from open source bounties? Or bad 
> stories for that matter?
>
> On Fri, Sep 25, 2015 at 12:35 PM, Uwe Fechner  > wrote:
>
>> I just created a bounty for implementing a low latency garbage collector:
>>
>> https://www.bountysource.com/issues/5020251-implement-a-low-latency-incremental-garbage-collector
>>
>> Uwe
>>
>>
>> Am Freitag, 25. September 2015 17:31:11 UTC+2 schrieb Jonathan Malmaud:
>>>
>>> $5 to the first person to take transposes seriously 
>>> https://www.bountysource.com/issues/1333116-taking-vector-transposes-seriously/backers
>>>
>>> On Friday, September 25, 2015 at 10:45:30 AM UTC-4, Tom Breloff wrote:

 Moving the discussion from the matlab thread...

 The idea was brought up about being able to contribute money to package 
 development to motivate developers... a quick search brought up this: 
 https://www.bountysource.com/

 Does anyone have any experience with this?  Are there other similar 
 options?  Are there users out there that would pledge money for specific 
 bug fixes and functionality right now?  

>>>
>

[julia-users] Pkg.[update()/install()/build()] woes on Windows 10 64 bit

2015-09-25 Thread Evan Fields
I've been encountering problems with packages. Here's what happened:

   - I installed Julia 0.3.11 via the 64 bit .exe on julialang.org
   - Changed the install path to C:\Julia-0.3.11 but otherwise all default 
   options
   - On Windows 10 x64, not using Cygwin or related
   - Right after install I opened a Julia terminal window; I had the 
   session below.

The errors are shown in the session below. I've tried
- Running as an administrator
- Running git config --global url."https://".insteadOf git:// in shell mode
- Running Pkg.init() (already initialized)
- Trying to clone a repository in Julia/Git using the git-bash there (it 
worked over https)

   _   _ _(_)_ |  A fresh approach to technical computing
  (_) | (_) (_)|  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.3.11 (2015-07-27 06:18 UTC)
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
|__/   |  x86_64-w64-mingw32

julia> Pkg.add("Images")
INFO: Nothing to be done
INFO: METADATA is out-of-date — you may not have the latest version of Images
INFO: Use `Pkg.update()` to get the latest versions of your packages

julia> Pkg.update()
INFO: Updating METADATA...
Checking out files: 100% (1627/1627), done.
INFO: Updating cache of Hexagons...
INFO: Updating cache of Gadfly...
INFO: Updating cache of ArrayViews...
INFO: Updating cache of Lazy...
INFO: Updating cache of ImmutableArrays...
INFO: Updating cache of Graphics...
INFO: Updating cache of StatsBase...
INFO: Updating cache of Requires...
INFO: Updating cache of MacroTools...
INFO: Updating cache of NaNMath...
INFO: Updating cache of FactCheck...
INFO: Updating cache of DataArrays...
INFO: Updating cache of Grid...
INFO: Updating cache of Loess...
INFO: Updating cache of Compat...
INFO: Updating cache of FixedPointNumbers...
INFO: Updating cache of WoodburyMatrices...
INFO: Updating cache of Compose...
INFO: Updating cache of JuliaParser...
INFO: Updating cache of Iterators...
INFO: Updating cache of JSON...
INFO: Updating cache of DataFrames...
INFO: Updating cache of GZip...
INFO: Updating cache of Reexport...
INFO: Updating cache of Showoff...
INFO: Updating cache of Distributions...
INFO: Updating cache of Optim...
INFO: Updating cache of Color...
INFO: Updating cache of SortingAlgorithms...
INFO: Updating cache of Docile...
INFO: Updating cache of Calculus...
INFO: Updating cache of PDMats...
INFO: Updating cache of DualNumbers...
INFO: Updating cache of DataStructures...
INFO: Updating cache of Jewel...
ERROR: couldn't update C:\Users\ejfie\.julia\v0.3\.cache\Hexagons using `git 
remote update`
 in wait at task.jl:284
 in wait at task.jl:194
 in wait at task.jl:48
 in sync_end at task.jl:311
 in update at pkg/entry.jl:319
 in anonymous at pkg/dir.jl:28
 in cd at file.jl:30
 in cd at pkg/dir.jl:28
 in update at pkg.jl:41

julia> using Images
ERROR: Images not properly installed. Please run Pkg.build("Images") then 
restart Julia.
 in error at error.jl:21 (repeats 2 times)
while loading C:\Users\ejfie\.julia\v0.3\Images\src\ioformats/libmagickwand.jl, 
in expression starting on line 31
while loading C:\Users\ejfie\.julia\v0.3\Images\src\Images.jl, in expression 
starting on line 38

julia> Pkg.build("Images")
INFO: Building Images
=[ ERROR: Images 
]=


type Nothing has no field match
while loading C:\Users\ejfie\.julia\v0.3\Images\deps\build.jl, in expression 
starting on line 37

===


=[ BUILD ERRORS 
]==


WARNING: Images had build errors.

 - packages with build errors remain installed in C:\Users\ejfie\.julia\v0.3
 - build the package(s) and all dependencies with `Pkg.build("Images")`
 - build a single package by running its `deps/build.jl` script

===


julia>


Hopefully I'm missing something simple here! Any suggestion?


[julia-users] Re: Emacs, ESS and julia-mode

2015-09-25 Thread David Ellison
For what it's worth, my pull request to ESS to add support for using '?' in 
the Julia REPL for documentation lookup was merged into master earlier this 
week, so if you update, that should work now! The docstring comes up in a 
new help buffer (like ESS's R REPL) rather than just being printed like in 
Julia's native REPL. Also, the prompt doesn't change to help?>... it seemed 
to be a Julia trick, so I didn't really spend much time trying to get it to 
work.

I was also pretty unhappy about the help() function disappearing in 0.4, 
but I learned that you can use the @doc macro just as easily.

E.g. 

julia> @doc fft

instead of

julia> help(fft)

I hope this is helpful to some of you!

Regarding having a Swank/SLIME-like backend, I think this would be really 
cool and would be very interested in contributing, if I can. But I don't 
really have any experience designing or implementing something like that.


[julia-users] Re: Same native code, different performance

2015-09-25 Thread TY
Out of curiosity, I tried the following one (on julia 0.4-rc1)

  f(x) = ( c = cos(x); c^3 )
  f_float(x) = ( c = cos(x); c^3.0 )

then I get
  0.006489 seconds
  0.013220 seconds

but with the original code, I get
  0.076714 seconds
  0.013280 seconds

(both without @fastmath)


Re: [julia-users] Re: Optimal Control using Dynamic Programming

2015-09-25 Thread Tony Kelman
If you want an uninitialized 61-by-61 array of double precision floating point 
numbers you can do Array(61, 61)

If you want the array initialized to zero you can call zeros(61, 61)

A few for loops should accomplish what you're after here. Depending how 
expenaive your cost function is to evaluate this doesn't sound very big at all. 
How many state and input dimensions do you have?

Re: [julia-users] Re: Optimal Control using Dynamic Programming

2015-09-25 Thread Narayani Vedam
I have 3 states and two inputs. State 1 is [10:1:20], state 2 is
[85:0.2:95] and state 3 is [1:1:12]. The two inputs are [0 1] and [-1 0].
On Sep 25, 2015 1:00 PM, "Tony Kelman"  wrote:

> If you want an uninitialized 61-by-61 array of double precision floating
> point numbers you can do Array(61, 61)
>
> If you want the array initialized to zero you can call zeros(61, 61)
>
> A few for loops should accomplish what you're after here. Depending how
> expenaive your cost function is to evaluate this doesn't sound very big at
> all. How many state and input dimensions do you have?


Re: [julia-users] Stateflow equivalent in Julia

2015-09-25 Thread Miles Lubin
It's not too clear to me what's trying to be accomplished here, but "gear" 
and "N" are optimization variables and can't be used inside conditional 
statements. You can use getValue() to query the value of the variables in 
an optimal solution after calling solve(). If these statements are supposed 
to be constraints in the optimization problem, you'll have to reformulate 
them into standard nonlinear programming form, possibly with the addition 
of integer variables to model logical relationships.

On Friday, September 25, 2015 at 10:22:15 AM UTC-4, NV wrote:
>
> Yes, I have a transmission model to implement. I used the following code. 
> But I need it to run for as long as I have initialized the time variable to.
>
> using JuMP, Ipopt
> Truck = Model(solver=IpoptSolver(print_level=0))
> #Initial Values
> gear_0 = 1
> v_0 = 20
> N_0 = 600
> #Constants:
> i_f = 3.27
> eta_f = 0.95
> eta_t = 0.95
> r_w = 0.52
> i = [11.27; 9.14; 7.17; 5.81; 4.62; 3.75; 3.01; 2.44; 1.91; 1.55; 1.23; 1]
> #Discretization
> n = 500
> @defVar(Truck,Δt≥0,start = 1/n)
> @defNLExpr(t_f,Δt*n)
> @defVar(Truck,600<=N[1:n]<=2500)
> @defVar(Truck,1<=gear[1:n]<=12)
> @defVar(Truck,i_t[1:n])
> @addConstraint(Truck,N[0]==N_0)
> @addConstraint(Truck,gear[0]==gear_0)
> @addConstraint(Truck,i_t[0]==i[1])
> @defNLExpr(N[j=0:n],(30*i_t[j]*i_f)/(pi*r_w))
> for j in 1:1:n
> if(gear[j]==1)
> if(N[j]>=1500)
> gear[j+1]= 2
> else
> gear[j+1] = 1
> end
> elseif(gear[j]==2)
> if(N[j]>=1501)
> gear[j+1] = 3
> elseif(N[j]<=950)
> gear[j+1]= 1
> else
> gear[j+1] = 2
> end
> elseif(gear[j]==3)
> if(N[j]>=1502)
> gear[j+1] = 4
> elseif(N[j]<=960)
> gear[j+1] = 2
> else
> gear[j+1] = 3
> end
> elseif(gear[j]==4)
> if(N[j]>=1503)
> gear[j+1] = 5;
> elseif(N[j]<=970)
> gear[j+1] = 3
> else
> gear[j+1] = 4
> end
> elseif(gear[j]==5)
> if(N[]>=1504)
> gear[j+1] = 6;
> elseif(N[j]<=980)
> gear[j+1] = 4
> else
> gear[j+1] = 5
> end
> elseif(gear[j]==6)
> if(N[j]>=1505)
> gear[j+1] = 7
> elseif(N[j]<=990)
> gear[j+1] = 5
> else
> gear[j+1] = 6
> end
> elseif(gear[j]==7)
> if(N[j]>=1497)
> gear[j+1] = 8
> elseif(N[j]<=1000)
> gear[j+1] = 6
> else
> gear[j+1] = 7
> end
> elseif(gear[j]==8)
> if(N[j]>=1489)
> gear[j+1] = 9
> elseif(N[j]<=1006)
> gear[j+1] = 7
> else
> gear[j+1] = 8
> end
> elseif(gear[j]==9)
> if(N[j]>=1481)
> gear[j+1] = 10
> elseif(N[j]<=1012)
> gear[j+1] = 8
> else
> gear[j+1] = 9
> end
> elseif(gear[j]==10)
> if(N[j]>=1473)
> gear[j+1] = 11
> elseif(N[j]<=1018)
> gear[j+1] = 9
> else
> gear[j+1] = 10
> end
> elseif(gear[j]==11)
> if(N[j]>=1465)
> gear[j+1] = 12
> elseif(N[j]<=1024)
> gear[j+1] = 10
> else
> gear[j+1] = 11
> end 
> elseif(gear[j]==12)
> if(N[j]<=1030)
> gear[j+1] = 11
> else
> gear[j+1] = 12
> end
> end   
> i_t[j] = i[gear[j+1]]
> end
>
> To solve for the system dynamics, I am following the example in 
> http://www.juliaopt.org/notebooks/JuMP-Rocket.html . I tried passing gear 
> position(gear), engine rpm(N) and transmission ratio(i_t) as variables and 
> have added the necessary constraints as well. However, on trying to run it, 
> I kept getting an error:
>
>
> The comparison operator == has been deprecated for constructing constraints. 
> Use the macro form @addConstraint instead.
>
>
> LoadError: TypeError: non-boolean 
> (JuMP.GenericRangeConstraint{JuMP.GenericAffExpr{Float64,JuMP.Variable}}) 
> used in boolean context
> while loading In[2], in expression starting on line 30
>
>  in anonymous at no file
>
>
> On Friday, 25 September 2015 08:18:53 UTC-5, Spencer Russell wrote:
>>
>> Welcome to Julia! 
>>
>> To get useful answers you’re going to need to provide quite a bit more 
>> detail on what problems you’re running into. What did you try? What errors 
>> are you getting? Are there specific concepts from the documentation that 
>> you’re having trouble with? 
>>
>> -s 
>>
>> > On Sep 25, 2015, at 1:18 AM, Narayani Vedam  
>> wrote: 
>> > 
>> > Hi, 
>> >I am new to Julia. I tried implementing a logic that I had in 
>> Simulink - Stateflow using Julia, but ran into trouble. Any heads-up on 
>> this? 
>> > 
>> > Thank you 
>>
>>

[julia-users] Re: Crowdsourced Julia development

2015-09-25 Thread Uwe Fechner
I just created a bounty for implementing a low latency garbage collector:
https://www.bountysource.com/issues/5020251-implement-a-low-latency-incremental-garbage-collector

Uwe

Am Freitag, 25. September 2015 17:31:11 UTC+2 schrieb Jonathan Malmaud:
>
> $5 to the first person to take transposes seriously 
> https://www.bountysource.com/issues/1333116-taking-vector-transposes-seriously/backers
>
> On Friday, September 25, 2015 at 10:45:30 AM UTC-4, Tom Breloff wrote:
>>
>> Moving the discussion from the matlab thread...
>>
>> The idea was brought up about being able to contribute money to package 
>> development to motivate developers... a quick search brought up this: 
>> https://www.bountysource.com/
>>
>> Does anyone have any experience with this?  Are there other similar 
>> options?  Are there users out there that would pledge money for specific 
>> bug fixes and functionality right now?  
>>
>

Re: [julia-users] Re: Crowdsourced Julia development

2015-09-25 Thread Stefan Karpinski
Is anyone aware of success stories from open source bounties? Or bad
stories for that matter?

On Fri, Sep 25, 2015 at 12:35 PM, Uwe Fechner 
wrote:

> I just created a bounty for implementing a low latency garbage collector:
>
> https://www.bountysource.com/issues/5020251-implement-a-low-latency-incremental-garbage-collector
>
> Uwe
>
>
> Am Freitag, 25. September 2015 17:31:11 UTC+2 schrieb Jonathan Malmaud:
>>
>> $5 to the first person to take transposes seriously
>> https://www.bountysource.com/issues/1333116-taking-vector-transposes-seriously/backers
>>
>> On Friday, September 25, 2015 at 10:45:30 AM UTC-4, Tom Breloff wrote:
>>>
>>> Moving the discussion from the matlab thread...
>>>
>>> The idea was brought up about being able to contribute money to package
>>> development to motivate developers... a quick search brought up this:
>>> https://www.bountysource.com/
>>>
>>> Does anyone have any experience with this?  Are there other similar
>>> options?  Are there users out there that would pledge money for specific
>>> bug fixes and functionality right now?
>>>
>>


[julia-users] Re: Optimal Control using Dynamic Programming

2015-09-25 Thread cdm

you may find the Julia interface to apmonitor useful:

https://groups.google.com/forum/#!searchin/julia-opt/apmonitor/julia-opt/y5sc_xtLJfk/PKNBik_A82AJ


good luck,

cdm


On Thursday, September 24, 2015 at 10:25:19 PM UTC-7, NV wrote:
>
> Hi,
>   I am new to Julia. I need to solve an optimal control problem using 
> dynamic programming. Are there pre-defined functions/packages that I could 
> use?
>
> Thanks.
>


Re: [julia-users] Large HDF5 matrix multiplication

2015-09-25 Thread Erik Schnetter
Some background information about HDF5 and chunking:

HDF5 supports chunking of datasets. If you look at an HDF5 file via h5ls or
h5dump, you should see the chunk size. "Chunking" means that the data are
not stored contiguously,  but in terms of chunks with a certain size (e.g.
100x100 elements); each chunk is stored contiguously, but the chunks
themselves are stored (I think) in a B-tree. To create chunks, one needs to
explicitly request that when the dataset is created; Julia's HDF5 module
supports this (don't know whether this is passed through to JLD). There are
also ways to post-process HDF5 files via command line tools such as
"h5repack" to add chunking or compression. If data are not chunked, then it
is very important whether you read the data by rows or in columns. (I
assume you know this since you asked about chunking.)

I don't think there exists a way to iterate over a matrix in an HDF5 file
via chunks. You'll probably have to roll your own. After obtaining the
chunk size of a dataset, you'd probably use the "getindex" function on the
HDF5 dataset to read each chunk.

-erik


On Fri, Sep 25, 2015 at 5:30 PM, Jim Garrison  wrote:

> I have a very large, dense matrix (too large to fit in RAM) "A" saved in
> an HDF5/JLD file.  I also have several vectors of the same dimension
> v[1]..v[n], which *are* able to fit in memory, and I would like to know
> the result of multiplying each vector by my matrix A.
>
> My current idea is to do this manually -- simply loading each row or
> column from the matrix dataset, one at a time, and implementing
> matrix-vector multiplication myself.  However, it is possible that my
> large matrix is already stored is some sort of "chunked"/block form in
> the HDF5 file, and it would be nice to choose my blocks accordingly so
> the calculation happens as efficiently as possible.  Is there a way to
> load all blocks of an HDF5 dataset in the most efficient way?
>
> In terms of the bigger picture, I've also considered that it might be
> nice to implement in JLD all general matrix-matrix and matrix-vector
> operations for JldDataset (which would throw an error when the
> dimensions of the objects do not match, or when the data types do not
> make sense for multiplication).  But I could also see this being an
> unwelcome "feature," as it would be quite easy to accidentally call this
> even when it is possible to load the matrix into memory.  (Also, it
> would not be the most efficient way to handle my problem, as it would
> involve loading the dataset n times, once for each vector v[i].)
>
>


-- 
Erik Schnetter 
http://www.perimeterinstitute.ca/personal/eschnetter/


Re: [julia-users] Re: Pkg.[update()/install()/build()] woes on Windows 10 64 bit

2015-09-25 Thread Tony Kelman
What is it? A cache. Other than that, no idea what it accomplishes (aside 
from reading the code to find out) or why it works the way it does. It was 
added 
in 
https://github.com/JuliaLang/julia/commit/df7a08893e4402182ec64178ffdb3130aa228943
 
but there are no design docs on the package manager. Ask Stefan.

.cache moved to being shared between different versioned package 
directories on 0.4 because of https://github.com/JuliaLang/julia/pull/7361. 
It worked that way on unix in 0.3 as well. With better support for making 
directory junctions via the symlink function (which was still a pretty new 
feature when 0.3.0 was released), that PR made the behavior consistent on 
Windows as well.


On Friday, September 25, 2015 at 5:10:50 PM UTC-7, David Anthoff wrote:
>
> What is the .cache directory actually? And why is it moved into the 
> ~\.julia folder for 0.4?
>
>  
>
> *From:* julia...@googlegroups.com  [mailto:
> julia...@googlegroups.com ] *On Behalf Of *Tony Kelman
> *Sent:* Friday, September 25, 2015 2:35 PM
> *To:* julia-users 
> *Subject:* [julia-users] Re: Pkg.[update()/install()/build()] woes on 
> Windows 10 64 bit
>
>  
>
> Try deleting everything in C:\Users\ejfie\.julia\v0.3\.cache  - something 
> might be corrupt there
>
>
> On Friday, September 25, 2015 at 12:29:14 PM UTC-7, Evan Fields wrote:
>
> I've been encountering problems with packages. Here's what happened:
>
>- I installed Julia 0.3.11 via the 64 bit .exe on julialang.org
>- Changed the install path to C:\Julia-0.3.11 but otherwise all 
>default options
>- On Windows 10 x64, not using Cygwin or related
>- Right after install I opened a Julia terminal window; I had the 
>session below.
>
> The errors are shown in the session below. I've tried
>
> - Running as an administrator
>
> - Running git config --global url."https://".insteadOf git:// in shell 
> mode
>
> - Running Pkg.init() (already initialized)
>
> - Trying to clone a repository in Julia/Git using the git-bash there (it 
> worked over https)
>
>  
>
>_   _ _(_)_ |  A fresh approach to technical computing
>
>   (_) | (_) (_)|  Documentation: http://docs.julialang.org
>
>_ _   _| |_  __ _   |  Type "help()" for help.
>
>   | | | | | | |/ _` |  |
>
>   | | |_| | | | (_| |  |  Version 0.3.11 (2015-07-27 06:18 UTC)
>
>  _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
>
> |__/   |  x86_64-w64-mingw32
>
>  
>
> julia> Pkg.add("Images")
>
> INFO: Nothing to be done
>
> INFO: METADATA is out-of-date — you may not have the latest version of Images
>
> INFO: Use `Pkg.update()` to get the latest versions of your packages
>
>  
>
> julia> Pkg.update()
>
> INFO: Updating METADATA...
>
> Checking out files: 100% (1627/1627), done.
>
> INFO: Updating cache of Hexagons...
>
> INFO: Updating cache of Gadfly...
>
> INFO: Updating cache of ArrayViews...
>
> INFO: Updating cache of Lazy...
>
> INFO: Updating cache of ImmutableArrays...
>
> INFO: Updating cache of Graphics...
>
> INFO: Updating cache of StatsBase...
>
> INFO: Updating cache of Requires...
>
> INFO: Updating cache of MacroTools...
>
> INFO: Updating cache of NaNMath...
>
> INFO: Updating cache of FactCheck...
>
> INFO: Updating cache of DataArrays...
>
> INFO: Updating cache of Grid...
>
> INFO: Updating cache of Loess...
>
> INFO: Updating cache of Compat...
>
> INFO: Updating cache of FixedPointNumbers...
>
> INFO: Updating cache of WoodburyMatrices...
>
> INFO: Updating cache of Compose...
>
> INFO: Updating cache of JuliaParser...
>
> INFO: Updating cache of Iterators...
>
> INFO: Updating cache of JSON...
>
> INFO: Updating cache of DataFrames...
>
> INFO: Updating cache of GZip...
>
> INFO: Updating cache of Reexport...
>
> INFO: Updating cache of Showoff...
>
> INFO: Updating cache of Distributions...
>
> INFO: Updating cache of Optim...
>
> INFO: Updating cache of Color...
>
> INFO: Updating cache of SortingAlgorithms...
>
> INFO: Updating cache of Docile...
>
> INFO: Updating cache of Calculus...
>
> INFO: Updating cache of PDMats...
>
> INFO: Updating cache of DualNumbers...
>
> INFO: Updating cache of DataStructures...
>
> INFO: Updating cache of Jewel...
>
> ERROR: couldn't update C:\Users\ejfie\.julia\v0.3\.cache\Hexagons using `git 
> remote update`
>
>  in wait at task.jl:284
>
>  in wait at task.jl:194
>
>  in wait at task.jl:48
>
>  in sync_end at task.jl:311
>
>  in update at pkg/entry.jl:319
>
>  in anonymous at pkg/dir.jl:28
>
>  in cd at file.jl:30
>
>  in cd at pkg/dir.jl:28
>
>  in update at pkg.jl:41
>
>  
>
> julia> using Images
>
> ERROR: Images not properly installed. Please run Pkg.build("Images") then 
> restart Julia.
>
>  in error at error.jl:21 (repeats 2 times)
>
> while loading 
> C:\Users\ejfie\.julia\v0.3\Images\src\ioformats/libmagickwand.jl, in 
> expression starting on line 31
>
> while loading C:\Users\ejfie\.julia\v0.3\Images\src\Images.jl, in expression 
> starting on line 38
>
>  

RE: [julia-users] Re: Pkg.[update()/install()/build()] woes on Windows 10 64 bit

2015-09-25 Thread David Anthoff
What is the .cache directory actually? And why is it moved into the ~\.julia 
folder for 0.4?

 

From: julia-users@googlegroups.com [mailto:julia-users@googlegroups.com] On 
Behalf Of Tony Kelman
Sent: Friday, September 25, 2015 2:35 PM
To: julia-users 
Subject: [julia-users] Re: Pkg.[update()/install()/build()] woes on Windows 10 
64 bit

 

Try deleting everything in C:\Users\ejfie\.julia\v0.3\.cache  - something might 
be corrupt there


On Friday, September 25, 2015 at 12:29:14 PM UTC-7, Evan Fields wrote:

I've been encountering problems with packages. Here's what happened:

*   I installed Julia 0.3.11 via the 64 bit .exe on julialang.org 
 
*   Changed the install path to C:\Julia-0.3.11 but otherwise all default 
options
*   On Windows 10 x64, not using Cygwin or related
*   Right after install I opened a Julia terminal window; I had the session 
below.

The errors are shown in the session below. I've tried

- Running as an administrator

- Running git config --global url."https://".insteadOf git:// in shell mode

- Running Pkg.init() (already initialized)

- Trying to clone a repository in Julia/Git using the git-bash there (it worked 
over https)

 

   _   _ _(_)_ |  A fresh approach to technical computing
  (_) | (_) (_)|  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.3.11 (2015-07-27 06:18 UTC)
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
|__/   |  x86_64-w64-mingw32
 
julia> Pkg.add("Images")
INFO: Nothing to be done
INFO: METADATA is out-of-date — you may not have the latest version of Images
INFO: Use `Pkg.update()` to get the latest versions of your packages
 
julia> Pkg.update()
INFO: Updating METADATA...
Checking out files: 100% (1627/1627), done.
INFO: Updating cache of Hexagons...
INFO: Updating cache of Gadfly...
INFO: Updating cache of ArrayViews...
INFO: Updating cache of Lazy...
INFO: Updating cache of ImmutableArrays...
INFO: Updating cache of Graphics...
INFO: Updating cache of StatsBase...
INFO: Updating cache of Requires...
INFO: Updating cache of MacroTools...
INFO: Updating cache of NaNMath...
INFO: Updating cache of FactCheck...
INFO: Updating cache of DataArrays...
INFO: Updating cache of Grid...
INFO: Updating cache of Loess...
INFO: Updating cache of Compat...
INFO: Updating cache of FixedPointNumbers...
INFO: Updating cache of WoodburyMatrices...
INFO: Updating cache of Compose...
INFO: Updating cache of JuliaParser...
INFO: Updating cache of Iterators...
INFO: Updating cache of JSON...
INFO: Updating cache of DataFrames...
INFO: Updating cache of GZip...
INFO: Updating cache of Reexport...
INFO: Updating cache of Showoff...
INFO: Updating cache of Distributions...
INFO: Updating cache of Optim...
INFO: Updating cache of Color...
INFO: Updating cache of SortingAlgorithms...
INFO: Updating cache of Docile...
INFO: Updating cache of Calculus...
INFO: Updating cache of PDMats...
INFO: Updating cache of DualNumbers...
INFO: Updating cache of DataStructures...
INFO: Updating cache of Jewel...
ERROR: couldn't update C:\Users\ejfie\.julia\v0.3\.cache\Hexagons using `git 
remote update`
 in wait at task.jl:284
 in wait at task.jl:194
 in wait at task.jl:48
 in sync_end at task.jl:311
 in update at pkg/entry.jl:319
 in anonymous at pkg/dir.jl:28
 in cd at file.jl:30
 in cd at pkg/dir.jl:28
 in update at pkg.jl:41
 
julia> using Images
ERROR: Images not properly installed. Please run Pkg.build("Images") then 
restart Julia.
 in error at error.jl:21 (repeats 2 times)
while loading C:\Users\ejfie\.julia\v0.3\Images\src\ioformats/libmagickwand.jl, 
in expression starting on line 31
while loading C:\Users\ejfie\.julia\v0.3\Images\src\Images.jl, in expression 
starting on line 38
 
julia> Pkg.build("Images")
INFO: Building Images
=[ ERROR: Images 
]=
 
 
type Nothing has no field match
while loading C:\Users\ejfie\.julia\v0.3\Images\deps\build.jl, in expression 
starting on line 37
 
===
 
 
=[ BUILD ERRORS 
]==
 
 
WARNING: Images had build errors.
 
 - packages with build errors remain installed in C:\Users\ejfie\.julia\v0.3
 - build the package(s) and all dependencies with `Pkg.build("Images")`
 - build a single package by running its `deps/build.jl` script
 
===
 
 
julia>

 

Hopefully I'm missing something simple here! Any suggestion?



RE: [julia-users] Re: Pkg.[update()/install()/build()] woes on Windows 10 64 bit

2015-09-25 Thread David Anthoff
Stefan, any pointers about this design?

 

I sometimes delete the folder of a package and then reinstall it with 
Pkg.update() if something got screwed up. Do I have to manually manage what is 
going on in .cache in that case as well?

 

Thanks,

David

 

From: julia-users@googlegroups.com [mailto:julia-users@googlegroups.com] On 
Behalf Of Tony Kelman
Sent: Friday, September 25, 2015 5:46 PM
To: julia-users 
Subject: Re: [julia-users] Re: Pkg.[update()/install()/build()] woes on Windows 
10 64 bit

 

What is it? A cache. Other than that, no idea what it accomplishes (aside from 
reading the code to find out) or why it works the way it does. It was added in 
https://github.com/JuliaLang/julia/commit/df7a08893e4402182ec64178ffdb3130aa228943
 but there are no design docs on the package manager. Ask Stefan.

 

.cache moved to being shared between different versioned package directories on 
0.4 because of https://github.com/JuliaLang/julia/pull/7361. It worked that way 
on unix in 0.3 as well. With better support for making directory junctions via 
the symlink function (which was still a pretty new feature when 0.3.0 was 
released), that PR made the behavior consistent on Windows as well.



On Friday, September 25, 2015 at 5:10:50 PM UTC-7, David Anthoff wrote:

What is the .cache directory actually? And why is it moved into the ~\.julia 
folder for 0.4?

 

From:   julia...@googlegroups.com [mailto:  
julia...@googlegroups.com] On Behalf Of Tony Kelman
Sent: Friday, September 25, 2015 2:35 PM
To: julia-users <  julia...@googlegroups.com>
Subject: [julia-users] Re: Pkg.[update()/install()/build()] woes on Windows 10 
64 bit

 

Try deleting everything in C:\Users\ejfie\.julia\v0.3\.cache  - something might 
be corrupt there


On Friday, September 25, 2015 at 12:29:14 PM UTC-7, Evan Fields wrote:

I've been encountering problems with packages. Here's what happened:

* I installed Julia 0.3.11 via the 64 bit .exe on  
 julialang.org

*   Changed the install path to C:\Julia-0.3.11 but otherwise all default 
options

* On Windows 10 x64, not using Cygwin or related

*   Right after install I opened a Julia terminal window; I had the session 
below.

The errors are shown in the session below. I've tried

- Running as an administrator

- Running git config --global url."https://".insteadOf git:// in shell mode

- Running Pkg.init() (already initialized)

- Trying to clone a repository in Julia/Git using the git-bash there (it worked 
over https)

 

   _   _ _(_)_ |  A fresh approach to technical computing
  (_) | (_) (_)|  Documentation:   
http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.3.11 (2015-07-27 06:18 UTC)
 _/ |\__'_|_|_|\__'_|  |  Official   
http://julialang.org/ release
|__/   |  x86_64-w64-mingw32
 
julia> Pkg.add("Images")
INFO: Nothing to be done
INFO: METADATA is out-of-date — you may not have the latest version of Images
INFO: Use `Pkg.update()` to get the latest versions of your packages
 
julia> Pkg.update()
INFO: Updating METADATA...
Checking out files: 100% (1627/1627), done.
INFO: Updating cache of Hexagons...
INFO: Updating cache of Gadfly...
INFO: Updating cache of ArrayViews...
INFO: Updating cache of Lazy...
INFO: Updating cache of ImmutableArrays...
INFO: Updating cache of Graphics...
INFO: Updating cache of StatsBase...
INFO: Updating cache of Requires...
INFO: Updating cache of MacroTools...
INFO: Updating cache of NaNMath...
INFO: Updating cache of FactCheck...
INFO: Updating cache of DataArrays...
INFO: Updating cache of Grid...
INFO: Updating cache of Loess...
INFO: Updating cache of Compat...
INFO: Updating cache of FixedPointNumbers...
INFO: Updating cache of WoodburyMatrices...
INFO: Updating cache of Compose...
INFO: Updating cache of JuliaParser...
INFO: Updating cache of Iterators...
INFO: Updating cache of JSON...
INFO: Updating cache of DataFrames...
INFO: Updating cache of GZip...
INFO: Updating cache of Reexport...
INFO: Updating cache of Showoff...
INFO: Updating cache of Distributions...
INFO: Updating cache of Optim...
INFO: Updating cache of Color...
INFO: Updating cache of SortingAlgorithms...
INFO: Updating cache of Docile...
INFO: Updating cache of Calculus...
INFO: Updating cache of PDMats...
INFO: Updating cache of DualNumbers...
INFO: Updating cache of DataStructures...
INFO: Updating cache of Jewel...
ERROR: couldn't update C:\Users\ejfie\.julia\v0.3\.cache\Hexagons using `git 
remote update`
 in wait at task.jl:284
 in wait at task.jl:194
 in wait at task.jl:48
 in sync_end at task.jl:311
 in update at pkg/entry.jl:319
 in anonymous at pkg/dir.jl:28
 in cd at file.jl:30
 in cd at pkg/dir.jl:28
 in update at pkg.jl:41
 
julia> using Images
ERROR: Images not properly installed. Please run Pkg.build("Images") then 

Re: [julia-users] Is there a tutorial on how to set up my own Julia cluster?

2015-09-25 Thread Spencer Russell
Hi Ismael,

So I don’t actually know anything about setting up a Julia cluster 
specifically, but it sounds like you do indeed need to have an SSH server set 
up on each machine. That’s actually not very uncommon on linux boxes and it’s 
very possible there’s already one running by default.

One useful utility is `ssh-copy-id user@hostname` which will add your default 
public key ($HOME/.ssh/id_rsa.pub) to the authorized_keys list on the remote 
machine. Make sure to use the same remote machine user that you’ll be using 
later to log in from your Julia master node. The nice thing about ssh-copy-id 
is that it won’t add your key twice if you accidentally run it twice for the 
same remote machine.

Hope that’s helpful.

-s


> On Sep 25, 2015, at 5:42 PM, Ismael VC  wrote:
> 
> Hello everyone!
> 
> I am trying to set up a Julia cluster with 20 nodes, this is the very first 
> time I've tried something like this. I have looked around for examples, but 
> documentation is not very helpful for me:
> 
> Julia can be started in parallel mode with either the -p or the --machinefile 
> options. -p n will launch an additional n worker processes, while 
> --machinefile file will launch a worker for each line in file file. The 
> machines defined in file must be accessible via a passwordless ssh login, 
> with Julia installed at the same location as the current host. Each machine 
> definition takes the form [count*][user@]host[:port] [bind_addr[:port]] . 
> user defaults to current user, port to the standard ssh port. count is the 
> number of workers to spawn on the node, and defaults to 1. The optional 
> bind-to bind_addr[:port] specifies the ip-address and port that other workers 
> should use to connect to this worker.
> 
> This is what I think I have understood so far:
> 
> Ok I list the machines on a machine file, that's easy, I have a file like 
> this:
> 
> n user@555.555.555.555
> n user@555.555.555.556
> n user@555.555.555.555
> 
> 
> The machines defined in file must be accessible via a passwordless ssh login,
> 
> This is the part that is difficult for me the most, it says that machines 
> must be accesible via paswordless ssh
> 
>  with Julia installed at the same location as the current host.
> 
> I understand this as I need to install Julia en every node in the same 
> location, so I have 20 nodes, same software and hardware stacks. Does this 
> means that the nodes must be of the same operating system? the same bits 
> (32/64) only?
> 
> Right now I have 20 CentOS 6.7 (64 bits) nodes with julia-0.3.11 installed 
> from the generic linux binaries (64bits), all of them installed at 
> /opt/julia-0.3.11/bin (added to the PATH and already exported in /etc/profile)
> 
> Now the plan in my mind is to use my laptop (windows 7 64 bits, julia-0.3.11 
> 64 bits) as master node and control the cluster with that, so according to 
> what I understand, I'll need to do (leaving password blank):
> 
> ssh-keygen -t rsa
> 
> 
> From my Windows laptop (I plan to install Arch Linux soon), in order to 
> create my ssh key and then:
> 
> cat ~/.ssh/id_rsa.pub | ssh user@hostname 'cat >> .ssh/authorized_keys'
> 
> 
> To every node? So I have to be running the ssh server at every one of them? 
> (I understand I'll need it at the master node) This is where I simply don't 
> understand anymore, I haven't seen any tutorial, or article, or something 
> like that, just that paragraph in the manual, I know there is 
> ClusterManagers.jl but that sounds even more complicated for me right now.
> 
> I also want to help David Sanders to set up another cluster (once I got this 
> figured out) in his lab at Science Faculty, UNAM. I promise to enhance the 
> documentation around this topic once I understand this.
> 
> What do you guys think, do I have it all wrong?
> 
> If anyone can help me, I'll be very grateful, thank's in advance!



[julia-users] Re: Julia equivalent to a static member function in C++/MATLAB

2015-09-25 Thread Eric Forgy
You probably know this, but the way dispatch works in Julia, it will look for a 
function matching the signatures. Since, presumably, MyMatrix is not in base 
Julia, that zeros function will do whatever you want it to do because you have 
yo implement it.

[julia-users] How to import all symbols from a module with @everywhere?

2015-09-25 Thread Ismael VC
Hello everyone!

I have been trying to do some parallel tests with a simple example using 
Images and Colors,  you can see here:

   - http://nbviewer.ipython.org/gist/Ismael-VC/e18bcae78a49f68a0838

ERROR (unhandled task failure): On worker 15:
UndefVarError: Gray not defined


The same on every worker.

It seems that the problem is the way I'm importing the modules? I do:

addprocs(CPU_CORES)


@everywhere importall Images, Colors

@everywhere function procesar_imagen(imagen::AbstractString, σ=2)
imagen₁ = imread(imagen)
imagen₂ = convert(Image{Gray}, imagen₁)
σ₁ = [σ, σ]# un valor de σ por cada dimensión
imagen₃ = imfilter_gaussian(imagen₂, σ₁)
imagen₄ = reinterpret(Float64, data(imagen₃))
return var(imagen₄)
end

y = @time @parallel vcat for i = 1:100
gc()# llamar al recolector de basura
procesar_imagen("imagen.jpg")
end

gc()

y


Thanks in advance.

Cheers!


Re: [julia-users] Re: Request for comments: best way to deal with type uncertainty.

2015-09-25 Thread Milan Bouchet-Valat
Le jeudi 24 septembre 2015 à 17:41 -0700, Ben Ward a écrit :
> As an update: We have tested fetching annotations without trying to
> enforce type, and then another in which we don't. I don't understand
> why, but the one in which we don't enforce type, is faster, it is
> also puzzling for me as the one where we don't enforce type allocates
> memory, and yet is still faster:
Maybe the type assertion triggers some conversion? You can use @code_*
macros to see what's going on for a given set of input types.

Regarding your main post, though, I'm not sure it's really the best
approach. How is passing the type to getannotations() different from
users simply adding the type assertion themselves? If you really want
to make things easier for users, you could even create a typealias to
allow writing ::Annotation{MyType} instead of ::Dict{PhyNode, MyType}.

Also, AFAIK, a type uncertainty in one field doesn't affect code using
only the other fields. So, if annotations are not performance-critical,
I wouldn't bother. That's one of the strengths of Julia: you can also
avoid dealing with types where it's not really needed.

FWIW, your problem is quite similar to that DataFrames are facing. You
could have a look at
https://github.com/JuliaStats/DataFrames.jl/issues/744


Regards


> function getannotations{T}(x::Phylogeny, name::ASCIIString, ::Type{T})
> x.annotations[T][name]::T 
> end
> 
> 
> 
> function getannotations(x::Phylogeny, name::ASCIIString)
> for (k, v) in x.annotations
> if haskey(v, name)
> return(v[name])
>  end
> end
> error("No such key in the phylogeny")
> end
> 
> 
> julia> @time for i in 1:1; a = tree["Node Names", ASCIIString];end
> 
>   0.002090 seconds
> 
> julia> @time for i in 1:1; a = tree["Node Names"]; end
> 
>   0.001367 seconds (10.00 k allocations: 312.500 KB)
> 
> 
> 
> 
>  
> 
> On Thursday, September 24, 2015 at 8:17:52 PM UTC+1, Ben Ward wrote:
> > Hi Julia Users,
> > 
> > I'm one of the Core-Devs in the BioJulia organisation, with a
> > background in evolutionary biology/genetics, and, with a few other
> > contributors I'm writing Bio.jl's Phylo submodule.
> > 
> > The primary type of this submodule is the Phylogeny. Which is a
> > composite type, used to describe a model of evolution. At the very
> > minimum it looks like this:
> > 
> > type PhyNode
> > children::Vector{PhyNode}
> > parent::PhyNode
> > 
> > function PhyNode(children::Vector{PhyNode} = PhyNode[],
> >  parent = nothing)
> > x = new()
> > if parent != nothing
> > graft!(parent, x)
> > else
> > x.parent = x
> > end
> > x.children = PhyNode[]
> > for child in children
> > graft!(x, child)
> > end
> > return x
> > end
> > end
> > 
> > type Phylogeny
> > root::PhyNode
> > rooted::Bool
> > rerootable::Bool
> > 
> > Phylogeny() = new(PhyNode(), false, true)
> > end
> > 
> > PhyNodes are types which link to their children and to their parent
> > - they are the individual objects that form the tree structure. The
> > Phylogeny type describes the overall tree, and contains a variable
> > pointing to a PhyNode that forms the root of the tree, and
> > determines whether the tree is rooted in the phylogenetic sense,
> > and whether the phylogeny is re-rootable. So far so good. We can
> > represent the structure of a phylogeny - a model of how various
> > species are related through history.
> > 
> > Here is where I'd like comments from the julia-users, if possible:
> > With a phylogeny, often additional information is annotated to the
> > tree, like branch lengths, confidence intervals, sequences, labels,
> > colours for plotting, and so on. Well, we can do this with a Dict,
> > and use PhyNodes as keys:
> > 
> > typealias NodeAnnotation{T} Dict{PhyNode, T}
> > 
> > We can then store thee annotations in the Phylogeny type like this:
> > type Phylogeny{S <: AbstractString}
> > root::PhyNode
> > rooted::Bool
> > rerootable::Bool
> > annotations::Dict{S, Any}
> > end
> > 
> > However, I don't like the type uncertainty of Any because if I'm
> > correct, it could propagate up through a user's code. But we will
> > always have some uncertainty, because we don't know in advance what
> > the user might want to annotate the Phylogeny with - could be
> > anything from simple float values, to other composite types.
> > 
> > Am I correct that the uncertainty getting and setting such
> > annotations, would propagate through the user's code when they deal
> > with annotations?
> > If so, we have tried to think of ways to get around this. One idea
> > was to store the NodeAnnotations in the phylogeny according to the
> > type of their values, and then provide getter and setter methods
> > that make the return type predictable from the types of the
> > parameters passed in the method:
> > 
> > type 

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

2015-09-25 Thread Valentin Churavy
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 
> 
>  
> 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] Re: Julia code 5x to 30x slower than Matlab code

2015-09-25 Thread Daniel Carrera
+1  Someone give this man a cookie.

On 25 September 2015 at 01:46, Steven G. Johnson 
wrote:

> To put it another way, there are plenty of problems that can't be
> vectorized effectively. ODEs, matrix assembly for FEM or BEM, implementing
> special functions... If you do enough scientific computing, eventually you
> will hit a problem where you need to write your own inner loops, and then
> with Matlab you need to drop down to C if performance matters.
>
> If all performance-critical computing were linear algebra, life would be a
> lot simpler.


[julia-users] Re: Optimal Control using Dynamic Programming

2015-09-25 Thread Uwe Fechner
Hello,
as far as I know, there is no ready-made package for optimal control.
There is one package on control design:
https://github.com/JuliaControl/Control.jl

And there are a lot of packages for solving optimization problems.

Could you be a little bit more specific about your problem?

How do you want to describe the system, that you want to control?
Is it a linear system?

Uwe

Am Freitag, 25. September 2015 07:25:19 UTC+2 schrieb Narayani Vedam:
>
> Hi,
>   I am new to Julia. I need to solve an optimal control problem using 
> dynamic programming. Are there pre-defined functions/packages that I could 
> use?
>
> Thanks.
>


Re: [julia-users] Is there a way to define abstract type from a type in base.jl

2015-09-25 Thread Mauro
Julia's parametric types are invariant (except tuples).  To figure out
what that means have a read through
http://docs.julialang.org/en/release-0.4/manual/types/#parametric-composite-types

> How to make Array{BigFloat,1}<:Array{Real,1}?

This is always false (that is invariance).  But presumably you want a
method which takes any Array with eltype<:Real, try something like:

julia> f{T<:Real}(ar::Array{T,1}) = typeof(ar)
f (generic function with 1 method)

julia> f(Array(BigFloat, 2))
Array{BigFloat,1}


[julia-users] Can't install Cairo, Winston, IJulia... on OSX

2015-09-25 Thread Ferran Mazzanti
Hi folks,
I start to learn how painful thinks can get when you miss different things 
from different packages... I feel somehow miserable.
I try to install Winston, which needs Cairo, etc... on my OSX Yosemite box. 
When I issue 
Pkg.add("Winston") for exemple I get the following:

INFO: Installing Cairo v0.2.31
ERROR: sendfile: operation not supported on socket (ENOTSUP)
 in wait at 
/Applications/Julia-0.3.11.app/Contents/Resources/julia/lib/julia/sys.dylib 
(repeats 2 times)
 in wait at task.jl:48
 in sync_end at 
/Applications/Julia-0.3.11.app/Contents/Resources/julia/lib/julia/sys.dylib
 in add at pkg/entry.jl:319
 in add at pkg/entry.jl:71
 in anonymous at pkg/dir.jl:28
 in cd at 
/Applications/Julia-0.3.11.app/Contents/Resources/julia/lib/julia/sys.dylib
 in __cd#229__ at 
/Applications/Julia-0.3.11.app/Contents/Resources/julia/lib/julia/sys.dylib
 in add at pkg.jl:20

and I can't for the sake of me understand what is going on. Is it a problem 
of Yosemite? Julia?...
Anybody here can help me please? I used to have everything working, but 
after an upgrade everything
stopped working.

Any help appreciated.


[julia-users] Re: Can't install Cairo, Winston, IJulia... on OSX

2015-09-25 Thread Tony Kelman
This is a strange error, closest thing I can find 
is https://github.com/JuliaLang/julia/issues/10434. Could you test with the 
0.4.0-rc2 version of Julia that's available on the downloads page?


On Friday, September 25, 2015 at 12:52:23 AM UTC-7, Ferran Mazzanti wrote:
>
> Hi folks,
> I start to learn how painful thinks can get when you miss different things 
> from different packages... I feel somehow miserable.
> I try to install Winston, which needs Cairo, etc... on my OSX Yosemite 
> box. When I issue 
> Pkg.add("Winston") for exemple I get the following:
>
> INFO: Installing Cairo v0.2.31
> ERROR: sendfile: operation not supported on socket (ENOTSUP)
>  in wait at 
> /Applications/Julia-0.3.11.app/Contents/Resources/julia/lib/julia/sys.dylib 
> (repeats 2 times)
>  in wait at task.jl:48
>  in sync_end at 
> /Applications/Julia-0.3.11.app/Contents/Resources/julia/lib/julia/sys.dylib
>  in add at pkg/entry.jl:319
>  in add at pkg/entry.jl:71
>  in anonymous at pkg/dir.jl:28
>  in cd at 
> /Applications/Julia-0.3.11.app/Contents/Resources/julia/lib/julia/sys.dylib
>  in __cd#229__ at 
> /Applications/Julia-0.3.11.app/Contents/Resources/julia/lib/julia/sys.dylib
>  in add at pkg.jl:20
>
> and I can't for the sake of me understand what is going on. Is it a 
> problem of Yosemite? Julia?...
> Anybody here can help me please? I used to have everything working, but 
> after an upgrade everything
> stopped working.
>
> Any help appreciated.
>


[julia-users] Re: Julia code 5x to 30x slower than Matlab code

2015-09-25 Thread Sisyphuss
Although not understanding the final part of the performance tips, I would 
like to make the point here that the "style guide" could also use some love.

I am too obsessive to aesthetic. I cannot accept to write ugly code. 

 

On Thursday, September 24, 2015 at 10:13:18 PM UTC+2, Steven G. Johnson 
wrote:
>
>
>
> On Thursday, September 24, 2015 at 1:55:18 PM UTC-4, Sisyphuss wrote: 
>>
>> However, Julia is assumed to be fast (high expectation), and performance 
>> varies a lot according to the knowledge/skill a programmer own (high 
>> variance).
>>
>
> Again, that's true in any language where you are trying to get high 
> performance.  It's true in C as well.   If you ask a bunch of programmers 
> in C to implement something as "trivial" as a matrix multiplication, 
> performance can easily vary between their implementations by a factor of 10 
> or more.  (See e.g. 
> http://nbviewer.ipython.org/url/math.mit.edu/~stevenj/18.335/Matrix-multiplication-experiments.ipynb
>  
> for some examples and explanations.)  The performance variation can be even 
> larger for more complicated problems.
>
> It is really hard to know whether you are obtaining nearly "maximum" 
> performance in any language, even "high-performance" languages, unless you 
> either have (a) a lot of knowledge or (b) have alternative highly optimized 
> code for similar problems to compare to.  Ideally you have both, even if 
> you are an expert.
>
> (e.g. FFTW would never have existed if I hadn't started by benchmarking a 
> bunch of FFT implementations, and noticing the wide variation in 
> performance for different codes, different problem sizes, and different 
> machines.)
>
> What is true, however, is that in a very high-level language there can be 
> more going on "under the hood" than in lower-level languages like C that 
> require you to write lots of low-level instructions explicitly.  The 
> tradeoff here is that you can be more productive in a higher-level 
> language, but you need to have some more knowledge to avoid performance 
> traps that arise from expressions that seem unexpectedly slow for new 
> users.  Fortunately, the rules in Julia are fairly straightforward once you 
> get used to them (see the performance tips section of the manual), and the 
> situation is much better than in other high-level languages where it is 
> often not even possible to get good performance without dropping down to a 
> separate C-like language.
>


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  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
>> 
>> 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: Same native code, different performance

2015-09-25 Thread Kristoffer Carlsson
If you want to reproduce this you can use JuliaBox ( I changed cos(x) to x 
because it doesnt change anything)




On Thursday, September 24, 2015 at 11:03:21 PM UTC+2, Erik Schnetter wrote:
>
> On Thu, Sep 24, 2015 at 4:56 PM, Yichao Yu  > wrote:
>
>> On Thu, Sep 24, 2015 at 4:42 PM, Erik Schnetter > > wrote:
>> > In the native code above, the C function `pow(double, double)` is 
>> called in
>> > both cases. Maybe `llvm_powi` is involved; if so, it is lowered to the 
>> same
>> > `pow` function. The speed difference must have a different reason.
>>
>> Not necessarily, IIRC. we use the openlibm functions by default but
>> llvm will use the system libm version.
>>
>
> Good catch. (I can't reproduce this locally, neither with Julia 0.4 nor 
> 0.5, neither on OS X nor on Linux -- I'm getting different assembler code 
> for both function, both different from the versions shown here, so I can't 
> try my suggestion below.)
>
> To test this, you could comment out or modify the `llvm_powi` definition 
> of `pow`, or you could rebuild Juila without Openlibm.
>
> -erik
>  
>
>> > Sometimes there are random things occurring that invalidate benchmark
>> > results. (This could be caused by how the compiled functions are aligned
>> > respective to cache lines or page boundaries, etc. -- this is black 
>> magic I
>> > like to invoke if there's a result that I can't explain. You can just 
>> ignore
>> > my ramblings here.) You could restart Julia, reboot the machine, try a
>> > different machine, define several identical functions `f` and `f_float` 
>> and
>> > look at their speeds, etc...
>> >
>> > (I would have hoped that this function is translated to the equivalent 
>> of
>> > `c=cos(x); c2=c*c; return c*c2`, but this is obviously not happening.)
>> >
>> > -erik
>> >
>> > On Thu, Sep 24, 2015 at 4:24 PM, Kristoffer Carlsson <
>> kcarl...@gmail.com >
>> > wrote:
>> >>
>> >> But the floating ones are the faster ones. Shouldn't it be the 
>> opposite?
>> >
>> >
>> >
>> >
>> > --
>> > Erik Schnetter 
>> > http://www.perimeterinstitute.ca/personal/eschnetter/
>>
>
>
>
> -- 
> Erik Schnetter  
> http://www.perimeterinstitute.ca/personal/eschnetter/
>


Re: [julia-users] Re: Same native code, different performance

2015-09-25 Thread Kristoffer Carlsson
If you want to reproduce the results above and below you can use JuliaBox.

This has something to do with the constant propagation of sin and cos I 
think. Changing cos to x reverses the results.

f(x) = @fastmath x^3
f2(x) = @fastmath x^3.0

fs(x) = @fastmath cos(x)^3
fs2(x) = @fastmath cos(x)^3.0
function bench(N)
s = 0.0
@time for i = 1:N
s+=f(π/4)
   end
   @time for i = 1:N
s+=f2(π/4)
   end
   @time for i = 1:N
s+=fs(π/4)
   end
   @time for i = 1:N
s+=fs2(π/4)
   end
return s
end

bench(10^6);

  0.001040 seconds
  0.008002 seconds
  0.086514 seconds
  0.015082 seconds


So for f(x) = x^3 the int version is ~8 times faster.
For f(x) = cox(x)^3 the double version is five times faster.

Changing the exponent from 3 to 40 gives.

  0.001048 seconds
  0.092466 seconds
  0.085958 seconds
  0.113476 seconds


where the integer versions run at pretty much the same speed but the double 
versions gets ~10 times slower.

On Thursday, September 24, 2015 at 11:03:21 PM UTC+2, Erik Schnetter wrote:
>
> On Thu, Sep 24, 2015 at 4:56 PM, Yichao Yu  > wrote:
>
>> On Thu, Sep 24, 2015 at 4:42 PM, Erik Schnetter > > wrote:
>> > In the native code above, the C function `pow(double, double)` is 
>> called in
>> > both cases. Maybe `llvm_powi` is involved; if so, it is lowered to the 
>> same
>> > `pow` function. The speed difference must have a different reason.
>>
>> Not necessarily, IIRC. we use the openlibm functions by default but
>> llvm will use the system libm version.
>>
>
> Good catch. (I can't reproduce this locally, neither with Julia 0.4 nor 
> 0.5, neither on OS X nor on Linux -- I'm getting different assembler code 
> for both function, both different from the versions shown here, so I can't 
> try my suggestion below.)
>
> To test this, you could comment out or modify the `llvm_powi` definition 
> of `pow`, or you could rebuild Juila without Openlibm.
>
> -erik
>  
>
>> > Sometimes there are random things occurring that invalidate benchmark
>> > results. (This could be caused by how the compiled functions are aligned
>> > respective to cache lines or page boundaries, etc. -- this is black 
>> magic I
>> > like to invoke if there's a result that I can't explain. You can just 
>> ignore
>> > my ramblings here.) You could restart Julia, reboot the machine, try a
>> > different machine, define several identical functions `f` and `f_float` 
>> and
>> > look at their speeds, etc...
>> >
>> > (I would have hoped that this function is translated to the equivalent 
>> of
>> > `c=cos(x); c2=c*c; return c*c2`, but this is obviously not happening.)
>> >
>> > -erik
>> >
>> > On Thu, Sep 24, 2015 at 4:24 PM, Kristoffer Carlsson <
>> kcarl...@gmail.com >
>> > wrote:
>> >>
>> >> But the floating ones are the faster ones. Shouldn't it be the 
>> opposite?
>> >
>> >
>> >
>> >
>> > --
>> > Erik Schnetter 
>> > http://www.perimeterinstitute.ca/personal/eschnetter/
>>
>
>
>
> -- 
> Erik Schnetter  
> http://www.perimeterinstitute.ca/personal/eschnetter/
>


[julia-users] Re: Optimal Control using Dynamic Programming

2015-09-25 Thread Tony Kelman
The closest pre-made package for doing dynamic programming for optimal 
control would likely be one of the quantitative economics packages. If you 
have discrete decisions or want to grid your input space, it should be 
fairly straightforward to write out a cost-to-go matrix and apply the 
Bellman equation iteratively.



On Thursday, September 24, 2015 at 10:25:19 PM UTC-7, NV wrote:
>
> Hi,
>   I am new to Julia. I need to solve an optimal control problem using 
> dynamic programming. Are there pre-defined functions/packages that I could 
> use?
>
> Thanks.
>


[julia-users] Re: Request for comments: best way to deal with type uncertainty.

2015-09-25 Thread harven


Le vendredi 25 septembre 2015 02:41:32 UTC+2, Ben Ward a écrit :
>
> As an update: We have tested fetching annotations without trying to 
> enforce type, and then another in which we don't. I don't understand why, 
> but the one in which we don't enforce type, is faster, it is also puzzling 
> for me as the one where we don't enforce type allocates memory, and yet is 
> still faster
>
>
The type Any is fine. Let the compiler do its job. You want to specify the 
type when working with arrays of floats to prevent boxing. Apart from that, 
I don't think I have ever seen a significant speed improvement from typing 
everything. On the other hand, I have sometimes seen a speed decrease when 
typing recursive data structures. My two cents: don't bother with the types 
unless this has to do with iterating on floats. Use profiling if there is a 
speed issue.

 


Re: [julia-users] Is there a way to define abstract type from a type in base.jl

2015-09-25 Thread Roger Luo
Thanks,I've read about the arrays,but just don't know how to define some
existed type.
though a type may be define as:
type a{T<:Integer}<:Real
xxx
end

but that's will work in my function.I tried to pass different types into a
function, so I asked this question.
still do not understand why can define a existed type become a subtype of
some other type?

2015-09-25 15:11 GMT+08:00 Mauro :

> Julia's parametric types are invariant (except tuples).  To figure out
> what that means have a read through
>
> http://docs.julialang.org/en/release-0.4/manual/types/#parametric-composite-types
>
> > How to make Array{BigFloat,1}<:Array{Real,1}?
>
> This is always false (that is invariance).  But presumably you want a
> method which takes any Array with eltype<:Real, try something like:
>
> julia> f{T<:Real}(ar::Array{T,1}) = typeof(ar)
> f (generic function with 1 method)
>
> julia> f(Array(BigFloat, 2))
> Array{BigFloat,1}
>


[julia-users] "WARNING: Base.String is deprecated, use AbstractString instead" en masse

2015-09-25 Thread Andreas Lobinger
Hello colleagues,

the warning is quite nice, but a location would be nicer. How can i track 
down, which line triggered the warning?

Wishing a happy day,
Andreas


Re: [julia-users] Is there a way to define abstract type from a type in base.jl

2015-09-25 Thread Yichao Yu
I have some trouble understand your question.

On Fri, Sep 25, 2015 at 8:22 AM, Roger Luo  wrote:
> Thanks,I've read about the arrays,but just don't know how to define some
> existed type.

You cannot redefine a type. Or do you mean how are certain existed
types implemented? For that you can just check out the source code.

> though a type may be defined as:
> type a{T<:Integer}<:Real
> xxx
> end
>
> but that's will work in my function.I tried to pass different types into a
> function, so I asked this question.
> still do not understand why can define a existed type become a subtype of
> some other type?

You cannot change the type inheritance of an existing type, period. As
Mauro pointed out, you are probably looking for something else. It
would be better if you can post the original problem you are trying to
solve.

>
> 2015-09-25 15:11 GMT+08:00 Mauro :
>>
>> Julia's parametric types are invariant (except tuples).  To figure out
>> what that means have a read through
>>
>> http://docs.julialang.org/en/release-0.4/manual/types/#parametric-composite-types
>>
>> > How to make Array{BigFloat,1}<:Array{Real,1}?
>>
>> This is always false (that is invariance).  But presumably you want a
>> method which takes any Array with eltype<:Real, try something like:
>>
>> julia> f{T<:Real}(ar::Array{T,1}) = typeof(ar)
>> f (generic function with 1 method)
>>
>> julia> f(Array(BigFloat, 2))
>> Array{BigFloat,1}
>
>


Re: [julia-users] "WARNING: Base.String is deprecated, use AbstractString instead" en masse

2015-09-25 Thread Yichao Yu
On Fri, Sep 25, 2015 at 8:25 AM, Andreas Lobinger  wrote:
> Hello colleagues,
>
> the warning is quite nice, but a location would be nicer. How can i track
> down, which line triggered the warning?

What I did was just `grep -R`

>
> Wishing a happy day,
> Andreas


Re: [julia-users] "WARNING: Base.String is deprecated, use AbstractString instead" en masse

2015-09-25 Thread Isaiah Norton
>
>  But still, i'd prefer error messages that have more content...


Yes, there are a number of open issues already about errors, warnings, and
backtraces. The situation should improve when we bump to a newer LLVM
version.

On Fri, Sep 25, 2015 at 9:17 AM, Andreas Lobinger 
wrote:

>
>
> On Friday, September 25, 2015 at 2:52:43 PM UTC+2, Yichao Yu wrote:
>>
>> On Fri, Sep 25, 2015 at 8:25 AM, Andreas Lobinger 
>> wrote:
>> > Hello colleagues,
>> >
>> > the warning is quite nice, but a location would be nicer. How can i
>> track
>> > down, which line triggered the warning?
>>
>> What I did was just `grep -R`
>>
>
> I did similar (find all in editor for the full package dir). But still,
> i'd prefer error messages that have more content...
>


Re: [julia-users] "WARNING: Base.String is deprecated, use AbstractString instead" en masse

2015-09-25 Thread Glen H
I ran something like this to do the conversion (in bash or zsh):

find . -name "*.jl" | while read i; do sed -i -e 
's/\bString\b/AbstractString/g' $i; done

Glen

On Friday, September 25, 2015 at 9:22:44 AM UTC-4, Isaiah wrote:
>
>  But still, i'd prefer error messages that have more content...
>
>
> Yes, there are a number of open issues already about errors, warnings, and 
> backtraces. The situation should improve when we bump to a newer LLVM 
> version. 
>
> On Fri, Sep 25, 2015 at 9:17 AM, Andreas Lobinger  > wrote:
>
>>
>>
>> On Friday, September 25, 2015 at 2:52:43 PM UTC+2, Yichao Yu wrote:
>>>
>>> On Fri, Sep 25, 2015 at 8:25 AM, Andreas Lobinger  
>>> wrote: 
>>> > Hello colleagues, 
>>> > 
>>> > the warning is quite nice, but a location would be nicer. How can i 
>>> track 
>>> > down, which line triggered the warning? 
>>>
>>> What I did was just `grep -R` 
>>>
>>
>> I did similar (find all in editor for the full package dir). But still, 
>> i'd prefer error messages that have more content... 
>>
>
>

[julia-users] Re: Optimal Control using Dynamic Programming

2015-09-25 Thread Tony Kelman
I'm biased, but for control problems with constraints I would pose it as a 
model predictive control problem and use JuMP.jl with the Ipopt.jl optimization 
solver. If you prefer to construct a cost to go map and do dynamic programming 
then I can't point you to any Julia code that I know of that solves your exact 
problem, though there may be some similar matlab code posted somewhere that you 
could translate. Without a complete mathematical or code description of your 
problem you're being too vague for this forum to help much.

Re: [julia-users] Re: What are the "strengths" of the Julia "ecosystem" (e.g. for bio and quants/finance)? This is not a very specific question (while sub-questions are), you've been warned..

2015-09-25 Thread Jameson Nash
>From browsing issues, it looks like the HttpServer.jl performance issue you
referenced below should be now fixed by
https://github.com/JuliaWeb/HttpServer.jl/pull/59.

On Fri, Sep 25, 2015 at 5:47 AM Páll Haraldsson 
wrote:

> On Thursday, September 24, 2015 at 11:07:56 PM UTC, Andrei Zh wrote:
>>
>>
>>
>>> I find this statement highly surprising.. wander if you meant to reverse
>>> this.. My quant friend who had worked for years in Python had trouble
>>> parallelizing Python code (may be resolved now..). I'm not familiar with R,
>>> but Python has the GIL and associated problems. I also thought Erlang was
>>> best-in-class (for concurrent, not "parallel").
>>>
>>
>> Oops, you are right, it's exactly the opposite. Consider it a result of
>> quick answer between 2 meetings. Julia's capabilities are much better for
>> concurrent and parallel programming than these in Python or R.
>>
>
> But "probably comparable with Erlang" was not an error, taken
> conservatively, you are probably talking about what pure benchmark numbers
> of concurrency (only) might indicate. I believe Erlang has more (than
> speed) currently not in Julia, while not better for non-concurrency related.
>
>
>> For those in the Java/Scala world, I'm less sure about reusing that, I
>>> know you can with JavaCall.jl, but understand there are bugs and
>>> limitations to it.
>>
>>
>> Unfortunately, that's true. @aviks has made a great work connecting Julia
>> to JVMs via Java Native Interface, but as far as I can see, JNI is shitty
>> by itself, and it's very hard to to make integration between Julia and Java
>> really stable.
>>
>
> Even if this would work perfectly, I'm not sure (most) Julia (or Java?)
> users would want to mix (I guess ok for truly good/critical libraries..) at
> least for GUI/enterprise applications.. At least for me, it seems involving
> a JVM or any VM, is outdated.. Yes, Julia has LLVM, but it's not the same.
>
>>
>> "HttpServer.jl, has low latency 0.5 ms and high throughput (latency on
>>> the same order of Python's Flask and Scala's Spray mature frameworks, and
>>> throughput also comparable[82])."
>>
>>
>> That's funny, because specified reference leads to an issue on
>> performance that was opened by me and incorrectly interpreted by the author
>> of Wikipedia page. At that test Julia outperformed Flask, but was still 3-6
>> times slower than Spray.
>>
>
>
> Good throughput, but very high latency
> https://github.com/JuliaWeb/HttpServer.jl/issues/48
> "At the same time, with even very naive test in Python (using requests
> library) I was able to get 1.3ms, and with Julia (Requests.jl) it was even
> lower - about 0.5ms per request."
>
> Then the issue was closed. It seems Julia can have low latency (are Flask
> and Splay [numbers, for it and throughput] considered best-in-class, at
> least for those language?). Splay has "< 1 ms" so unclear how much better,
> it may be. It seems you do not dispute the low latency claim of Julia [on
> the WP page] (any more)?
>
> Do you only disagree, then only, with the "high throughput" of
> Julia/[HttpServer.jl] (and would only change high->good)? [With 1000
> threads] Julia beats Flask, "comparable", while a third of Splay. Maybe
> within an order of magnitude is not comparable.. Not sure about the 6 times
> slower number.
>
> I haven't looked to closely at Requests.jl, so I do not know the
> differences between it and HttpServer.jl are other libraries. It really
> only matters that one library gets good throughput and then you can use
> that one?
>
>
>
>> Seems like I need to repeat my tests to get latest results.
>>
>
> It would be interesting to know if the numbers have improved..
>
>
>> I didn't check if this works the same, or just similarly?
>>
>>
>> They have totally different APIs and approaches in general. The main
>> point is that if you want to keep it working with updated version of Julia
>> and libraries, you have to adapt web application too. And it's really not
>> funny to come back to a code written half a year ago just because libraries
>> it used are now deprecated.
>>
>
> Yes, see your point.. I guess the stuff still works it it ever did.. I see
> for plots that there is a generic package that is supposed to hide the
> differences of six (by now) different plotting packages.. You say the API
> is totally different, I wander how difficult or stupid it is to support old
> APIs here in some way..
>


[julia-users] Re: Julia code 5x to 30x slower than Matlab code

2015-09-25 Thread Marcio Sales
all right... Well.. Julia's price will allways be better... 
Btw.. what about crowdfunded initiatives? Has anyone tried that? I would be 
wiling to donate for a geospatial visualization package, for example...




[julia-users] help!

2015-09-25 Thread Marcio Sales
Hi, 

I have 2 silly (but could find the answer yet) questions about help.
1) Is there another way to see help text besides using "?" to change the 
shell mode? I use software like Juno that doesn't allow that. I know that 
methods(function) shows a function's methods, but I wonder if there's 
something simillar to show help..., as help() is not defined.

2) how can I write help text in a function that could be displayed in the 
same way?
 


[julia-users] Simulation time

2015-09-25 Thread NV
Hi,
   I am new to Julia and would like to run a set of operations repeatedly 
for a finite set of time. I tried to implement the following code:

using JuMP, Ipopt
Truck = Model(solver=IpoptSolver(print_level=0))
#Initial Values
gear_0 = 1
v_0 = 20
N_0 = 600
#Constants:
i_f = 3.27
eta_f = 0.95
eta_t = 0.95
r_w = 0.52
gear = 1
i = [11.27 9.14 7.17 5.81 4.62 3.75 3.01 2.44 1.91 1.55 1.23 1] 
#Discretization
n = 500
@defVar(Truck,Δt≥0,start = 1/n)
@defNLExpr(t_f,Δt*n)
@defVar(Truck,600<=N[0:n]<=2500)
@defVar(Truck,1<=gear[0:n]<=12)
@defVar(Truck,i_t[0:n])
@addConstraint(Truck,N[0]==N_0)
@addConstraint(Truck,gear[0]==gear_0)
@addConstraint(Truck,i_t[0]==i[1])
@defNLExpr(N[j=0:n],(30*i_t[j]*i_f)/(pi*r_w))
for j in 1:n
if(gear[j]==1)
if(N[j]>=1500)
gear[j]= 2
else
gear[j] = 1
end
elseif(gear[j]==2)
if(N[j]>=1501)
gear[j] = 3
elseif(N[j]<=950)
gear[j]= 1
else
gear[j] = 2
end
elseif(gear[j]==3)
if(N[j]>=1502)
gear[j] = 4
elseif(N[j]<=960)
gear[j] = 2
else
gear[j] = 3
end
elseif(gear[j]==4)
if(N[j]>=1503)
gear[j] = 5;
elseif(N[j]<=970)
gear[j] = 3
else
gear[j] = 4
end
elseif(gear[j]==5)
if(N[j]>=1504)
gear[j] = 6;
elseif(N[j]<=980)
gear[j] = 4
else
gear[j] = 5
end
elseif(gear[j]==6)
if(N[j]>=1505)
gear[j] = 7
elseif(N[j]<=990)
gear[j] = 5
else
gear[j] = 6
end
elseif(gear[j]==7)
if(N[j]>=1497)
gear[j] = 8
elseif(N[j]<=1000)
gear[j] = 6
else
gear[j] = 7
end
elseif(gear[j]==8)
if(N[j]>=1489)
gear[j] = 9
elseif(N[j]<=1006)
gear[j] = 7
else
gear[j] = 8
end
elseif(gear[j]==9)
if(N[j]>=1481)
gear[j] = 10
elseif(N[j]<=1012)
gear[j] = 8
else
gear[j] = 9
end
elseif(gear[j]==10)
if(N[j]>=1473)
gear[j] = 11
elseif(N[j]<=1018)
gear[j] = 9
else
gear[j] = 10
end
elseif(gear[j]==11)
if(N[j]>=1465)
gear[j] = 12
elseif(N[j]<=1024)
gear[j] = 10
else
gear[j] = 11
end 
elseif(gear[j]==12)
if(N[j]<=1030)
gear[j] = 11
else
gear[j] = 12
end
end
i_t[j] = i[gear[j]]
end

However, I keep getting the error: 

LoadError: TypeError: non-boolean 
(JuMP.GenericRangeConstraint{JuMP.GenericAffExpr{Float64,JuMP.Variable}}) used 
in boolean context
while loading In[52], in expression starting on line 25

 in anonymous at no file


I am clueless about how I could debug this!


Thank you.



[julia-users] Re: Optimal Control using Dynamic Programming

2015-09-25 Thread Narayani Vedam
The system is non-linear. I have a cost function, that I need to minimize 
to find the optimal control to move from one state to another. There are a 
few constraints that the states should satisfy even.

On Friday, 25 September 2015 01:20:52 UTC-5, Uwe Fechner wrote:
>
> Hello,
> as far as I know, there is no ready-made package for optimal control.
> There is one package on control design:
> https://github.com/JuliaControl/Control.jl
>
> And there are a lot of packages for solving optimization problems.
>
> Could you be a little bit more specific about your problem?
>
> How do you want to describe the system, that you want to control?
> Is it a linear system?
>
> Uwe
>
> Am Freitag, 25. September 2015 07:25:19 UTC+2 schrieb Narayani Vedam:
>>
>> Hi,
>>   I am new to Julia. I need to solve an optimal control problem using 
>> dynamic programming. Are there pre-defined functions/packages that I could 
>> use?
>>
>> Thanks.
>>
>

[julia-users] Re: Optimal Control using Dynamic Programming

2015-09-25 Thread NV
Hi,
   I am trying to control the velocity of a system optimally. I have a cost 
function (DP formulation) to minimize subject to a few constraints.
Thanks

On Friday, 25 September 2015 00:25:19 UTC-5, NV wrote:
>
> Hi,
>   I am new to Julia. I need to solve an optimal control problem using 
> dynamic programming. Are there pre-defined functions/packages that I could 
> use?
>
> Thanks.
>


Re: [julia-users] "WARNING: Base.String is deprecated, use AbstractString instead" en masse

2015-09-25 Thread Andreas Lobinger


On Friday, September 25, 2015 at 2:52:43 PM UTC+2, Yichao Yu wrote:
>
> On Fri, Sep 25, 2015 at 8:25 AM, Andreas Lobinger  > wrote: 
> > Hello colleagues, 
> > 
> > the warning is quite nice, but a location would be nicer. How can i 
> track 
> > down, which line triggered the warning? 
>
> What I did was just `grep -R` 
>

I did similar (find all in editor for the full package dir). But still, i'd 
prefer error messages that have more content... 


Re: [julia-users] Stateflow equivalent in Julia

2015-09-25 Thread Spencer Russell
Welcome to Julia!

To get useful answers you’re going to need to provide quite a bit more detail 
on what problems you’re running into. What did you try? What errors are you 
getting? Are there specific concepts from the documentation that you’re having 
trouble with?

-s

> On Sep 25, 2015, at 1:18 AM, Narayani Vedam  wrote:
> 
> Hi,
>I am new to Julia. I tried implementing a logic that I had in Simulink - 
> Stateflow using Julia, but ran into trouble. Any heads-up on this?
> 
> Thank you



Re: [julia-users] Why two based indexing? [A package.. it's not the default..]

2015-09-25 Thread Spencer Russell
I understand it as a meditation (koan?) on the futility of arguing about where 
indices should begin, and where they come to rest.

Hold it lightly, and be enlightened.

-s

> On Sep 25, 2015, at 7:00 AM, Páll Haraldsson  
> wrote:
> 
> https://libraries.io/julia/TwoBasedIndexing
> 
> 
> http://python-history.blogspot.is/2013/10/why-python-uses-0-based-indexing.html
> 
> [While Guido's former ABC used 1-based]
> 
> "Guido van RossumOctober 24, 2013 at 8:49 AM
> To anyone who prefers 1-based indexing: you are the same people who screwed 
> up the calendar, starting at year 1"
> 
> 
> I think my next year will start at January 2..
> 
> I do not want to start an argument on 0-based vs. 1-based, I've grown to like 
> Julia's 1-based variant. Just 2-based seemed odd.. Probably a prove of 
> concept, for more general n-based/Pascal arrays..
> 
> -- 
> Palli.
> 



Re: [julia-users] Re: Optimal Control using Dynamic Programming

2015-09-25 Thread Narayani Vedam
Thank you for your inputs. My concern was about calculating the cost to go
map. I have discretized the state space and have 61 possible states in each
stages and there are 20 such stages.

That roughly amounts to 61*61 values for one stage. I am overwhelmed by the
amount of computations that this would mean and how best I could initialize
a suitable array and index it for later use.
On Sep 25, 2015 8:30 AM, "Tony Kelman"  wrote:

> I'm biased, but for control problems with constraints I would pose it as a
> model predictive control problem and use JuMP.jl with the Ipopt.jl
> optimization solver. If you prefer to construct a cost to go map and do
> dynamic programming then I can't point you to any Julia code that I know of
> that solves your exact problem, though there may be some similar matlab
> code posted somewhere that you could translate. Without a complete
> mathematical or code description of your problem you're being too vague for
> this forum to help much.


Re: [julia-users] Request for comments: best way to deal with type uncertainty.

2015-09-25 Thread Stefan Karpinski
You want to type locations, i.e. arrays and fields, not function parameters
and generally not local variables (although that's useful to get
autoconversion behavior).

On Friday, September 25, 2015, harven  wrote:

>
>
> Le vendredi 25 septembre 2015 02:41:32 UTC+2, Ben Ward a écrit :
>>
>> As an update: We have tested fetching annotations without trying to
>> enforce type, and then another in which we don't. I don't understand why,
>> but the one in which we don't enforce type, is faster, it is also puzzling
>> for me as the one where we don't enforce type allocates memory, and yet is
>> still faster
>>
>>
> The type Any is fine. Let the compiler do its job. You want to specify the
> type when working with arrays of floats to prevent boxing. Apart from that,
> I don't think I have ever seen a significant speed improvement from typing
> everything. On the other hand, I have sometimes seen a speed decrease when
> typing recursive data structures. My two cents: don't bother with the types
> unless this has to do with iterating on floats. Use profiling if there is a
> speed issue.
>
>
>


Re: [julia-users] help!

2015-09-25 Thread Yichao Yu
On Fri, Sep 25, 2015 at 9:55 AM, Marcio Sales  wrote:
> Hi,
>
> I have 2 silly (but could find the answer yet) questions about help.
> 1) Is there another way to see help text besides using "?" to change the
> shell mode? I use software like Juno that doesn't allow that. I know that
> methods(function) shows a function's methods, but I wonder if there's
> something simillar to show help..., as help() is not defined.
>

julia> Docs.@repl sin
search: sin sinh sind sinc sinpi asin using isinf asinh asind isinteger

 sin(x)

 Compute sine of x, where x is in radians


> 2) how can I write help text in a function that could be displayed in the
> same way?
>

http://julia.readthedocs.org/en/latest/manual/documentation/


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


Re: [julia-users] Re: Same native code, different performance

2015-09-25 Thread Páll Haraldsson
On Thursday, September 24, 2015 at 8:05:52 PM UTC, Jeffrey Sarnoff wrote:
>
> It could be that integer powers are done with binary shifts in software 
> and the floating point powers are computed in the fpu.
>

I suspect not. [At least in this case here, where the numbers to be raised 
to a power are not an integer. It would not make much sense to force 
results of cos or sin to be integers.. :) ]


int^int could avoid the FPU.

float^int would I think (at least for low integers) be slow with binary 
shifts (and more that is needed) as floating point representation is 
hard/slow to emulate in software.


What could be done (and maybe is), is to handle:

float^2, float^3 and up to some small integer and change to floating point 
multiplication. In general, would LLVM take care of such optimizations or 
would Julia have to do it/help?

I'm not sure how fast pow is in an FPU, probably not(?) optimized for these 
simple cases, needs to be general, while MULs can be issued every cycle in 
FPUs commonly (may have some latency, for using result right away).

Such as for float^2.0 or any other literal "float" that is actually an int, 
can be treated my the compiler as an int.

-- 
Palli.



[julia-users] Re: Julia code 5x to 30x slower than Matlab code

2015-09-25 Thread Kristoffer Carlsson
Then don't? 

[julia-users] Re: What are the "strengths" of the Julia "ecosystem" (e.g. for bio and quants/finance)? This is not a very specific question (while sub-questions are), you've been warned..

2015-09-25 Thread Páll Haraldsson
On Thursday, September 24, 2015 at 11:07:56 PM UTC, Andrei Zh wrote:
>
>  
>
>> I find this statement highly surprising.. wander if you meant to reverse 
>> this.. My quant friend who had worked for years in Python had trouble 
>> parallelizing Python code (may be resolved now..). I'm not familiar with R, 
>> but Python has the GIL and associated problems. I also thought Erlang was 
>> best-in-class (for concurrent, not "parallel").
>>
>
> Oops, you are right, it's exactly the opposite. Consider it a result of 
> quick answer between 2 meetings. Julia's capabilities are much better for 
> concurrent and parallel programming than these in Python or R. 
>

But "probably comparable with Erlang" was not an error, taken 
conservatively, you are probably talking about what pure benchmark numbers 
of concurrency (only) might indicate. I believe Erlang has more (than 
speed) currently not in Julia, while not better for non-concurrency related.


> For those in the Java/Scala world, I'm less sure about reusing that, I 
>> know you can with JavaCall.jl, but understand there are bugs and 
>> limitations to it.
>
>
> Unfortunately, that's true. @aviks has made a great work connecting Julia 
> to JVMs via Java Native Interface, but as far as I can see, JNI is shitty 
> by itself, and it's very hard to to make integration between Julia and Java 
> really stable.
>

Even if this would work perfectly, I'm not sure (most) Julia (or Java?) 
users would want to mix (I guess ok for truly good/critical libraries..) at 
least for GUI/enterprise applications.. At least for me, it seems involving 
a JVM or any VM, is outdated.. Yes, Julia has LLVM, but it's not the same. 

>
> "HttpServer.jl, has low latency 0.5 ms and high throughput (latency on the 
>> same order of Python's Flask and Scala's Spray mature frameworks, and 
>> throughput also comparable[82])." 
>
>
> That's funny, because specified reference leads to an issue on performance 
> that was opened by me and incorrectly interpreted by the author of 
> Wikipedia page. At that test Julia outperformed Flask, but was still 3-6 
> times slower than Spray.
>


Good throughput, but very high latency
https://github.com/JuliaWeb/HttpServer.jl/issues/48
"At the same time, with even very naive test in Python (using requests 
library) I was able to get 1.3ms, and with Julia (Requests.jl) it was even 
lower - about 0.5ms per request."

Then the issue was closed. It seems Julia can have low latency (are Flask 
and Splay [numbers, for it and throughput] considered best-in-class, at 
least for those language?). Splay has "< 1 ms" so unclear how much better, 
it may be. It seems you do not dispute the low latency claim of Julia [on 
the WP page] (any more)?

Do you only disagree, then only, with the "high throughput" of 
Julia/[HttpServer.jl] (and would only change high->good)? [With 1000 
threads] Julia beats Flask, "comparable", while a third of Splay. Maybe 
within an order of magnitude is not comparable.. Not sure about the 6 times 
slower number.

I haven't looked to closely at Requests.jl, so I do not know the 
differences between it and HttpServer.jl are other libraries. It really 
only matters that one library gets good throughput and then you can use 
that one?

 

> Seems like I need to repeat my tests to get latest results.
>

It would be interesting to know if the numbers have improved..


> I didn't check if this works the same, or just similarly?
>
>  
> They have totally different APIs and approaches in general. The main point 
> is that if you want to keep it working with updated version of Julia and 
> libraries, you have to adapt web application too. And it's really not funny 
> to come back to a code written half a year ago just because libraries it 
> used are now deprecated.
>

Yes, see your point.. I guess the stuff still works it it ever did.. I see 
for plots that there is a generic package that is supposed to hide the 
differences of six (by now) different plotting packages.. You say the API 
is totally different, I wander how difficult or stupid it is to support old 
APIs here in some way..


[julia-users] [ANN] Nemo: A computer algebra package for Julia

2015-09-25 Thread 'Bill Hart' via julia-users
Hi all,

It is with pleasure that we release Nemo, a new computer algebra package
we've been working on that uses the Julia programming language.

The official announcement was made yesterday at the computer algebra
minisymposium at the annual meeting of the German Mathematical Society
(DMV) in Hamburg [1].

We are releasing Nemo 0.3, the first really public release of Nemo.

   http://nemocas.org

This represents joint work of myself, Claus Fieker, Tommy Hofmann, Fredrik
Johansson and Oleksandr Motsak.

What we have so far is a generic rings mechanism (polynomial rings, residue
rings, fraction fields, power series, matrices), plus specific rings
implemented by C libraries, Flint [6], Antic [7], Arb [8], Pari [9], GMP
[10]/MPIR [11], providing integers, rationals, integers mod n, finite
fields, padics, real and complex ball arithmetic, number fields and maximal
orders and ideals thereof.

We envision Nemo eventually covering much of computer algebra (in the
limited sense of the word) and number theory. (Of course, Julia itself is
already very capable in the numerical area.)

Nemo's real strengths are in mid-range algorithms, where there is
considerable genericity, but where performance is also required.

For example, one of our aims in the coming months is to implement a very
generic Hermite Normal Form over quite general Euclidean domains and
benchmark it.

Julia is of course a high level language, but is performant over a very
wide range, from things that are typically done in C or even assembler,
right through to things typically done in Ruby, Perl or Python.

See the Nemo website for:

   * benchmarks: http://nemocas.org/benchmarks.html

   * documentation: http://nemocas.org/downloads.html

   * devel list and repository: http://nemocas.org/development.html

Nemo is known to work on Ubuntu, Fedora, Windows 32 and 64 bit (natively).

(It should in theory work on OSX, but this is untested. Bug reports/patches
welcome. See deps/build.jl)

You will need Julia-0.4-rc2 and then just follow the instructions on our
website to obtain and build Nemo.

   http://nemocas.org/downloads.html

Claus Fieker and Tommy Hofmann have also been building a package for
algebraic number theory on top of Julia and Nemo, called Hecke, which may
be of interest to some people:

https://github.com/thofma/hecke

As far as interfacing to Nemo from other projects, this should ultimately
be possible, I believe. There is already some Python-Julia cooperation and
Julia can be embedded in C, I believe. IntelLabs also produced at one point
a Julia to C compiler, though I don't know the current status of that.

There are bound to be rough edges and bugs in Nemo, and there is much to be
added. But we think the time has come to start thinking about student
projects using Nemo, graduate students implementing their thesis in Nemo
and contributors getting involved in the project generally, bearing in mind
what is in Nemo so far and what is not, and bearing in mind what the
strengths and weaknesses are.

Indeed, Nemo/Hecke have already been used for student projects and at least
two more are planned.

One of the next big steps is to integrate Singular [2] in Nemo (we also
later plan to interface with Gap [3] and Polymake[4]). The Singular wrapper
is being developed by Oleksandr Motsak as we speak.

We also plan to implement many more generic matrix algorithms into our
generics system and probably extend the quite limited Pari [5] interface.

As with any Open Source project, we welcome contributors. Please sign up
for our development list if you are interested or have questions.

Finally, I just want to take this opportunity to thank the Julia developers
for the incredibly hard work they are doing on the Julia language. We have
really benefited greatly from the innovation you guys have been putting
into the language, and the extremely rapid pace of development.

Bill Hart.

[1] http://www.math.uni-hamburg.de/DMV2015/minisymposiaschedule.html
[2] http://www.singular.uni-kl.de/
[3] http://www.gap-system.org/
[4] http://www.polymake.org/doku.php
[5] http://pari.math.u-bordeaux.fr/
[6] http://flintlib.org/
[7] https://github.com/wbhart/antic
[8] http://fredrikj.net/arb/
[9] http://pari.math.u-bordeaux.fr/
[10] https://gmplib.org/
[11] http://mpir.org/


Re: [julia-users] Why two based indexing? [A package.. it's not the default..]

2015-09-25 Thread Tomas Lycken
I think that specific repository has the additional function of testing the 
implementation of indexing in base, which is written with the explicit 
intention of being easy to extend. Two-based indexing is mostly useless, 
but implementing it you get the chance to explore and test all the 
different things that needs to work for other packages to be able to extend 
indexing in more useful ways.

// T

On Friday, September 25, 2015 at 3:30:02 PM UTC+2, Spencer Russell wrote:
>
> I understand it as a meditation (koan?) on the futility of arguing about 
> where indices should begin, and where they come to rest. 
>
> Hold it lightly, and be enlightened. 
>
> -s 
>
> > On Sep 25, 2015, at 7:00 AM, Páll Haraldsson  > wrote: 
> > 
> > https://libraries.io/julia/TwoBasedIndexing 
> > 
> > 
> > 
> http://python-history.blogspot.is/2013/10/why-python-uses-0-based-indexing.html
>  
> > 
> > [While Guido's former ABC used 1-based] 
> > 
> > "Guido van RossumOctober 24, 2013 at 8:49 AM 
> > To anyone who prefers 1-based indexing: you are the same people who 
> screwed up the calendar, starting at year 1" 
> > 
> > 
> > I think my next year will start at January 2.. 
> > 
> > I do not want to start an argument on 0-based vs. 1-based, I've grown to 
> like Julia's 1-based variant. Just 2-based seemed odd.. Probably a prove of 
> concept, for more general n-based/Pascal arrays.. 
> > 
> > -- 
> > Palli. 
> > 
>
>

Re: [julia-users] Re: Julia code 5x to 30x slower than Matlab code

2015-09-25 Thread Tom Breloff
Marcio: crowdfunded julia packages is a really awesome idea... is there a
platform for this already for other languages? or should we create one?

On Fri, Sep 25, 2015 at 9:47 AM, Marcio Sales 
wrote:

> all right... Well.. Julia's price will allways be better...
> Btw.. what about crowdfunded initiatives? Has anyone tried that? I would
> be wiling to donate for a geospatial visualization package, for example...
>
>
>


Re: [julia-users] HDF5.jl do not support BigFloat?

2015-09-25 Thread Erik Schnetter
The JLD package should support all Julia types. JLD uses HDF5 as backend.

-erik

On Fri, Sep 25, 2015 at 8:26 AM, Roger Luo  wrote:

> I want to write a data of a trajectory into a HDF5 file by write(or
> h5write) but it seems they both do not have the method of writing a
> BigFloat in?
> Is there any other data file package which can support BigFloat?
>



-- 
Erik Schnetter 
http://www.perimeterinstitute.ca/personal/eschnetter/


Re: [julia-users] Stateflow equivalent in Julia

2015-09-25 Thread NV
Yes, I have a transmission model to implement. I used the following code. 
But I need it to run for as long as I have initialized the time variable to.

using JuMP, Ipopt
Truck = Model(solver=IpoptSolver(print_level=0))
#Initial Values
gear_0 = 1
v_0 = 20
N_0 = 600
#Constants:
i_f = 3.27
eta_f = 0.95
eta_t = 0.95
r_w = 0.52
i = [11.27; 9.14; 7.17; 5.81; 4.62; 3.75; 3.01; 2.44; 1.91; 1.55; 1.23; 1]
#Discretization
n = 500
@defVar(Truck,Δt≥0,start = 1/n)
@defNLExpr(t_f,Δt*n)
@defVar(Truck,600<=N[1:n]<=2500)
@defVar(Truck,1<=gear[1:n]<=12)
@defVar(Truck,i_t[1:n])
@addConstraint(Truck,N[0]==N_0)
@addConstraint(Truck,gear[0]==gear_0)
@addConstraint(Truck,i_t[0]==i[1])
@defNLExpr(N[j=0:n],(30*i_t[j]*i_f)/(pi*r_w))
for j in 1:1:n
if(gear[j]==1)
if(N[j]>=1500)
gear[j+1]= 2
else
gear[j+1] = 1
end
elseif(gear[j]==2)
if(N[j]>=1501)
gear[j+1] = 3
elseif(N[j]<=950)
gear[j+1]= 1
else
gear[j+1] = 2
end
elseif(gear[j]==3)
if(N[j]>=1502)
gear[j+1] = 4
elseif(N[j]<=960)
gear[j+1] = 2
else
gear[j+1] = 3
end
elseif(gear[j]==4)
if(N[j]>=1503)
gear[j+1] = 5;
elseif(N[j]<=970)
gear[j+1] = 3
else
gear[j+1] = 4
end
elseif(gear[j]==5)
if(N[]>=1504)
gear[j+1] = 6;
elseif(N[j]<=980)
gear[j+1] = 4
else
gear[j+1] = 5
end
elseif(gear[j]==6)
if(N[j]>=1505)
gear[j+1] = 7
elseif(N[j]<=990)
gear[j+1] = 5
else
gear[j+1] = 6
end
elseif(gear[j]==7)
if(N[j]>=1497)
gear[j+1] = 8
elseif(N[j]<=1000)
gear[j+1] = 6
else
gear[j+1] = 7
end
elseif(gear[j]==8)
if(N[j]>=1489)
gear[j+1] = 9
elseif(N[j]<=1006)
gear[j+1] = 7
else
gear[j+1] = 8
end
elseif(gear[j]==9)
if(N[j]>=1481)
gear[j+1] = 10
elseif(N[j]<=1012)
gear[j+1] = 8
else
gear[j+1] = 9
end
elseif(gear[j]==10)
if(N[j]>=1473)
gear[j+1] = 11
elseif(N[j]<=1018)
gear[j+1] = 9
else
gear[j+1] = 10
end
elseif(gear[j]==11)
if(N[j]>=1465)
gear[j+1] = 12
elseif(N[j]<=1024)
gear[j+1] = 10
else
gear[j+1] = 11
end 
elseif(gear[j]==12)
if(N[j]<=1030)
gear[j+1] = 11
else
gear[j+1] = 12
end
end   
i_t[j] = i[gear[j+1]]
end

To solve for the system dynamics, I am following the example 
in http://www.juliaopt.org/notebooks/JuMP-Rocket.html . I tried passing 
gear position(gear), engine rpm(N) and transmission ratio(i_t) as variables 
and have added the necessary constraints as well. However, on trying to run 
it, I kept getting an error:


The comparison operator == has been deprecated for constructing constraints. 
Use the macro form @addConstraint instead.


LoadError: TypeError: non-boolean 
(JuMP.GenericRangeConstraint{JuMP.GenericAffExpr{Float64,JuMP.Variable}}) used 
in boolean context
while loading In[2], in expression starting on line 30

 in anonymous at no file


On Friday, 25 September 2015 08:18:53 UTC-5, Spencer Russell wrote:
>
> Welcome to Julia! 
>
> To get useful answers you’re going to need to provide quite a bit more 
> detail on what problems you’re running into. What did you try? What errors 
> are you getting? Are there specific concepts from the documentation that 
> you’re having trouble with? 
>
> -s 
>
> > On Sep 25, 2015, at 1:18 AM, Narayani Vedam  > wrote: 
> > 
> > Hi, 
> >I am new to Julia. I tried implementing a logic that I had in 
> Simulink - Stateflow using Julia, but ran into trouble. Any heads-up on 
> this? 
> > 
> > Thank you 
>
>

Re: [julia-users] Re: Julia code 5x to 30x slower than Matlab code

2015-09-25 Thread Mauro
> Marcio: crowdfunded julia packages is a really awesome idea... is there a
> platform for this already for other languages? or should we create one?
>
> On Fri, Sep 25, 2015 at 9:47 AM, Marcio Sales 
> wrote:
>
>> all right... Well.. Julia's price will allways be better...
>> Btw.. what about crowdfunded initiatives? Has anyone tried that? I would
>> be wiling to donate for a geospatial visualization package, for example...

Maybe better start a new thread for this.