I think what you want is a view rather than a copy. This will probably come 
to base Julia in the next release cycle, but for now you might check out 
the ArrayViews.jl package:

https://github.com/lindahua/ArrayViews.jl

On Friday, July 18, 2014 12:00:05 PM UTC-4, Yimin Zhong wrote:
>
> I tried to implement Strassen algorithm for matrix multiplication in 
> julia. And here is the gist, a naive implementation. a sample  benchmark  
> is included at beginning of the file.
>
> https://gist.github.com/GaZ3ll3/87df748f76b119199fed
>
> It can beat Julia's A_mul_B!(). around 2~8% faster, depending on the size 
> of matrix and mindim threhold.
>
> However*, my problem* is it takes julia like 2~5% of the running time on 
> allocating *lots* of memory, like storing 3 extra matrices.
>
> Now I am using 
>
> a11 = a[1:mt, 1:kt] 
>
> to get a submatrix, I assume this is a copy of values, not passing 
> reference or using pointer. I think this is the problem, but I do not know 
> how to avoid this and use pure julia pointer for all computing( in julia).
>
> later I found out "sub" function can give a SUBARRAY, which is using 
> reference. But when I changed the code into sub-based.
>
> It takes much longer time to run a program. Not better, also it consumes 
> lots of memory. I do not know why.
>
> Anyway, I can write this in C using cblas, using pure pointer operations 
> and then call the C library(in fact, i already wrote it), I just want to 
> see how is strassen algorithm working on Julia.
>
>
>

Reply via email to