@pelevesque/get-matrix-dihedral-group

Gets all the variants for a matrix dihedral group.

Stats

StarsIssuesVersionUpdatedCreatedSize
@pelevesque/get-matrix-dihedral-group
040.0.42 years ago3 years agoMinified + gzip package size for @pelevesque/get-matrix-dihedral-group in KB

Readme

Build Status Coverage Status JavaScript Style Guide

get-matrix-dihedral-group

Gets all the variants of a matrix dihedral group.

Node Repository

https://www.npmjs.com/package/@pelevesque/get-matrix-dihedral-group

Installation

npm install @pelevesque/get-matrix-dihedral-group

Tests

Standard Style & Unit Tests

npm test

Unit Tests & Coverage

npm run cover

Usage

Requiring

const getMatrixDihedralGroup = require('@pelevesque/get-matrix-dihedral-group')

Retrieving the Matrix Dihedral Group

const matrix = [
  [1, 1, 1],
  [0, 0, 0],
  [0, 0, 0]
]
const result = getMatrixDihedralGroup(matrix)
// result is now equal to the array below
result = [
  [ [ 1, 1, 1 ], [ 0, 0, 0 ], [ 0, 0, 0 ] ],
  [ [ 0, 0, 1 ], [ 0, 0, 1 ], [ 0, 0, 1 ] ],
  [ [ 0, 0, 0 ], [ 0, 0, 0 ], [ 1, 1, 1 ] ],
  [ [ 1, 0, 0 ], [ 1, 0, 0 ], [ 1, 0, 0 ] ],
  [ [ 1, 1, 1 ], [ 0, 0, 0 ], [ 0, 0, 0 ] ],
  [ [ 1, 0, 0 ], [ 1, 0, 0 ], [ 1, 0, 0 ] ],
  [ [ 0, 0, 0 ], [ 0, 0, 0 ], [ 1, 1, 1 ] ],
  [ [ 0, 0, 1 ], [ 0, 0, 1 ], [ 0, 0, 1 ] ]
]

In the example above, some elements of the group are identical because there is symmetry in the original element.

Duplicate elements can be removed by turning on the removeDuplicates flag as in the example below.

const matrix = [
  [1, 1, 1],
  [0, 0, 0],
  [0, 0, 0]
]
const removeDuplicates = true
const result = getMatrixDihedralGroup(matrix, removeDuplicates)
// result is now equal to the array below
result = [
  [ [ 1, 1, 1 ], [ 0, 0, 0 ], [ 0, 0, 0 ] ],
  [ [ 0, 0, 1 ], [ 0, 0, 1 ], [ 0, 0, 1 ] ],
  [ [ 0, 0, 0 ], [ 0, 0, 0 ], [ 1, 1, 1 ] ],
  [ [ 1, 0, 0 ], [ 1, 0, 0 ], [ 1, 0, 0 ] ]
]

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.