-
-
Notifications
You must be signed in to change notification settings - Fork 399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2D JuMPArray (symbols-integers): indexing fails with column #851
Comments
If you index with anything except a numeric range then you cannot slice or use any array-like properties. |
This does not make sense to me… Why then allow using anything else than integers for indexing, if it's just going to bite you the second after? |
What kind of object would you expect julia> d = Dict(:a => 1, :b => 2);
julia> sum(d[:])
ERROR: KeyError: Colon() not found
in getindex at dict.jl:738 |
Why couldn't
|
We've been heading in this direction, see #782. PRs accepted. |
I believe this is a dup of #643 |
OK, thanks! So I'm closing this, and having a look at these issues (and maybe send a PR, at least for a better error message). |
I am defining a series of variables with one dimension being symbols and the other integers; then I am trying to work with ranges of variables, but this yields strange errors.
When there is only one dimension, indexed with symbols, columns work as expected:
However, when selecting a subset of variables, this no more works (unlike with basic integers for indexing):
Things become worse with more than one dimension, as nothing works as expected when slicing on the symbol or the integer variables (only selecting one symbol value works):
(The same tests fail on
z
when switching symbols and integers for indexing.)To solve this issue, I am currently forced to use the
sum{}
construction, which is much less nice just to sum over a dimension (likesum(y[:1, :])
.Would this issue be similar to #833 or #730?
The text was updated successfully, but these errors were encountered: