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://gitlab.inria.fr/line/aide-group/macrovsa
04 May 2026, 13:41:51 UTC
  • Code
  • Branches (1)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/master
    No releases to show
  • d85ce8c
  • /
  • src
  • /
  • algo.hpp
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.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge
swh:1:cnt:38176a5914da49b935aeccc3edc0e26033ee137c
origin badgedirectory badge
swh:1:dir:b8157120e03f8858febdc76e496e300e843c5750
origin badgerevision badge
swh:1:rev:31a87d848f8ab28a06ccf77d0b359fc966974138
origin badgesnapshot badge
swh:1:snp:ffb1e6ef77e78b82672462770a7171c80c299b3b

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
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
Tip revision: 31a87d848f8ab28a06ccf77d0b359fc966974138 authored by vthierry on 15 December 2025, 21:31:50 UTC
sync from makefile
Tip revision: 31a87d8
algo.hpp
#ifndef __macrovsa_algo__
#define __macrovsa_algo__

#include "Belief.hpp"
#include "Symbol.hpp"
#include "Bundling.hpp"
#include <map>

namespace macrovsa {
  class algo {
    /**
     * @class algo
     * @description Specifies the macroscopic algorithmic ersatz on VSA symbol.
     * - These functions are accessible via the `macrovsa::` prefix.
     */
public:

    /**
     * @function reduce
     * @memberof algo
     * @static
     * @description Reduces a symbol with respect to binding/unbinding operations.
     * @param {Symbol} symbol The symbol to reduce.
     * @return {Symbol} A reference to the reduced symbol. Available until program end.
     */
    static const Symbol& reduce(const Symbol& symbol);
private:
    static const Symbol& reduce(const Symbol& symbol, Symbol::Symbols& symbols);
    static const Symbol& reduce(Bundling *bundling, Symbol::Symbols& symbols);
public:

    /**
     * @function sim
     * @memberof algo
     * @static
     * @description Returns the similarity between two symbols.
     * - For convinience the symbol can be given by its name, considering that `tau = 1, sigma = 0`.
     * - A similarity is non-negligible up to a confidence interval of `99%` if ``tau > 2 sigma`.
     * @param {Symbol|String} s1 A reference to the first symbol, or its string representation as defined in [fromJSON()](./Symbol.html#.fromJSON).
     * @param {Symbol|String} s2 A reference to the second symbol, or its string representation as defined in [fromJSON()](./Symbol.html#.fromJSON).
     * @return {Belief} The similarity or 0 if out of bounds, as belief, thus with an error estimation.
     */
    static Belief sim(const Symbol& s1, const Symbol& s2, bool reduce = true);
    static Belief sim(String s1, const Symbol& s2, bool reduce = true)
    {
      return sim(Symbol::fromJSON(s1), s2, reduce);
    }
    static Belief sim(const Symbol& s1, String s2, bool reduce = true)
    {
      return sim(s1, Symbol::fromJSON(s2), reduce);
    }
    static Belief sim(String s1, String s2, bool reduce = true)
    {
      return sim(Symbol::fromJSON(s1), Symbol::fromJSON(s1), reduce);
    }
    /**
     * @function msim
     * @memberof algo
     * @static
     * @description Returns the mesoscopic similarity between two symbol vectors.
     * @param {Symbol s1 A reference to the first symbol.
     * @param {Symbol} s2 A reference to the second symbol.
     * @return {double} The similarity, using the dotprod.
     */
    static double msim(const Symbol& s1, const Symbol& s2);

    /**
     * @function conj
     * @memberof algo
     * @static
     * @description Calculates the conjuction of belief values (and operator).
     * - Here the `max(0,min(...))` operator is used as [T-Norm](https://en.wikipedia.org/wiki/T-norm).
     * @param {...Belief} degree... Degree of belief values, at least 2 and up to 8 arguments, in this implementation.
     * @return {Belief} The computed value.
     */
    static Belief conj(const Belief& a1, const Belief& a2);
    static Belief conj(const Belief& a1, const Belief& a2, const Belief& a3);
    static Belief conj(const Belief& a1, const Belief& a2, const Belief& a3, const Belief& a4);
    static Belief conj(const Belief& a1, const Belief& a2, const Belief& a3, const Belief& a4, const Belief& a5);
    static Belief conj(const Belief& a1, const Belief& a2, const Belief& a3, const Belief& a4, const Belief& a5, const Belief& a6);
    static Belief conj(const Belief& a1, const Belief& a2, const Belief& a3, const Belief& a4, const Belief& a5, const Belief& a6, const Belief& a7);
    static Belief conj(const Belief& a1, const Belief& a2, const Belief& a3, const Belief& a4, const Belief& a5, const Belief& a6, const Belief& a7, const Belief& a8);

    /**
     * @member {double} sigma_0
     * @memberof algo
     * @static
     * @description The standard-deviation of the additive noise generated by an approximate operation.
     * - Its value order of magnitude is `O(1/d)` where `d` is the VSA space dimension, default value is `d=10000`, and is calibrated on the [(Schlegel et al 2020)](https://arxiv.org/abs/2001.11797) numerical results, here set to `1/d/64`.
     */
    static double sigma_0;
    // sigma_0^(1/4)
    static double sigma_04;
  };
}
#endif

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