-
-
Notifications
You must be signed in to change notification settings - Fork 529
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
Matrices can be "constructed" from matrices of wrong dimensions #10793
Comments
This comment has been minimized.
This comment has been minimized.
comment:1
I have completely replaced the original Volker's description since the problem is unrelated to fan morphisms themselves. Also I think that this is an extremely dangerous bug and will take the liberty to elevate its priority... |
comment:2
So it seems that the problem here is that in converting to an element of the matrix space, it views the entries of the matrix (or indeed, the entries of a nested list as well) as a flattened list:
So I guess you're saying that MatrixSpace shouldn't flatten the list, but instead should throw an error? |
comment:3
Around line 361 in
So:
|
comment:4
Replying to @jasongrout:
Absolutely! I see no reason why such flattening can make sense, so even if there some - I think they should do it explicitly. I find it a bit confusing that Sage uses right matrix action, so in the description I tend to think that |
comment:5
Hi Rob, this is the ticket I was talking about! |
Attachment: trac_10793_bug_in_matrix_construction.patch.gz |
Author: Andrey Novoseltsev |
Changed keywords from none to sd31 |
Work Issues: doctest failures |
comment:8
There are doctest failures that have to be addressed. I suspect that all places that are affected were just kind of wrong. For Nx1 and 1xN matrices nothing too horrible is going on, hopefully there are no other cases. |
comment:9
Here is the list of offenders:
IMHO, all these files are full of bugs! |
comment:10
OK, it turned out to be not as scary as it seemed to me originally. Most of the errors were due to forgetting that matrices act from the right. In crypto I have added explicit conversion of matrices to lists since it seems that they wanted it. I don't understand that code to make sure that this is indeed correct, but at the very least I didn't introduce a new bug ;-) |
Changed work issues from doctest failures to none |
comment:11
Patches should apply fine on top of sage-4.7.1.alpha4, as #11200 (and other patches modifying fan morphisms) was merged. |
Dependencies: #11200 |
This comment has been minimized.
This comment has been minimized.
comment:13
I totally forgot that we haven't merged this ticket yet. Applies fine on Sage-4.7.1.rc2. Positive review. |
Reviewer: Volker Braun |
comment:15
Attachment: trac_10793_fixing_existing_bugs.patch.gz Rebased on top of #11552, needs review. |
comment:16
I think that if a rebase is straightforward (ie there is no real change to code), then it does not need to be reviewed. I can't tell here, since the rebased patch replaced the old patch. No matter - I've applied it and done minimal tests. All looks good. I'm running all tests right now and then will flip to positive review. I'm glad this got fixed. While doing work on free module morphisms I ran into this frequently, where domains and codomains got confused, and so on. I'm surprised it survived this long. Thanks Volker and Andrey for the fix! Rob |
comment:17
It was straightforward, your patch added spaces after commas in two lines that I have altered... |
comment:18
Sorry. ;-) Thanks for the rebase. Passes all tests. Rob |
Merged: sage-4.7.2.alpha2 |
Let's make a matrix and use it to define a morphism:
As we see, the matrix of the morphism is very unlikely to be what it should be. Here is the source of the problem:
So the matrix space converts the input to the matrix no matter what (same with
matrix
command, but inside morphisms matrix spaces are used). I suppose this will work any time the number of entries in the original and in the destination is matching. I think that if one really wants to do it, then this one is very welcome to insert an explicit conversion of a matrix to a list and then back to a matrix, but the above should raise exceptions.Apply trac_10793_bug_in_matrix_construction.patch, trac_10793_fixing_existing_bugs.patch
Depends on #11200
Depends on #11552
CC: @rbeezer @kcrisman
Component: linear algebra
Keywords: sd31
Author: Andrey Novoseltsev
Reviewer: Volker Braun
Merged: sage-4.7.2.alpha2
Issue created by migration from https://trac.sagemath.org/ticket/10793
The text was updated successfully, but these errors were encountered: