permutation-parity
v1.0.0
Published
Computes the parity of a permutation
Downloads
116,877
Readme
permutation-parity
Computes the parity of a permutation.
Example
var sgn = require("permutation-parity")
console.log(sgn([0, 1, 2]), sgn([0, 2, 1]))
Install
npm install permutation-parity
API
require("permutation-parity")(p)
Determines the sign of a permutation
p
is a permutation
Returns The sign of the permutation:
1
ifp
is odd-1
ifp
is even0
ifp
is not a permutation
Credits
(c) 2014 Mikola Lysenko. MIT License