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/cran/doParallel
23 February 2022, 09:29:41 UTC
  • Code
  • Branches (23)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/master
    • refs/tags/1.0.0
    • refs/tags/1.0.1
    • refs/tags/1.0.10
    • refs/tags/1.0.11
    • refs/tags/1.0.14
    • refs/tags/1.0.15
    • refs/tags/1.0.16
    • refs/tags/1.0.17
    • refs/tags/1.0.3
    • refs/tags/1.0.6
    • refs/tags/1.0.7
    • refs/tags/1.0.8
    • refs/tags/R-2.14.1
    • refs/tags/R-2.14.2
    • refs/tags/R-2.15.0
    • refs/tags/R-2.15.1
    • refs/tags/R-2.15.2
    • refs/tags/R-2.15.3
    • refs/tags/R-3.0.0
    • refs/tags/R-3.0.1
    • refs/tags/R-3.0.2
    • refs/tags/R-3.0.3
    No releases to show
  • dba23b2
  • /
  • demo
  • /
  • sincParallel.R
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:d51eabcac278b76c5fd4ed7fc3413bdcf61e2aba
origin badgedirectory badge
swh:1:dir:1f54769e74a505c9555c20198207381d108f289f
origin badgerevision badge
swh:1:rev:b17d866a871ca8ab0d7e6d03c7f35e05fee010aa
origin badgesnapshot badge
swh:1:snp:9e237295e4cb0cb01a3f5c368216b67a29736c74

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: b17d866a871ca8ab0d7e6d03c7f35e05fee010aa authored by Revolution Analytics on 12 April 2012, 00:00:00 UTC
version 1.0.1
Tip revision: b17d866
sincParallel.R
library(doParallel)
registerDoParallel()

# Define a function that creates an iterator that returns subvectors
ivector <- function(x, chunks) {
  n <- length(x)
  i <- 1

  nextEl <- function() {
    if (chunks <= 0 || n <= 0) stop('StopIteration')
    m <- ceiling(n / chunks)
    r <- seq(i, length=m)
    i <<- i + m
    n <<- n - m
    chunks <<- chunks - 1
    x[r]
  }

  obj <- list(nextElem=nextEl)
  class(obj) <- c('abstractiter', 'iter')
  obj
}

# Define the coordinate grid and figure out how to split up the work
x <- seq(-10, 10, by=0.1)
nw <- getDoParWorkers()
cat(sprintf('Running with %d worker(s)\n', nw))

# Compute the value of the sinc function at each point in the grid
z <- foreach(y=ivector(x, nw), .combine=cbind) %dopar% {
  y <- rep(y, each=length(x))
  r <- sqrt(x ^ 2 + y ^ 2)
  matrix(10 * sin(r) / r, length(x))
}

# Plot the results as a perspective plot
persp(x, x, z, ylab='y', theta=30, phi=30, expand=0.5, col="lightblue")

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