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/koffie/mdmagma
22 August 2025, 12:46:07 UTC
  • Code
  • Branches (5)
  • Releases (0)
  • Visits
Revision 65a8ca6dd8d54862cd20257523e0054fe908c737 authored by Maarten Derickx on 23 August 2024, 15:45:41 UTC, committed by Maarten Derickx on 23 August 2024, 15:45:41 UTC
Oneliner for strange characters in parallel
1 parent 3428603
  • Files
  • Changes
    • Branches
    • Releases
    • HEAD
    • refs/heads/master
    • refs/heads/patch-1
    • refs/tags/v0.1.0
    • refs/tags/v0.2.0
    • refs/tags/v0.2.1
    • 65a8ca6dd8d54862cd20257523e0054fe908c737
    No releases to show
  • 8229e21
  • /
  • strange_characters.m
Raw File Download Save again
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 ...

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
  • snapshot
origin badgerevision badge
swh:1:rev:65a8ca6dd8d54862cd20257523e0054fe908c737
origin badgedirectory badge
swh:1:dir:8229e21d067d89ae6bd6d4176d32ecde447566c8
origin badgecontent badge
swh:1:cnt:bd95b897cdd9ef9124d09ec4a646b34f6bda9bbf
origin badgesnapshot badge
swh:1:snp:69a0fcb477f0fe8dbd9256da2f6292c8d8cf7556

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
  • 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: 65a8ca6dd8d54862cd20257523e0054fe908c737 authored by Maarten Derickx on 23 August 2024, 15:45:41 UTC
Oneliner for strange characters in parallel
Tip revision: 65a8ca6
strange_characters.m
function NextPrimeInArithmeticProgression(p, a, b);
// the smallest prime q > p such that q mod a = b mod a
  assert GCD(a,b) eq 1;
  b := b mod a;
  q := p;
  repeat q := NextPrime(q); until q mod a eq b;
  return q;
end function;

function UnitExponent(N)
// the exponent of the group (Z/NZ)^*
  return Exponent(UnitGroup(Integers(N)));
end function;

function SuitableRootOfUnity(N : lowerbound := 0)
//
  r := UnitExponent(N);
  if lowerbound eq 0 then
    lowerbound := r;
  end if;
  p := NextPrimeInArithmeticProgression(lowerbound, r, 1);
  zeta := RootOfUnity(r, GF(p));
  return zeta, r;
end function;


function NextSuitableRootOfUnity(zeta, r)
//
  p := Characteristic(Parent(zeta));
  p := NextPrimeInArithmeticProgression(p, r, 1);
  zeta := RootOfUnity(r, GF(p));
  return zeta, r;
end function;

function IsStrange(label : zeta := 0, r := 0, new := false)
    chi := DirichletCharacter(label: zeta:=zeta, r:=r);
    S := CuspidalSubspace(ModularSymbols(chi, 2, 1));
    if new then
      S := NewSubspace(S);
    end if;
    if Dimension(S) eq 0 then return false, 0, 0; end if;
    W := WindingSubmodule(S);
    dimS := Dimension(S);
    dimW := Dimension(W);
    return dimS ne dimW, dimW, dimS;
end function;



function StrangeInfo(N : lowerbound := 2^25, tries := 10, new := false, proof := true)
    zeta, r := SuitableRootOfUnity(N : lowerbound := lowerbound);
    potentially_strange_characters := [];
    for label in ConreyCharacterOrbitReps(N) do
      // skip the trivial character
      if Order(label) eq 1 then continue; end if;

      success := false;
      for i in [1..tries] do
        try
          is_strange, dimW, dimS := IsStrange(label : zeta:=zeta, r:=r, new := new);
          success := true;
          break;
        catch e
          zeta, r := NextSuitableRootOfUnity(zeta, r);
        end try;
      end for;
      error if not success, "computation did not succeed, increase the number of tries";


      if is_strange and proof then
        is_strange, dimW, dimS := IsStrange(label : zeta:=0, r:=0, new := new);
      end if;

      if is_strange then
        Append(~potentially_strange_characters, <CharacterOrbitLabel(label), Order(label), dimS - dimW, dimS>);
      end if;

    end for;
    return potentially_strange_characters;
end function;

function Quote(o)
  return Sprintf("\"%o\"",o);
end function;

function AsListOfStrings(l)
  return [Quote(x) : x in l];
end function;

function PrintStrangeInfoRange(a, b : lowerbound := 2^25, tries := 10, new := false, proof := true)
  print "{";
  separator := ",";
  for N in [a..b] do
    strange_info := StrangeInfo(N : lowerbound := lowerbound, tries := tries, new := new, proof := proof);
    if N eq b then separator := ""; end if;
    print Quote(N), ":", [AsListOfStrings(l) : l in strange_info], separator;
  end for;
  print "}";
  return "";
end function;

if assigned start and assigned stop then
  start := StringToInteger(start);
  stop := StringToInteger(stop);
  if not assigned new then new := false; end if;
  PrintStrangeInfoRange(start, stop : new := new);
  exit;
end if;

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 ...

back to top

Software Heritage — Copyright (C) 2015–2026, 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— Content policy— Contact— JavaScript license information— Web API