#14666: Test if a weight function is generic for a given matroid
-------------------------------------+-------------------------------------
       Reporter:  Stefan             |        Owner:  Stefanf
           Type:  enhancement        |       Status:  needs_review
       Priority:  minor              |    Milestone:  sage-7.2
      Component:  matroid theory     |   Resolution:
       Keywords:  matroid, weight    |    Merged in:
  function                           |    Reviewers:
        Authors:                     |  Work issues:
Report Upstream:  N/A                |       Commit:
         Branch:                     |  059b6d3816eae7412bc5e6570c17888fa2b75678
  public/ticket/14666                |     Stopgaps:
   Dependencies:                     |
-------------------------------------+-------------------------------------

Comment (by tara):

 Replying to [comment:24 Stefan]:

 >
 > I see it. The problem is that the user input variable "weights" is used
 down the line, as opposed to the object created in the try/except blocks.
 The list `wt` is not so useful, so I would probably define something
 that's guaranteed to be a function, like so:
 >
 > {{{
 > if callable(weights):
 >     wts = weights
 > else:
 >     wts = lambda x: weights[x]
 > }}}
 > Then use wts instead of weights down the line.
 >

 The reason that `wt` is currently useful, is that it is used to sort the
 elements in decreasing order of weight. I'm not sure how to do that with
 only a function `wts`. I tried adding the function wts, but I ended up
 having it not compile. I'll look at it again tomorrow.

--
Ticket URL: <http://trac.sagemath.org/ticket/14666#comment:25>
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 https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to