Skip to content

Commit

Permalink
Migrate permute.js
Browse files Browse the repository at this point in the history
  • Loading branch information
curran committed Dec 30, 2020
1 parent 8a17cb7 commit e94479e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ export { order } from './order';
export { pca1d, pca_order } from './pca_order';
export { array_to_dicts, dicts_to_array, pcp, parcoords } from './pcp';
export { permutation, inverse_permutation } from './permutation';
//export {
//} from '';
export { permute, permute_inplace, permutetranspose } from './permute';
//export {
//} from '';
//export {
Expand Down
8 changes: 3 additions & 5 deletions src/permute.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
function permute_copy(list, perm) {
export function permute(list, perm) {
var m = perm.length;
var copy = list.slice();
while (m--)
copy[m] = list[perm[m]];
return copy;
}
reorder.permute = permute_copy;

function permute_inplace(list, perm) {
export function permute_inplace(list, perm) {
var i, j, v, tmp;

//list = list.slice();
Expand All @@ -30,9 +29,8 @@ function permute_inplace(list, perm) {
}
return list;
}
reorder.permute_inplace = permute_inplace;

reorder.permutetranspose = function(array, indexes) {
export function permutetranspose(array, indexes) {
var m = array.length;
while (m-- > 0)
array[m] = reorder.permute(array[m], indexes);
Expand Down

0 comments on commit e94479e

Please sign in to comment.