#14456: New methods for alternating sign matrices
-----------------------------------+----------------------------------------
Reporter: jessicapalencia | Owner: sage-combinat
Type: enhancement | Status: new
Priority: major | Milestone: sage-5.10
Component: combinatorics | Resolution:
Keywords: asm | Work issues:
Report Upstream: N/A | Reviewers:
Authors: | Merged in:
Dependencies: #14301 | Stopgaps:
-----------------------------------+----------------------------------------
Comment (by stumpc5):
Hi Jessica,
when you do the doctests, you should see several errors:
{{{
***Test Failed*** 4 failures.
For whitespace errors, see the file
/home/stumpc5/.sage//tmp/alternating_sign_matrix_4355.py
}}}
This doesn't mean that the 4 failures are actuall whitespace errors. When
looking further above in the output, you see
{{{
File "/home/stumpc5/progs/sage-5.8/devel/sage-
main/sage/combinat/alternating_sign_matrix.py", line 223:
...
if number_negative_ones(self)==0:
NameError: global name 'number_negative_ones' is not defined
}}}
So in line 223 of the file, you do {{{number_negative_ones(self)}}} rather
than {{{self.number_negative_ones()}}}. The second failure is the same,
while the 3rd and 4th are different. There, you use
{{{NonDecreasingParkingFunction}}} in the code. Whenever you want to use a
function that is not defined in the present file, you have to import it
into the source code using
{{{
from sage.combinat.non_decreasing_parking_function import
NonDecreasingParkingFunction
}}}
(see other examples at the beginning of the file). If you do not know how
to import something, you can write
{{{
sage: import_statements(NonDecreasingParkingFunction)
}}}
from within sage to get the import statement.
Finally, some coding remarks:
- you can use {{{ return self.number_negative_ones()==0 }}}
- explaining variable names are easier to read than a, aa, b, bb, ...,
like
{{{
PF = ParkingFunction(data)
D = DyckWord(data)
...
}}}
- if you only use a variable ones, you often do not really need it, like
in
{{{
cc=NonDecreasingParkingFunction(c)
d=cc.to_dyck_word()
dd=d.reverse()
return dd
}}}
which becomes
{{{
return NonDecreasingParkingFunction(c).to_dyck_word().reverse()
}}}
Let me know if anything is unclear!
Cheers, Christian
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14456#comment:3>
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.