Yes, write code to workaround this case.


On 2/7/09, Florent Hivert <[email protected]> wrote:
>
> On Sat, Feb 07, 2009 at 03:22:51PM +0000, Martin Albrecht wrote:
>>
>> > One community question : suppose that this happen and that I don't
>> > find the correct way to fix it (no one knows about strange data
>> > structure
>> > :-)) is this ok to post a patch that test the problem and raise a doc
>> > error
>> > and to add a trac ticket for this specific problem ?
>>
>> I'd say: Don't raise a doc error but write a doctest with the expected
>> behaviour after the fix. Then ping someone (e.g. [sage-devel]) and point
>> out
>> that help is needed to finish the patch. Then -- hopefully -- someone will
>>
>> jump in and fix the behaviour of the code to match your doctest.
>
> Unfortunately things went exactly as I feared. I've some problem with the
> handling of symbolic matrices. It seems that maxima refuse to invert the 0x0
> matrix (see below)... Any suggestion ?
>
> The code is
>        cdef Matrix_symbolic_dense M = self._new_c()
>        M._maxima = self._maxima.invert()
>        return M
>
> Should I write so code to work around maxima in this vary particular case ?
>
> Florent
>
> ==========
>
> sage:  M = matrix(SR, 0, 0)
> sage: M
> []
> sage: M.inverse()
> ---------------------------------------------------------------------------
> TypeError                                 Traceback (most recent call last)
>
> /home/averell/.sage/temp/tomahawk/17911/_home_averell__sage_init_sage_0.py
> in <module>()
> ----> 1
>       2
>       3
>       4
>       5
>
> /usr/local/sage/local/lib/python2.5/site-packages/sage/matrix/matrix2.so in
> sage.matrix.matrix2.Matrix.inverse (sage/matrix/matrix2.c:23433)()
>    3953
>    3954         TESTS:
> -> 3955             sage: matrix().inverse()
>    3956             []
>    3957        """
>
> /usr/local/sage/local/lib/python2.5/site-packages/sage/matrix/matrix_symbolic_dense.so
> in sage.matrix.matrix_symbolic_dense.Matrix_symbolic_dense.__invert__
> (sage/matrix/matrix_symbolic_dense.c:3159)()
>     240         """
>     241         cdef Matrix_symbolic_dense M = self._new_c()
> --> 242         M._maxima = self._maxima.invert()
>     243         return M
>     244
>
> /usr/local/sage/local/lib/python2.5/site-packages/sage/interfaces/expect.pyc
> in __call__(self, *args, **kwds)
>    1290
>    1291     def __call__(self, *args, **kwds):
> -> 1292         return self._obj.parent().function_call(self._name,
> [self._obj] + list(args), kwds)
>    1293
>    1294     def help(self):
>
> /usr/local/sage/local/lib/python2.5/site-packages/sage/interfaces/expect.pyc
> in function_call(self, function, args, kwds)
>    1210         self._check_valid_function_name(function)
>    1211         return self.new("%s(%s)"%(function, ",".join([s.name() for s
> in args]+
> -> 1212
> ['%s=%s'%(key,value.name()) for key, value in kwds.items()])))
>    1213
>    1214     def call(self, function_name, *args, **kwds):
>
> /usr/local/sage/local/lib/python2.5/site-packages/sage/interfaces/expect.pyc
> in new(self, code)
>    1028
>    1029     def new(self, code):
> -> 1030         return self(code)
>    1031
>    1032
> ###################################################################
>
> /usr/local/sage/local/lib/python2.5/site-packages/sage/interfaces/expect.pyc
> in __call__(self, x, name)
>     963             return x
>     964         if isinstance(x, basestring):
> --> 965             return cls(self, x, name=name)
>     966         try:
>     967             return self._coerce_from_special_method(x)
>
> /usr/local/sage/local/lib/python2.5/site-packages/sage/interfaces/expect.pyc
> in __init__(self, parent, value, is_name, name)
>    1333             except (TypeError, KeyboardInterrupt, RuntimeError,
> ValueError), x:
>    1334                 self._session_number = -1
> -> 1335                 raise TypeError, x
>    1336         self._session_number = parent._session_number
>    1337
>
> TypeError: Error executing code in Maxima
> CODE:
>       sage29 : invert(sage28)$
> Maxima ERROR:
>       
> `fullmap' found arguments with incompatible structure.
>
>
>> /usr/local/sage/local/lib/python2.5/site-packages/sage/interfaces/expect.py(1335)__init__()
>    1334                 self._session_number = -1
> -> 1335                 raise TypeError, x
>    1336         self._session_number = parent._session_number
>
>
>
> >
>


-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to