Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/uberparagon/mgn
22 June 2021, 16:13:34 UTC
  • Code
  • Branches (5)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/master
    • refs/tags/1.1.2
    • refs/tags/v1.0.4
    • refs/tags/v1.0.5
    • refs/tags/v1.0.9
    No releases to show
  • 97085ea
  • /
  • strataalgebra
  • /
  • tests.py
Raw File Download
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge Iframe embedding
swh:1:cnt:31d19ec7d03d2a530fef4fb0430a37a49dbeb523
origin badgedirectory badge Iframe embedding
swh:1:dir:81284197a7d7278adc1fe2d2fbd5c72cd401c538
origin badgerevision badge
swh:1:rev:87eacb93177c9d41edb525bb71ae03ae45f18d14
origin badgesnapshot badge
swh:1:snp:6e9d4128140ea9fc091a9d1ff362de9d8be50de2
Citations

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Tip revision: 87eacb93177c9d41edb525bb71ae03ae45f18d14 authored by Drew Johnson on 20 March 2020, 16:48:33 UTC
added a ps and ps_ member to strataalgebra
Tip revision: 87eacb9
tests.py
"""
The ``tests`` module tests the implementation of the product and the FZ relations by comparing them to the ``topintersections`` code.

You can change which pairs you want to check by modifying the ``g_n_pairs_to_check variable`` in the source code ``tests.py``.

::

    sage: from strataalgebra import tests as tests
    sage: tests.run() # not tested

The comment is there so that the doctests don't try to run it.
"""
from __future__ import absolute_import, print_function

from sage.all import QQ, floor, WeightedIntegerVectors, subsets
#from sage.all import *
from .strataalgebra import StrataAlgebra
from topintersections import intnum

g_n_pairs_to_check = [
(2,0),
(1,1),
(1,2),
(1,3),
(2,1),
(2,2)
]

def get_all_combis(g,n):
    dim = 3*g-3 + n
    reducible_boundaries = 0
    marks = list(range(1,n+1))
    if n != 0:
        first_mark_list = [marks.pop()]            
        for g1 in range(0, g + 1):
            for p in subsets(marks):
                r_marks = set(first_mark_list + p)
                if 3*g1 - 3 + len(r_marks) + 1 >= 0 and 3*(g-g1) - 3 + n - len(r_marks) + 1 >= 0:
                    reducible_boundaries+=1  
    
    else: #self.n == 0
        for g1 in range(1, floor(g/2.0)+1):
            reducible_boundaries+=1

    #print "computed red bound"
    indexes = list(range(1,n+dim+1)) + list(range(n+dim+g+1, n+dim+g+reducible_boundaries + 2))
    codims = [1]*n + list(range(1,dim+1)) + [1]*(reducible_boundaries +1)
    
    for w in WeightedIntegerVectors(dim,codims):
        combi = []
        #print w
        for index, wi in zip(indexes,w):
            combi += [index]*wi
        yield combi

def run():
    """
    run doc
    :return:
    """
    ok = 0
    bad = 0
    for g,n in g_n_pairs_to_check:
        print("Beginning to check g = {0}, n = {1}...".format(g,n))
        s = StrataAlgebra(QQ,g,tuple(range(1,n+1)),False)
        for c in get_all_combis(g,n):
            print(c, end=' ')
            v1 = intnum(g,n,c, confirm = False)
            v2 = s.MgnLb_int(c)
            if v1==v2:
                print(" ok.")
                ok+=1
            else:
                print()
                print(" FAILED!")
                bad+=1
                #print c
                print(v1, "vs", v2)

    print("{0} tests performed, {1} successful, {2} failed".format(ok+bad,ok,bad))

          
class doctestclass(object):
    """
    here is the doc
    """
    pass

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Contact— JavaScript license information— Web API

back to top