[sage-support] Re: The image of a matrix
That On Dec 13, 6:50 pm, Jason Grout jason-s...@creativetrax.com wrote: That sounds the best way. We'll make kernel_left/right (along with left/right_kernel) the global functions, and people can do kernel = left_kernel in their init.sage or at the beginning of their session, if they want. \begin{devils-advocate} That's inviting people to write code which will then silently and mysteriously not work as soon as they pass it on to someone else. \end{devils-advocate} David --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: The image of a matrix
I think the following is also a source of frustration: v=vector([1,2,3]) rm=matrix(v)#This will be a row matrix cm=v.transpose()#This will be a column matrix. What would the convention be for this one? This came up in another discussion: http://groups.google.com/group/sage-support/browse_thread/thread/24fa62276520b799/2ba996a4f9d18545?hl=enlnk=gstq=vector+to+matrix#2ba996a4f9d18545 Keep the good work. On Dec 14, 3:48 am, mabshoff michael.absh...@mathematik.uni- dortmund.de wrote: On Dec 14, 2:44 am, daveloeffler dave.loeff...@gmail.com wrote: That On Dec 13, 6:50 pm, Jason Grout jason-s...@creativetrax.com wrote: That sounds the best way. We'll make kernel_left/right (along with left/right_kernel) the global functions, and people can do kernel = left_kernel in their init.sage or at the beginning of their session, if they want. \begin{devils-advocate} That's inviting people to write code which will then silently and mysteriously not work as soon as they pass it on to someone else. \end{devils-advocate} David Yes, people will do dumb things if they are given a chance, but at least it will not be code in the Sage library that causes any more trouble. I guess someone has to get burned a couple times to realize that customization can be evil. If this happens a lot it won't be long before we ask bug submitters to provide their init.sage along with the code in question that causes trouble. Cheers, Michael --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: The image of a matrix
Two comments: (1) in the theory of linear block codes, a basis of the code is represented by the rows of the generating martix, by standard convention. So, from that perspective, the way things are for lattices makes sense (of course a lattice gives rise to a binary code by reducing mod 2). (2) Chapter 2 of Cohen's book A course in computational algebraic number theory uses, as you do, the columns to generate the lattices. Since Cohen's book is used in other parts of Sage as a guide for how to implement things (eg, alelian groups), it makes sense to me to use Cohen's conventions here as well. There is even a book Lattices and codes by Ebeling and he seems to simply rework the few facts in coding theory he needs to fit the column convention. (Maybe this is why he called it Lattices and codes as opposed to Codes and lattices:-) Possibly the standard could be using one convention (say columns) and then there could be an optional method for using the other convention (say rows)? On Sat, Dec 13, 2008 at 6:42 AM, Thomas Kahle tom...@gmx.de wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi all, I'm slightly confused about the following computation I tried to do with integer lattices. I typically represent them as a matrix A such that the lattice is the image of that matrix. But somehow the image seems to be different in sage than in my mind. sage: A [ 1 3 -2 -1 0] [-1 -4 3 2 1] [ 0 3 -3 -3 -3] [ 2 -2 4 6 8] [-2 0 -2 -4 -6] sage: A.LLL() [ 0 0 0 0 0] [ 0 0 0 0 0] [ 0 0 0 0 0] [ 0 -1 1 1 1] [ 1 2 -1 0 1] - --- This confuses me as the reduction is performed on the rows instead of columns --- sage: A.image() Free module of degree 5 and rank 2 over Integer Ring Echelon basis matrix: [ 1 0 1 2 3] [ 0 1 -1 -1 -1] sage: A.LLL().image() Free module of degree 5 and rank 2 over Integer Ring Echelon basis matrix: [ 1 0 1 2 3] [ 0 1 -1 -1 -1] So this shows that in sage the image is defined as the set of z sucht that exists an x with z = xA ??? Why would that make sense ? I feel like totally from a different planet here, what am I missing? Why does sage multiply from the left ?? thanks Thomas -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAklDny0ACgkQrpEWPKIUt7PhUACeIKMie+pLkXwE3UywOrdTTF6h QU8AoIQT9wkJw2KwLXPXp4lfgsalITmS =BoBs -END PGP SIGNATURE- --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: The image of a matrix
I think that the main reason that Sage uses rows rather than columns by default (example: eigenvectors are left eigenvectors by default, i.e. v*A=lambda*A and not A*v=lambda*v , whereas most -- but not all -- linear algebra textbooks use the other convention is that that is the case in Magma. This comes up regularly on Sage-support. Sage developers feel that as long as this is well documented, and the non-default behaviour is possible, then that's ok. So if you can point to a place in the documentation of the functions you ar eusing where things are not made clear, please point them out. I think that the LLL function is one such place: I just looked at its docstring (via A.LLL?) and there is no mention of the row convention. That should be added. John Cremona 2008/12/13 David Joyner wdjoy...@gmail.com: Two comments: (1) in the theory of linear block codes, a basis of the code is represented by the rows of the generating martix, by standard convention. So, from that perspective, the way things are for lattices makes sense (of course a lattice gives rise to a binary code by reducing mod 2). (2) Chapter 2 of Cohen's book A course in computational algebraic number theory uses, as you do, the columns to generate the lattices. Since Cohen's book is used in other parts of Sage as a guide for how to implement things (eg, alelian groups), it makes sense to me to use Cohen's conventions here as well. There is even a book Lattices and codes by Ebeling and he seems to simply rework the few facts in coding theory he needs to fit the column convention. (Maybe this is why he called it Lattices and codes as opposed to Codes and lattices:-) Possibly the standard could be using one convention (say columns) and then there could be an optional method for using the other convention (say rows)? On Sat, Dec 13, 2008 at 6:42 AM, Thomas Kahle tom...@gmx.de wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi all, I'm slightly confused about the following computation I tried to do with integer lattices. I typically represent them as a matrix A such that the lattice is the image of that matrix. But somehow the image seems to be different in sage than in my mind. sage: A [ 1 3 -2 -1 0] [-1 -4 3 2 1] [ 0 3 -3 -3 -3] [ 2 -2 4 6 8] [-2 0 -2 -4 -6] sage: A.LLL() [ 0 0 0 0 0] [ 0 0 0 0 0] [ 0 0 0 0 0] [ 0 -1 1 1 1] [ 1 2 -1 0 1] - --- This confuses me as the reduction is performed on the rows instead of columns --- sage: A.image() Free module of degree 5 and rank 2 over Integer Ring Echelon basis matrix: [ 1 0 1 2 3] [ 0 1 -1 -1 -1] sage: A.LLL().image() Free module of degree 5 and rank 2 over Integer Ring Echelon basis matrix: [ 1 0 1 2 3] [ 0 1 -1 -1 -1] So this shows that in sage the image is defined as the set of z sucht that exists an x with z = xA ??? Why would that make sense ? I feel like totally from a different planet here, what am I missing? Why does sage multiply from the left ?? thanks Thomas -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAklDny0ACgkQrpEWPKIUt7PhUACeIKMie+pLkXwE3UywOrdTTF6h QU8AoIQT9wkJw2KwLXPXp4lfgsalITmS =BoBs -END PGP SIGNATURE- --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: The image of a matrix
I think that the main reason that Sage uses rows rather than columns by default (example: eigenvectors are left eigenvectors by default, i.e. v*A=lambda*A and not A*v=lambda*v , whereas most -- but not all -- linear algebra textbooks use the other convention is that that is the case in Magma. This comes up regularly on Sage-support. Sage developers feel that as long as this is well documented, and the non-default behaviour is possible, then that's ok. So if you can point to a place in the documentation of the functions you ar eusing where things are not made clear, please point them out. I think that the LLL function is one such place: I just looked at its docstring (via A.LLL?) and there is no mention of the row convention. That should be added. Well, sorry then. I had no idea that the other convention is used somewhere. As some (the majority?) of mathematicians declare the image to be the colspan it should be stated more explicitly for instance in image? that sage uses the rowspan. It can be easily overlooked in the example given there. Same applies to matrix?. These are acutally the places where I was looking. I don't know your design principles, but for me, if the developers stick to a non-standard(??) convention they should spell this out clearly and BOLD in many places. John Cremona 2008/12/13 David Joyner wdjoy...@gmail.com: Two comments: (1) in the theory of linear block codes, a basis of the code is represented by the rows of the generating martix, by standard convention. So, from that perspective, the way things are for lattices makes sense (of course a lattice gives rise to a binary code by reducing mod 2). (2) Chapter 2 of Cohen's book A course in computational algebraic number theory uses, as you do, the columns to generate the lattices. Since Cohen's book is used in other parts of Sage as a guide for how to implement things (eg, alelian groups), it makes sense to me to use Cohen's conventions here as well. There is even a book Lattices and codes by Ebeling and he seems to simply rework the few facts in coding theory he needs to fit the column convention. (Maybe this is why he called it Lattices and codes as opposed to Codes and lattices:-) Possibly the standard could be using one convention (say columns) and then there could be an optional method for using the other convention (say rows)? On Sat, Dec 13, 2008 at 6:42 AM, Thomas Kahle tom...@gmx.de wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi all, I'm slightly confused about the following computation I tried to do with integer lattices. I typically represent them as a matrix A such that the lattice is the image of that matrix. But somehow the image seems to be different in sage than in my mind. sage: A [ 1 3 -2 -1 0] [-1 -4 3 2 1] [ 0 3 -3 -3 -3] [ 2 -2 4 6 8] [-2 0 -2 -4 -6] sage: A.LLL() [ 0 0 0 0 0] [ 0 0 0 0 0] [ 0 0 0 0 0] [ 0 -1 1 1 1] [ 1 2 -1 0 1] - --- This confuses me as the reduction is performed on the rows instead of columns --- sage: A.image() Free module of degree 5 and rank 2 over Integer Ring Echelon basis matrix: [ 1 0 1 2 3] [ 0 1 -1 -1 -1] sage: A.LLL().image() Free module of degree 5 and rank 2 over Integer Ring Echelon basis matrix: [ 1 0 1 2 3] [ 0 1 -1 -1 -1] So this shows that in sage the image is defined as the set of z sucht that exists an x with z = xA ??? Why would that make sense ? I feel like totally from a different planet here, what am I missing? Why does sage multiply from the left ?? thanks Thomas -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAklDny0ACgkQrpEWPKIUt7PhUACeIKMie+pLkXwE3UywOrdTTF6h QU8AoIQT9wkJw2KwLXPXp4lfgsalITmS =BoBs -END PGP SIGNATURE- --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: The image of a matrix
On Dec 13, 5:16 am, Thomas Kahle tom...@gmx.de wrote: Hi, I think that the main reason that Sage uses rows rather than columns by default (example: eigenvectors are left eigenvectors by default, i.e. v*A=lambda*A and not A*v=lambda*v , whereas most -- but not all -- linear algebra textbooks use the other convention is that that is the case in Magma. This comes up regularly on Sage-support. Sage developers feel that as long as this is well documented, and the non-default behaviour is possible, then that's ok. So if you can point to a place in the documentation of the functions you ar eusing where things are not made clear, please point them out. I think that the LLL function is one such place: I just looked at its docstring (via A.LLL?) and there is no mention of the row convention. That should be added. Well, sorry then. I had no idea that the other convention is used somewhere. As some (the majority?) of mathematicians declare the image to be the colspan it should be stated more explicitly for instance in image? that sage uses the rowspan. It can be easily overlooked in the example given there. Same applies to matrix?. These are acutally the places where I was looking. I don't know your design principles, but for me, if the developers stick to a non-standard(??) convention they should spell this out clearly and BOLD in many places. Hi, this is known and a ticket has been open to fix this - see http://trac.sagemath.org/sage_trac/ticket/1587 Cheers, Michael --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: The image of a matrix
mabshoff wrote: On Dec 13, 5:16 am, Thomas Kahle tom...@gmx.de wrote: Hi, I think that the main reason that Sage uses rows rather than columns by default (example: eigenvectors are left eigenvectors by default, i.e. v*A=lambda*A and not A*v=lambda*v , whereas most -- but not all -- linear algebra textbooks use the other convention is that that is the case in Magma. This comes up regularly on Sage-support. Sage developers feel that as long as this is well documented, and the non-default behaviour is possible, then that's ok. So if you can point to a place in the documentation of the functions you ar eusing where things are not made clear, please point them out. I think that the LLL function is one such place: I just looked at its docstring (via A.LLL?) and there is no mention of the row convention. That should be added. Well, sorry then. I had no idea that the other convention is used somewhere. As some (the majority?) of mathematicians declare the image to be the colspan it should be stated more explicitly for instance in image? that sage uses the rowspan. It can be easily overlooked in the example given there. Same applies to matrix?. These are acutally the places where I was looking. I don't know your design principles, but for me, if the developers stick to a non-standard(??) convention they should spell this out clearly and BOLD in many places. Hi, this is known and a ticket has been open to fix this - see http://trac.sagemath.org/sage_trac/ticket/1587 There are also some tickets that I have worked on to make this convention way more explicit. Others are right; there have been lots of discussion about this convention. Personally, as a linear algebra person, I would much rather have columns as the default way of looking at things. However, I understand that others are just as opposed to the idea. One of the projects that has been on my back burner for a long time is making all linear algebra functions consist of function_left and function_right (and left_function/right_function) versions, as well as explicitly deprecating the function that doesn't have left/right attached. This is already done for eigenspaces for general matrices, for example (eigenspaces is deprecated, left/right_eigenspaces and eigenspaces_left/right functions exist). I've done a lot of work on converting other things too (kernel and image, for example). I hope to complete it over the Christmas break. I teach linear algebra next semester (using columns, of course) and don't want my students getting really confused. I've also been introducing Sage to other linear algebra people, and this default is a constant source of frustration. There are other tickets that contain partial patches of my work, but I don't have time to look them up right now. Thanks, Jason --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: The image of a matrix
William Stein wrote: On Sat, Dec 13, 2008 at 8:48 AM, Jason Grout jason-s...@creativetrax.com wrote: mabshoff wrote: On Dec 13, 5:16 am, Thomas Kahle tom...@gmx.de wrote: Hi, I think that the main reason that Sage uses rows rather than columns by default (example: eigenvectors are left eigenvectors by default, i.e. v*A=lambda*A and not A*v=lambda*v , whereas most -- but not all -- linear algebra textbooks use the other convention is that that is the case in Magma. This comes up regularly on Sage-support. Sage developers feel that as long as this is well documented, and the non-default behaviour is possible, then that's ok. So if you can point to a place in the documentation of the functions you ar eusing where things are not made clear, please point them out. I think that the LLL function is one such place: I just looked at its docstring (via A.LLL?) and there is no mention of the row convention. That should be added. Well, sorry then. I had no idea that the other convention is used somewhere. As some (the majority?) of mathematicians declare the image to be the colspan it should be stated more explicitly for instance in image? that sage uses the rowspan. It can be easily overlooked in the example given there. Same applies to matrix?. These are acutally the places where I was looking. I don't know your design principles, but for me, if the developers stick to a non-standard(??) convention they should spell this out clearly and BOLD in many places. Hi, this is known and a ticket has been open to fix this - see http://trac.sagemath.org/sage_trac/ticket/1587 There are also some tickets that I have worked on to make this convention way more explicit. Others are right; there have been lots of discussion about this convention. Personally, as a linear algebra person, I would much rather have columns as the default way of looking at things. However, I understand that others are just as opposed to the idea. Very few people. I only did it the wrong way, because Magma does things the wrong way, and David Kohel convinced me to stay consistent with that convention. Sage was originally intended to be very similar to Magma. Now, that doesn't matter so much. Well, for right now, the plan is to deprecate the functions that make the assumption you are working with row vectors and make everything explicit. Eventually those main functions can be removed. Then after that, if people want to introduce the main functions back in again, but tied to (the :) right action, it'll work. I think this way, we avoid bugs and frustration from people basing things around the left action stuff. Jason --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: The image of a matrix
On Dec 13, 10:33 am, Jason Grout jason-s...@creativetrax.com wrote: William Stein wrote: SNIP Very few people. I only did it the wrong way, because Magma does things the wrong way, and David Kohel convinced me to stay consistent with that convention. Sage was originally intended to be very similar to Magma. Now, that doesn't matter so much. Well, for right now, the plan is to deprecate the functions that make the assumption you are working with row vectors and make everything explicit. Eventually those main functions can be removed. Then after that, if people want to introduce the main functions back in again, but tied to (the :) right action, it'll work. I think this way, we avoid bugs and frustration from people basing things around the left action stuff. Jason I think we should leave it explicit. As is things are canonically wrong from the perspective where I come from while switching to the opposite will make plenty of other people shake their heads. If they want some think canonical, i.e. kernel() and so on, once we deprecated the functionality and have eventually removed it those people are free to define something in their init.sage. Cheers, Michael --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---