Unfortunately, my idx will be computed on the fly and there's zero chance that it would be a range. Is there a plan to support more general indexing in subarrays and/or ArrayView?
On Sunday, March 29, 2015 at 6:13:16 PM UTC-4, Andreas Noack wrote: > > C[:,idx] creates a copy, so gemm updates a copy of part of C and then > discarts it after the computation. sub(C,:,idx) creates a view instead of a > copy. > > 2015-03-29 18:10 GMT-04:00 Dominique Orban <[email protected] > <javascript:>>: > >> Sorry there was a typo in my example. It should have been >> >> BLAS.gemm!('N', 'N', 1.0, A[:,idx], B[idx,idx], 1.0, C[:,idx]); >> >> for the dimensions to work out. >> >> The gemm! command works fine, is happy with the dimensions, and produces >> the correct update. As far as I can tell, >> >> C1 = C[:,idx]; >> BLAS.gemm!('N', 'N', 1.0, A[:,idx], B[:,idx], 1.0, C1); >> >> does what it's supposed to do, it just doesn't update C (which is awkward >> for a ! function, though I realize there's something else going on here). >> >> >> On Sunday, March 29, 2015 at 5:56:27 PM UTC-4, Andreas Noack wrote: >>> >>> I think that you could use sub(A,:,2:2:4) for BLAS, but not >>> sub(A,:,[2,4]) because the indexing has to be with ranges for BLAS to be >>> able to extract the right elements of the matrix. >>> >>> 2015-03-29 17:34 GMT-04:00 Dominique Orban <[email protected]>: >>> >>>> Sorry if this is another [:] kind of question, but I can't seem to find >>>> the right syntax to call BLAS.gemm! on part of an array. The piece of code >>>> >>>> julia> n = 10; m = 5; idx = [2, 4]; >>>> julia> C = rand(n, m); A = rand(n, m); B = rand(m, m); >>>> julia> BLAS.gemm!('N', 'N', 1.0, A[:,idx], B[:,idx], 1.0, C[:,idx]); >>>> >>>> won't modify C. I'm simply trying to do >>>> >>>> C[:,idx] += A[:,idx] * B[:,idx]; >>>> >>>> What's the right syntax here? >>>> >>>> It seems ArrayViews.jl might be the way to go, but it doesn't let me do >>>> view(A, :, idx). >>>> >>>> Thanks! >>>> >>> >>> >
