[sage-devel] Re: recommended method to extend sage classes
David Joyner wrote: By extend a Sage class it seems you mean add a method to a Sage class. You want to know how to add a method to the class matrix_complex_double_dense.pyx at http://www.sagemath.org/hg/sage-main/file/8b1d19463fc4/sage/matrix/matrix_complex_double_dense.pyx ? (If you want to license it under the GPLv2+ and don't know how to submit it to Sage as a contribution, that is a separate question.) What is really confusing me is that the docstring for matrix_complex_double_dense.pyx (presumably *complex* matrices) is more or less the same as the docstring for matrix_real_double_dense.pyx at http://www.sagemath.org/hg/sage-main/file/8b1d19463fc4/sage/matrix/matrix_real_double_dense.pyx In other words, there are no examples of *complex* matrices in the docstring for matrix_complex_double_dense.pyx, which seems odd. Yep, that's an error. A copy-paste oversight. It's now trac #4669. Thanks for catching it. Jason --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-devel] Re: recommended method to extend sage classes
Simon Beaumont wrote: What is the recommended way to extend sage classes? - I want to add some functionality to the complex matrix class - specifically tests for: is_symmetric, is_hermitian, is_unitary etc... you get the idea. As noted in other replies, you could add these methods to either matrix/matrix_complex_double_dense.pyx (but please then add corresponding methods to matrix_real_double_dense.pyx for consistency), or you could add the methods to matrix_double_dense.pyx. Thanks for thinking of these things! Jason --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-devel] Re: recommended method to extend sage classes
By extend a Sage class it seems you mean add a method to a Sage class. You want to know how to add a method to the class matrix_complex_double_dense.pyx at http://www.sagemath.org/hg/sage-main/file/8b1d19463fc4/sage/matrix/matrix_complex_double_dense.pyx ? (If you want to license it under the GPLv2+ and don't know how to submit it to Sage as a contribution, that is a separate question.) What is really confusing me is that the docstring for matrix_complex_double_dense.pyx (presumably *complex* matrices) is more or less the same as the docstring for matrix_real_double_dense.pyx at http://www.sagemath.org/hg/sage-main/file/8b1d19463fc4/sage/matrix/matrix_real_double_dense.pyx In other words, there are no examples of *complex* matrices in the docstring for matrix_complex_double_dense.pyx, which seems odd. Getting back to your question, matrix_double_dense.pyx http://www.sagemath.org/hg/sage-main/file/8b1d19463fc4/sage/matrix/matrix_double_dense.pyx does have an is_symmetric method, which maybe could be modified for the purpose you state? +++ On Sun, Nov 30, 2008 at 8:01 AM, Simon Beaumont [EMAIL PROTECTED] wrote: What is the recommended way to extend sage classes? - I want to add some functionality to the complex matrix class - specifically tests for: is_symmetric, is_hermitian, is_unitary etc... you get the idea. I have experienced and read that this is not so straightforward. I guess I could do it by delegation but that's a bit naff given the power of the python object system. -- simon --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-devel] Re: recommended method to extend sage classes
Thanks David, Yes extend by inheriting (and adding methods using the functionality of the parent) is what I meant. I think that gives me enough to get the job done... I'm sure the is_symmetric method is usable as is - I just didn't spot it. Cheers, Simon On Nov 30, 1:55 pm, David Joyner [EMAIL PROTECTED] wrote: By extend a Sage class it seems you mean add a method to a Sage class. You want to know how to add a method to the class matrix_complex_double_dense.pyx athttp://www.sagemath.org/hg/sage-main/file/8b1d19463fc4/sage/matrix/ma... ? (If you want to license it under the GPLv2+ and don't know how to submit it to Sage as a contribution, that is a separate question.) What is really confusing me is that the docstring for matrix_complex_double_dense.pyx (presumably *complex* matrices) is more or less the same as the docstring for matrix_real_double_dense.pyx athttp://www.sagemath.org/hg/sage-main/file/8b1d19463fc4/sage/matrix/ma... In other words, there are no examples of *complex* matrices in the docstring for matrix_complex_double_dense.pyx, which seems odd. Getting back to your question, matrix_double_dense.pyxhttp://www.sagemath.org/hg/sage-main/file/8b1d19463fc4/sage/matrix/ma... does have an is_symmetric method, which maybe could be modified for the purpose you state? +++ On Sun, Nov 30, 2008 at 8:01 AM, Simon Beaumont [EMAIL PROTECTED] wrote: What is the recommended way to extend sage classes? - I want to add some functionality to the complex matrix class - specifically tests for: is_symmetric, is_hermitian, is_unitary etc... you get the idea. I have experienced and read that this is not so straightforward. I guess I could do it by delegation but that's a bit naff given the power of the python object system. -- simon --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~--~~~~--~~--~--~---