Ok I gdb'd this, and I can tell you exactly where the problem is, but  
I can't tell you how to fix it, because I don't think anyone has  
written down the rules for how this should work. Or maybe they have  
and I don't know where to look.

In structure/element.pyx, the __mul__ method of class Vector is being  
called. By inspecting the *type* of its arguments it determines that  
this is a vector*matrix operation, and calls the  
_vector_times_matrix_c() method on the matrix. However it looks like  
the implementation of _vector_times_matrix_c() on  
Matrix_rational_dense *assumes* that the vector is over Q, i.e. is a  
Vector_rational_dense. It just does a C pointer cast to do this, no  
type checking. Crash.

So my feeling is that:
(1) the vector_times_matrix_c() function should be able to assume  
that the vector is over the same ring as the matrix,
(2) therefore there is a bug in Vector.__mul__(). It shouldn't just  
be checking the types, it should also be checking the base rings, and  
if they don't agree, some coercion should be kicking in.

Thoughts?

My only concern is the whole question about multiple representation  
formats... like what happens if a parent (say vectors over some ring)  
has more than one way of representing elements. Is Vector.__mul__  
responsible for the conversion in this case, or is it the vector/ 
matrix multiply operation?

david

On Jun 21, 2007, at 3:00 AM, Gonzalo Tornaria wrote:

>
> ----------------------------------------------------------------------
> | SAGE Version 2.6, Release Date: 2007-06-02                         |
> | Type notebook() for the GUI, and license() for information.        |
> ----------------------------------------------------------------------
>
> sage: vector(ZZ[x],[1])*matrix(QQ,1,1,[1])
> *** glibc detected *** sage.bin: realloc(): invalid old size:
> 0x00007fff27379990 ***


--~--~---------~--~----~------------~-------~--~----~
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://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to