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

Revision 87eacb93177c9d41edb525bb71ae03ae45f18d14 authored by Drew Johnson on 20 March 2020, 16:48:33 UTC, committed by Drew Johnson on 20 March 2020, 16:48:33 UTC
added a ps and ps_ member to strataalgebra
and updated the doc string
1 parent 19376f1
  • Files
  • Changes
  • 97085ea
  • /
  • topintersections
  • /
  • checkin.py
Raw File Download
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.

  • revision
  • directory
  • content
revision badge
swh:1:rev:87eacb93177c9d41edb525bb71ae03ae45f18d14
directory badge Iframe embedding
swh:1:dir:370d394cc10295b17330f0bd86b2e47ea9df92ec
content badge Iframe embedding
swh:1:cnt:f62837c1b206ef406d502f2fc2538d5a2be10cbf
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.

  • revision
  • directory
  • content
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 ...
checkin.py
"""
This is very useful for debugging recursive programs.  It is not a part of the intersection theory code.
"""


level = 0
def checkin(func):    
    def checkin_func(*args):
        global level
        print "." * level + "Entering {0} with arguments {1}".format(func.__name__, args)
        level += 1
        value = func(*args)
        level -= 1
        print "." * level + "Exiting {0} with arguments {1}, returning value {2}".format(func.__name__, args, value)
        
        return value
    return checkin_func

    
    
    
    
    
class Node:
    def __init__(self, data, parent = None, func = "unknown"):
        self.children = []
        self.data =  str(data)
        self.real_data = data
        self.parent = parent
        self.value = None
        self.func = func
        self.flag = ""
        
    def add_child(self, data, func="unknown"):
        child = Node(data, self,func)
        self.children.append(child)
        return child
        
    def make_big_maple_code(self, filename):
        with open(filename, "w") as f:
            f.write("read MgnF;")
            for c in self.children:
                f.write(c.maple_code() + "\n")
                
    def maple_code(self):
        M = self.data[0][0]
        m = self.data[1]
        expon_list = []
        for l in ([M.num(d)]*expon for d, expon in m.decompose_monomial()):
            expon_list += l
        return "mgn(" + str(M.genus) + ", "+ str( expon_list )  + ");\n"
        
    def __str__(self):
        _str = repr(self) 
        for c,i in zip(self.children, range(len(self.children))):
            _str += "\n[{0}] ".format(i) + repr(c)
        return _str
        
    def inFaberNotation(self): #not done yet!
        _str = repr(self) 
        for c,i in zip(self.children, range(len(self.children))):
            _str += "\n[{0}] ".format(i) + repr(c)
        return _str
        
    def __repr__(self):
        return self.func + " " + str(self.data) + " = " + str(self.value) + " " + self.flag
        
    def __getitem__(self,i):
        return self.children[i]
        
    def mark_ancestors(self, message):
        if self.parent != None:
            self.parent.flag += ", " +  message
            self.parent.mark_ancestors(message)

        
def cireset():
    global root, current, level
    root = Node("root")
    current = root
    level = 0
cireset()

def breadth_first_tree(func):
    def bft(*args):
        global root, current, level
        #print "." * level + "Entering {0} with arguments {1}".format(func.__name__, args)
        level += 1
        current = current.add_child(args, func.__name__)
        value = func(*args)
        current.value = value
        current = current.parent        
        level -= 1
        #print "." * level + "Exiting {0} with arguments {1}, returning value {2}".format(func.__name__, args, value)
        return value
        
    return bft
        
fabers_dir = "/home/drew/Dropbox/fabers maple code/Send10/"
    
from sage.all import *
maple('currentdir("{0}")'.format(fabers_dir))
maple.eval('read "MgnLb.txt"')
print "Loaded MgnLb."

def breadth_first_tree_MgnLb(func):
    def bft(*args):
        global root, current, level
        #print "." * level + "Entering {0} with arguments {1}".format(func.__name__, args)
        level += 1
        current = current.add_child(args, func.__name__)
        
        g= args[0].space.genus
        n= args[0].space.n
        c= args[0].get_MgnLb_indexes()
        mapleans = maple("mgn({0}, {1}, {2})".format(g, n, c))
        value = func(*args)
        if mapleans != value:
            current.flag = "wrong... should be " + str(c) + " = " + str(mapleans)
            current.mark_ancestors("bad child")
        current.value = value
        current = current.parent        
        level -= 1
        #print "." * level + "Exiting {0} with arguments {1}, returning value {2}".format(func.__name__, args, value)
        return value
        
    return bft
        

        
The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

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