def _test_suspension(self, tester=None, **options):
            from sage.misc.sage_unittest import TestSuite
            from sage.misc.lazy_format import LazyFormat

            is_sub_testsuite = tester is not None
            tester = self._tester(tester=tester, **options)
            myatt = "_suspension_tested"
            if not hasattr(self, myatt):
                s = self.an_element()
                X = suspension(self, t=5, s=3)
                tester.assertTrue(
                    X is suspension(self, t=5, s=3),
                    LazyFormat(
                        "suspension(X,..) is not suspension(X,..) for X=%s") %
                    (X, ),
                )
                setattr(X, myatt, "yo")
                try:
                    tester.info("\n  Running the test suite of a suspension")
                    TestSuite(X).run(
                        verbose=tester._verbose,
                        prefix=tester._prefix + "  ",
                        raise_on_failure=is_sub_testsuite,
                    )
                    tester.info(tester._prefix + " ", newline=False)
                    x = s.suspend(t=5, s=3)
                    x3 = s.suspend(t=5, s=3)
                    x2 = self.suspend_element(s, t=5, s=3)
                    tester.assertEqual(
                        x,
                        x3,
                        LazyFormat(
                            "x.suspend(...) != x.suspend(...):\n   A=%s\n   B=%s"
                        ) % (
                            x,
                            x3,
                        ),
                    )
                    tester.assertEqual(
                        x,
                        x2,
                        LazyFormat(
                            "x.suspend(...) != parent.suspend_element(x,...):\n   A=%s\n   B=%s"
                        ) % (
                            x,
                            x2,
                        ),
                    )
                    tester.assertTrue(
                        x.parent() == X,
                        LazyFormat("suspended element %s not in suspension %s")
                        % (
                            x,
                            X,
                        ),
                    )
                finally:
                    delattr(X, myatt)
            def SuspendedObjectsFactory(self, *args, **kwopts):
                """
                suspension of morphisms.

                TESTS::

                   sage: from yacop.categories.functors import suspension
                   sage: from yacop.modules.all import BZp
                   sage: M = BZp(3)
                   sage: X = cartesian_product((M,M))
                   sage: f = X.cartesian_projection(0)
                   sage: sf = suspension(f,t=5)
                   sage: sf.domain() is suspension(f.domain(),t=5)
                   True
                   sage: sf.codomain() is suspension(f.codomain(),t=5)
                   True
                   sage: x = X.an_element()
                   sage: sf(x.suspend(t=5)) == f(x).suspend(t=5)
                   True

                """
                M, N = self.domain(), self.codomain()
                SM, SN = [suspension(x, **kwopts) for x in (M, N)]
                lam = lambda i: self(M.monomial(i)).suspend(**kwopts)
                res = SM.module_morphism(codomain=SN, on_basis=lam)
                res.rename("suspension of %s" % self)
                return res
Beispiel #3
0
        def suspend_element(self, elem, **kwargs):
            from copy import deepcopy

            N = suspension(self, **kwargs)
            x = deepcopy(elem)
            x._set_parent(N)
            return x
            def SuspendedObjectsFactory(module, *args, **kwopts):
                from sage.categories.tensor import tensor

                l = len(module._sets)
                last = module._sets[l - 1]
                newsets = list(module._sets[:l - 1]) + [
                    suspension(last, *args, **kwopts),
                ]
                return tensor(tuple(newsets))
 def suspend_element(self, m, **options):
     susp = suspension(self, **options)
     smds = []
     for i in range(0, len(self._sets)):
         Mi = self._sets[i]
         mi = self.cartesian_projection(i)(m)
         mis = Mi.suspend_element(mi, **options)
         # hack: we might have nonidentical parents here: mis.parent() != susp._sets[i]
         mis._set_parent(susp._sets[i])
         smds.append(susp.summand_embedding(i)(mis))
     return susp.sum(smds)
Beispiel #6
0
 def __classcall_private__(cls, other, **kwargs):
     reg = region(**kwargs)
     if reg.is_full():
         return other
     shft = other._off
     reg = reg + shft.negative()
     return suspension(
         truncation(other._other, **(reg.as_dict())),
         t=shft.tmin,
         e=shft.emin,
         s=shft.smin,
     )
Beispiel #7
0
 def basis(self, reg=None):
     if reg is None:
         reg = region()
     b = self._other.basis(reg + self._neg)
     if b.cardinality() == 0:
         return FiniteEnumeratedSet(())
     x = next(iter(b))
     dom = suspension(x.parent(), **self._kwargs)
     mapfunc = lambda x: x.suspend(**self._kwargs)
     unmapfunc = lambda x: x.suspend(
         t=self._neg.t, e=self._neg.e, s=self._neg.s)
     return SetOfElements(dom, b, b.cardinality(), mapfunc, unmapfunc)
Beispiel #8
0
    def SuspendedObjectsFactory(module, *args, **kwopts):
        """

        TESTS::

            sage: from yacop import *
            sage: from yacop.modules.classifying_spaces import BZp
            sage: A=SteenrodAlgebra(7)
            sage: suspension(A.Ext(BZp(7)),t=3) is A.Ext(suspension(BZp(7),t=3))
            True
        """
        return SmashResolutionHomology(suspension(module._res, *args,
                                                  **kwopts))
Beispiel #9
0
 def _act_on_(self, othr, self_is_left):
     try:
         dct = self.suspension_args()
         if not self_is_left or (self[0] & 1) == 0:
             return othr.suspend(**dct)
         ans = []
         for (deg, elem) in othr.homogeneous_decomposition().items():
             e = elem.suspend(**dct)
             tmin, tmax = deg.trange
             if tmin & 1:
                 ans.append(-e)
             else:
                 ans.append(e)
         return sum(ans)
     except:
         pass
     if othr in YacopGradedObjects():
         return suspension(othr, **self.suspension_args())
     raise ValueError("do not know how to suspend %s" % othr)
Beispiel #10
0
    def SuspendedObjectsFactory(module, *args, **kwopts):
        """

        TESTS::

            sage: from yacop import *
            sage: from yacop.resolutions.smashres import SmashResolution
            sage: from yacop.resolutions.minres import MinimalResolution
            sage: from yacop.modules.classifying_spaces import BZp
            sage: A=SteenrodAlgebra(3,profile=((1,),(2,2)))
            sage: D=BZp(3)
            sage: C=MinimalResolution(A,memory=True)
            sage: S=SmashResolution(D,C)
            sage: S.category()
            Category of tensor products of yacop left modules over sub-Hopf algebra of mod 3 Steenrod algebra, milnor basis, profile function ([1], [2, 2])
            sage: X=suspension(S,t=4)
            sage: X is SmashResolution(suspension(D,t=4),C)
            True
            sage: X.category()
            Category of tensor products of yacop left modules over sub-Hopf algebra of mod 3 Steenrod algebra, milnor basis, profile function ([1], [2, 2])
        """
        return SmashResolution(suspension(module._sets[0], *args, **kwopts),
                               module._sets[1])
            def SuspendedObjectsFactory(module, *args, **kwopts):
                from sage.categories.cartesian_product import cartesian_product

                return cartesian_product(
                    [suspension(mod, *args, **kwopts) for mod in module._sets])