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])
>
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)
>
e.g. for a function like this:
tupleFun(a::Float64) = (a+1, a-1);
if I use
@vectorize_1arg Float64 tupleFun
I get for:
typeof( tupleFun(rand(3,3)) )
Array{Tuple{Float64,Float64},2}
How can I get a function which returns:
Tuple{Array{Float64,2},Array{Float64,2}}
(without an explicit for loop over
Am Montag, 9. Mai 2016 19:03:18 UTC+2 schrieb Steven G. Johnson:
>
>
>
> No, I think sortperm(A, dim) would need to return an array of single-index
> indices (i.e. to be used with A[i]). I posted a sample implementation for
> 2d arrays in the issue linked above, which should suffice for your
Am Montag, 9. Mai 2016 15:26:48 UTC+2 schrieb Steven G. Johnson:
>
> Actually, see https://github.com/JuliaLang/julia/issues/16273
>
Thanks for your answer. Sry, about my strange postings, there was an error,
you have seen the other two postings below?.
sortperm(A, dim)
would be nearly the
but I don't like the storage allocation of 'offset'. Is there a better way
to do it?
I would like to avoid for-loops.
Is there a way to access the current index of mapslices (ciom) ? And do
something like this:
mapslices(x - > m[ x[:, ciom ], ciom], i, 1);
or do i need to do a for?
for
currently I'm using:
i = mapslices(sortperm, m, 1);
offset=repmat( (0:(c-1))'.*r ,r, 1); #'
v = m[offset+i];
currently I'm using:
i = mapslices(sortperm, m, 1);
offset=repmat( (0:(c-1))'.*r ,r, 1);
v = m[offset+i];
Hi there, I'm new to Julia but have some experience with Matlab.
To sort each column of a matrix M ( r rows, c columns) I can write in
Matlab:
test