permutation-parity

1.0.0 • Public • Published

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 if p is odd
  • -1 if p is even
  • 0 if p is not a permutation

Credits

(c) 2014 Mikola Lysenko. MIT License

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    236,319
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    236,319
  • 0.0.2
    3
  • 0.0.1
    13
  • 0.0.0
    2

Package Sidebar

Install

npm i permutation-parity

Weekly Downloads

81,994

Version

1.0.0

License

MIT

Last publish

Collaborators

  • mikolalysenko
  • jaspervdg
  • hughsk
  • planeshifter
  • rreusser