hey list, If you look at the code, there is a function called _new_c() which is used in the multiplication algorithm.
In there, the following line is called: x = <Matrix_integer_2x2> Matrix_integer_2x2.__new__(Matrix_integer_2x2, self._parent, None, False, False) this returns a Matrix_integer_2x2, but is different from the one you get, if you call: Matrix_integer_2x2(M2Z,None,false,false) sage: from sage.matrix.matrix_integer_2x2 import Matrix_integer_2x2 as mi2x2 sage: M2Z = MatrixSpace(ZZ,2) sage: null = mi2x2(M2Z,None,false,false);null [0 0] [0 0] sage: some_other_null = mi2x2.__new__(mi2x2, M2Z , None, False, False);some_other_null [] sage: some_other_null.set_immutable() --------------------------------------------------------------------------- AttributeError Traceback (most recent call last): [..] AttributeError: 'NoneType' object has no attribute 'set_immutable' even, if in _new_c the number of cols and rows is set, I think there is some internal object, which still has no value greatz Johannes On 10.01.2013 10:10, David Loeffler wrote: > The following curious bug came up during work on ticket #12233. For some > reason, if one creates a 2x2 integer matrix directly using the > constructor then it is possible to tell it to be immutable; but if one > creates one via arithmetic operations then calling "set_immutable" on it > fails. Here's an example: > > sage: from sage.matrix.matrix_integer_2x2 import Matrix_integer_2x2 as > mi2x2 > sage: M2Z = MatrixSpace(ZZ,2) > sage: mi2x2(M2Z, [1,0,0,1]) > sage: x=mi2x2(M2Z, [1,0,0,1], false, false) > sage: y=mi2x2(M2Z, [1,0,0,1], false, false) > sage: type(x) > <type 'sage.matrix.matrix_integer_2x2.Matrix_integer_2x2'> > sage: z = x*y > sage: type(z) > <type 'sage.matrix.matrix_integer_2x2.Matrix_integer_2x2'> > sage: x.set_immutable() # ok > sage: z.set_immutable() # error > [...] > AttributeError: 'NoneType' object has no attribute 'set_immutable' > > (Many thanks to Timo Kluck for clarifying the problem and finding this > example.) Does anyone have any idea what's going on here, and if so how > to fix it? > > Regards, David > > -- > You received this message because you are subscribed to the Google > Groups "sage-devel" group. > To post to this group, send email to sage-devel@googlegroups.com. > To unsubscribe from this group, send email to > sage-devel+unsubscr...@googlegroups.com. > Visit this group at http://groups.google.com/group/sage-devel?hl=en. > > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To post to this group, send email to sage-devel@googlegroups.com. To unsubscribe from this group, send email to sage-devel+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel?hl=en.