#18645: Add some methods to CartanMatrix
-------------------------------------+-------------------------------------
       Reporter:  jonathan.judge     |        Owner:  jonathan.judge
           Type:  enhancement        |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.8
      Component:  combinatorics      |   Resolution:
       Keywords:  days65             |    Merged in:
        Authors:                     |    Reviewers:  Ben Salisbury
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/jonathan.judge/add_some_methods_to_cartanmatrix|  
8d06af9a2013822895f945e37cf7df0137b421ed
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by tscrim):

 A couple of things:

 - IMO `not self.det() == 0` would be better as `self.det() != 0`.
 - Instead of `return len([x for x in self.eigenvalues() if x < 0]) == 1`,
 I would use `sum(1 for x in M.eigenvalues() if x < 0)` since then we don't
 create the intermediate list (but this probably isn't really important
 since matrices we consider are usually "small").
 - I would do this import `from sage.misc.misc import powerset` at the
 module level. It makes the code run faster. (Sorry, I should have
 mentioned this earlier.)
 - I would cache the `is_*` methods since they actually seem to get called
 with some frequency (specifically `is_finite`).
 - I think your check for `is_hyperbolic` is overkill. You should instead
 iterate over the vertices and check the subgraph of everything except that
 vertex.

--
Ticket URL: <http://trac.sagemath.org/ticket/18645#comment:15>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to