TensorCast.jl icon indicating copy to clipboard operation
TensorCast.jl copied to clipboard

Smarter repeat?

Open mcabbott opened this issue 4 years ago • 0 comments

Would be neat if this worked (from this thread):

julia> X = randn(1000, 1000);

julia> Y = zeros(2000, 2000);

julia> Y .= repeat(X, inner=(2,2));

julia> @cast Y[(a,b), (c,d)] = X[b, d];
ERROR: LoadError: index a appears only on the left
    @cast Y[(a, b), (c, d)] = X[b, d]  
    @ Main REPL[51]:1
Stacktrace:
 [1] checkallseen(canon::Vector{Any}, store::NamedTuple{(:dict, :assert, :mustassert, :seen, :need, :top, :main), Tuple{Dict{Any, Any}, Vector{Any}, Vector{Any}, Vector{Any}, Vector{Any}, Vector{Any}, Vector{Any}}}, call::TensorCast.CallInfo)
   @ TensorCast ~/.julia/packages/TensorCast/eabry/src/macro.jl:1466

julia> @cast Y[(a,b), (c,d)] = X[b, d]  a in 1:2, c in 1:2;
ERROR: LoadError: index a appears only on the left

julia> @cast Y[(a,b), (c,d)] := X[b, d]  a in 1:2, c in 1:2;
ERROR: LoadError: index a appears only on the left

mcabbott avatar Nov 28 '21 17:11 mcabbott