@@ -21,12 +21,9 @@ describe('Positive linear combination', () => {
21
21
22
22
solutions = positiveLinearCombination ( base , vector ) ;
23
23
24
-
25
24
expect ( solutions ) . toEqual ( expected ) ;
26
25
} ) ;
27
-
28
-
29
- it ( 'Base I Decimal I' , ( ) => {
26
+ it ( 'Decimal Base I' , ( ) => {
30
27
let base = new Matrix ( [
31
28
[ 0 , 20 , 100 , 20 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
32
29
[ 0 , 0 , 0 , 0 , 0 , 30 , 100 , 30 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
@@ -40,128 +37,9 @@ describe('Positive linear combination', () => {
40
37
let solutions = Matrix . zeros ( 1 , base . columns ) ;
41
38
let expected = new Matrix ( [ [ 1 , 0 , 1 , 0 , 0 , 0.5 ] ] ) ;
42
39
43
- solutions = positiveLinearCombination ( base , vector , { lowestDecimal :
44
- 0.5 } ) ;
45
-
46
- expect ( solutions ) . toEqual ( expected ) ;
47
- } ) ;
48
-
49
-
50
- it ( 'Luc I' , ( ) => {
51
- let base = new Matrix ( [
52
- [ 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
53
- [ 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
54
- [ 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
55
- [ 1 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
56
- [ 1 , 1 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 ] ,
57
- [ 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 0 , 0 ] ,
58
- [ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 0 ] ,
59
- [ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 ] ,
60
- [ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 ] ,
61
- [ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ]
62
- ] ) ;
63
- let vector = new Matrix ( [ [ 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ] ) ;
64
- let solutions = Matrix . zeros ( 1 , base . columns ) ;
65
- let expected = new Matrix ( [ [ 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ] ) ;
66
-
67
- solutions = positiveLinearCombination ( base , vector ) ;
40
+ solutions = positiveLinearCombination ( base , vector , { lowestDecimal : 0.5 } ) ;
68
41
42
+ console . table ( solutions ) ;
69
43
expect ( solutions ) . toEqual ( expected ) ;
70
44
} ) ;
71
-
72
-
73
- it ( 'Luc II' , ( ) => {
74
- let base = new Matrix ( [
75
- [ 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
76
- [ 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
77
- [ 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
78
- [ 1 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
79
- [ 1 , 1 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 ] ,
80
- [ 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 0 , 0 ] ,
81
- [ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 0 ] ,
82
- [ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 ] ,
83
- [ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 ] ,
84
- [ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ]
85
- ] ) ;
86
- let vector = new Matrix ( [ [ 3 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ] ) ;
87
- let solutions = Matrix . zeros ( 1 , base . columns ) ;
88
-
89
-
90
- let expected = new Matrix ( [ [ 3 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ] ) ;
91
-
92
- solutions = positiveLinearCombination ( base , vector ) ;
93
- expect ( solutions ) . toEqual ( expected ) ;
94
- } ) ;
95
-
96
-
97
- it ( 'Luc III' , ( ) => {
98
- let base = new Matrix ( [
99
- [ 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
100
- [ 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
101
- [ 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
102
- [ 1 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
103
- [ 1 , 1 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 ] ,
104
- [ 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 0 , 0 ] ,
105
- [ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 0 ] ,
106
- [ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 ] ,
107
- [ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 ] ,
108
- [ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ]
109
- ] ) ;
110
- let vector = new Matrix ( [ [ 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ] ) ;
111
- let solutions = Matrix . zeros ( 1 , base . columns ) ;
112
-
113
-
114
- let expected = new Matrix ( [ [ 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ] ) ;
115
-
116
- solutions = positiveLinearCombination ( base , vector ) ;
117
- expect ( solutions ) . toEqual ( expected ) ;
118
- } ) ;
119
- it ( 'Luc IV' , ( ) => {
120
- let base = new Matrix ( [
121
- [ 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
122
- [ 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
123
- [ 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
124
- [ 1 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
125
- [ 1 , 1 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 ] ,
126
- [ 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 0 , 0 ] ,
127
- [ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 0 ] ,
128
- [ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 ] ,
129
- [ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 ] ,
130
- [ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ]
131
- ] ) ;
132
- let vector = new Matrix ( [ [ 0 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ] ) ;
133
- let solutions = Matrix . zeros ( 1 , base . columns ) ;
134
-
135
-
136
- let expected = new Matrix ( [ [ 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ] ) ;
137
-
138
- solutions = positiveLinearCombination ( base , vector ) ;
139
- expect ( solutions ) . toEqual ( expected ) ;
140
- } ) ;
141
-
142
- /*
143
-
144
- it('Luc V', () => {
145
- let base = new Matrix([
146
- [1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
147
- [1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
148
- [1, 1, 1, 0, 0, 0, 0, 0, 0, 0],
149
- [1, 1, 1, 1, 0, 0, 0, 0, 0, 0],
150
- [1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
151
- [1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
152
- [1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
153
- [1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
154
- [1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
155
- [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
156
- ]);
157
- let vector = new Matrix([[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]]);
158
- let solutions = Matrix.zeros(1, base.columns);
159
-
160
-
161
- let expected = new Matrix([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]);
162
-
163
- solutions = positiveLinearCombination(base, vector);
164
- expect(solutions).toEqual(expected);
165
- });
166
- */
167
45
} ) ;
0 commit comments