Sorry; the function I wrote is wrong: def restrict_right(M,W): return (M.transpose().restrict(W)).transpose()
On Dec 3, 11:23 pm, adrian <nihilalienumcr...@gmail.com> wrote: > The following code breakes with > ArithmeticError: subspace is not invariant under matrix > > since sage assumes that vectors are left vectors. However there is no > restrict_right nor restrict_left methods. > > V=VectorSpace(QQ,3) > W=V.subspace_with_basis([[0,1,0],[1,1,0]]) > M=matrix(ZZ,3,3,[1,0,1,1,0,0,0,0,1]) > show(W) > show(M) > show(M.restrict(W)) > > The fix is simple > def restrict_right(W): > return (W.transpose().restrict(W)).transpose() > > I guess the same assumptions are made for restrict_domain and > restrict_codomain > > V=VectorSpace(QQ,3) > W=V.subspace_with_basis([[0,1,0],[1,1,0]]) > M=matrix(ZZ,3,3,[1,0,1,1,0,0,0,0,1]) > > show(W) > show(M) > show(M.restrict(W)) -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org