@pelevesque/get-matrix-dihedral-group
v0.0.4
Published
Gets all the variants for a matrix dihedral group.
Downloads
9
Readme
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 ] ]
]