-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
math.subset
converts matrix to scalar
#1484
Comments
Thanks @DbCrWk, great to hear you like the library :) Changing 1x1 output of a matrix subset is indeed intentional. When retrieving a single value from a matrix, often you want to continue working with it as being a scalar. There is currently no way to enforce output being kept a matrix. We could consider making this possible for example by configuring What you could do for now is create a small wrapper around |
Good to know. I have a wrapper written around it for now. If you're good with some parameter being passed (or equivalent), I can open a PR on this! |
Thanks for your offer Dev. I'm still a bit in doubt about what would be the best approach here: passing an option along with |
Sounds good! I'll take a crack at it. |
Cool, thanks! This will be a breaking change so we have to schedule when to release. @DbCrWk can you please work from the |
Cool, will do |
Dev, I've just merged |
Closing as duplicate of #2344. |
First, this is a great package!
One small quirk that I've noticed is that if I do something like:
Is this an intentional casting of a
1
-by-1
matrix into a scalar? If so, is there a way to enforce that pulling the subset of a matrix always returns a matrix?(For my particular use case, I have a function that accepts an arbitrary index
k
and returns thek
-by-k
upper left submatrix. Therefore, to get around this quirk, I have to special case the situation when the passedk
value is1
.)@pdeaville
The text was updated successfully, but these errors were encountered: