-
Notifications
You must be signed in to change notification settings - Fork 0
/
root.ndf
57 lines (49 loc) · 1.02 KB
/
root.ndf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
slv IS OPERATION Simul {
%;
Output := [] ; Redux := [] ; N := tally Simul ;
%;
FOR I WITH reverse tell N DO
%;
FOR J WITH reverse tell (I + 1) DO
IF not mate (J I reach Simul) 0 THEN
Row := J pick Simul ; EXIT '' ;
ENDIF ;
ENDFOR ;
%;
IF empty Row THEN
Output := 'No unique solution' ; EXIT '' ;
ELSE
Simul := Simul except single Row ;
Row := Row / (I pick Row) ;
Redux := Row hitch Redux ;
FOR J WITH reverse grid Simul DO
IF not mate (J I reach Simul) 0 THEN
Simul@J := Simul@J - (J I reach Simul * Row) ;
ENDIF ;
ENDFOR ;
ENDIF ;
%;
ENDFOR ;
%;
Output := N reshape 0 ;
FOR I WITH tell N DO
Sum := 0 ;
FOR J WITH tell I DO
Sum := I J reach Redux * (J pick Output) + Sum ;
ENDFOR ;
Output@I := I N reach Redux - Sum ;
ENDFOR ;
%;
Output }
Main IS {
%;
% -2. 4. ;
A := [3 2 2, 2 5 16] ;
%;
% 4. -1. ;
B := [3 10 2,5 6 14] ;
%;
% 1. 3. ;
C := [1 3 10,5 -2 -1] ;
%;
EACH slv A B C }