Skip to content
This repository has been archived by the owner on Sep 10, 2022. It is now read-only.

Commit

Permalink
Merge pull request #52 from stonejing/magic
Browse files Browse the repository at this point in the history
fix typo in magic & add magic to all
  • Loading branch information
Gaoooooo authored May 20, 2022
2 parents e3a5f8f + 2745459 commit 7767cb3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions all.hhs
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@
*import math:multinomial
*import math:reshape
*import math:is_diag
*import math:magic

*import math:check_input
4 changes: 2 additions & 2 deletions magic.hhs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ function magic(input)
}
// 1x1 magic square is called trivial
if(input === 1) return (new Mat([1]));
// 2x2 magic square do not exist, retrun a default matrix
// 2x2 magic square do not exist, return a default matrix
if(input === 2) return (new Mat([[1, 2], [3, 4]]));

/*
The method of generating magic matrix depends on the rank
The method of generating magic matrix depends on the order
it should be consider as odd, 4M+2, 4M, M is an integer greater than 1
mode = 0 : the input is 4M, use generate_square_doubly_even
mode = 2 : the input is 4M+2, use generate_square_even
Expand Down

0 comments on commit 7767cb3

Please sign in to comment.