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

  • 36df0f8
  • /
  • src
  • /
  • pattern.c
Raw File Download

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
content badge
swh:1:cnt:227d765f9d8f034a88f48189244cb2ef805c2518
directory badge
swh:1:dir:fc46366647aa97bab54c0984791545d611abc4d0

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
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
pattern.c
#include "types.h"
#include "constants.h"

ladel_int ladel_nonzero_pattern_of_row_in_L(ladel_sparse_matrix *M, 
                                                ladel_symbolics *sym,
                                                ladel_int row)
{
    ladel_int start = M->ncol, index, next_node, nb_marked_nodes;
    ladel_int *etree = sym->etree, *pattern = sym->pattern, *nodes = sym->nodes;
    MARK(nodes,row);
    for (index = M->p[row]; index < M->p[row+1]; index++)
    {
        next_node = M->i[index];
        nb_marked_nodes = 0;
        /* mark all the nodes found by traversing the etree */
        while (!IS_MARKED(nodes, next_node))
        {
            MARK(nodes, next_node);
            pattern[nb_marked_nodes] = next_node;
            nb_marked_nodes++;
            next_node = etree[next_node];
        }
        /*append the newly marked nodes to pattern (which goes from ncol-1 to 0)*/
        while (nb_marked_nodes > 0)
        {
            start--;
            nb_marked_nodes--;
            pattern[start] = pattern[nb_marked_nodes];
        }
    }
    /* unmark all the nodes to prepare for finding the pattern of the next row */
    for (index = start; index < M->ncol; index++) UNMARK(nodes, pattern[index]);
    UNMARK(nodes, row);

    return start;
}


ladel_int ladel_etree_dfs(ladel_sparse_matrix *W, 
                            ladel_symbolics *sym,
                            ladel_int row,
                            ladel_int maximum_row)
{
    ladel_int start = sym->ncol, index, next_node, nb_marked_nodes;
    ladel_int *etree = sym->etree, *pattern = sym->pattern, *nodes = sym->nodes;

    for (index = W->p[row]; index < W->p[row+1]; index++)
    {
        next_node = W->i[index];
        if (next_node >= maximum_row) break;
        nb_marked_nodes = 0;
        /* mark all the nodes found by traversing the etree */
        while (next_node != NONE && !IS_MARKED(nodes, next_node) && next_node < maximum_row)
        {
            MARK(nodes, next_node);
            pattern[nb_marked_nodes] = next_node;
            nb_marked_nodes++;
            next_node = etree[next_node];
        }
        /*append the newly marked nodes to pattern (which goes from ncol-1 to 0)*/
        while (nb_marked_nodes > 0)
        {
            start--;
            nb_marked_nodes--;
            pattern[start] = pattern[nb_marked_nodes];
        }
    }
    /* unmark all the nodes to prepare for finding the pattern of the next row */
    for (index = start; index < sym->ncol; index++) UNMARK(nodes, pattern[index]);
    UNMARK(nodes, row);

    return start;
}

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