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
  • /
  • Bundling.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:3a96946662eda2dc38ba6b59c58e76b48719d349
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
Bundling.hpp
 #ifndef __macrovsa_Bundling__
#define __macrovsa_Bundling__

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

namespace macrovsa {
  class AssociativeMap;

  /**
   * @class Bundling
   * @description Implements a macroscopic ersatz of a VSA bundling.
   * - A bundling or superposition is created adding new symbols.
   * - The bundling belief `tau = tau_1 tau_2 ...` and `sigma = sigma_1 + sigma_2 + ...` is calculated from its member belief.
   * - Note: a bundling can not be copied, use the [clone()](Symbol.html/#.clone) method instead.
   * @extends Symbol
   * @param {string} [name] An optional name. By default, a `#index` unique name is generated.
   * @param {...Symbol} symbol Symbol added to the bundling from 0 to 8 in this implementation
   */
  class Bundling: public Symbol {
    friend class Symbol;
    // Bundling data structure symbol-ID => Symbol
    std::unordered_map < unsigned int, Symbol * > values;
    bool values_changed = false;
    // Non assignable
    Bundling& operator = (const Bundling&) = delete;
    // Residual noise
    double sigma0 = 0;
protected:
    // Symbol remanence
    mutable Symbols symbols;
    // Mesoscopic implementation
    friend class AssociativeMap;
    virtual void setVector(double *vector) const;
public:
    Bundling() : Symbol("", bundling) {}
    Bundling(String name) : Symbol(name, bundling) {}
    Bundling(String name, const Symbol& s1) : Symbol(name, bundling) {
      add(s1);
    }
    Bundling(String name, const Symbol& s1, const Symbol& s2) : Symbol(name, bundling) {
      add(s1), add(s2);
    }
    Bundling(String name, const Symbol& s1, const Symbol& s2, const Symbol& s3) : Symbol(name, bundling) {
      add(s1), add(s2), add(s3);
    }
    Bundling(String name, const Symbol& s1, const Symbol& s2, const Symbol& s3, const Symbol& s4) : Symbol(name, bundling) {
      add(s1), add(s2), add(s3), add(s4);
    }
    Bundling(String name, const Symbol& s1, const Symbol& s2, const Symbol& s3, const Symbol& s4, const Symbol& s5) : Symbol(name, bundling) {
      add(s1), add(s2), add(s3), add(s4), add(s5);
    }
    Bundling(String name, const Symbol& s1, const Symbol& s2, const Symbol& s3, const Symbol& s4, const Symbol& s5, const Symbol& s6) : Symbol(name, bundling) {
      add(s1), add(s2), add(s3), add(s4), add(s5), add(s6);
    }
    Bundling(String name, const Symbol& s1, const Symbol& s2, const Symbol& s3, const Symbol& s4, const Symbol& s5, const Symbol& s6, const Symbol& s7) : Symbol(name, bundling) {
      add(s1), add(s2), add(s3), add(s4), add(s5), add(s6), add(s7);
    }
    Bundling(String name, const Symbol& s1, const Symbol& s2, const Symbol& s3, const Symbol& s4, const Symbol& s5, const Symbol& s6, const Symbol& s7, const Symbol& s8) : Symbol(name, bundling) {
      add(s1), add(s2), add(s3), add(s4), add(s5), add(s6), add(s7), add(s8);
    }
    Bundling(const Symbol& s1) : Symbol("", bundling) {
      add(s1);
    }
    Bundling(const Symbol& s1, const Symbol& s2) : Symbol("", bundling) {
      add(s1), add(s2);
    }
    Bundling(const Symbol& s1, const Symbol& s2, const Symbol& s3) : Symbol("", bundling) {
      add(s1), add(s2), add(s3);
    }
    Bundling(const Symbol& s1, const Symbol& s2, const Symbol& s3, const Symbol& s4) : Symbol("", bundling) {
      add(s1), add(s2), add(s3), add(s4);
    }
    Bundling(const Symbol& s1, const Symbol& s2, const Symbol& s3, const Symbol& s4, const Symbol& s5) : Symbol("", bundling) {
      add(s1), add(s2), add(s3), add(s4), add(s5);
    }
    Bundling(const Symbol& s1, const Symbol& s2, const Symbol& s3, const Symbol& s4, const Symbol& s5, const Symbol& s6) : Symbol("", bundling) {
      add(s1), add(s2), add(s3), add(s4), add(s5), add(s6);
    }
    Bundling(const Symbol& s1, const Symbol& s2, const Symbol& s3, const Symbol& s4, const Symbol& s5, const Symbol& s6, const Symbol& s7) : Symbol("", bundling) {
      add(s1), add(s2), add(s3), add(s4), add(s5), add(s6), add(s7);
    }
    Bundling(const Symbol& s1, const Symbol& s2, const Symbol& s3, const Symbol& s4, const Symbol& s5, const Symbol& s6, const Symbol& s7, const Symbol& s8) : Symbol("", bundling) {
      add(s1), add(s2), add(s3), add(s4), add(s5), add(s6), add(s7), add(s8);
    }
    Bundling(Bundling const&);
    virtual ~Bundling() {}
    virtual const Belief& getBelief() const;
    virtual void setBelief(double tau, double sigma);
    virtual bool equals(const Symbol& symbol, char what = 'i') const;
    static bool equals(const std::unordered_map < unsigned int, Symbol * > &v1, const std::unordered_map < unsigned int, Symbol * > &v2, char what);
    virtual std::string asString() const;

