Re: [sage-devel] submodules subvectorspaces violate the unique parent condition. Why? Should we change that?

2017-10-09 Thread Maarten Derickx
The reason why unique parents were introduced is for speed and memory reasons. 
Having a million copies of the same parent around is a bit of a waste, but this 
is something that happens quite easily if one does not make parents unique. I 
also noticed that submodules violate the "equal => equal hash principle" since:

X = QQ^2
V = X.span([[1,0],[0,1]])
W = X.span_of_basis([[1,0],[0,1]])

Are all equal but have distinct hashes.

-- 
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] submodules subvectorspaces violate the unique parent condition. Why? Should we change that?

2017-10-09 Thread Simon Brandhorst
"While *parents* are unique, equal *elements* of a parent in Sage are not 
necessarily identical. "
in
http://doc.sagemath.org/html/en/tutorial/tour_coercion.html

OK.  In the parent class it says
"...this is useful if parents are unique, or element_constructor is a bound 
method (this latter case can be detected automatically). ..."

So uniqueness is not strict. But when is a parent supposed to be unique and 
when not?


On Monday, October 9, 2017 at 9:48:29 AM UTC+2, vdelecroix wrote:
>
> It is a violation of what!? Where did you read that parents should be 
> unique? 
>
> On 09/10/2017 09:26, Simon Brandhorst wrote: 
> > {{{ 
> > sage: V = span(QQ,[(1,1),(1,0)]) 
> > sage: W = span(QQ,[(0,1),(1,0)]) 
> > sage: V 
> > 
> > Vector space of degree 2 and dimension 2 over Rational Field 
> > Basis matrix: 
> > [1 0] 
> > [0 1] 
> > sage: W 
> > 
> > Vector space of degree 2 and dimension 2 over Rational Field 
> > Basis matrix: 
> > [1 0] 
> > [0 1] 
> > sage: V is W 
> > False 
> > sage: V==W 
> > True 
> > sage: type(V) 
> >  'sage.modules.free_module.FreeModule_submodule_field_with_category'> 
> > sage: type(W) 
> >  'sage.modules.free_module.FreeModule_submodule_field_with_category'> 
> > }}} 
> > 
> > They are parents. Yet they are not unique. 
> > 
>

-- 
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] submodules subvectorspaces violate the unique parent condition. Why? Should we change that?

2017-10-09 Thread Vincent Delecroix
It is a violation of what!? Where did you read that parents should be 
unique?


On 09/10/2017 09:26, Simon Brandhorst wrote:

{{{
sage: V = span(QQ,[(1,1),(1,0)])
sage: W = span(QQ,[(0,1),(1,0)])
sage: V

Vector space of degree 2 and dimension 2 over Rational Field
Basis matrix:
[1 0]
[0 1]
sage: W

Vector space of degree 2 and dimension 2 over Rational Field
Basis matrix:
[1 0]
[0 1]
sage: V is W
False
sage: V==W
True
sage: type(V)

sage: type(W)

}}}

They are parents. Yet they are not unique.



--
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] submodules subvectorspaces violate the unique parent condition. Why? Should we change that?

2017-10-09 Thread Simon Brandhorst
{{{
sage: V = span(QQ,[(1,1),(1,0)])
sage: W = span(QQ,[(0,1),(1,0)])
sage: V

Vector space of degree 2 and dimension 2 over Rational Field
Basis matrix:
[1 0]
[0 1]
sage: W

Vector space of degree 2 and dimension 2 over Rational Field
Basis matrix:
[1 0]
[0 1]
sage: V is W
False
sage: V==W
True
sage: type(V)

sage: type(W)

}}}

They are parents. Yet they are not unique.

-- 
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.