[sage-devel] Re: Sort ambient spaces by inner product as well?

2017-09-22 Thread Simon Brandhorst
Just fixing the == method is probably not good enough: 

On Thursday, September 21, 2017 at 4:10:10 PM UTC+2, Maarten Derickx wrote:
>
>
> Note that there is no distinction between the FreeModule with 
> inner_product_matrix=matrix.identity(1)*2 and FreeQuadraticModusince the 
> sage object created in both ways is the same object. Not just equal, but 
> literally the same object in memory, so any change will automatically 
> affect both.
>
> FreeQuadraticModule(ZZ,1,matrix.identity(1)*2) is 
> FreeModule(ZZ,1,inner_product_matrix=matrix.identity(1)*2) 
>
> I think it is good to open a ticket to make == also take the inner product 
> matrix into account, and I think no deprecation is needed since it fixes 
> something which is mathematically incorrect.
>
> One more subtle question is wether we want:
>
> sage: 
> FreeModule(ZZ,1)==FreeModule(ZZ,1,inner_product_matrix=matrix.identity(1))
>
> I think so. It is mathematically the same thing. But just changing the == 
operator is not good enough. Then we also need to reconsider < ,<= etc.

Currently:
"
Modules are ordered by their ambient spaces, then by dimension,
then in order by their echelon matrices. However, if
other is a sub-module or is a quotient module then its
comparison method is used instead of generic comparison.
"
Ambient spaces are ordered by rank and base ring.

So I think that ambient spaces should be ordered by
rank, inner_product_matrix, and then base ring. 

This change should  take place in 
sage.modules.free_module.FreeModule_ambient
One might need to adapt the hash function there?
Objections?



-- 
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] Re: Sort ambient spaces by inner product as well?

2017-09-21 Thread Maarten Derickx

Note that there is no distinction between the FreeModule with 
inner_product_matrix=matrix.identity(1)*2 and FreeQuadraticModusince the 
sage object created in both ways is the same object. Not just equal, but 
literally the same object in memory, so any change will automatically 
affect both.

FreeQuadraticModule(ZZ,1,matrix.identity(1)*2) is 
FreeModule(ZZ,1,inner_product_matrix=matrix.identity(1)*2) 

I think it is good to open a ticket to make == also take the inner product 
matrix into account, and I think no deprecation is needed since it fixes 
something which is mathematically incorrect.

One more subtle question is wether we want:

sage: 
FreeModule(ZZ,1)==FreeModule(ZZ,1,inner_product_matrix=matrix.identity(1))


On Thursday, 21 September 2017 10:13:13 UTC+2, Simon Brandhorst wrote:
>
> Currently, comparison of free_module_generic (and free_quadratic_modules) 
> ignores the inner product matrix
>
> sage: 
> FreeModule(ZZ,1)==FreeModule(ZZ,1,inner_product_matrix=matrix.identity(1)*2)
> True
> sage: 
> FreeQuadraticModule(ZZ,1,matrix.identity(1))==FreeQuadraticModule(ZZ,1,matrix.identity(1)*2)
> True
>
> Especially for FreeQuadraticModules, the inner_product_matrix is essential 
> and two FreeQuadraticModules are certainly different (mathematically) if 
> their inner product is different.
>
> Is that intended behavior? If not, I would like to open a ticket. Do I 
> need a deprecation warning or something for that ? 
>
>

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