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

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
content badge
swh:1:cnt:b9c2a620241249af7ffdd0a5a78b321568922d73

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
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
from numba import njit
import numpy as np
from common import vec2

@njit
def hash2d(x):
	p1 = 73856093
	p2 = 19349663
	p3 = 83492791
	K = 93856263
	i = int(x[0])
	j = int(x[1])
	h1 = ((i * p1) ^ (j * p2)) % K
	h2 = ((j * p1) ^ (i * p3)) % K
	return vec2(h1,h2) / float(K) - 0.5

@njit	
def perlin_noise_grad( p ):
	x = p[0:2]
	'''returns 3D value noise (in [0])  and its derivatives (in .yz)'''
	i = np.floor(x)
	f = x-i	

	u = f*f*f*(f*(f*6.0-15.0)+10.0)
	du = 30.0*f*f*(f*(f-2.0)+1.0)
    
	ga = hash2d( i + vec2(0.0,0.0) )
	gb = hash2d( i + vec2(1.0,0.0) )
	gc = hash2d( i + vec2(0.0,1.0) )
	gd = hash2d( i + vec2(1.0,1.0) )
	#print(ga, gb,gc,gd)
    
	va = np.dot( ga, f - vec2(0.0,0.0) )
	vb = np.dot( gb, f - vec2(1.0,0.0) )
	vc = np.dot( gc, f - vec2(0.0,1.0) )
	vd = np.dot( gd, f - vec2(1.0,1.0) )

	grd =  ga + u[0]*(gb-ga) + u[1]*(gc-ga) + u[0]*u[1]*(ga-gb-gc+gd) + (vec2(u[1],u[0])*(va-vb-vc+vd) + vec2(vb,vc) - va)*du
	return grd
	# return vec3( va + u[0]*(vb-va) + u[1]*(vc-va) + u[0]*u[1]*(va-vb-vc+vd),
    #             grd[0], grd[1])

back to top

Software Heritage — Copyright (C) 2015–2025, 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