[julia-users] Re: pmap on functions with variable #'s of arguments

2016-06-02 Thread 'Greg Plowman' via julia-users
Of course I meant:
Fprime(a) = F(a,b0,c0)


[julia-users] Re: Private Forks of Julia Repositories

2016-06-02 Thread Chris Rackauckas
I think I will need both versions available, since the majority of the work 
is public, while the private work will tend to sit around longer (i.e. 
waiting to hear back from reviewers). So I'd want to be able to easily work 
with the public repository, but basically switch over to a private branch 
every once in awhile.

On Thursday, June 2, 2016 at 9:21:13 PM UTC-7, Curtis Vogt wrote:
>
> If you don't need to have both versions of the package available at the 
> same time then I would recommend using a single Git repo with multiple 
> remotes. With this setup you can push to your private remote for 
> experiments and later push to the public remote when your ready to share 
> your work.
>
> Some reading material on Git remotes:
> https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes
>


Re: [julia-users] Signal / slot (or publish-subscribe) libraries in Julia

2016-06-02 Thread Femto Trader
Thanks Penn...

Here is my implementation on top of Reactive
That I post also https://github.com/JuliaLang/Reactive.jl/issues/99

using Reactive

Signal() = Reactive.Signal(Bool, false)
typealias Slot Function

function emit(signal::Reactive.Signal, args...; kwargs...)
push!(signal, !signal.value)
end

function myslot01(value::Bool, args...; kwargs...)
println("$(time()) myslot01 with $args and $kwargs")
end

function myslot02(value::Bool, args...; kwargs...)
println("$(time()) myslot02 with $args and $kwargs")
end

function myslot03(value::Bool, a, b; x=-1, y=-1)
println("$(time()) myslot03 with a=$a b=$b x=$x y=$y")
end

function connect(signal::Reactive.Signal, slot::Slot)
preserve(map(slot, signal))
end

function is_connected(signal::Reactive.Signal, slot::Slot)
# ToDo
end

#function disconnect(signal::Signal, slot::Slot)
#ERROR: LoadError: TypeError: Tuple: in parameter, expected Type{T}, 
got Function
#end


stop_modified = Signal()
connect(stop_modified, myslot01)
connect(stop_modified, myslot02)
#connect(stop_modified, myslot03)
emit(stop_modified, 1, 2, x=3, y=4)

#sleep(0.1)

emit(stop_modified, 10, 20, x=30, y=40)



This implementation have some issue

emit is not able to pass arguments (positionnal arguments and keyword 
arguments)
I don't know how to implement is_connected
Removing comments for disconnect raises an error.
If there isn't enough delay between 2 emit calls... slots are not executed 
twice as they should !

Any idea to fix these issues ?


Le vendredi 3 juin 2016 00:59:27 UTC+2, Penn Taylor a écrit :
>
> Sampling only happens with Reactive if you explicitly use the `sampleon` 
> function. Otherwise, you just map a function onto a Signal to get a new 
> Signal. When the first Signal changes, the second Signal changes too. 
> There's no sampling or polling going on in the normal case.
>
> I'm in no way involved with the development of Reactive, but I think an 
> imperative signals/slots package would work best as something separate from 
> Reactive. I tend to think of Reactive as allowing me to declaratively build 
> "value circuits". If I change the value of this thing over here, the value 
> of everything else connected to it automatically changes. Conceptually, you 
> don't *tell* other things a value has changed; it's all passive propagation.
>
> With the imperative signals/slots libraries I've used (Qt 4.x, Qt 5.x, 
> Boost, and my own managed signals/slots implementation on top of Boost), a 
> pretty common pattern is to send out a signal with signature
>
> void foo( );
>
> This is essentially broadcasting "foo has happened!". Consider the use of 
> "clicked()" in Qt. That sort of completely imperative use (no value sent, 
> no value returned) is harder to do with Reactive. Well, it's fairly ugly 
> anyway:
>
> using Reactive
>
> foo = Signal(Void)
>
> # Ugly part #1
> # Emit is only meaningful for Void signals;
> # anything else would simply push a new value into its signal,
> # but pushing Void into a Void signal is conceptually nonsense.
> function emit(sig)
>   push!(sig, Void)
> end
>
> # Ugly part #2
> # Even though the signal we're interested in is a Void signal, our slot
> # has to accept an argument: the Void that the signal "sends"
> function myslot01( _ )
>   println("myslot01 called")
> end
>
> # Ugly part #3
> # Since Reactive.map results in a new signal that we don't care about,
> # we have to wrap the "connection" in `preserve` to prevent the GC
> # from killing the connection. Not sure how to break this
> # connection later should we desire to
> preserve(map(myslot01, foo))
>
>
> emit(stop_modified)
>
> Like I said, fairly ugly.
>
> Hope that helps,
> Penn
>
>
> On Thursday, June 2, 2016 at 5:10:20 AM UTC-5, Bart Janssens wrote:
>>
>> Hello,
>>
>> I would also be interested to know how and if this kind of functionality 
>> relates to Reactive.jl. Looking at the docs for Reactive, it seems it was 
>> designed for "continuous" signals. In Reactive, sampling seems to be 
>> needed, while in a classical signal/slot implementation (such as in Qt) 
>> slots are linked to a signal and called whenever the signal is emitted, 
>> i.e. changes value.
>>
>> So would the way forward for the system described by OP be to extend 
>> Reactive (if needed), or should this be a separate package?
>>
>> Cheers,
>>
>> Bart
>>
>> On Tuesday, May 31, 2016 at 2:17:54 AM UTC+2, Steven G. Johnson wrote:
>>>
>>> Reactive.jl?
>>
>>

[julia-users] Re: pmap on functions with variable #'s of arguments

2016-06-02 Thread 'Greg Plowman' via julia-users

>
>
> function Fprime(a; b0 = b, c0 = c)
>F(a, b0, c0) # treating b and c above as fixed
> end 
>

Where did you define b and c? Did you define on all workers?
 

>
> (i) this does not solve my problem when the a_i's are different sizes and 
> can't be put into one array 
>

Not sure what you mean by this.

In any case, either of these 2 methods work for me:

@everywhere begin
F(a,b,c) = a+b+c

global const b0 = 20
global const c0 = 200
Fprime(a) = a+b0+c0
end

a = [1,2,3,4,5]
b = fill(10, length(a))
c = fill(100, length(a))

pmap(F,a,b,c)
pmap(Fprime,a)




[julia-users] Private Forks of Julia Repositories

2016-06-02 Thread Curtis Vogt
If you don't need to have both versions of the package available at the same 
time then I would recommend using a single Git repo with multiple remotes. With 
this setup you can push to your private remote for experiments and later push 
to the public remote when your ready to share your work.

Some reading material on Git remotes:
https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes

[julia-users] Re: How to build a range of -Inf to Inf

2016-06-02 Thread colintbowers
For those interested, I just hacked together the following implementation 
of what I was after. I've extended in, filter, and replace to the new type:

#Type BasicInterval
#My own extremely simple interval type that denotes all elements between 
start and stop
immutable BasicInterval{T}
start::T
stop::T
function BasicInterval{T}(start::T, stop::T)
start > stop && error("Start must be less than or equal to stop")
new(start, stop)
end
end
BasicInterval{T}(start::T, stop::T) = BasicInterval{T}(start, stop)
Base.in{T}(x::T, r::BasicInterval{T}) = (r.start <= x <= r.stop) ? true : 
false
Base.in{T}(x::AbstractVector{T}, r::BasicInterval{T}) = Bool[ in(x[n], r) 
for n = 1:length(x) ]
function Base.filter!{T}(x::AbstractVector{T}, r::BasicInterval{T})
for n = length(x):-1:1
!in(x[n], r) && deleteat!(x, n)
end
return(x)
end
Base.filter{T}(x::AbstractVector{T}, r::BasicInterval{T}) = 
filter!(deepcopy(x), r)
function replace!{T}(x::AbstractVector{T}, r::BasicInterval{T}, xNew::T)
for n = 1:length(x)
!in(x[n], r) && (x[n] = xNew)
end
return(x)
end
Base.replace{T}(x::AbstractVector{T}, r::BasicInterval{T}, xNew::T) = 
replace!(deepcopy(x), r, xNew)



