You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @mcabbott,
Really enjoying this package, thanks for making it.
I was thinking about a more intuitive way of doing concatenation in higher dimensions (with differently-shaped arrays), and I wondered if the following trick with TensorCast.jl would work:
X =randn(5, 100)
y =randn(100)
@cast data[i, j] := (1<= i <=5) ? X[i, j] : y[j] (i in1:6)
Essentially what I am attempting to do here is creating a new array of shape (6, 100), where the first 5 rows are from X, and the last row is from y. I see the following error:
ERROR: DimensionMismatch: range of index i must agree
Stacktrace:
[1] top-level scope
@ ~/.julia/packages/TensorCast/mQB8h/src/macro.jl:209
I know that the range of indices is usually inferred from arrays, but I thought: perhaps if I pass the range explicitly like this (i in 1:6), it would ignore the inferred range.
Is this syntax for concatenation possible in any way, or does it break key assumptions in the macro?
Thanks!
Miles
The text was updated successfully, but these errors were encountered:
This certainly isn't supported right now, all indices must run the full range, and explicit ranges like (i in 1:6) have no special priority, all must agree.
This concatenation idea is roughly the inverse of #56.
I would have to think a bit, but at first glance adding this to @cast sounds very complicated. The example you write is a simple one, how would something like vcat(X, inv.(X)) be written? It could be this:
then i has 3 different ranges which seems hard to keep track of.
Maybe, in addition to A[(i,j)] which means ⊗ and can be written A[i⊗j], there should be some other combined-index for ⊕? With some unknown operator... or perhaps ⊕ inside & outside of indexing?
Hi @mcabbott,
Really enjoying this package, thanks for making it.
I was thinking about a more intuitive way of doing concatenation in higher dimensions (with differently-shaped arrays), and I wondered if the following trick with TensorCast.jl would work:
Essentially what I am attempting to do here is creating a new array of shape
(6, 100)
, where the first 5 rows are fromX
, and the last row is fromy
. I see the following error:I know that the range of indices is usually inferred from arrays, but I thought: perhaps if I pass the range explicitly like this (
i in 1:6
), it would ignore the inferred range.Is this syntax for concatenation possible in any way, or does it break key assumptions in the macro?
Thanks!
Miles
The text was updated successfully, but these errors were encountered: