-
-
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
Diagonal(::AbstractMatrix)
behavior differs from documentation in certain cases
#28581
Comments
Makes sense. Can this be fixed in 1.x? |
I think changing the doc is not a good solution, because that would complicate a simple situation and manifest the inconsistent behaviour. Looking at
So the constructors for For other constructors, i.e. To describe the current situation the documentation for each
I think, that is too complex to remember. It would also require extra effort, if you wanted to ignore out-of-shape data in your use case. |
I would like to revive this issue. My reasons, similar to the discussion above, are given in a discourse post. |
Whereas docu states:
When applied to a subtype of
AbstractMatrix
we obtain the following results:That means, in this case the
Diagonal
is not constructed from the diagonal ofA
, but an error is thrown, ifisdiag(A) == false
.The same behavior applies for some other subtypes of
AbstractMatrix
, and not for others.IMO the check for diagonality should be removed from the constructors, and in all cases
Diagonal(A::AbstractMatrix) = Diagonal(diag(A))
should be true.Alternatively the docu string should warn the user about the error check in some and which cases.
The text was updated successfully, but these errors were encountered: