|
1 | | -import { |
2 | | - ParitiesInstance, |
3 | | - _sign_to_parity, |
4 | | - _keys_to_parity, |
5 | | - _parse_DIMACS_CNF, |
6 | | -} from '../core/index.js'; |
| 1 | +import ParitiesInstance from '../core/convert/ParitiesInstance.js'; |
| 2 | +import _sign_to_parity from '../core/convert/_sign_to_parity.js'; |
| 3 | +import _keys_to_parity from '../core/convert/_keys_to_parity.js'; |
| 4 | +import _parse_DIMACS_CNF from '../core/parse/_parse_DIMACS_CNF.js'; |
7 | 5 |
|
8 | 6 | /** |
9 | 7 | * The input is converted to parity format in each case. |
10 | 8 | */ |
11 | | -export const from = { |
| 9 | +const from = { |
12 | 10 | /** |
13 | 11 | * The input is in parity format where variables are given integer labels |
14 | 12 | * 0 to n-1, a positive literal is represented by the double of its |
15 | 13 | * variable's label, and a negative literal is represented by the successor |
16 | 14 | * of the double of its variable's label. |
| 15 | + * |
| 16 | + * @param {number[][]} clauses The clauses in parity format. |
| 17 | + * @return {ParitiesInstance} |
17 | 18 | */ |
18 | 19 | parities: (clauses) => new ParitiesInstance(clauses), |
19 | 20 | /** |
20 | 21 | * The input is in signs format where variables are given integer labels |
21 | 22 | * 1 to n, a positive literal is represented by its variable's label, and a |
22 | 23 | * negative literal is represented by the opposite of its variable's label. |
| 24 | + * |
| 25 | + * @function |
| 26 | + * @param {number[][]} clauses |
| 27 | + * @return {SignsInstance} |
23 | 28 | */ |
24 | 29 | signs: _sign_to_parity, |
25 | 30 | /** |
26 | 31 | * The input is in keys format where variables are given arbitrary object labels, |
27 | 32 | * a literal is represented by a pair from the set {true, false} x |
28 | 33 | * labels, where the first item in the pair is true if the literal is positive, |
29 | 34 | * and false otherwise. |
| 35 | + * |
| 36 | + * @function |
| 37 | + * @param {[any,any][][]} clauses |
| 38 | + * @return {KeysInstance} |
30 | 39 | */ |
31 | 40 | keys: _keys_to_parity, |
32 | 41 | /** |
33 | 42 | * Parses a character iterable in DIMACS CNF format. |
| 43 | + * |
| 44 | + * @param {Iterable<string>} iterable |
| 45 | + * @return {ParitiesInstance} |
34 | 46 | */ |
35 | 47 | dcnf: (iterable) => new ParitiesInstance(_parse_DIMACS_CNF(iterable)), |
36 | 48 | }; |
| 49 | + |
| 50 | +export default from; |
0 commit comments