-
-
Notifications
You must be signed in to change notification settings - Fork 77
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
correct some POD #1188
correct some POD #1188
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine to me.
Do you mean that you would like Or do you mean that 1D matrices should be treated more like Would Would The original idea was that you passed |
First of all, I think that things are the way they are right now, and making changes about this is probably off the table. Because problems out there in the wild handle 1D matrices the way they handle them now, and a change like I am thinking would disrupt how they work, possibly even breaking them. But to answer your question, I was thinking this one:
Right now, if I make a 1D matrix
If I want to get to an entry, I specify an index, and I walk horizontally to get that index. And if I make a 2D matrix
If I want to get to an entry, I specify two indices, and I walk vertically then horizontally. And if I make a 3D matrix
If I want to get to an entry, I specify three indices, and I walk vertically, then horizontally, then horizontally again. The "6" is in the (1,2,2) position. And if I make a 4D matrix,
If I want to get to an entry, I specify four indices, and I walk vertically, horizontally, vertically, horizontally. The "6" here is in the (1,2,1,2) position. So as we go up in dimensions, how you walk to an entry has a sort of inconsistent pattern:
And if 1D matrices were handled as column vectors, then the index walk pattern would instead be:
Of course with that change, to make something that looks like a row vector would need
I think this characterizes the inconsistency too. If you pass multiple arguments to
Yes, under the change the first one is a 1D matrix that looks like a column vector when displayed. And is upgraded to a 2D 3x1 matrix as needed for multiplication with 2D matrices. Whereas the second one would be a 2D 1x3 matrix from the start.
(Note that presently, |
Sorry, I messed up at least one thing typing that and not being careful.
Should have saud: Of course with that change, to make something that looks like a row vector would need |
This has two approvals. If it can be merged, I will proceed with phase 2. That's just rearranging the POD to be like @pstaabp's in #1076. I'll pause after that for discussion. But I would like to review the existing methods and possibly enhance them. For example Also if @dpvc doesn't think my idea about 1D matrices would be a disaster for existing exercises, maybe I would do that as well. And only after existing methods have all been reviewed/revised, I'd return to the new methods that @pstaabp is adding in #1076. |
I will go ahead and merge this, so you can proceed with the next phase. |
This is phase 1 of my attempt to replace #1076. It seemed to me that some of the POD for
lib/Value/Matrix.pm
is just incorrect or unclear. So this tries to fix that.I started thinking of MathObject Matrices as n-dimensional tensors, to help with some confusion when is not a "normal" 2D matrix. I'm using "tensor" some in the POD. There are inconsistencies with how things work when you have a 1D tensor versus nD with n > 1. The inconsistencies would be resolved if 1D tensors were presented as column vectors instead of row vectors. But I suppose we can't make a change like that for backward compatibility reasons, for problems out there that use 1D matrices. With the inconsistencies kept, a lot of the POD is going to need to be like "it works this way for a 1D tensor/matrix but it works this other way for higher D".
Phase 2 will be to rearrange/clean up the POD in the manner of #1076. But that should be easier to review as it will just be moving things around with perhaps some minor rewording.
Phase 3 will be to enhance some things in the existing methods. Specifically I think that
row()
andcolumn()
should be allowed to take multiple index arguments to produce submatrices (e.g. the submatrix of the 1st and 3rd rows).Phase 4 will be to add
@pstaabp's
new methods.Somewhere in there, also add the tests. Maybe some with Phase 3 and some with Phase 4.