Re: [sage-combinat-devel] Re: Constructing homs

2012-12-05 Thread Nicolas M. Thiery
On Thu, Dec 06, 2012 at 01:13:09AM +, Dima Pasechnik wrote:
> > Here's a related question: suppose I have an object G in sage. Is there a 
> > "correct" way to ask G if is it a CombinatorialFreeModule? I can check for
> >
> > if hasattr(G,'_basis_keys'): ...
> >
> > but I would have thought that there was a better way to do this...
> isinstance?
> 
> 
> sage: F = CombinatorialFreeModule(QQ, ['a','b','c'])
> sage: isinstance(F,CombinatorialFreeModule)
> True
> sage: isinstance([],CombinatorialFreeModule)
> False

Depending on what you want to test exactly, you might or not want to do

sage: F in ModulesWithBasis

which will eventually include QQ^3, QQ['x'], ...

Cheers,

Nicolas
--
Nicolas M. Thiéry "Isil" 
http://Nicolas.Thiery.name/

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To post to this group, send email to sage-combinat-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.



[sage-combinat-devel] Re: Constructing homs

2012-12-05 Thread Andrew Mathas
Yes, I worked it out and deleted my question bot before you replied it 
seems. 

Thanks anyway,
Andrew

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sage-combinat-devel/-/wWxrvtdzHRoJ.
To post to this group, send email to sage-combinat-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.



[sage-combinat-devel] Re: Constructing homs

2012-12-05 Thread Dima Pasechnik
On 2012-12-05, Andrew Mathas  wrote:
> --=_Part_33_6944284.1354751535501
> Content-Type: text/plain; charset=ISO-8859-1
>
> Here's a related question: suppose I have an object G in sage. Is there a 
> "correct" way to ask G if is it a CombinatorialFreeModule? I can check for
>
> if hasattr(G,'_basis_keys'): ...
>
> but I would have thought that there was a better way to do this...
isinstance?


sage: F = CombinatorialFreeModule(QQ, ['a','b','c'])
sage: isinstance(F,CombinatorialFreeModule)
True
sage: isinstance([],CombinatorialFreeModule)
False

HTH,
Dima
>
> Andrew
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To post to this group, send email to sage-combinat-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.



Re: [sage-combinat-devel] Re: Constructing homs

2012-12-05 Thread Andrew Mathas
Here's a related question: suppose I have an object G in sage. Is there a 
"correct" way to ask G if is it a CombinatorialFreeModule? I can check for

if hasattr(G,'_basis_keys'): ...

but I would have thought that there was a better way to do this...

Andrew

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sage-combinat-devel/-/8axqoe8vKCQJ.
To post to this group, send email to sage-combinat-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.



Re: [sage-combinat-devel] Re: Constructing homs

2012-12-05 Thread Nicolas M. Thiery
On Wed, Dec 05, 2012 at 10:45:13AM -0800, Travis Scrimshaw wrote:
>Hey Andrew,
>   It sounds more like you want to use a spare matrix (or even just a
>dictionary with a tuple as the key) and fill in entries as you compute
>them.

A sparse matrix would probably not work, as you can't make difference
between a coefficient that has been computed and is zero, and a not
computed coefficient.

I guess we need both; morphism implemented as matrices, and morphisms
implemented as "lazy matrices", and we should share as much as
possible between the two.

Andrew: please keep up implementing such things! Don't worrying too
much about the design; just make it as straightforward as
possible. When the infrastructure will be in place, it should be easy
to cleanup the things before getting them into Sage.


Btw: Hom(F, G, C) models the set of all morphisms from F to G in the
category C. By default, C is the meet of the categories of F and G. Of
course, for most categories one can't do much with that. But there
certainly are categories where we can or could and would want to:

 - Hom(V, W, VectorSpaces)
 - Hom(V, W, A-modules)
 - Hom(F, G, Groups)

Cheers,
Nicolas
--
Nicolas M. Thiéry "Isil" 
http://Nicolas.Thiery.name/

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To post to this group, send email to sage-combinat-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.



[sage-combinat-devel] Re: Constructing homs

2012-12-05 Thread Travis Scrimshaw
Hey Andrew,
   It sounds more like you want to use a spare matrix (or even just a 
dictionary with a tuple as the key) and fill in entries as you compute them.

Best,
Travis


On Wednesday, December 5, 2012 3:29:27 AM UTC-8, Andrew Mathas wrote:
>
>
> huh? 
>> sage: m=matrix([[1,2],[3,4]]) 
>> sage: m 
>> [1 2] 
>> [3 4] 
>> sage: m[1,1]=100 
>> sage: m 
>> [  1   2] 
>> [  3 100] 
>> sage: 
>>
>
> Yes, you're right. My issue with matrices is that I can't write something 
> like:
>
> sage: matrix([[1,0],[None,0]])
>
> (Unless, of course, you want to correct me again:)
>
> A.
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sage-combinat-devel/-/bGhR-svWEI8J.
To post to this group, send email to sage-combinat-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.



[sage-combinat-devel] Re: Constructing homs

2012-12-05 Thread Andrew Mathas


> huh? 
> sage: m=matrix([[1,2],[3,4]]) 
> sage: m 
> [1 2] 
> [3 4] 
> sage: m[1,1]=100 
> sage: m 
> [  1   2] 
> [  3 100] 
> sage: 
>

Yes, you're right. My issue with matrices is that I can't write something 
like:

sage: matrix([[1,0],[None,0]])

(Unless, of course, you want to correct me again:)

A.
 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sage-combinat-devel/-/6Qm7YHqf5g8J.
To post to this group, send email to sage-combinat-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.



[sage-combinat-devel] Re: Constructing homs

2012-12-05 Thread Dima Pasechnik
On 2012-12-05, Andrew Mathas  wrote:
> --=_Part_1499_29645117.1354701799117
> Content-Type: text/plain; charset=ISO-8859-1
>
>
>
>> - Matrices with rows and columns indexed by whatever objects 
>>
>  
> I have a (very) rough prototype for this as it is one of the things that I 
> need. Rather than matrices, however, I am thinking of making the underlying 
> object just an array/table as for my applications the full matrix is often 
> not known and more entries are added as the calculations proceed whereas 
> matrices are immutable. 
huh?
sage: m=matrix([[1,2],[3,4]])
sage: m
[1 2]
[3 4]
sage: m[1,1]=100
sage: m
[  1   2]
[  3 100]
sage: 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To post to this group, send email to sage-combinat-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.