On Friday, 3 June 2016 12:44:26 UTC+10, colint...@gmail.com wrote:
>
> Hi all,
>
> Is there any way to build a range that corresponds to the mathematical set 
> (-Inf, Inf)? I had a look at the source code in range.jl (which is very 
> readable!) and it doesn't appear that any of the Range types is suitable to 
> this task, e.g. StepRange doesn't take Float64 inputs, UnitRange(-Inf, Inf) 
> returns the range (-Inf, NaN) since the constructor returns convert
> (T,start+floor(stop-start)) for the stop value (I'm presuming for good 
> reasons that I'm not smart enough to understand), and FloatRange needs 
> concepts like step, len, and divisor that aren't well defined in this 
> context.
>
> Cheers,
>
> Colin
>
>
>

Re: [julia-users] How to build a range of -Inf to Inf

2016-06-02 Thread colintbowers
Thanks for responding. I've posted a response to both you and Tom in 
response to Tom's post. In short, it sounds like my definition of Range is 
poor/wrong and I should just implement my own custom type.

Cheers and thanks,

Colin

On Friday, 3 June 2016 12:54:57 UTC+10, Yichao Yu wrote:
>
> On Thu, Jun 2, 2016 at 10:44 PM,   
> wrote: 
> > Hi all, 
> > 
> > Is there any way to build a range that corresponds to the mathematical 
> set 
> > (-Inf, Inf)? I had a look at the source code in range.jl (which is very 
> > readable!) and it doesn't appear that any of the Range types is suitable 
> to 
> > this task, e.g. StepRange doesn't take Float64 inputs, UnitRange(-Inf, 
> Inf) 
> > returns the range (-Inf, NaN) since the constructor returns 
> > convert(T,start+floor(stop-start)) for the stop value (I'm presuming for 
> > good reasons that I'm not smart enough to understand), and FloatRange 
> needs 
> > concepts like step, len, and divisor that aren't well defined in this 
> > context. 
>
> A Range is not a interval but rather a series of equally spaced 
> numbers so a range with `Inf` as start/end is basically meaningless. 
> You should probably find another datastructure. 
>
> > 
> > Cheers, 
> > 
> > Colin 
> > 
> > 
>


Re: [julia-users] How to build a range of -Inf to Inf

2016-06-02 Thread colintbowers
Looking at your and Yichao's responses, I think my definition of Range is 
poor/wrong.

I just wanted a type that denoted every element of the same type between 
the start and stop point (inclusive). So e.g. an input of (0.0, 1.0) would 
denote the set of every Float64 between 0.0 and 1.0, and (4, 7) would 
denote the Ints 4, 5, 6, 7, and so on.

It sounds like there is no type in Base that does this, and 
ValidatedNumerics and Unums sound like over-kill based on their github 
pages. I think I'll just implement it myself - I'm sure it'll only be about 
5-10 lines of code.

Cheers and thanks for responding,

Colin

On Friday, 3 June 2016 12:53:40 UTC+10, Tom Breloff wrote:
>
> It seems like you're misusing Range here. Maybe you want to look at 
> ValidatedNumerics or Unums? What's your use-case?
>
> On Thursday, June 2, 2016,  wrote:
>
>> Hi all,
>>
>> Is there any way to build a range that corresponds to the mathematical 
>> set (-Inf, Inf)? I had a look at the source code in range.jl (which is very 
>> readable!) and it doesn't appear that any of the Range types is suitable to 
>> this task, e.g. StepRange doesn't take Float64 inputs, UnitRange(-Inf, Inf) 
>> returns the range (-Inf, NaN) since the constructor returns convert
>> (T,start+floor(stop-start)) for the stop value (I'm presuming for good 
>> reasons that I'm not smart enough to understand), and FloatRange needs 
>> concepts like step, len, and divisor that aren't well defined in this 
>> context.
>>
>> Cheers,
>>
>> Colin
>>
>>
>>

[julia-users] Private Forks of Julia Repositories

2016-06-02 Thread Chris Rackauckas
Hey,
  I was wondering if anyone has experience creating a private fork of a 
Julia repository. I would like to implement some research codes via 
modifying (my own) public repository, keep it private until publication, 
and then merge it into the main repository. I found a StackOverflow 
solution for doing this:

http://stackoverflow.com/questions/10065526/github-how-to-make-a-fork-of-public-repository-private

However, I was wondering if I'd run into any issues with Julia's package 
manager. If I have both versions on my computer, how will Julia know which 
module to import when importing/using? Does anyone know of a good way to 
deal with this?


Re: [julia-users] Can we make Julia develop itself?

2016-06-02 Thread Lyndon White
And on that
take a look at all the interlanguage operations.
I have some old notes, I wrote:


Julia is well know for its excellent Foreign Function Interface (FFI). What 
you might not know is that it is more than C, Fortran and Python.
 There are many more. In theory we could daisy chain off of those 
languages, to get even more. Eg using Pycall and oct2py to call octave

##.*[C, Fortran, 
Rust...](http://julia.readthedocs.org/en/latest/manual/calling-c-and-fortran-code/)*
 C and Fortran are infact supported within the core system. No 3rd Party 
Libary needed. It also appears to be able to call 
[Rust](http://paul.woolcock.us/posts/rust-perl-julia-ffi.html). Presumably 
it can be used to call any number of other compiled languages, so long as 
the follow certain conventions.

*## [PyCall](https://github.com/stevengj/PyCall.jl) *
Probably the most well known Julia FFI.
Its great for NLTK, sklearn etc.
Also useful for things like Pickle

Several popular julia libraries are build around python libraries Eg:


   -  - [SymPy](https://github.com/jverzani/SymPy.jl) is 
   [SymPy](http://www.sympy.org) 
   -  - [PyPlot](https://github.com/stevengj/PyPlot.jl) is 
   [Matplotlib](http://matplotlib.org/) 



*##[Mathematica](https://github.com/one-more-minute/Mathematica.jl)*

 Far less well known. I am yet to test it, but it looks real neat. It does 
require Mathematica, and my liscense has expired. 
The [Mathlink Component can be found 
here.](https://github.com/one-more-minute/MathLink.jl).

* ##[Matlab](https://github.com/JuliaLang/MATLAB.jl) *
Like the Mathematica above requires the commercial Matlab. Does not appear 
to support octave. 

*##[JavaCall](http://aviks.github.io/JavaCall.jl/) *

This seems like a strange notion, Java doesn't seem like it has much use by 
the scientific community tht is julia's target audience. However, both 
Matlab and Mathematica have support for calling Java so there must be some 
use. CoreNLP and a few other things like that, some good datamining tools. 
Could be very useful depending on field.

*##[C++](https://github.com/Keno/CXX.jl) CXX *
used to require a custom build of Julia 0.4 with LLVM 3.7.
I think that in no longer true.


A few more have probably shown up there.



On cracking wise: 
It is not that there is no such that as *inane* questions, it is that there 
is no such thing as *stupid *questions.
A stupid question (in this context) is one that demonstrates your ignorance 
of the answer.
An inane question is one that demonstrates your ignorance of the question.


On Friday, 3 June 2016 07:24:54 UTC+8, Isaiah wrote:
>
> I'm going to assume that there is a terminology barrier here...
>
> My interpretation of the question is: can we directly translate programs 
> from other languages?
>
> This is called source to source translation or compilation (
> https://en.m.wikipedia.org/wiki/Source-to-source_compiler), and the 
> answer is "it's complicated".
>
> Kevin, hopefully that terminology will give you a better start on looking 
> for answers -- stackoverflow probably has better treatments than I can give 
> regarding why this is difficult.
>
> On Thursday, June 2, 2016, Kevin Liu  
> wrote:
>
>> Is there an answer somewhere here? 
>>
>> On Thursday, June 2, 2016 at 7:54:04 PM UTC-3, Kristoffer Carlsson wrote:
>>>
>>> Someone taught you wrong.
>>
>>

[julia-users] pmap on functions with variable #'s of arguments

2016-06-02 Thread ABB
Hello all - 

I'd like to apply pmap to a function F I've written, which takes several 
arguments, only one of which will be varying across pmap.

For example:

function F(a, b, c)
# a silly example
a + b + c 
end

I'd like to pmap F over a1, a2, and a3, while keeping b and c the same for 
the three iterations.  

(I tried this stackexchange 
answer: http://stackoverflow.com/questions/24637064/julia-using-pmap-correctly 
  and did not have any luck - { } are deprecated as containers (I think) 
and the a_i's may be of different sizes so [a1 a2 a3] might not be a 
reasonable object to try to form.  I tried both ideas in that answer: 
writing the arguments as [a1 b c] [a2 b c]... etc or [a1 a2 a3] [b b b] ... 
etc.  Neither one worked.)

I have also tried defining

function Fprime(a; b0 = b, c0 = c)
   F(a, b0, c0) # treating b and c above as fixed
end 

And then doing pmap( Fprime, [a1 a2 a3]), but 

(i) this does not solve my problem when the a_i's are different sizes and 
can't be put into one array 

(ii) it gave me an error even when I tried it on the easy case [a1 a1], 
where I think pmap should just (eventually) call F(a1, b, c) on two 
workers.  The error I got was a CapturedException MethodError, even though 
Fprime( a1) works just fine.

If you can point me to what I am doing wrong, I would be very grateful.

Thanks!

ABB


Re: [julia-users] How to build a range of -Inf to Inf

2016-06-02 Thread Yichao Yu
On Thu, Jun 2, 2016 at 10:44 PM,   wrote:
> Hi all,
>
> Is there any way to build a range that corresponds to the mathematical set
> (-Inf, Inf)? I had a look at the source code in range.jl (which is very
> readable!) and it doesn't appear that any of the Range types is suitable to
> this task, e.g. StepRange doesn't take Float64 inputs, UnitRange(-Inf, Inf)
> returns the range (-Inf, NaN) since the constructor returns
> convert(T,start+floor(stop-start)) for the stop value (I'm presuming for
> good reasons that I'm not smart enough to understand), and FloatRange needs
> concepts like step, len, and divisor that aren't well defined in this
> context.

A Range is not a interval but rather a series of equally spaced
numbers so a range with `Inf` as start/end is basically meaningless.
You should probably find another datastructure.

>
> Cheers,
>
> Colin
>
>


Re: [julia-users] How to build a range of -Inf to Inf

2016-06-02 Thread Tom Breloff
It seems like you're misusing Range here. Maybe you want to look at
ValidatedNumerics or Unums? What's your use-case?

On Thursday, June 2, 2016,  wrote:

> Hi all,
>
> Is there any way to build a range that corresponds to the mathematical set
> (-Inf, Inf)? I had a look at the source code in range.jl (which is very
> readable!) and it doesn't appear that any of the Range types is suitable to
> this task, e.g. StepRange doesn't take Float64 inputs, UnitRange(-Inf, Inf)
> returns the range (-Inf, NaN) since the constructor returns convert
> (T,start+floor(stop-start)) for the stop value (I'm presuming for good
> reasons that I'm not smart enough to understand), and FloatRange needs
> concepts like step, len, and divisor that aren't well defined in this
> context.
>
> Cheers,
>
> Colin
>
>
>


[julia-users] How to build a range of -Inf to Inf

2016-06-02 Thread colintbowers
Hi all,

Is there any way to build a range that corresponds to the mathematical set 
(-Inf, Inf)? I had a look at the source code in range.jl (which is very 
readable!) and it doesn't appear that any of the Range types is suitable to 
this task, e.g. StepRange doesn't take Float64 inputs, UnitRange(-Inf, Inf) 
returns the range (-Inf, NaN) since the constructor returns convert(T,start+
floor(stop-start)) for the stop value (I'm presuming for good reasons that 
I'm not smart enough to understand), and FloatRange needs concepts like 
step, len, and divisor that aren't well defined in this context.

Cheers,

Colin




Re: [julia-users] Is the master algorithm on the roadmap?

2016-06-02 Thread Isaiah Norton
This is not a forum for wildly off-topic, speculative discussion.

Take this to Reddit, Hacker News, etc.


On Thu, Jun 2, 2016 at 10:01 PM, Kevin Liu  wrote:

> I am wondering how Julia fits in with the unified tribes
>
> mashable.com/2016/06/01/bill-gates-ai-code-conference/#8VmBFjIiYOqJ
>
> https://www.youtube.com/watch?v=B8J4uefCQMc
>


Re: [julia-users] Can we make Julia develop itself?

2016-06-02 Thread cdm

even sans any terminology barriers, i appreciate the self-referential 
nature of the question ...

given Julia's ties to AI and the fact that it is no foreign concept at 
StrangeLoop,

i say "good on you, Mr. Liu"



"The only walls that exist are those you have placed in your mind.
And whatever obstacles you conceive, exist only because you have
forgotten what you have already achieved." ~ S. Kassem


[julia-users] Is the master algorithm on the roadmap?

2016-06-02 Thread Kevin Liu
I am wondering how Julia fits in with the unified tribes

mashable.com/2016/06/01/bill-gates-ai-code-conference/#8VmBFjIiYOqJ

https://www.youtube.com/watch?v=B8J4uefCQMc


Re: [julia-users] Can we make Julia develop itself?

2016-06-02 Thread Kevin Liu
Got it. Thanks.

On Thursday, June 2, 2016 at 8:24:54 PM UTC-3, Isaiah wrote:
>
> I'm going to assume that there is a terminology barrier here...
>
> My interpretation of the question is: can we directly translate programs 
> from other languages?
>
> This is called source to source translation or compilation (
> https://en.m.wikipedia.org/wiki/Source-to-source_compiler), and the 
> answer is "it's complicated".
>
> Kevin, hopefully that terminology will give you a better start on looking 
> for answers -- stackoverflow probably has better treatments than I can give 
> regarding why this is difficult.
>
> On Thursday, June 2, 2016, Kevin Liu  
> wrote:
>
>> Is there an answer somewhere here? 
>>
>> On Thursday, June 2, 2016 at 7:54:04 PM UTC-3, Kristoffer Carlsson wrote:
>>>
>>> Someone taught you wrong.
>>
>>

Re: [julia-users] Can we make Julia develop itself?

2016-06-02 Thread Isaiah Norton
I'm going to assume that there is a terminology barrier here...

My interpretation of the question is: can we directly translate programs
from other languages?

This is called source to source translation or compilation (
https://en.m.wikipedia.org/wiki/Source-to-source_compiler), and the answer
is "it's complicated".

Kevin, hopefully that terminology will give you a better start on looking
for answers -- stackoverflow probably has better treatments than I can give
regarding why this is difficult.

On Thursday, June 2, 2016, Kevin Liu  wrote:

> Is there an answer somewhere here?
>
> On Thursday, June 2, 2016 at 7:54:04 PM UTC-3, Kristoffer Carlsson wrote:
>>
>> Someone taught you wrong.
>
>


Re: [julia-users] Can we make Julia develop itself?

2016-06-02 Thread Kevin Liu
Look who jumped into the wiseass train. An honest, short answer would be 
appreciated.

On Thursday, June 2, 2016 at 7:54:04 PM UTC-3, Kristoffer Carlsson wrote:
>
> Someone taught you wrong.



Re: [julia-users] Can we make Julia develop itself?

2016-06-02 Thread Kevin Liu
Is there an answer here somewhere?

On Thursday, June 2, 2016 at 7:54:04 PM UTC-3, Kristoffer Carlsson wrote:
>
> Someone taught you wrong.



Re: [julia-users] Can we make Julia develop itself?

2016-06-02 Thread Kevin Liu
Is there an answer somewhere here? 

On Thursday, June 2, 2016 at 7:54:04 PM UTC-3, Kristoffer Carlsson wrote:
>
> Someone taught you wrong.



Re: [julia-users] Signal / slot (or publish-subscribe) libraries in Julia

2016-06-02 Thread Penn Taylor
Sampling only happens with Reactive if you explicitly use the `sampleon` 
function. Otherwise, you just map a function onto a Signal to get a new 
Signal. When the first Signal changes, the second Signal changes too. 
There's no sampling or polling going on in the normal case.

I'm in no way involved with the development of Reactive, but I think an 
imperative signals/slots package would work best as something separate from 
Reactive. I tend to think of Reactive as allowing me to declaratively build 
"value circuits". If I change the value of this thing over here, the value 
of everything else connected to it automatically changes. Conceptually, you 
don't *tell* other things a value has changed; it's all passive propagation.

With the imperative signals/slots libraries I've used (Qt 4.x, Qt 5.x, 
Boost, and my own managed signals/slots implementation on top of Boost), a 
pretty common pattern is to send out a signal with signature

void foo( );

This is essentially broadcasting "foo has happened!". Consider the use of 
"clicked()" in Qt. That sort of completely imperative use (no value sent, 
no value returned) is harder to do with Reactive. Well, it's fairly ugly 
anyway:

using Reactive

foo = Signal(Void)

# Ugly part #1
# Emit is only meaningful for Void signals;
# anything else would simply push a new value into its signal,
# but pushing Void into a Void signal is conceptually nonsense.
function emit(sig)
  push!(sig, Void)
end

# Ugly part #2
# Even though the signal we're interested in is a Void signal, our slot
# has to accept an argument: the Void that the signal "sends"
function myslot01( _ )
  println("myslot01 called")
end

# Ugly part #3
# Since Reactive.map results in a new signal that we don't care about,
# we have to wrap the "connection" in `preserve` to prevent the GC
# from killing the connection. Not sure how to break this
# connection later should we desire to
preserve(map(myslot01, foo))


emit(stop_modified)

Like I said, fairly ugly.

Hope that helps,
Penn


On Thursday, June 2, 2016 at 5:10:20 AM UTC-5, Bart Janssens wrote:
>
> Hello,
>
> I would also be interested to know how and if this kind of functionality 
> relates to Reactive.jl. Looking at the docs for Reactive, it seems it was 
> designed for "continuous" signals. In Reactive, sampling seems to be 
> needed, while in a classical signal/slot implementation (such as in Qt) 
> slots are linked to a signal and called whenever the signal is emitted, 
> i.e. changes value.
>
> So would the way forward for the system described by OP be to extend 
> Reactive (if needed), or should this be a separate package?
>
> Cheers,
>
> Bart
>
> On Tuesday, May 31, 2016 at 2:17:54 AM UTC+2, Steven G. Johnson wrote:
>>
>> Reactive.jl?
>
>

Re: [julia-users] Can we make Julia develop itself?

2016-06-02 Thread Kristoffer Carlsson
Someone taught you wrong.

Re: [julia-users] Can we make Julia develop itself?

2016-06-02 Thread Kevin Liu
I'm sorry. I was taught no questions were inane.

Assuming we know what the packages ready in other languages do, can't the 
missing Julia packages be done through induction?

On Thursday, June 2, 2016 at 2:45:03 PM UTC-3, Stefan Karpinski wrote:
>
> Please don't spam the list with inane questions like this.
>
> On Thu, Jun 2, 2016 at 12:06 PM, Kevin Liu  > wrote:
>
>> Isn't package development mechanical? 
>>
>
>

[julia-users] Re: starting a worker limits blas to one thread

2016-06-02 Thread Michael Eastwood
And I figured out the answer to my own problem.

The suspect line in the `addprocs` behavior is here:
https://github.com/JuliaLang/julia/blob/v0.4.3/base/multi.jl#L1120
This function calls `blas_set_num_threads(1)` so I can undo this behavior
by just calling `Base.blas_set_num_threads(16)` after `addprocs`.

I am going to open an issue asking for this to become a keyword argument.

Thanks,
Michael



On Thu, Jun 2, 2016 at 2:44 PM, Michael Eastwood <
michael.w.eastw...@gmail.com> wrote:

> Hello julia-users,
>
> I've noticed that if I start a worker blas is all of the sudden restricted
> to only running on one thread. See for example the following log. Here I
> multiply a large matrix by itself, add a remote worker, and repeat the
> multiplication (on the master process). In the latter case blas only uses
> one thread despite the fact it was happily using 16 threads before adding
> the worker. (Note that this log only shows timings but I've verified the
> number of threads being used by watching top).
>
> Can this behavior be circumvented?
>
> $ julia
>_
>_   _ _(_)_ |  A fresh approach to technical computing
>   (_) | (_) (_)|  Documentation: http://docs.julialang.org
>_ _   _| |_  __ _   |  Type "?help" for help.
>   | | | | | | |/ _` |  |
>   | | |_| | | | (_| |  |  Version 0.4.3 (2016-01-12 21:37 UTC)
>  _/ |\__'_|_|_|\__'_|  |
> |__/   |  x86_64-unknown-linux-gnu
>
> julia> function multiply(A)
>A'*A
>end
> multiply (generic function with 1 method)
>
> julia> A = randn(5000, 5000);
>
> julia> ENV["OMP_NUM_THREADS"]
> "16"
>
> julia> @time multiply(A); # 16 threads used as expected
>   1.302345 seconds (634.91 k allocations: 220.681 MB, 3.01% gc time)
>
> julia> addprocs([("astm10", 1)]) # add a process on a remote machine
> 1-element Array{Int64,1}:
>  2
>
> julia> ENV["OMP_NUM_THREADS"] # unchanged
> "16"
>
> julia> @time multiply(A); # only one thread used
>  10.126372 seconds (9 allocations: 190.735 MB, 0.02% gc time)
>
> julia> versioninfo()
> Julia Version 0.4.3
> Commit a2f713d* (2016-01-12 21:37 UTC)
> Platform Info:
>   System: Linux (x86_64-unknown-linux-gnu)
>   CPU: Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
>   WORD_SIZE: 64
>   BLAS: libopenblas (USE64BITINT NO_AFFINITY NEHALEM)
>   LAPACK: libopenblas64_
>   LIBM: libopenlibm
>   LLVM: libLLVM-3.3
>
>
> Thanks,
> Michael
>
>


[julia-users] starting a worker limits blas to one thread

2016-06-02 Thread Michael Eastwood
Hello julia-users,

I've noticed that if I start a worker blas is all of the sudden restricted
to only running on one thread. See for example the following log. Here I
multiply a large matrix by itself, add a remote worker, and repeat the
multiplication (on the master process). In the latter case blas only uses
one thread despite the fact it was happily using 16 threads before adding
the worker. (Note that this log only shows timings but I've verified the
number of threads being used by watching top).

Can this behavior be circumvented?

$ julia
   _
   _   _ _(_)_ |  A fresh approach to technical computing
  (_) | (_) (_)|  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.4.3 (2016-01-12 21:37 UTC)
 _/ |\__'_|_|_|\__'_|  |
|__/   |  x86_64-unknown-linux-gnu

julia> function multiply(A)
   A'*A
   end
multiply (generic function with 1 method)

julia> A = randn(5000, 5000);

julia> ENV["OMP_NUM_THREADS"]
"16"

julia> @time multiply(A); # 16 threads used as expected
  1.302345 seconds (634.91 k allocations: 220.681 MB, 3.01% gc time)

julia> addprocs([("astm10", 1)]) # add a process on a remote machine
1-element Array{Int64,1}:
 2

julia> ENV["OMP_NUM_THREADS"] # unchanged
"16"

julia> @time multiply(A); # only one thread used
 10.126372 seconds (9 allocations: 190.735 MB, 0.02% gc time)

julia> versioninfo()
Julia Version 0.4.3
Commit a2f713d* (2016-01-12 21:37 UTC)
Platform Info:
  System: Linux (x86_64-unknown-linux-gnu)
  CPU: Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT NO_AFFINITY NEHALEM)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.3


Thanks,
Michael


Re: [julia-users] Input to Function Not Replaced if Part of Larger Array

2016-06-02 Thread Kaela Martin
This solution worked. Thanks so much!

On Thursday, June 2, 2016 at 12:02:05 PM UTC-7, Yichao Yu wrote:
>
> On Thu, Jun 2, 2016 at 2:28 PM, Kaela Martin  > wrote: 
> > I have a function that computes the unit vector and replaces the input 
> with 
> > that unit vector. However, when I have the input as part of a larger 
> array, 
> > it doesn't replace that part of the array. 
> > 
> > For example, if the vector I want to make a unit vector is R = [1. 2.; 
> 3. 
> > 4.; 5. 6.], the function unit!(R[:,1]) (listed below) should replace the 
>
> R[:, 1] does not return a view, sth like `sub(R, :, 1)` should work. 
>
> > first column of R with its unit vector. The current code is not. What am 
> I 
> > doing wrong? 
> > 
> > Thanks for the help! 
> > 
> > function unit!{T}(V::AbstractArray{T}) 
> > v=mag(V) 
> > 
> > for ii in 1:3 
> >   V[ii] = V[ii]/v 
> > end 
> > 
> > if v == 0 
> >   V[1] = 1 
> >   V[2] = 0 
> >   V[3] = 0 
> > end #no divide by 0 
> > 
> > return v 
> > end 
> > 
> > function mag{T}(R::AbstractArray{T}) 
> > 
> > R=sqrt(dot(R,R)) 
> > 
> > end 
>


[julia-users] errors using packages in parallel

2016-06-02 Thread Ethan Anderes


I’m looking for help setting up a parallel job spread across different 
servers. I would like to use my laptop as the master node. I’m getting 
errors when using packages and I’m not sure what I’m doing wrong. Any help 
would be appreciated

   _
   _   _ _(_)_ |  A fresh approach to technical computing
  (_) | (_) (_)|  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.4.6-pre+36 (2016-05-19 19:11 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit 1e3e941 (14 days old release-0.4)
|__/   |  x86_64-apple-darwin15.5.0

julia> machines = ["ande...@xxx.xxx.edu", "ande...@yyy.yyy.edu"]
2-element Array{ASCIIString,1}:
 "ande...@xxx.xxx.edu"
 "ande...@yyy.yyy.edu"

julia> addprocs(
   machines,
   tunnel=true,
   dir="/home/anderes/",
   exename="/usr/local/bin/julia",
   topology=:master_slave,
   )
2-element Array{Int64,1}:
 2
 3

julia> using  Dierckx
WARNING: node state is inconsistent: node 2 failed to load cache from 
/Users/ethananderes/.julia/lib/v0.4/Dierckx.ji
WARNING: node state is inconsistent: node 3 failed to load cache from 
/Users/ethananderes/.julia/lib/v0.4/Dierckx.ji

julia> @everywhere spl = Dierckx.Spline1D([1., 2., 3.], [1., 2., 3.], k=2)
ERROR: On worker 2:
ERROR: On worker 2:
UndefVarError: Dierckx not defined
 in eval at ./sysimg.jl:14
 in anonymous at multi.jl:1394
 in anonymous at multi.jl:923
 in run_work_thunk at multi.jl:661
 [inlined code] from multi.jl:923
 in anonymous at task.jl:63
 in remotecall_fetch at multi.jl:747
 in remotecall_fetch at multi.jl:750
 in anonymous at multi.jl:1396

...and 1 other exceptions.

 in sync_end at ./task.jl:413
 in anonymous at multi.jl:1405

Note: I’ve got Dierckx installed and working on the remote servers (not 
even sure if that is needed). Also, as you can see below, I can get the 
code to run fine if I have the workers on my local machine.

julia> addprocs(2, topology=:master_slave)
2-element Array{Int64,1}:
 2
 3

julia> using  Dierckx

julia> @everywhere spl = Dierckx.Spline1D([1., 2., 3.], [1., 2., 3.], k=2)

Thanks!
​


Re: [julia-users] Re: Arithmetic with TypePar

2016-06-02 Thread Robert DJ
That's a nice solution -- thanks!

On Thursday, June 2, 2016 at 1:54:23 PM UTC+2, Erik Schnetter wrote:
>
> In these cases I do the following:
>
> (1) Add additional type parameters, as in
>
> ```Julia
> type FooImp{D,D1}
> baz::Array{D}
> bar::Array{D1}
> end
> ```
>
> (2) Add a function that calculates the type:
>
> ```Julia
> Foo(D) = FooImpl{D,D+1}
> ```
>
> In many cases I can then have to write `Foo(D)` instead of `Foo{D}` (round 
> parentheses instead of curly braces), but apart from this, things work out 
>  nicely. I'm sure there is some `@pure` annotation or similar for `Foo` to 
> help type inference.
>
> -erik
>
> PS: Yes, it would be nice if this calculation (`D1 = D+1`) could be moved 
> elsewhere, e.g. into the type definition. I don't see why this isn't 
> possible, I think it's mostly a complicated thing to implement, and people 
> haven't demonstrated the necessity for this yet.
>
>
>
> On Thu, Jun 2, 2016 at 2:07 AM, Robert DJ  > wrote:
>
>> The problem with not specifying D is type inference. I actually have more 
>> entries in Foo and would like
>>
>> type Foo{D}
>> baz::Array{D}
>> bar::Array{D+1}
>> end
>>
>>
>> I want to use Foo in calculations and for D = 1 I am doing something like
>>
>> baz + bar[:,1]
>> baz + bar[:,2]
>>
>>
>> For D = 2:
>>
>> baz + bar[:,:,1]
>> baz + bar[:,:,2]
>>
>>
>> I *could* instead (for D = 2) move the third dimension to extra columns...
>>
>>
>> On Wednesday, June 1, 2016 at 8:56:28 PM UTC+2, Robert DJ wrote:
>>>
>>> I have a custom type with a TypePar denoting a dimension and would like 
>>> to define the following:
>>>
>>> type Foo{D}
>>> bar::Array{D+1}
>>> end
>>>
>>> However, this does not work. As D is only 1 or 2 it would OK with
>>>
>>> type Foo{1}
>>> bar::Matrix
>>> end
>>>
>>> type Foo{2}
>>> bar::Array{3}
>>> end
>>>
>>> but unfortunately this isn't working, either. 
>>>
>>> Can this problem be solved?
>>>
>>> Thanks!
>>>
>>
>
>
> -- 
> Erik Schnetter  
> http://www.perimeterinstitute.ca/personal/eschnetter/
>


Re: [julia-users] Input to Function Not Replaced if Part of Larger Array

2016-06-02 Thread Yichao Yu
On Thu, Jun 2, 2016 at 3:01 PM, Yichao Yu  wrote:
> On Thu, Jun 2, 2016 at 2:28 PM, Kaela Martin  wrote:
>> I have a function that computes the unit vector and replaces the input with
>> that unit vector. However, when I have the input as part of a larger array,
>> it doesn't replace that part of the array.
>>
>> For example, if the vector I want to make a unit vector is R = [1. 2.; 3.
>> 4.; 5. 6.], the function unit!(R[:,1]) (listed below) should replace the
>
> R[:, 1] does not return a view, sth like `sub(R, :, 1)` should work.

For reference, if you think you have an opinion on what `R[:, 1]`
should return, you can read
https://github.com/JuliaLang/julia/issues/13157 and
https://github.com/JuliaLang/julia/pull/9150 and various linked
discussions.

>
>> first column of R with its unit vector. The current code is not. What am I
>> doing wrong?
>>
>> Thanks for the help!
>>
>> function unit!{T}(V::AbstractArray{T})
>> v=mag(V)
>>
>> for ii in 1:3
>>   V[ii] = V[ii]/v
>> end
>>
>> if v == 0
>>   V[1] = 1
>>   V[2] = 0
>>   V[3] = 0
>> end #no divide by 0
>>
>> return v
>> end
>>
>> function mag{T}(R::AbstractArray{T})
>>
>> R=sqrt(dot(R,R))
>>
>> end


Re: [julia-users] Input to Function Not Replaced if Part of Larger Array

2016-06-02 Thread Yichao Yu
On Thu, Jun 2, 2016 at 2:28 PM, Kaela Martin  wrote:
> I have a function that computes the unit vector and replaces the input with
> that unit vector. However, when I have the input as part of a larger array,
> it doesn't replace that part of the array.
>
> For example, if the vector I want to make a unit vector is R = [1. 2.; 3.
> 4.; 5. 6.], the function unit!(R[:,1]) (listed below) should replace the

R[:, 1] does not return a view, sth like `sub(R, :, 1)` should work.

> first column of R with its unit vector. The current code is not. What am I
> doing wrong?
>
> Thanks for the help!
>
> function unit!{T}(V::AbstractArray{T})
> v=mag(V)
>
> for ii in 1:3
>   V[ii] = V[ii]/v
> end
>
> if v == 0
>   V[1] = 1
>   V[2] = 0
>   V[3] = 0
> end #no divide by 0
>
> return v
> end
>
> function mag{T}(R::AbstractArray{T})
>
> R=sqrt(dot(R,R))
>
> end


[julia-users] Input to Function Not Replaced if Part of Larger Array

2016-06-02 Thread Kaela Martin
I have a function that computes the unit vector and replaces the input with 
that unit vector. However, when I have the input as part of a larger array, 
it doesn't replace that part of the array.

For example, if the vector I want to make a unit vector is R = [1. 2.; 3. 
4.; 5. 6.], the function unit!(R[:,1]) (listed below) should replace the 
first column of R with its unit vector. The current code is not. What am I 
doing wrong?

Thanks for the help!

function unit!{T}(V::AbstractArray{T})
v=mag(V)

for ii in 1:3
  V[ii] = V[ii]/v
end

if v == 0
  V[1] = 1
  V[2] = 0
  V[3] = 0
end #no divide by 0

return v
end

function mag{T}(R::AbstractArray{T})

R=sqrt(dot(R,R))

end


Re: [julia-users] Function argument inlining

2016-06-02 Thread Ford Ox
I have thought that every function in julia is Functor by default, since it 
is object like any other.

On Thursday, June 2, 2016 at 2:53:12 PM UTC+2, Yichao Yu wrote:
>
> On Thu, Jun 2, 2016 at 8:37 AM, Cedric St-Jean  > wrote: 
> > I have two very similar functions that differ in only which function 
> they 
> > call 
> > 
> > function search_suspects_forward(...) 
> > ... 
> > searchsortedfirst(...) 
> > end 
> > 
> > function search_suspects_backward(...) 
> > ... 
> > searchsortedlast(...) 
> > end 
> > 
> > function foo() 
> >search_suspects_forward(...) 
> > end 
> > 
> > Naturally, I'd like to refactor the common code 
> > 
> > function search_suspects(..., search_fun::Function) 
> > ... 
> > search_fun(...) 
> > end 
> > 
> > search_suspects_foward(...) = search_suspects(..., searchsortedfirst) 
> > ... 
> > 
> > But Julia doesn't specialize search_suspects based on search_fun (at 
> least 
> > on 0.4), which is a missed optimization opportunity. Is there any way to 
> do 
> > that? I could turn `search_fun` into a functor, but that kinda sucks (is 
> > there a way to do that automatically?) If I understand inlining 
> heuristics 
> > correctly, I would expect that `search_suspects_forward`, being a short 
> > function, will be inlined into `foo`, but what I want is for 
> > `search_suspects` to be inlined into `search_suspects_forward`. Are 
> there 
> > ways of communicating that to the compiler? Is there a @notinline? 
>
> Functor is the only way on 0.4. This is done automatically on 0.5. 
>


Re: [julia-users] Re: Double free or corruption (out)

2016-06-02 Thread Nils Gudat
Hm, interesting observation... I suppose the issue in my case is that the 
code as it is takes about 3-4 days to complete, so running it on 1 instead 
of 15 cores means I'm unlikely to ever get my PhD!
I will at least try to run a shorter version that might be solvable in a 
day or two without parallel.



Re: [julia-users] Can we make Julia develop itself?

2016-06-02 Thread Stefan Karpinski
Please don't spam the list with inane questions like this.

On Thu, Jun 2, 2016 at 12:06 PM, Kevin Liu  wrote:

> Isn't package development mechanical?
>


[julia-users] How to run task in background without disabling kb input?

2016-06-02 Thread Forrest Curo
If I try the following:
@async begin
 while(1 == 1)
  iter(x) # the function listens for incoming rt MIDI events
  end
 end
end

iter begins printing out any notes I play in from my [music] keyboard -- 
but then I can't use my [text] keyboard to do anything else in the 
forground.

I want to leave the MIDI function running while I add other functions.

How? Is there a suitable way to use @async? -- or is that even the right 
approach at all? 


[julia-users] Can we make Julia develop itself?

2016-06-02 Thread Kevin Liu
Isn't package development mechanical? 


[julia-users] Can we make Julia make itself complete?

2016-06-02 Thread Kevin Liu
Instead of developing packages, make Julia develop on its own? Isn't 
package development mechanical? 


Re: [julia-users] Re: Arithmetic with TypePar

2016-06-02 Thread Kristoffer Carlsson
The annoyance is when you have to store these things in a type because for type 
stability you need to parameterize the type on everything the sotred fields 
parameterize on, including the "redundant" ones.

For example, I have a tensor type which is wrapping a tuple and instead of 
storing "SymmetricTensor{dim, order, T}" I have to store "SymmetricTensor{dim, 
order, T, N}" where N is the number of independent components.

Re: [julia-users] Re: Double free or corruption (out)

2016-06-02 Thread Andrew
Have you tried running the code without using parallel? I have been getting 
similar errors in my economics code. It segfaults sometimes, though not 
always, after a seemingly random amount of time, sometimes an hour or so, 
sometimes less. However, I don't recall it having ever occurred in the 
times I've run it without parallel. I'm using SharedArrays like you. I've 
seen this occur on both 0.4.1 and 0.4.5.

The error isn't too serious for me because I periodically save the 
optimization state to disk, so I can just restart.

I also can't remember this ever occurring on my own (Linux) computer. It's 
happened on a (Linux) cluster with many cores.  


On Thursday, June 2, 2016 at 3:45:24 AM UTC-4, Nils Gudat wrote:
>
> Fair enough. Does anyone have any clues as to how I would go about 
> investigating this? As has been said before, the stacktraces aren't very 
> helpful for segfaults, so how do I figure out what's going wrong here?
>


Re: [julia-users] Function argument inlining

2016-06-02 Thread Cedric St-Jean
Thanks. Maybe it's time to upgrade...

On Thursday, June 2, 2016 at 8:53:12 AM UTC-4, Yichao Yu wrote:
>
> On Thu, Jun 2, 2016 at 8:37 AM, Cedric St-Jean  > wrote: 
> > I have two very similar functions that differ in only which function 
> they 
> > call 
> > 
> > function search_suspects_forward(...) 
> > ... 
> > searchsortedfirst(...) 
> > end 
> > 
> > function search_suspects_backward(...) 
> > ... 
> > searchsortedlast(...) 
> > end 
> > 
> > function foo() 
> >search_suspects_forward(...) 
> > end 
> > 
> > Naturally, I'd like to refactor the common code 
> > 
> > function search_suspects(..., search_fun::Function) 
> > ... 
> > search_fun(...) 
> > end 
> > 
> > search_suspects_foward(...) = search_suspects(..., searchsortedfirst) 
> > ... 
> > 
> > But Julia doesn't specialize search_suspects based on search_fun (at 
> least 
> > on 0.4), which is a missed optimization opportunity. Is there any way to 
> do 
> > that? I could turn `search_fun` into a functor, but that kinda sucks (is 
> > there a way to do that automatically?) If I understand inlining 
> heuristics 
> > correctly, I would expect that `search_suspects_forward`, being a short 
> > function, will be inlined into `foo`, but what I want is for 
> > `search_suspects` to be inlined into `search_suspects_forward`. Are 
> there 
> > ways of communicating that to the compiler? Is there a @notinline? 
>
> Functor is the only way on 0.4. This is done automatically on 0.5. 
>


[julia-users] Re: Using pmap in julia

2016-06-02 Thread Martha White
I was printing information from each worker, and seeing the worker number 
increase. But, when I actually check nworkers, the number stays at 3. So, I 
was incorrect about the number of workers increasing. Rather, because I am 
adding and removing workers in the outer loop, the worker id is increasing. 
However, I do still have issues with speed, where it is slower to use pmap 
and run in parallel. I am not currently seeing the open files issues, but 
am running again to see if I can recreate that problem. In any case, for 
speed, it might be that too much memory is being copied to pass to each 
worker. Is there a way to restrict what is copied? For example, some values 
are const; can I somehow give this information to pmap?

On Wednesday, June 1, 2016 at 11:05:46 PM UTC-4, Greg Plowman wrote:
>
> You say you get a large number of workers.
> Without delving too deep, this seems pretty weird, regardless of other 
> code.
> Have you checked the number of workers (using nworkers()) after call to 
> addprocs()? 
> If you are getting errors and re-run the script, is addprocs() just 
> accumulating more workers?
> If so, perhaps try rmprocs(workers()) before addprocs()
>
>

[julia-users] Constructing Markdown text for IJulia

2016-06-02 Thread Carl
Hi,

I would like to programatically create markdown strings and have them 
rendered in IJulia so that I can use markdown as a template language to 
substitute in variables values, etc.

For example, something like:

```julia
temp = 27
humidity = 88
caption(x) = """\n$x"""

tp = md"""
# Test Plan

The following settings were used:

| Variable | Value | Units |
||-|-|
| temperature | $temp | degC |
| humidity   | $humidity | %  |
$(caption("Table 1 - Test Plan"))
"""
```

The output from the IJulia cell should render the Markdown and display the 
generated docs.  Another nice feature would be to be able to get HTML 
generated from Markdown in case Markdown isn't flexible enough.  Is there a 
md2html function?

Any recommendations on how to proceed?  

(Also, the jldoctest stuff in Base looks amazing, can that be used outside 
of Base?)

Carl


[julia-users] ANN: Book --- Julia Programming for Operations Research

2016-06-02 Thread Chang Kwon
I wrote a book on julia programming, focusing on optimization problems from 
operations research and management science.

http://www.chkwon.net/julia/




I think this book will be useful for first-year graduate students and 
advanced undergraduate students in operations research and related 
disciplines who need to solve optimization problems, as well as 
practitioners in a similar situation. 

Here is a table of contents:


   1. Introduction and Installation
   2. Simple Linear Optimization
   3. Basics of the Julia Language
   4. Selected Topics in Numerical Methods
   5. The Simplex Method
   6. Network Optimization Problems
   7. General Optimization Problems
   8. Monte Carlo Methods
   9. Lagrangian Relaxation
   10. Parameters in Optimization Solvers
   11. Useful and Related Packages

I believe this book will make a good reference for various courses like 


   - Introduction to Operations Research
   - Operations Research I, or Deterministic Operations Research
   - Linear Programming
   - Network Optimization
   - Nonlinear Programming
   - Convex Optimization
   - Numerical Optimization
   - Transportation Modeling
   - and any other courses involving optimization problems

The book is available in the formats of online HTML, paperback, and kindle. 

If you have any questions, please feel free to send me a message.

Best,
Chang




Re: [julia-users] Function argument inlining

2016-06-02 Thread Yichao Yu
On Thu, Jun 2, 2016 at 8:37 AM, Cedric St-Jean  wrote:
> I have two very similar functions that differ in only which function they
> call
>
> function search_suspects_forward(...)
> ...
> searchsortedfirst(...)
> end
>
> function search_suspects_backward(...)
> ...
> searchsortedlast(...)
> end
>
> function foo()
>search_suspects_forward(...)
> end
>
> Naturally, I'd like to refactor the common code
>
> function search_suspects(..., search_fun::Function)
> ...
> search_fun(...)
> end
>
> search_suspects_foward(...) = search_suspects(..., searchsortedfirst)
> ...
>
> But Julia doesn't specialize search_suspects based on search_fun (at least
> on 0.4), which is a missed optimization opportunity. Is there any way to do
> that? I could turn `search_fun` into a functor, but that kinda sucks (is
> there a way to do that automatically?) If I understand inlining heuristics
> correctly, I would expect that `search_suspects_forward`, being a short
> function, will be inlined into `foo`, but what I want is for
> `search_suspects` to be inlined into `search_suspects_forward`. Are there
> ways of communicating that to the compiler? Is there a @notinline?

Functor is the only way on 0.4. This is done automatically on 0.5.


[julia-users] Function argument inlining

2016-06-02 Thread Cedric St-Jean
I have two very similar functions that differ in only which function they 
call

function search_suspects_forward(...)
...
searchsortedfirst(...)
end

function search_suspects_backward(...)
...
searchsortedlast(...)
end

function foo()
   search_suspects_forward(...)
end

Naturally, I'd like to refactor the common code

function search_suspects(..., search_fun::Function)
...
search_fun(...)
end

search_suspects_foward(...) = search_suspects(..., searchsortedfirst)
...

But Julia doesn't specialize search_suspects based on search_fun (at least 
on 0.4), which is a missed optimization opportunity. Is there any way to do 
that? I could turn `search_fun` into a functor, but that kinda sucks (is 
there a way to do that automatically?) If I understand inlining heuristics 
correctly, I would expect that `search_suspects_forward`, being a short 
function, will be inlined into `foo`, but what I want is for 
`search_suspects` to be inlined into `search_suspects_forward`. Are there 
ways of communicating that to the compiler? Is there a @notinline?


[julia-users] Re: ANN: DC.jl - automagical linked plots in your IJulia Notebook

2016-06-02 Thread Cedric St-Jean
Looks great, thank you for this!

On Thursday, June 2, 2016 at 12:28:07 AM UTC-4, Tim Wheeler wrote:
>
> Hello Julia Users,
>
> We are happy to announce DC.jl  - a 
> package which gives you the power of DC.js 
>  in your IJulia notebook. The premise is 
> simple: put in a DataFrame and you get out a nice set of charts that you 
> can interactively filter. Whenever you do so they automatically crossfilter.
>
>
> 
>
>
>
> The package is up and running. We (three students) put it together for our 
> data visualization course. We hope you like it and welcome comments / 
> suggestions.
>
>
>
>

Re: [julia-users] Re: Arithmetic with TypePar

2016-06-02 Thread Erik Schnetter
In these cases I do the following:

(1) Add additional type parameters, as in

```Julia
type FooImp{D,D1}
baz::Array{D}
bar::Array{D1}
end
```

(2) Add a function that calculates the type:

```Julia
Foo(D) = FooImpl{D,D+1}
```

In many cases I can then have to write `Foo(D)` instead of `Foo{D}` (round
parentheses instead of curly braces), but apart from this, things work out
 nicely. I'm sure there is some `@pure` annotation or similar for `Foo` to
help type inference.

-erik

PS: Yes, it would be nice if this calculation (`D1 = D+1`) could be moved
elsewhere, e.g. into the type definition. I don't see why this isn't
possible, I think it's mostly a complicated thing to implement, and people
haven't demonstrated the necessity for this yet.



On Thu, Jun 2, 2016 at 2:07 AM, Robert DJ  wrote:

> The problem with not specifying D is type inference. I actually have more
> entries in Foo and would like
>
> type Foo{D}
> baz::Array{D}
> bar::Array{D+1}
> end
>
>
> I want to use Foo in calculations and for D = 1 I am doing something like
>
> baz + bar[:,1]
> baz + bar[:,2]
>
>
> For D = 2:
>
> baz + bar[:,:,1]
> baz + bar[:,:,2]
>
>
> I *could* instead (for D = 2) move the third dimension to extra columns...
>
>
> On Wednesday, June 1, 2016 at 8:56:28 PM UTC+2, Robert DJ wrote:
>>
>> I have a custom type with a TypePar denoting a dimension and would like
>> to define the following:
>>
>> type Foo{D}
>> bar::Array{D+1}
>> end
>>
>> However, this does not work. As D is only 1 or 2 it would OK with
>>
>> type Foo{1}
>> bar::Matrix
>> end
>>
>> type Foo{2}
>> bar::Array{3}
>> end
>>
>> but unfortunately this isn't working, either.
>>
>> Can this problem be solved?
>>
>> Thanks!
>>
>


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


Re: [julia-users] Re: Using Julia for real time astronomy

2016-06-02 Thread Cedric St-Jean
John: Common Lisp and Julia have a lot in common. I didn't mean to suggest
writing your software in Lisp, I meant that if ITA was able to run a hugely
popular website involving a complicated optimization problem without
triggering the GC, then you can do the same in Julia. Like others have
suggested, you just preallocate everything (global const arrays), and make
sure that every code path is run once (to force compilation) before the
system goes online. @time will tell you if you've been successful at
eliminating everything. You might run into issues with libraries allocating
during their calls, and it might be easier all things considered in C, but
it's certainly doable with enough efforts in Julia. I might be up for
helping out, if you're interested.

On Thu, Jun 2, 2016 at 3:54 AM, Leger Jonathan 
wrote:

> Páll: don't worry about the project failing because of YOUU ;) in any
> case we wanted to try Julia and see if we could get help/tips from the
> community.
> About the nogc I wonder if activating it will also prevent the core of
> Julia to be garbage collected ? If yes for long run it's a bad idea to
> disable it too long.
>
> For now the only options options are C/C++ and Julia, sorry no D or Lisp
> :) Why would you not recommend C for this kind of tasks ?
> And I said 1000 images/sec but the camera may be able to go up to 10 000
> images/sec so I think we can define it as hard real time.
>
> Thank you for all these ideas !
>
>
>
> Le 01/06/2016 23:59, Páll Haraldsson a écrit :
>
> On Wednesday, June 1, 2016 at 9:40:54 AM UTC, John leger wrote:
>>
>> So for now the best is to build a toy that is equivalent in processing
>> time to the original and see by myself what I'm able to get.
>> We have many ideas, many theories due to the nature of the GC so the best
>> is to try.
>>
>> Páll -> Thanks for the links
>>
>
> No problem.
>
> While I did say it would be cool to now of Julia in space, I would hate
> for the project to fail because of Julia (because of my advice).
>
> I endorse Julia for all kinds of uses, hard real-time (and building
> operating systems) are where I have doubts.
>
> A. I thought a little more about making a macro @nogc to mark functions,
> and it's probably not possible. You could I guess for one function, as the
> macro has access to the AST of it. But what you really want to disallow, is
> that function calling functions that are not similarly marked. I do not
> know about metadata on functions and if a nogc-bit could be put in, but
> even then, in theory couldn't that function be changed at runtime..?
>
> What you would want is that this nogc property is statically checked as I
> guess D does, but Julia isn't separately compiled by default. Note there is
> Julia2C, and see
>
> http://juliacomputing.com/blog/2016/02/09/static-julia.html
>
> for gory details on compiling Julia.
>
> I haven't looked, I guess Julia2C does not generate malloc and free, only
> some malloc substitute in libjulia runtime. That substitute will allocate
> and run the GC when needed. These are the calls you want to avoid in your
> code and could maybe grep for.. There is a Lint.jl tool, but as memory
> allocation isn't an error it would not flag it, maybe it could be an
> option..
>
> B. One idea I just had (in the shower..), if @nogc is used or just on
> "gc_disable" (note it is deprecated*), it would disallow allocations (with
> an exception if tried), not just postpone them, it would be much easier to
> test if your code uses allocations or calls code that would. Still, you
> would have to check all code-paths..
>
> C. Ada, or the Spark-subset, might be the go-to language for hard
> real-time. Rust seems also good, just not as tried. D could also be an
> option with @nogc. And then there is C and especially C++ that I try do
> avoid recommending.
>
> D. Do tell if you only need soft real-time, it makes the matter so much
> simpler.. not just programming language choice..
>
> *
> help?> gc_enable
> search: gc_enable
>
>   gc_enable(on::Bool)
>
>   Control whether garbage collection is enabled using a boolean argument
> (true for enabled, false for disabled). Returns previous GC state. Disabling
>   garbage collection should be used only with extreme caution, as it can
> cause memory use to grow without bound.
>
>
>
>
>>
>> Le mardi 31 mai 2016 18:44:17 UTC+2, Páll Haraldsson a écrit :
>>>
>>> On Monday, May 30, 2016 at 8:19:34 PM UTC, Tobias Knopp wrote:

 If you are prepared to make your code to not perform any heap
 allocations, I don't see a reason why there should be any issue. When I
 once worked on a very first multi-threading version of Julia I wrote
 exactly such functions that won't trigger gc since the later was not thread
 safe. This can be hard work but I would assume that its at least not more
 work than implementing the application in C/C++ (assuming that you have
 some Julia experience)

>>>
>>> I would really like to know 

Re: [julia-users] how to set the maximal waiting time for ClusterManagers.addprocs_sge()?

2016-06-02 Thread Ben Arthur
i've used qrsh instead of qsub to avoid the aggressive disk buffering. 
 it's a much better solution all around.  check out this PR: 
 https://github.com/JuliaParallel/ClusterManagers.jl/pull/11


[julia-users] installation one side of a company firewall

2016-06-02 Thread Andreas Lobinger
Hello colleagues,

i'm trying to get julia (v0.4.5) running on a windows box inside company 
firewall (actually a cloud instance) which has valid and working http/https 
proxy,
I was able to configure git to use https isteadOf git and set http and 
https proxy. Pkg.status() clones and installs METADATA afaics.
However, trying Pkg.add fails with 
INFO: Cloning cache of Compat from git://github.com/JuliaLang/Compat.jl.git 
fatal: unable to access 'https://github.com//JuliaLang/Compat.jl.git' : The 
requested URL returned error: 400

Any idea?

Wishing a happy day,
Andreas



Re: [julia-users] Signal / slot (or publish-subscribe) libraries in Julia

2016-06-02 Thread Bart Janssens
Hello,

I would also be interested to know how and if this kind of functionality 
relates to Reactive.jl. Looking at the docs for Reactive, it seems it was 
designed for "continuous" signals. In Reactive, sampling seems to be 
needed, while in a classical signal/slot implementation (such as in Qt) 
slots are linked to a signal and called whenever the signal is emitted, 
i.e. changes value.

So would the way forward for the system described by OP be to extend 
Reactive (if needed), or should this be a separate package?

Cheers,

Bart

On Tuesday, May 31, 2016 at 2:17:54 AM UTC+2, Steven G. Johnson wrote:
>
> Reactive.jl?



Re: [julia-users] Re: Using Julia for real time astronomy

2016-06-02 Thread Leger Jonathan
Páll: don't worry about the project failing because of YOUU ;) in 
any case we wanted to try Julia and see if we could get help/tips from 
the community.
About the nogc I wonder if activating it will also prevent the core of 
Julia to be garbage collected ? If yes for long run it's a bad idea to 
disable it too long.


For now the only options options are C/C++ and Julia, sorry no D or Lisp 
:) Why would you not recommend C for this kind of tasks ?
And I said 1000 images/sec but the camera may be able to go up to 10 000 
images/sec so I think we can define it as hard real time.


Thank you for all these ideas !


Le 01/06/2016 23:59, Páll Haraldsson a écrit :

On Wednesday, June 1, 2016 at 9:40:54 AM UTC, John leger wrote:

So for now the best is to build a toy that is equivalent in
processing time to the original and see by myself what I'm able to
get.
We have many ideas, many theories due to the nature of the GC so
the best is to try.

Páll -> Thanks for the links


No problem.

While I did say it would be cool to now of Julia in space, I would 
hate for the project to fail because of Julia (because of my advice).


I endorse Julia for all kinds of uses, hard real-time (and building 
operating systems) are where I have doubts.


A. I thought a little more about making a macro @nogc to mark 
functions, and it's probably not possible. You could I guess for one 
function, as the macro has access to the AST of it. But what you 
really want to disallow, is that function calling functions that are 
not similarly marked. I do not know about metadata on functions and if 
a nogc-bit could be put in, but even then, in theory couldn't that 
function be changed at runtime..?


What you would want is that this nogc property is statically checked 
as I guess D does, but Julia isn't separately compiled by default. 
Note there is Julia2C, and see


http://juliacomputing.com/blog/2016/02/09/static-julia.html

for gory details on compiling Julia.

I haven't looked, I guess Julia2C does not generate malloc and free, 
only some malloc substitute in libjulia runtime. That substitute will 
allocate and run the GC when needed. These are the calls you want to 
avoid in your code and could maybe grep for.. There is a Lint.jl tool, 
but as memory allocation isn't an error it would not flag it, maybe it 
could be an option..


B. One idea I just had (in the shower..), if @nogc is used or just on 
"gc_disable" (note it is deprecated*), it would disallow allocations 
(with an exception if tried), not just postpone them, it would be much 
easier to test if your code uses allocations or calls code that would. 
Still, you would have to check all code-paths..


C. Ada, or the Spark-subset, might be the go-to language for hard 
real-time. Rust seems also good, just not as tried. D could also be an 
option with @nogc. And then there is C and especially C++ that I try 
do avoid recommending.


D. Do tell if you only need soft real-time, it makes the matter so 
much simpler.. not just programming language choice..


*
help?> gc_enable
search: gc_enable

  gc_enable(on::Bool)

  Control whether garbage collection is enabled using a boolean 
argument (true for enabled, false for disabled). Returns previous GC 
state. Disabling
  garbage collection should be used only with extreme caution, as it 
can cause memory use to grow without bound.




Le mardi 31 mai 2016 18:44:17 UTC+2, Páll Haraldsson a écrit :

On Monday, May 30, 2016 at 8:19:34 PM UTC, Tobias Knopp wrote:

If you are prepared to make your code to not perform any
heap allocations, I don't see a reason why there should be
any issue. When I once worked on a very first
multi-threading version of Julia I wrote exactly such
functions that won't trigger gc since the later was not
thread safe. This can be hard work but I would assume that
its at least not more work than implementing the
application in C/C++ (assuming that you have some Julia
experience)


I would really like to know why the work is hard, is it
getting rid of the allocations, or being sure there are no
more hidden in your code? I would also like to know then if
you can do the same as in D language:

http://wiki.dlang.org/Memory_Management


The most reliable way to guarantee latency is to preallocate
all data that will be needed by the time critical portion. If
no calls to allocate memory are done, the GC will not run and
so will not cause the maximum latency to be exceeded.

It is possible to create a real-time thread by detaching it
from the runtime, marking the thread function @nogc, and
ensuring the real-time thread does not hold any GC roots. GC
objects can still be used in the real-time thread, but they
must be 

Re: [julia-users] Re: Double free or corruption (out)

2016-06-02 Thread Nils Gudat
Fair enough. Does anyone have any clues as to how I would go about 
investigating this? As has been said before, the stacktraces aren't very 
helpful for segfaults, so how do I figure out what's going wrong here?


[julia-users] plans to add an extended standard library section?

2016-06-02 Thread Michele Zaffalon
Related to the recent discussion 
https://groups.google.com/d/msg/julia-users/IV4ulyX_dCc/fseYrc7xPgAJ

Are there any plans to add the documentation for StatsBase.jl to 
http://docs.julialang.org/, maybe as an "extended standard library" 
section? I for myself, use DataStructures often and the first place I tend 
to search is the standard library, only to remember that it is a separate 
package.

I found the python documentation at 
https://docs.python.org/3/library/index.html very convenient, especially 
when browsing.

michele


[julia-users] Re: Arithmetic with TypePar

2016-06-02 Thread Robert DJ
The problem with not specifying D is type inference. I actually have more 
entries in Foo and would like

type Foo{D}
baz::Array{D}
bar::Array{D+1}
end


I want to use Foo in calculations and for D = 1 I am doing something like

baz + bar[:,1]
baz + bar[:,2]


For D = 2:

baz + bar[:,:,1]
baz + bar[:,:,2]


I *could* instead (for D = 2) move the third dimension to extra columns...


On Wednesday, June 1, 2016 at 8:56:28 PM UTC+2, Robert DJ wrote:
>
> I have a custom type with a TypePar denoting a dimension and would like to 
> define the following:
>
> type Foo{D}
> bar::Array{D+1}
> end
>
> However, this does not work. As D is only 1 or 2 it would OK with
>
> type Foo{1}
> bar::Matrix
> end
>
> type Foo{2}
> bar::Array{3}
> end
>
> but unfortunately this isn't working, either. 
>
> Can this problem be solved?
>
> Thanks!
>