@@ -29,12 +29,12 @@ def test_lambda1():
2929 [0.112202 , 0.112202 , 0.112202 , 0.227134 , 0.112202 , 0.103473 ],
3030 [0.112202 , 0.112202 , 0.112202 , 0.112202 , 0.227134 , 0.103473 ],
3131 [0.103473 , 0.103473 , 0.103473 , 0.103473 , 0.103473 , 0.434339 ]])
32- F , s = l .lambda_solution_ (x , sigma , m )
32+ F , s = l .lambda_solution_ (x , np . asfortranarray ( sigma ) , m )
3333 assert np .allclose (F ,
34- np .array ([[ 1.58518400e+06 , 3.91574300e +06 , 9.56599100e +06 ,
35- 1.58518400e +06 , 3.91574300e +06 , 9.56599100e+06 ],
36- [ - 6.71659900e +06 , 7.62723400e +06 , 9.89457273e+08 ,
37- - 6.71660000e +06 , 7.62723300e +06 , 9.89457273e+08 ]]))
34+ np .array ([[1.58518400e+06 , - 6.71659900e +06 , 3.91574300e +06 ,
35+ 7.62723400e +06 , 9.56599100e +06 , 9.89457273e+08 ],
36+ [1.58518400e +06 , - 6.71660000e +06 , 3.91574300e+06 ,
37+ 7.62723300e +06 , 9.56599100e +06 , 9.89457273e+08 ]]))
3838 assert np .allclose (s , np .array ([ 3.50798444 , 3.70845619 ]))
3939
4040def test_lambda2 ():
@@ -59,13 +59,37 @@ def test_lambda2():
5959 [0.286388 , 0.286388 , 0.572775 , 0.286388 , 0.286388 , 0.367531 , 0.367531 , 0.735063 , 0.367531 , 0.367531 ],
6060 [0.286388 , 0.286388 , 0.286388 , 0.572775 , 0.286388 , 0.367531 , 0.367531 , 0.367531 , 0.735063 , 0.367531 ],
6161 [0.286388 , 0.286388 , 0.286388 , 0.286388 , 0.572775 , 0.367531 , 0.367531 , 0.367531 , 0.367531 , 0.735063 ]])
62- F , s = l .lambda_solution_ (x , sigma , m )
62+ F , s = l .lambda_solution_ (x , np . asfortranarray ( sigma ) , m )
6363 assert np .allclose (F ,
64- [[- 13324188. , - 7157236.00000014 , - 7454143.00000017 ,
65- 8336726.00000008 , - 17549108.00000054 , - 13324187.99999997 ,
66- - 7157236.00000013 , - 7454143.00000013 , 8336717.00000021 ,
67- - 17549108.00000053 ],
68- [- 10668900.99999994 , - 6149379.00000041 , - 5969220. , 6186959.99999982 ,
69- - 13970171.00000022 , - 10668907.99999984 , - 6149379.00000041 ,
70- - 5969219.99999996 , 6186959.99999983 , - 13970171.00000017 ]])
64+ np .array ([[- 13324188. , - 10668900.99999994 , - 7157236.00000014 ,
65+ - 6149379.00000041 , - 7454143.00000017 , - 5969220. ,
66+ 8336726.00000008 , 6186959.99999982 , - 17549108.00000054 ,
67+ - 13970171.00000022 ],
68+ [- 13324187.99999997 , - 10668907.99999984 , - 7157236.00000013 ,
69+ - 6149379.00000041 , - 7454143.00000013 , - 5969219.99999996 ,
70+ 8336717.00000021 , 6186959.99999983 , - 17549108.00000053 ,
71+ - 13970171.00000017 ]]))
72+
7173 assert np .allclose (s , np .array ([ 1506.43579559 , 1612.81177168 ]))
74+
75+ def test_lambda3 ():
76+ """
77+ Verify that passing in perfectly decorrelated integers results in the
78+ same integers being identified.
79+ """
80+ m = 1
81+ x = np .array ([- 22 , 22 , - 55 , 55 , - 33 , 33 , - 66 , 66 , - 44 , 44 , - 77 , 77 ])
82+ sigma = np .eye (x .size )
83+ F , s = l .lambda_solution_ (x , np .asfortranarray (sigma ), m )
84+ assert np .allclose (F [0 ], x )
85+
86+ def test_lambda4 ():
87+ """
88+ Verify that the relative scale of the covariance matrix doesn't affect
89+ the solution.
90+ """
91+ m = 1
92+ x = np .array ([- 22 , 22 , - 55 , 55 , - 33 , 33 , - 66 , 66 , - 44 , 44 , - 77 , 77 ])
93+ sigma = np .eye (x .size ) * 1000
94+ F , s = l .lambda_solution_ (x , np .asfortranarray (sigma ), m )
95+ assert np .allclose (F [0 ], x )
0 commit comments