Opened 4 years ago

Closed 4 years ago

#25007 closed defect (fixed)

Bug in to_vector-method of ClassicalMatrixLieAlgebra class

Reported by: soehms Owned by:
Priority: major Milestone: sage-8.2
Component: algebra Keywords: classical lie algebra to_vector
Cc: tscrim Merged in:
Authors: Travis Scrimshaw Reviewers: Sebastian Oehms
Report Upstream: N/A Work issues:
Branch: eb54616 (Commits, GitHub, GitLab) Commit: eb5461685e3589c2785bec694e02502a32b06e78
Dependencies: Stopgaps:

Status badges

Description

Reproducible bug explained by the following example:

sage: LM = lie_algebras.sp(QQ, 4, representation='matrix')
sage: e1, e2, f1, f2, h1, h2 = LM.gens()
sage: h1.to_vector()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/home/sebastian/develop/sage/local/lib/python2.7/site-packages/sage/categories/finite_dimensional_lie_algebras_with_basis.pyc in to_vector(self)
    862             M = self.parent().module()
    863             B = M.basis()
--> 864             return M.sum(self[k] * B[i] for i,k in enumerate(self.parent()._basis_ordering))
    865
    866         _vector_ = to_vector

....................

TypeError: unsupported operand parent(s) for *: 'Sparse vector space of dimension 4 over Rational Field' and 'Vector space of dimension 10 over Rational Field'
sage:

Change History (4)

comment:1 Changed 4 years ago by tscrim

  • Authors changed from Sebastian Oehms to Travis Scrimshaw
  • Branch set to public/lie_algebras/fix_to_vector_matrix-25007
  • Commit set to eb5461685e3589c2785bec694e02502a32b06e78
  • Reviewers set to Sebastian Oehms
  • Status changed from new to needs_review

What I did was make the generic to_vector call monomial_coefficients. Now the NotImplementedError raise by monomial_coefficients is a more general safeguard when the dimension is not known to be finite. However, fixing that is a separate issue IMO.


New commits:

eb54616Making the generic to_vector() call monomial_coefficients().

comment:2 follow-up: Changed 4 years ago by soehms

I agree! If you create a new ticket for the implementation of monomial_coefficients for finite dimensional instances of LieAlgebraFromAssociative? you can switch to positive review!

comment:3 in reply to: ↑ 2 Changed 4 years ago by tscrim

  • Status changed from needs_review to positive_review

Replying to soehms:

I agree! If you create a new ticket for the implementation of monomial_coefficients for finite dimensional instances of LieAlgebraFromAssociative? you can switch to positive review!

Great, thank you. This is now #25033.

comment:4 Changed 4 years ago by vbraun

  • Branch changed from public/lie_algebras/fix_to_vector_matrix-25007 to eb5461685e3589c2785bec694e02502a32b06e78
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.