On Wed, Jan 28, 2009 at 11:07 AM, Carl Witty <carl.wi...@gmail.com> wrote:
>
> On Jan 28, 12:44 am, mhampton <hampto...@gmail.com> wrote:
>> Hi Sébastien,
>>
>> Let me first say I am glad you are working on and thinking about this.
>
> Me too.
>
> ...
>
>> I have gone back and forth about changing the coordinate
>> representation into something more sophisticated.  At first I had
>> coordinates as vectors, but found that annoying for reasons which I
>> can't recall in detail.  I like the simplicity of coordinates as lists
>> of lists.  For functions that could benefit from having things in
>> matrix form, perhaps there could be a property like vertex_matrix that
>> would store things in that way.  Such a property could be created and
>> stored only when it is actually needed to avoid redundancy.  The
>> matrix representation might make sense as the default if people
>> started to write more sage-native polyhedral algorithms; my impression
>> is that it will be easier to wrap other people's code for most
>> purposes though (such as the volume computation with lrs).
>
> I can't get too excited about choosing the internal data structures.
> As long as they aren't exposed inappropriately, it shouldn't be hard
> to change them later.
>
> As an example of inappropriate exposure: the following is unfortunate
> (and probably rises to the level of "buggy"); especially since
> the .vertices() docstring doesn't mention the dangers.
>
> sage: square = Polyhedron(vertices = [[1, 1], [1, -1], [-1, 1], [-1,
> -1]])
> sage: verts = square.vertices()
> sage: verts.append((pi, e))
> sage: verts[0].append("Hi mom")
> sage: square.vertices()
> [[1, 1, 'Hi mom'], [1, -1], [-1, 1], [-1, -1], (pi, e)]

Cwitty -- +1 for pointing this out.   Not guarding against this is a typical
problem that can lead to bugs and confusion by users.

I remember in old versions of Sage in 2005 when people would point out
to me that, e.g., one could *change* matrices but the charpolys stayed
the same, which would obviously lead to subtle bugs, and is the same
sort of problem as the one above.   Already in sage-0.9.10 I had fixed
this (I just checked -- thanks Mabshoff), since it was so potentially
confusing.

William

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to