On Nov 27, 2007, at 4:19 PM, Jason Grout wrote:
> Would it be easy to make a set_immutable function for vectors?
> Grepping
> through the matrix code for the parts dealing with mutability makes it
> seem like it would be a huge project to add it to vectors, but I
> don't know.
I don't think it would be that hard. The mutability stuff for
matrices is mostly because of all the (expensive to compute) cached
quantities, which probably won't be nearly as common for vectors.
There are lots of vector types to edit however.
> I'd like to use vectors for vertices in a graph, which requires that
> they be hashable. For reference, I now do:
>
> sage: v = vector(GF(2),[1,0])
> sage: w = vector(GF(2),[0,1])
> sage: g = Graph({tuple(v): tuple(w)})
>
> To reconstruct the vector from the tuple t, it seems like it is enough
> to call vector(t) (it even guesses the right field from the
> elements!),
> i.e., it seems that v==vector(tuple(v)) for a vector. Can I count on
> v==vector(tuple(v)) being True?
I believe this will always be true, though if v lies in something
other than a free module (e.g. its an element of a subspace) the
parents may differ.
- Robert
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---