@pelevesque/get-matrix-dihedral-group

0.0.4 • Public • Published

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 ] ]
]

Readme

Keywords

Package Sidebar

Install

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

Weekly Downloads

0

Version

0.0.4

License

MIT

Unpacked Size

9.73 kB

Total Files

6

Last publish

Collaborators

  • pelevesque