JSPM

permutation-parity

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 21516
  • Score
    100M100P100Q145464F
  • License MIT

Computes the parity of a permutation

Package Exports

  • permutation-parity

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (permutation-parity) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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

Credits

(c) 2014 Mikola Lysenko. MIT License