    /**
     * @function add
     * @memberof Bundling
     * @instance
     * @description Adds a new symbol to the container.
     * @param {Symbol} symbol The symbol to add.
     */
    void add(const Symbol& symbol);
protected:
    static void add(std::unordered_map < unsigned int, Symbol * > &values, Symbol *symbol);
public:

    /**
     * @function erase
     * @memberof Bundling
     * @instance
     * @description Erases a symbol in the container.
     * @param {Symbol} [symbol ] The symbol to erase.
     * - Without key argument erases all keys, it is a synonym for clear().
     */
    virtual void erase(const Symbol& symbol);
    void erase()
    {
      clear();
    }
    virtual void clear();

    /**
     * @function getSorted
     * @memberof Bundling
     * @instance
     * @description Returns the bundling symbols as a decreasing tau value sorted associative map.
     * - This corresponds to a microscopic implementation of a spike time activity rank sorting mechanism
     * @param {uint} [count = 0] If `count > 0`, considers only the `count` symbols with a maximal tau value, otherwise all symbols.
     * @return {JSON} A `std::vector<const Symbol*>` temporary reference to the sorted list of string representation of symbols.
     */
    std::vector < const Symbol * > getSorted(unsigned int count = 0) const;

    /**
     * @function get
     * @memberof Bundling
     * @instance
     * @description Defines an iterator over the bundling symbols, used in a construct of the form:
     * ```
     *  for(auto it = bundling.Bundling::get().cbegin(); it != bundling.Bundling::get().cend(); it++) {
     *    const Symbol& symbol = *(it->second);
     *    ../..
     *  }
     * ```
     * - This is NOT a VSA plausible operation (unless another List data structure is used) by a debugging function.
     * - The `bundling.Bundling::get().size()` construct returns the number of symbols in this bundling.
     * @return A `const std::unordered_map < unsigned int, const Symbol* >` reference, with symbols indexed by their IDs.
     */
    const std::unordered_map < unsigned int, Symbol * >& get() const {
      return values;
    }
   /** 
     * @function getComputationTIme
     * @memberof Bundling
     * @instance
     * @description Returns a relative estimation of the computation time order of magnitude.
     * - It has been calibrated on a `Intel® CoreTM i5-8265U CPU @ 1.60GHz × 8 cores processor`with no use of GPU.
     * - This provides obviously only relative values, useful for comparison between orders of magnitude.
     * @return {double} A `O(dimension bundling-size)`  computation time order of magnitude estimation in milli-seconds.
     */
    double getComputationTime();
   };
}

#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