This package has been deprecated

Author message:

This package has moved to @combinatorics/permutation.

@aureooms/js-permutation

2.0.0 • Public • Published

js-permutation

Permutations code bricks for JavaScript.

next( reversed( identity( 3 ) ) ) ; // [ 0 , 1 , 2 ]

License NPM version Bower version Build Status Coverage Status Dependencies Status devDependencies Status Code Climate NPM downloads per month GitHub issues Inline docs

Can be managed through jspm, duo, component, bower, ender, jam, spm, and npm.

Caveat

Requires regeneratorRuntime to be defined, see babel docs.

Install

jspm

jspm install github:aureooms/js-permutation
# or
jspm install npm:@aureooms/js-permutation

duo

No install step needed for duo!

component

component install aureooms/js-permutation

bower

bower install @aureooms/js-permutation

ender

ender add @aureooms/js-permutation

jam

jam install @aureooms/js-permutation

spm

spm install @aureooms/js-permutation --save

npm

npm install @aureooms/js-permutation --save

Require

jspm

let permutation = require( "github:aureooms/js-permutation" ) ;
// or
import permutation from '@aureooms/js-permutation' ;

duo

let permutation = require( "aureooms/js-permutation" ) ;

component, ender, spm, npm

let permutation = require( "@aureooms/js-permutation" ) ;

bower

The script tag exposes the global variable permutation.

<script src="bower_components/@aureooms/js-permutation/js/dist/permutation.min.js"></script>

Alternatively, you can use any tool mentioned here.

jam

require( [ "@aureooms/js-permutation" ] , function ( permutation ) { ... } ) ;

Use

let sigma = permutation.identity( 3 ) ;

sigma ; // [ 0 , 1 , 2 ]

permutation.reversed( sigma ) ; // [ 2 , 1 , 0 ]

permutation.next( sigma ) ; // [ 0 , 2 , 1 ]

for ( let tau of permutation.permutations( 3 ) ) {

	... // yields [ 0 , 1 , 2 ]
	    //        [ 0 , 2 , 1 ]
	    //        [ 1 , 0 , 2 ]
	    //        [ 1 , 2 , 0 ]
	    //        [ 2 , 0 , 1 ]
	    //        [ 2 , 1 , 0 ]

}

permutation.invert( [ 0 , 1 , 2 ] ) ; // [ 0 , 1 , 2 ]
permutation.invert( [ 0 , 2 , 1 ] ) ; // [ 0 , 2 , 1 ]
permutation.invert( [ 1 , 0 , 2 ] ) ; // [ 1 , 0 , 2 ]
permutation.invert( [ 1 , 2 , 0 ] ) ; // [ 2 , 0 , 1 ]
permutation.invert( [ 2 , 0 , 1 ] ) ; // [ 1 , 2 , 0 ]
permutation.invert( [ 2 , 1 , 0 ] ) ; // [ 2 , 1 , 0 ]

permutation.compose( "abc" , [ 2 , 0 , 1 ] ) ; // [ "c" , "a" , "b" ]

permutation.bitreversal( 8 ) ; // [ 0 , 4 , 2 , 6 , 1 , 5 , 3 , 7 ]

Package Sidebar

Install

npm i @aureooms/js-permutation

Weekly Downloads

1

Version

2.0.0

License

AGPL-3.0

Last publish

Collaborators

  • aureooms