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 [email protected] 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 -~----------~----~----~----~------~----~------~--~---
