[julia-users] Re: How to vectorize a function which has a tuple as return value to a function which returns a tuple of matrices instead of a matrix with tuple elements?

2016-05-16 Thread Hakuna M.
Am Montag, 16. Mai 2016 16:11:39 UTC+2 schrieb Chris Rackauckas: > > I make this function to solve this problem in one of m codes: > > function shapeResult(res) > #Input is a vector of tuples > #Output the "columns" as vectors > out = cell(length(res[1])) > for i = 1:length(res[1]) >

[julia-users] Re: How to vectorize a function which has a tuple as return value to a function which returns a tuple of matrices instead of a matrix with tuple elements?

2016-05-16 Thread Hakuna M.
Am Montag, 16. Mai 2016 14:08:08 UTC+2 schrieb Christopher Fisher: > > > It appears that a::Float64 is converting your array into separate > instances of Float64. Either of these should work: > > tupleFun(a::Array{Float64,2}) = (a+1, a-1) > tupleFun(rand(3,3)) > > tupleFun(a) = (a+1, a-1) >

[julia-users] Re: How to vectorize a function which has a tuple as return value to a function which returns a tuple of matrices instead of a matrix with tuple elements?

2016-05-16 Thread Chris Rackauckas
I make this function to solve this problem in one of m codes: function shapeResult(res) #Input is a vector of tuples #Output the "columns" as vectors out = cell(length(res[1])) for i = 1:length(res[1]) out[i] = Vector{typeof(res[1][i])}(length(res)) end for i = 1:length(res), j =

[julia-users] Re: How to vectorize a function which has a tuple as return value to a function which returns a tuple of matrices instead of a matrix with tuple elements?

2016-05-16 Thread Christopher Fisher
It appears that a::Float64 is converting your array into separate instances of Float64. Either of these should work: tupleFun(a::Array{Float64,2}) = (a+1, a-1) tupleFun(rand(3,3)) tupleFun(a) = (a+1, a-1) tupleFun(rand(3,3)) On Sunday, May 15, 2016 at 11:20:33 AM UTC-4, Hakuna M. wrote: >