Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
241852 views
1
"""
2
Ambients of monoid power series and ambients of equivariant monoid power series.
3
4
AUTHOR :
5
- Martin Raum (2010 - 02 - 10) Initial version
6
"""
7
8
#===============================================================================
9
#
10
# Copyright (C) 2010 Martin Raum
11
#
12
# This program is free software; you can redistribute it and/or
13
# modify it under the terms of the GNU General Public License
14
# as published by the Free Software Foundation; either version 3
15
# of the License, or (at your option) any later version.
16
#
17
# This program is distributed in the hope that it will be useful,
18
# but WITHOUT ANY WARRANTY; without even the implied warranty of
19
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20
# General Public License for more details.
21
#
22
# You should have received a copy of the GNU General Public License
23
# along with this program; if not, see <http://www.gnu.org/licenses/>.
24
#
25
#===============================================================================
26
27
from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_element import MonoidPowerSeries, EquivariantMonoidPowerSeries
28
from sage.rings.all import Integer
29
from sage.structure.element import Element
30
31
#===============================================================================
32
# MonoidPowerSeriesAmbient_abstract
33
#===============================================================================
34
35
class MonoidPowerSeriesAmbient_abstract :
36
r"""
37
Given some `K` module or algebra `A` and a monoid `S` filtered over
38
a net `\Lambda` construct a module or ring of monoid power series.
39
40
Set `R = B[S]`. Then the projective limit of `R / R_\lambda` for
41
`\lambda \in \Lambda \rightarrow \infty` considered as a
42
`K` module or algebra is implemented by this class.
43
"""
44
45
def __init__(self, A, S) :
46
r"""
47
INPUT:
48
- `A` -- A ring or module.
49
- `S` -- A monoid as implemented in :class:~`from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids.NNMonoid`.
50
51
TESTS::
52
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import *
53
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_ambient import MonoidPowerSeriesAmbient_abstract
54
sage: mps = MonoidPowerSeriesAmbient_abstract(QQ, NNMonoid(False))
55
"""
56
self.__monoid = S
57
58
self._set_multiply_function()
59
self.__coefficient_domain = A
60
61
if not hasattr(self, "_element_class") :
62
self._element_class = MonoidPowerSeries
63
64
def is_exact(self) :
65
r"""
66
TESTS::
67
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import *
68
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_ring import MonoidPowerSeriesRing
69
sage: mps = MonoidPowerSeriesRing(QQ, NNMonoid(False))
70
sage: mps.is_exact()
71
False
72
"""
73
return False
74
75
def monoid(self) :
76
r"""
77
Return the index monoid of ``self``.
78
79
OUTPUT:
80
A monoid.
81
82
TESTS::
83
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import *
84
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_ambient import MonoidPowerSeriesAmbient_abstract
85
sage: mps = MonoidPowerSeriesAmbient_abstract(QQ, NNMonoid(False))
86
sage: mps.monoid()
87
NN
88
"""
89
return self.__monoid
90
91
def coefficient_domain(self) :
92
r"""
93
The coefficient domain of ``self``.
94
95
OUTPUT:
96
A ring or module.
97
98
TESTS::
99
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import *
100
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_ambient import MonoidPowerSeriesAmbient_abstract
101
sage: mps = MonoidPowerSeriesAmbient_abstract(QQ, NNMonoid(False))
102
sage: mps.coefficient_domain()
103
Rational Field
104
sage: mps = MonoidPowerSeriesAmbient_abstract(FreeModule(ZZ, 3), NNMonoid(False))
105
sage: mps.coefficient_domain()
106
Ambient free module of rank 3 over the principal ideal domain Integer Ring
107
"""
108
return self.__coefficient_domain
109
110
def _multiply_function(self) :
111
r"""
112
Return the currect multiply function.
113
114
The standard implementation of elements asks its parent to
115
provide a multiplication function, which has the following signature:
116
117
multiply function INPUT:
118
- `k` -- Element of the index monoid; An index.
119
- ``lcoeffs`` -- A dictionary; Coefficient dictionary of the left factor.
120
- ``rcoeffs`` -- A dictionary; Coefficient dictionary of the right factor.
121
- ``null`` -- An element of a ring or module; An initialized zero object
122
of the coefficient domain.
123
multiply function OUTPUT:
124
A ring element. The `k`-th coefficent of the product ``left * right``.
125
126
TESTS::
127
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import *
128
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_ring import MonoidPowerSeriesRing
129
sage: mps = MonoidPowerSeriesRing(QQ, NNMonoid(False))
130
sage: h = mps._multiply_function()
131
"""
132
return self.__multiply_function
133
134
def _set_multiply_function(self, f = None) :
135
r"""
136
Set the multiply function that is decribed in :meth:~`._multiply_function`.
137
If `f` is ``None`` an iteration over the decompositions in the
138
monoid is used.
139
140
INPUT:
141
- `f` -- A function or ``None`` (default: ``None``).
142
143
OUTPUT:
144
``None``.
145
146
TESTS::
147
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import *
148
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_ring import MonoidPowerSeriesRing
149
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_element import MonoidPowerSeries
150
sage: mps = MonoidPowerSeriesRing(QQ, NNMonoid(False))
151
sage: e = MonoidPowerSeries( mps, { 4 : 1, 5 : 2}, mps.monoid().filter_all() )
152
sage: h = e * e # indirect doctest
153
sage: h = lambda : None
154
sage: mps._set_multiply_function(h)
155
sage: h == mps._multiply_function()
156
True
157
"""
158
if not f is None :
159
self.__multiply_function = f
160
return
161
162
def mul(s, lcoeffs, rcoeffs, res) :
163
for s1, s2 in self.__monoid.decompositions(s) :
164
try :
165
v1 = lcoeffs[s1]
166
v2 = rcoeffs[s2]
167
except KeyError :
168
continue
169
170
res += v1 * v2
171
172
return res
173
#! def mul
174
175
self.__multiply_function = mul
176
177
def _coerce_map_from_(self, other) :
178
r"""
179
TESTS::
180
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import *
181
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_ring import MonoidPowerSeriesRing
182
sage: mps = MonoidPowerSeriesRing(QQ, NNMonoid(False))
183
sage: mps.has_coerce_map_from( MonoidPowerSeriesRing(ZZ, NNMonoid(False)) ) # indirect doctest
184
True
185
"""
186
if isinstance(other, MonoidPowerSeriesAmbient_abstract) :
187
if self.monoid() == other.monoid() and \
188
self.coefficient_domain().has_coerce_map_from(other.coefficient_domain()) :
189
from sage.structure.coerce_maps import CallableConvertMap
190
return CallableConvertMap(other, self, self._element_constructor_)
191
192
def _element_constructor_(self, x) :
193
r"""
194
TESTS::
195
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import *
196
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_ring import MonoidPowerSeriesRing
197
sage: mps = MonoidPowerSeriesRing(QQ, NNMonoid(False))
198
sage: h = mps(dict()) # indirect doctest
199
sage: h = mps(h) # indirect doctest
200
"""
201
if isinstance(x, dict) :
202
return self._element_class(self, x, self.monoid().filter_all())
203
if isinstance(x, Element) :
204
P = x.parent()
205
if P is self :
206
return x
207
elif isinstance(P, MonoidPowerSeriesAmbient_abstract) :
208
if self.coefficient_domain() is P.coefficient_domain() :
209
return self._element_class( self,
210
x.coefficients(), x.precision() )
211
else :
212
coefficient_domain = self.coefficient_domain()
213
return self._element_class( self,
214
dict( (k,coefficient_domain(c)) for (k,c) in x.coefficients().iteritems() ),
215
x.precision() )
216
217
raise (TypeError, "Cannot construct an element of %s" % (x))
218
219
def __cmp__(self, other) :
220
r"""
221
TESTS::
222
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import *
223
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_ambient import MonoidPowerSeriesAmbient_abstract
224
sage: mps = MonoidPowerSeriesAmbient_abstract(QQ, NNMonoid(False))
225
sage: mps2 = MonoidPowerSeriesAmbient_abstract(ZZ, NNMonoid(False))
226
sage: mps == MonoidPowerSeriesAmbient_abstract(QQ, NNMonoid(False))
227
True
228
sage: mps == mps2
229
False
230
"""
231
c = cmp(type(self), type(other))
232
233
if c == 0 :
234
c = cmp(self.coefficient_domain(), other.coefficient_domain())
235
if c == 0 :
236
c = cmp(self.monoid(), other.monoid())
237
238
return c
239
240
###############################################################################
241
###############################################################################
242
###############################################################################
243
244
#===============================================================================
245
# EquivariantMonoidPowerSeriesAmbient_abstract
246
#===============================================================================
247
248
class EquivariantMonoidPowerSeriesAmbient_abstract :
249
r"""
250
Given some ring or module `A`, a monoid `S` filtered over some originated
251
net `\Lambda` such that all induced submonoids are finite, a group `G`, a
252
semigroup `C` with a map `c \rightarrow \mathrm{Hom}(G, Aut_K(A))`, a
253
homomorphism `\phi : G -> Aut(S)` and a homomorphism `\eta : G -> C`, where
254
`K` is the base ring of `A`.
255
256
Suppose for every `c, c'` in `C`, and `g` in `G`, and `a, a'` in `A` we have
257
`(c c') (g) (a a') = c(g)(a) c'(g)(a')`.
258
Set `R = B[C][S]`. Then the projective limit of
259
`R / R_\lambda` for `\lambda \in \Lambda \rightarrow \infinity` is a
260
`K`-algebra or -module.
261
"""
262
263
def __init__(self, O, C, R) :
264
r"""
265
INPUT:
266
- `O` -- A monoid with an action of a group; As implemented in
267
:class:~`fourier_expansion_framework.monoidpowerseries.NNMonoid`.
268
- `C` -- A monoid of characters; As implemented in ::class:~`fourier_expansion_framework.monoidpowerseries.CharacterMonoid_class`.
269
- `R` -- A representation on an algebra or module; As implemented
270
in :class:~`fourier_expansion_framework.monoidpowerseries.TrivialRepresentation`.
271
272
EXAMPLES::
273
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import *
274
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_ring import EquivariantMonoidPowerSeriesRing
275
sage: emps = EquivariantMonoidPowerSeriesRing(NNMonoid(True), TrivialCharacterMonoid("1", QQ), TrivialRepresentation("1", QQ)) # indirect doctest
276
"""
277
self.__action = O
278
self.__characters = C
279
self.__representation = R
280
281
self.__coefficient_domain = R.codomain()
282
self.__monoid = O.monoid()
283
284
self._set_reduction_function()
285
self._set_character_eval_function()
286
self._set_apply_function()
287
self._set_multiply_function()
288
289
if not hasattr(self, "_element_class") :
290
self._element_class = EquivariantMonoidPowerSeries
291
292
def is_exact(self) :
293
r"""
294
TESTS::
295
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import *
296
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_ring import EquivariantMonoidPowerSeriesRing
297
sage: emps = EquivariantMonoidPowerSeriesRing(NNMonoid(True), TrivialCharacterMonoid("1", QQ), TrivialRepresentation("1", QQ))
298
sage: emps.is_exact()
299
False
300
"""
301
return False
302
303
def coefficient_domain(self) :
304
r"""
305
The domain of coefficients.
306
307
OUTPUT:
308
Either a ring or a module.
309
310
EXAMPLES::
311
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import *
312
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_ring import EquivariantMonoidPowerSeriesRing
313
sage: emps = EquivariantMonoidPowerSeriesRing(NNMonoid(True), TrivialCharacterMonoid("1", QQ), TrivialRepresentation("1", QQ))
314
sage: emps.coefficient_domain() == QQ
315
True
316
"""
317
return self.__coefficient_domain
318
319
def group(self) :
320
r"""
321
The group acting on the index monoid.
322
323
OUTPUT:
324
Of arbitrary type.
325
326
NOTE:
327
The framework might change at a later time such that this
328
function returns a group.
329
330
EXAMPLES::
331
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import *
332
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_ring import EquivariantMonoidPowerSeriesRing
333
sage: emps = EquivariantMonoidPowerSeriesRing(NNMonoid(True), TrivialCharacterMonoid("1", QQ), TrivialRepresentation("1", QQ))
334
sage: emps.group()
335
'1'
336
"""
337
return self.__action.group()
338
339
def monoid(self) :
340
r"""
341
The index monoid.
342
343
OUTPUT:
344
A monoid as implemented in :class:~`fourier_expansion_framework.monoidpowerseries.NNMonoid`.
345
346
EXAMPLES::
347
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import *
348
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_ring import EquivariantMonoidPowerSeriesRing
349
sage: emps = EquivariantMonoidPowerSeriesRing(NNMonoid(True), TrivialCharacterMonoid("1", QQ), TrivialRepresentation("1", QQ))
350
sage: emps.monoid()
351
NN
352
"""
353
return self.__action.monoid()
354
355
def action(self) :
356
r"""
357
The index monoid with the action of a group.
358
359
OUTPUT:
360
A monoid with action as implemented in :class:~`fourier_expansion_framework.monoidpowerseries.NNMonoid`.
361
362
EXAMPLES::
363
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import *
364
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_ring import EquivariantMonoidPowerSeriesRing
365
sage: emps = EquivariantMonoidPowerSeriesRing(NNMonoid(True), TrivialCharacterMonoid("1", QQ), TrivialRepresentation("1", QQ))
366
sage: emps.action()
367
NN with action
368
"""
369
return self.__action
370
371
def characters(self) :
372
r"""
373
The monoid of characters associated to the monoid index' group.
374
375
OUTPUT:
376
A monoid as implemented in :class:~`fourier_expansion_framework.monoidpowerseries.CharacterMonoid_class`.
377
378
EXAMPLES::
379
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import *
380
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_ring import EquivariantMonoidPowerSeriesRing
381
sage: emps = EquivariantMonoidPowerSeriesRing(NNMonoid(True), TrivialCharacterMonoid("1", QQ), TrivialRepresentation("1", QQ))
382
sage: emps.characters()
383
Character monoid over Trivial monoid
384
"""
385
return self.__characters
386
387
def representation(self) :
388
r"""
389
The representation on the coefficient domain.
390
391
OUTPUT:
392
A representation as implemented in :class:~`fourier_expansion_framework.monoidpowerseries.TrivialRepresentation`.
393
394
EXAMPLES::
395
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import *
396
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_ring import EquivariantMonoidPowerSeriesRing
397
sage: emps = EquivariantMonoidPowerSeriesRing(NNMonoid(True), TrivialCharacterMonoid("1", QQ), TrivialRepresentation("1", QQ))
398
sage: emps.representation()
399
Trivial representation of 1 on Rational Field
400
"""
401
return self.__representation
402
403
def _reduction_function(self) :
404
r"""
405
The reduction function accepts an index `s`. It returns the pair
406
reduction `(rs = g^-1 s, g)` of `s` with a group element `g`.
407
408
OUTPUT:
409
A function.
410
411
TESTS::
412
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import *
413
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_ring import EquivariantMonoidPowerSeriesRing
414
sage: emps = EquivariantMonoidPowerSeriesRing(NNMonoid(True), TrivialCharacterMonoid("1", QQ), TrivialRepresentation("1", QQ))
415
sage: red_function = emps._reduction_function()
416
sage: red_function(2)
417
(2, 1)
418
"""
419
return self.__reduction_function
420
421
def _set_reduction_function(self, f = None) :
422
r"""
423
Set the reduction function, explained in :class:~`._reduction_function`.
424
If `f` is ``None`` the reduction function of the action is used.
425
426
INPUT:
427
- `f` -- A function or ``None`` (default: ``None``).
428
429
TESTS::
430
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import *
431
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_ring import EquivariantMonoidPowerSeriesRing
432
sage: emps = EquivariantMonoidPowerSeriesRing(NNMonoid(True), TrivialCharacterMonoid("1", QQ), TrivialRepresentation("1", QQ))
433
sage: h = lambda : None
434
sage: emps._set_reduction_function(h)
435
sage: h == emps._reduction_function()
436
True
437
sage: emps._set_reduction_function() ## This is important since emps is globally unique
438
"""
439
if not f is None :
440
self.__reduction_function = f
441
return
442
443
self.__reduction_function = self.__action._reduction_function()
444
445
def _character_eval_function(self) :
446
r"""
447
The character evaluation function. It accepts a character `c` and
448
a group element `g` and returns `c(g)`.
449
450
OUTPUT:
451
A function.
452
453
TESTS::
454
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import *
455
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_ring import EquivariantMonoidPowerSeriesRing
456
sage: emps = EquivariantMonoidPowerSeriesRing(NNMonoid(True), TrivialCharacterMonoid("1", QQ), TrivialRepresentation("1", QQ))
457
sage: eval_func = emps._character_eval_function()
458
sage: eval_func(emps.characters().one_element(), 1)
459
1
460
"""
461
return self.__character_eval_function
462
463
def _set_character_eval_function(self, f = None) :
464
r"""
465
Set the character evaluation function. If `f` is ``None``, the
466
implementation of the character monoid is used.
467
468
INPUT:
469
- `f` -- A function or ``None`` (default: ``None``).
470
471
TESTS::
472
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import *
473
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_ring import EquivariantMonoidPowerSeriesRing
474
sage: emps = EquivariantMonoidPowerSeriesRing(NNMonoid(True), TrivialCharacterMonoid("1", QQ), TrivialRepresentation("1", QQ))
475
sage: h = lambda c,g: 1
476
sage: emps._set_character_eval_function(h)
477
sage: h == emps._character_eval_function()
478
True
479
sage: emps._set_character_eval_function() ## This is important since emps is globally unique
480
"""
481
if not f is None :
482
self.__character_eval_function = f
483
return
484
485
self.__character_eval_function = self.__characters._eval_function()
486
487
def _apply_function(self) :
488
r"""
489
The apply function. It applies a group element `g` to an element `v`
490
of the coefficient domain, the base space of the representation.
491
492
OUTPUT:
493
A function.
494
495
TESTS::
496
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import *
497
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_ring import EquivariantMonoidPowerSeriesRing
498
sage: emps = EquivariantMonoidPowerSeriesRing(NNMonoid(True), TrivialCharacterMonoid("1", QQ), TrivialRepresentation("1", QQ))
499
sage: app_func = emps._apply_function()
500
sage: app_func(1, 1/2)
501
1/2
502
"""
503
return self.__apply_function
504
505
def _set_apply_function(self, f = None) :
506
r"""
507
Set the apply function. If `f` is ``None``, the implementation of
508
the representation is used.
509
510
INPUT:
511
- `f` -- A function or ``None`` (default: ``None``).
512
513
TESTS::
514
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import *
515
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_ring import EquivariantMonoidPowerSeriesRing
516
sage: emps = EquivariantMonoidPowerSeriesRing(NNMonoid(True), TrivialCharacterMonoid("1", QQ), TrivialRepresentation("1", QQ))
517
sage: h = lambda : None
518
sage: emps._set_apply_function(h)
519
sage: h == emps._apply_function()
520
True
521
sage: emps._set_apply_function() ## This is important since emps is globally unique
522
"""
523
if not f is None :
524
self.__apply_function = f
525
return
526
527
self.__apply_function = self.__representation._apply_function()
528
529
def _multiply_function(self) :
530
r"""
531
The standard implementation of elements of this ring will ask its
532
parent to provide multplication function, which has the
533
following signature:
534
535
multiply function INPUT :
536
- `k` -- An index.
537
- ``lcoeffs`` -- A dictionary; The coefficient dictionary of the left factor.
538
- ``rcoeffs`` -- A dictionary; The coefficient dictionary of the right factor.
539
- ``lch`` -- A character; The character of the left factor.
540
- ``rch`` -- A character; The character of the right factor.
541
- ``null`` -- A ring or module element; TA initialized zero object of
542
the coefficient domain.
543
multiply function OUTPUT :
544
A ring or module element. The `k`-th coefficent of the product
545
``left * right``, where the power series transform with character
546
``lch`` and ``rch`` respectively under the action of the power series'
547
symmetry group.
548
549
TESTS::
550
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import *
551
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_ring import EquivariantMonoidPowerSeriesRing
552
sage: emps = EquivariantMonoidPowerSeriesRing(NNMonoid(True), TrivialCharacterMonoid("1", QQ), TrivialRepresentation("1", QQ))
553
sage: h = emps._multiply_function()
554
sage: e = emps( {emps.characters().one_element() : {4 : 3, 5 : 3} } )
555
sage: (e * e).coefficients() # indirect doctest
556
{8: 9, 9: 18, 10: 9}
557
"""
558
return self.__multiply_function
559
560
def _set_multiply_function(self, f = None) :
561
r"""
562
Set the multiply function. If `f` is ``None`` an iteration over the
563
decompositions in the monoid is used.
564
565
INPUT:
566
- `f` -- A function or ``None`` (default: ``None``).
567
568
TESTS::
569
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import *
570
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_ring import EquivariantMonoidPowerSeriesRing
571
sage: emps = EquivariantMonoidPowerSeriesRing(NNMonoid(True), TrivialCharacterMonoid("1", QQ), TrivialRepresentation("1", QQ))
572
sage: h = lambda : None
573
sage: emps._set_multiply_function(h)
574
sage: h == emps._multiply_function()
575
True
576
"""
577
if not f is None :
578
self.__multiply_function = f
579
return
580
581
def mul(s, lcoeffs, rcoeffs, cl, cr, res) :
582
reduction = self._reduction_function()
583
apply = self._apply_function()
584
character_ev = self._character_eval_function()
585
586
rs, g = reduction(s)
587
588
for s1, s2 in self.__monoid.decompositions(rs) :
589
rs1, g1 = reduction(s1)
590
rs2, g2 = reduction(s2)
591
592
try :
593
v1 = lcoeffs[rs1]
594
v2 = rcoeffs[rs2]
595
except KeyError :
596
continue
597
v1 = apply(g1, v1)
598
v2 = apply(g2, v2)
599
600
res += (character_ev(g1, cl) * character_ev(g2, cr)) * v1 * v2
601
602
return character_ev(g, cl*cr) * apply(g, res)
603
#! def mul
604
605
self.__multiply_function = mul
606
607
def _coerce_map_from_(self, other) :
608
r"""
609
TODO:
610
This is a stub. The dream is that representations know about
611
compatible coercions and so would actions and characters. Then
612
every equivariant monoid power series ring would be a functorial
613
construction in all three parameters (The functor would then be
614
applied to a representation within a universe of representations).
615
616
TESTS::
617
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import *
618
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_ring import EquivariantMonoidPowerSeriesRing
619
sage: emps = EquivariantMonoidPowerSeriesRing(NNMonoid(True), TrivialCharacterMonoid("1", QQ), TrivialRepresentation("1", QQ))
620
sage: emps.has_coerce_map_from( EquivariantMonoidPowerSeriesRing(NNMonoid(True), TrivialCharacterMonoid("1", QQ), TrivialRepresentation("1", ZZ)) ) # indirect doctest
621
True
622
"""
623
if isinstance(other, EquivariantMonoidPowerSeriesAmbient_abstract) :
624
if self.action() == other.action() and \
625
self.characters() == other.characters() :
626
if self.representation().extends(other.representation()) :
627
from sage.structure.coerce_maps import CallableConvertMap
628
return CallableConvertMap(other, self, self._element_constructor_)
629
630
def _element_constructor_(self, x) :
631
r"""
632
TESTS::
633
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import *
634
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_ring import MonoidPowerSeriesRing, EquivariantMonoidPowerSeriesRing
635
sage: emps = EquivariantMonoidPowerSeriesRing(NNMonoid(True), TrivialCharacterMonoid("1", QQ), TrivialRepresentation("1", QQ))
636
sage: mps = MonoidPowerSeriesRing(QQ, NNMonoid(False))
637
sage: h = emps(dict()) # indirect doctest
638
sage: h = emps(1)
639
sage: h = emps(h)
640
sage: h = emps(mps(1))
641
"""
642
if isinstance(x, Element) :
643
P = x.parent()
644
if P is self :
645
return x
646
elif isinstance(P, EquivariantMonoidPowerSeriesAmbient_abstract) :
647
if self.coefficient_domain() is P.coefficient_domain() :
648
return self._element_class( self,
649
x.coefficients(True), x.precision() )
650
else :
651
coefficient_domain = self.coefficient_domain()
652
653
return self._element_class( self,
654
dict( (ch, dict( (k,coefficient_domain(c)) for (k,c) in coeffs.iteritems()) )
655
for (ch, coeffs) in x.coefficients(True).iteritems() ),
656
x.precision() )
657
658
elif isinstance(P, MonoidPowerSeriesAmbient_abstract) :
659
if self.coefficient_domain() is P.coefficient_domain() :
660
return self._element_class(
661
self, dict([(self.__characters.one_element(),
662
x.coefficients())]),
663
self.action().filter(x.precision()),
664
symmetrise = True )
665
else :
666
return self._element_class(
667
self, dict([(self.__characters.one_element(),
668
dict( (k,coefficient_domain(c)) for (k,c) in x.coefficients().iteritems()) )]),
669
self.action().filter(x.precision()),
670
symmetrise = True )
671
elif isinstance(x, dict) :
672
if len(x) != 0 :
673
try :
674
if x.keys()[0].parent() is self.__characters :
675
return self._element_class( self,
676
x, self.action().filter_all() )
677
except AttributeError :
678
pass
679
680
return self._element_class( self,
681
dict([(self.__characters.one_element(), x)]),
682
self.action().filter_all() )
683
684
raise TypeError, "can't convert %s into %s" % (x, self)
685
686
def __cmp__(self, other) :
687
r"""
688
TESTS::
689
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import *
690
sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_ambient import EquivariantMonoidPowerSeriesAmbient_abstract
691
sage: emps = EquivariantMonoidPowerSeriesAmbient_abstract(NNMonoid(True), TrivialCharacterMonoid("1", QQ), TrivialRepresentation("1", QQ))
692
sage: emps == EquivariantMonoidPowerSeriesAmbient_abstract(NNMonoid(True), TrivialCharacterMonoid("1", QQ), TrivialRepresentation("1", QQ))
693
True
694
sage: emps2 = EquivariantMonoidPowerSeriesAmbient_abstract(NNMonoid(True), TrivialCharacterMonoid("1", ZZ), TrivialRepresentation("1", ZZ))
695
sage: emps == emps2
696
False
697
"""
698
c = cmp(type(self), type(other))
699
700
if c == 0 :
701
c = cmp(self.action(), other.action())
702
if c == 0 :
703
c = cmp(self.representation(), other.representation())
704
if c == 0 :
705
c = cmp(self.characters(), other.characters())
706
707
return c
708
709