Re: [sage-devel] Polyhedron.vertices() function call behaviour
I have created a ticket here: https://trac.sagemath.org/ticket/27709 and now made the vector method output a copy. Le mercredi 17 avril 2019 07:44:22 UTC+2, vdelecroix a écrit : > > Le 16/04/2019 à 09:58, jplab a écrit : > > > > > > Le vendredi 12 avril 2019 06:41:50 UTC+2, John H Palmieri a écrit : > >> > >> Can you provide details of how you created the polyhedron? As David > said, > >> Q.vertices() should make a copy before returning the result, and I > would > >> like to recreate this so I can fix it. > >> > >> +1 > > > > sage: C = polytopes.cube() > sage: C.vertices()[0].vector()[0] = 3 > sage: C.vertices() > (A vertex at (3, -1, -1), > ... > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] Polyhedron.vertices() function call behaviour
Le 16/04/2019 à 09:58, jplab a écrit : Le vendredi 12 avril 2019 06:41:50 UTC+2, John H Palmieri a écrit : Can you provide details of how you created the polyhedron? As David said, Q.vertices() should make a copy before returning the result, and I would like to recreate this so I can fix it. +1 sage: C = polytopes.cube() sage: C.vertices()[0].vector()[0] = 3 sage: C.vertices() (A vertex at (3, -1, -1), ... -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] Polyhedron.vertices() function call behaviour
Le vendredi 12 avril 2019 06:41:50 UTC+2, John H Palmieri a écrit : > > Can you provide details of how you created the polyhedron? As David said, > Q.vertices() should make a copy before returning the result, and I would > like to recreate this so I can fix it. > > +1 -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] Polyhedron.vertices() function call behaviour
Can you provide details of how you created the polyhedron? As David said, Q.vertices() should make a copy before returning the result, and I would like to recreate this so I can fix it. On Thursday, April 11, 2019 at 9:21:42 PM UTC-7, Narayanan Narayanan wrote: > > Thank you David. Using deepcopy seems to solve the issue if I make a > separate copy after the call. But as you mentioned, the return of function > should be a copy object. > regards > narayanan > > On Thursday, 11 April 2019 12:32:23 UTC+5:30, David Roe wrote: >> >> You probably want deepcopy. That being said, Q.vertices should probably >> also make a copy before returning the result. >> David >> >> >> -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] Polyhedron.vertices() function call behaviour
Thank you David. Using deepcopy seems to solve the issue if I make a separate copy after the call. But as you mentioned, the return of function should be a copy object. regards narayanan On Thursday, 11 April 2019 12:32:23 UTC+5:30, David Roe wrote: > > You probably want deepcopy. That being said, Q.vertices should probably > also make a copy before returning the result. > David > > > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] Polyhedron.vertices() function call behaviour
You probably want deepcopy. That being said, Q.vertices should probably also make a copy before returning the result. David On Thu, Apr 11, 2019 at 1:48 AM Narayanan Narayanan wrote: > > I have recently created a Polyhedron Q that corresponts to the cuts of a > graph. > > Once I have Q, I created a list of vectors of its vertices as follows: > > V=[s.vector() for s in Q.vertices()] > > Now I create a copy of V > W= copy(V) > > Then I change the 6th co-ordinate of each vector in W as follows > > for i in range(len(W)) : > W[i][5]=0 > > That is when all the hell broke lose. > > The change reflected in V also (all vectors of V had now 6th coordinate 0) > > But that is not the shocking part: call to Q.vertices() now returns > vertices where all have 6th coordinate 0! > > Can someone explain what is going on? > > Narayanan > > > -- > You received this message because you are subscribed to the Google Groups > "sage-devel" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-devel+unsubscr...@googlegroups.com. > To post to this group, send email to sage-devel@googlegroups.com. > Visit this group at https://groups.google.com/group/sage-devel. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
[sage-devel] Polyhedron.vertices() function call behaviour
I have recently created a Polyhedron Q that corresponts to the cuts of a graph. Once I have Q, I created a list of vectors of its vertices as follows: V=[s.vector() for s in Q.vertices()] Now I create a copy of V W= copy(V) Then I change the 6th co-ordinate of each vector in W as follows for i in range(len(W)) : W[i][5]=0 That is when all the hell broke lose. The change reflected in V also (all vectors of V had now 6th coordinate 0) But that is not the shocking part: call to Q.vertices() now returns vertices where all have 6th coordinate 0! Can someone explain what is going on? Narayanan -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.