-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
feature request: automatically convert 1x1 matrix to a scaler number in proper cases #4797
Comments
This is something that we have taken a measured decision on, as @jiahao 's link to related discussions shows. |
Actually, this is a little different since it really has nothing to do with other indexing and vector, matrix, tensor behaviors. Assigning any single-element array into a scalar location in another array should probably just work. |
Would we want to treat single-element array assignments into an array location differently from other array assignments into an array location? What if the assignment is into |
As has been discussed in those other issues, what we would do is allow
|
It will be more convenient that Julia can automatically convert 1x1 matrix to a scaler number in proper cases.
The julia session :
The Julia code test1.jl:
A general and uniform way to handle this and other issues is to allow automatic (type?) conversion (when needed)
between array of size (n), (n,1), (n,1,1),(n,1,1,1) etc
(Just like we automatically convert real number to complex number when needed)
Xiao-Gang
[jiahao: edit for formatting. Please escape code with triple backquotes (```) so that Github formats it correctly]
The text was updated successfully, but these errors were encountered: