Einsum.extractindices
— Methodextractindices(expr) -> (array_names, index_names, axis_expressions)
Compute all index_names
and respective axis calculations of an expression involving the arrays with array_names
. Everything is ordered by first occurence in expr
.
Examples
julia> extractindices(:(f(A[i,j,i]) + C[j]))
(Symbol[:A, :C], Symbol[:i, :j, :i, :j], Expr[:(size(A, 1)), :(size(A, 2)), :(size(A, 3)), :(size(C, 1))])
Einsum.nest_loops
— Methodnest_loops(expr, indices, axis_exprs, simd, threads) -> Expr
Construct a nested loop around expr
, using indices
in ranges axis_exprs
.
Example
julia> nest_loops(:(A[i] = B[i]), [:i], [:(size(A, 1))], true, false)
quote
local i
@simd for i = 1:size(A, 1)
A[i] = B[i]
end
end