Hi all,

I am fighting with the same problem for too much time... I want to invert matrices (squares and invertibles especially because they represent basis change of a finite dimensional quotient : K[X] / Sym(X)^+ ). We begin to have a large bunch of combinatorial ring in sage-combinat and most of them use a combinatorial free module data structure but the sage matrices doesn't like combinatorial free modules...

For all such matrix M, in a perfect world : I just want : (1/M.det)*M.adjoint() ( --> and all algorithms are already here and work fine, It is just a branching question between different features).

For now :
***************************************************************
sage: SF = SymmetricFunctions(QQ).schur()
sage: Id = identity_matrix(SF, 2); Id
[s[]   0]
[  0 s[]]
sage: Id.inverse()
Traceback (most recent call last):
...
AttributeError: 'SymmetricFunctionAlgebra_schur_with_category' object has no attribute 'fraction_field'
sage: ~Id.det()
s[]
sage: ~Id.det()*Id.adjoint()
Traceback (most recent call last):
...
TypeError: unsupported operand parent(s) for '*': 'Symmetric Functions over Rational Field in the Schur basis' and 'Full MatrixSpace of 2 by 2 dense matrices over Symmetric Functions over Rational Field in the Schur basis'
***************************************************************

Perhaps due to the fact that :
***************************************************************
sage: Id
[s[]   0]
[  0 s[]]
sage: P = Id.parent(); P
Full MatrixSpace of 2 by 2 dense matrices over Symmetric Functions over Rational Field in the Schur basis
sage: P.has_coerce_map_from(SF)
False
***************************************************************

Let's fix some compatibility bug with Combinatorial free module (because SF['x'] doesn't means polynomial in x over SF in combinat world but return a ValueError explaining that ['x'] is not a valid partition) and had a nice coercion, I still have the same error. But the sage matrix spaces use "some" category (the "some" is very important I guess but that already go further than my knowledge... I do not know anything with old category framework...):
***************************************************************
sage: SF = SymmetricFunctions(QQ).schur()
sage: Id = identity_matrix(SF, 2); Id
[s[]   0]
[  0 s[]]
sage: P = Id.parent()
sage: P.category()
Category of algebras over Symmetric Functions over Rational Field in the Schur basis
sage: P.__class__.mro()
[sage.matrix.matrix_space.MatrixSpace,
 sage.structure.unique_representation.UniqueRepresentation,
 sage.structure.unique_representation.CachedRepresentation,
 sage.misc.fast_methods.WithEqualityById,
 sage.structure.parent_gens.ParentWithGens,
 sage.structure.parent_base.ParentWithBase,
 sage.structure.parent_old.Parent,
 sage.structure.parent.Parent,
 sage.structure.category_object.CategoryObject,
 sage.structure.sage_object.SageObject,
 object]
sage: SF(1)
s[]
sage: SF(1)*Id
Traceback (most recent call last):
...
TypeError: unsupported operand parent(s) for '*': 'Symmetric Functions over Rational Field in the Schur basis' and 'Full MatrixSpace of 2 by 2 dense matrices over Symmetric Functions over Rational Field in the Schur basis'
***************************************************************

So, I need some advises to fix that... And currently, I find very hard to evaluate the difficulty to do it without an horrible hack since : - the class sage/matric/matrix_space.MatrixSpace seems to present problem with inheritance...
- this code seems to not be new category framework compatible
- tests in this file only concerns : ZZ, QQ, GF(11), GF(2), SR, RDF, CDF, CyclotomicField(7), QQ['x,y'] (inversion tests are at the end of the file matrix_space.py) (not any combinatorial free module ring...)

I also didn't find where was implemented usual coercions between rings and their corresponding matrix_space (ZZ, QQ, ...) and I do not manage to find where (internal/external) products are implemented. I am lost in a lot of code. If someone can help, feel free to give me some advises. I will still try to dig in...

Cheers,
Nicolas B.

--
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-combinat-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-combinat-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-combinat-devel.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to