Ticket #2215 (assigned enhancement)

Opened 9 months ago

Last modified 5 months ago

[with patch, negative review] if p is a permutation, matrix(p) should call p.to_matrix()

Reported by: jason Assigned to: mhansen (accepted)
Priority: minor Milestone: sage-3.2.1
Component: combinatorics Keywords: editor_mhansen
Cc:

Description

it seems like matrix(thing) should usually work if we can think of "thing" as a matrix. In this case, we even already have a p.to_matrix() function.

Attachments

2215.patch (1.1 kB) - added by mhansen on 02/20/2008 12:00:13 AM.
8631.patch (1.7 kB) - added by wdj on 02/20/2008 11:04:32 AM.

Change History

02/19/2008 02:39:48 PM changed by mabshoff

  • milestone set to sage-2.10.2.

02/19/2008 07:45:49 PM changed by mhansen

  • owner changed from was to mhansen.
  • priority changed from major to minor.
  • status changed from new to assigned.
  • component changed from algebraic geometry to combinatorics.

The fix to this would be to add a _matrix_ method to Permutation_class ( which can call .to_matrix() )

02/19/2008 11:57:49 PM changed by mhansen

  • summary changed from if p is a permutation, matrix(p) should call p.to_matrix() to [with patch, needs review] if p is a permutation, matrix(p) should call p.to_matrix().

02/20/2008 12:00:13 AM changed by mhansen

  • attachment 2215.patch added.

02/20/2008 10:17:02 AM changed by wdj

I created an hg bundle which modifies this patch. It makes it such that perm -> matrix(perm) is consistent with the corresponding map on perm gp elements and respects multiplication. It passes sage -t but sage -testall failed in *many* places, though none which seemed related to this patch.

02/20/2008 10:20:23 AM changed by wdj

The bundle was too large to attach (if that makes any sense). It is posted to http://sage.math.washington.edu/home/wdj/patches/perms-mat_20-02-2008.hg

02/20/2008 10:25:40 AM changed by mabshoff

The bundle is against the *2.10.1 release*, ergo reverts all patches and bundle from the roughly 120 tickets closed so far against 2.10.2. Please export the commits you made after applying Mike Hansen's 2215.patch and attach those to the tickets.

To reiterate a message which I should be pushing on sage-devel: bundles are evil, especially for single commits.

Cheers,

Michael

02/20/2008 10:43:29 AM changed by wdj

(a) I have no idea how I used 2.10.1 instead of 2.10.2.a1. (b) I am missing something. Use patches not bundles? I don't even know how to make a patch. I am used to following http://www.sagemath.org/doc/html/prog/node72.html Is there a corresponding list of commands for patches?

02/20/2008 10:53:09 AM changed by mabshoff

To quote from that page:

You can make all changes in the repository you're working in as a bundle by
typing hg_sage.bundle('mybundle') (this creates an hg bundle mybundle.hg). 
Alternatively, you can export any particular changeset as plain text 
patches by typing hg_sage.export(...); note that each individual changeset 
is recorded as a different patch. hg_sage.export(...) needs at least the 
argument revs - integer or list of integers (revision numbers); use the 
hg_sage.log() function to see them. An optional second argument is a 
'patch_filename', default is '(changeset_revision_number).patch'.

The command hg_sage.bundle('mybundle') creates a bundle against the current main repo, which is at 2.10.1. Use hg_sage.export(...) with the right commit numbers, which hg_sage.log() does tell you.

Cheers,

Michael

02/20/2008 11:04:32 AM changed by wdj

  • attachment 8631.patch added.

02/20/2008 11:05:28 AM changed by wdj

Thanks! Please see attached.

02/20/2008 11:12:25 AM changed by mabshoff

I guess you are giving Mike's patch a positive review. If so please change the summary from "[with patch, needs review]" to "[with patch, with positive review]". It also looks like I need to apply only the second patch?

Cheers,

Michael

02/20/2008 01:09:37 PM changed by wdj

  • summary changed from [with patch, needs review] if p is a permutation, matrix(p) should call p.to_matrix() to [with patch, with positive review] if p is a permutation, matrix(p) should call p.to_matrix().

Yes, only the 2nd one.

02/20/2008 01:42:37 PM changed by mhansen

  • summary changed from [with patch, with positive review] if p is a permutation, matrix(p) should call p.to_matrix() to [with patch, negative review] if p is a permutation, matrix(p) should call p.to_matrix().

I don't like that matrix(p) and p.to_matrix() will give out different things. In the documentation for to_matrix(), I specifically said that matrix multiplication will only agree with the permutation multiplication when the multiplication is not done "English-style". The proper way to change things would be to modify to_matix() and its documentation, and make sure other things don't break.

02/20/2008 03:46:28 PM changed by wdj

I tried to figure out to_matrix but failed. It seemed to me that it was implicitly using a global variable, permutation_options or something like that. I though global variables were Bad. Is there a reason not to use optional parameters instead? Anyway, I think the matrix command of a permutation should agree with the the matrix command of a permutation, when regarded as an element of permutation group.

06/19/2008 09:28:39 PM changed by craigcitro

  • keywords set to editor_mhansen.